From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- lotuswordpro/source/filter/xfilter/xfbase64.cxx | 133 ++++++ lotuswordpro/source/filter/xfilter/xfbase64.hxx | 82 ++++ lotuswordpro/source/filter/xfilter/xfbgimage.cxx | 162 ++++++++ lotuswordpro/source/filter/xfilter/xfborders.cxx | 366 ++++++++++++++++ lotuswordpro/source/filter/xfilter/xfcell.cxx | 197 +++++++++ lotuswordpro/source/filter/xfilter/xfcellstyle.cxx | 245 +++++++++++ lotuswordpro/source/filter/xfilter/xfchange.cxx | 148 +++++++ lotuswordpro/source/filter/xfilter/xfcolor.cxx | 88 ++++ lotuswordpro/source/filter/xfilter/xfcolstyle.cxx | 86 ++++ lotuswordpro/source/filter/xfilter/xfcolumns.cxx | 181 ++++++++ .../source/filter/xfilter/xfconfigmanager.cxx | 94 +++++ .../source/filter/xfilter/xfcontentcontainer.cxx | 175 ++++++++ lotuswordpro/source/filter/xfilter/xfcrossref.cxx | 100 +++++ lotuswordpro/source/filter/xfilter/xfdate.cxx | 109 +++++ lotuswordpro/source/filter/xfilter/xfdatestyle.cxx | 189 +++++++++ lotuswordpro/source/filter/xfilter/xfdocfield.cxx | 234 +++++++++++ .../source/filter/xfilter/xfdrawareastyle.cxx | 95 +++++ .../source/filter/xfilter/xfdrawareastyle.hxx | 143 +++++++ lotuswordpro/source/filter/xfilter/xfdrawline.cxx | 124 ++++++ .../source/filter/xfilter/xfdrawlinestyle.cxx | 117 ++++++ lotuswordpro/source/filter/xfilter/xfdrawobj.cxx | 130 ++++++ lotuswordpro/source/filter/xfilter/xfdrawpath.cxx | 155 +++++++ .../source/filter/xfilter/xfdrawpolygon.cxx | 99 +++++ .../source/filter/xfilter/xfdrawpolyline.cxx | 128 ++++++ lotuswordpro/source/filter/xfilter/xfdrawrect.cxx | 77 ++++ lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx | 327 +++++++++++++++ lotuswordpro/source/filter/xfilter/xfentry.cxx | 107 +++++ .../source/filter/xfilter/xffloatframe.cxx | 85 ++++ lotuswordpro/source/filter/xfilter/xffont.cxx | 315 ++++++++++++++ lotuswordpro/source/filter/xfilter/xffontdecl.cxx | 68 +++ .../source/filter/xfilter/xffontfactory.cxx | 78 ++++ .../source/filter/xfilter/xffontworkstyle.hxx | 121 ++++++ lotuswordpro/source/filter/xfilter/xfframe.cxx | 202 +++++++++ .../source/filter/xfilter/xfframestyle.cxx | 199 +++++++++ lotuswordpro/source/filter/xfilter/xfglobal.cxx | 130 ++++++ .../source/filter/xfilter/xfheaderstyle.cxx | 166 ++++++++ lotuswordpro/source/filter/xfilter/xfimage.cxx | 147 +++++++ .../source/filter/xfilter/xfimagestyle.cxx | 177 ++++++++ lotuswordpro/source/filter/xfilter/xfindex.cxx | 330 +++++++++++++++ lotuswordpro/source/filter/xfilter/xflist.cxx | 96 +++++ lotuswordpro/source/filter/xfilter/xfliststyle.cxx | 290 +++++++++++++ lotuswordpro/source/filter/xfilter/xfmargins.cxx | 119 ++++++ .../source/filter/xfilter/xfmasterpage.cxx | 86 ++++ .../source/filter/xfilter/xfnumberstyle.cxx | 356 ++++++++++++++++ .../source/filter/xfilter/xfofficemeta.cxx | 138 ++++++ .../source/filter/xfilter/xfpagemaster.cxx | 265 ++++++++++++ lotuswordpro/source/filter/xfilter/xfparagraph.cxx | 96 +++++ lotuswordpro/source/filter/xfilter/xfparastyle.cxx | 461 +++++++++++++++++++++ lotuswordpro/source/filter/xfilter/xfrow.cxx | 135 ++++++ lotuswordpro/source/filter/xfilter/xfrowstyle.cxx | 100 +++++ .../source/filter/xfilter/xfsaxattrlist.cxx | 82 ++++ .../source/filter/xfilter/xfsaxattrlist.hxx | 90 ++++ lotuswordpro/source/filter/xfilter/xfsaxstream.cxx | 122 ++++++ lotuswordpro/source/filter/xfilter/xfsection.cxx | 96 +++++ .../source/filter/xfilter/xfsectionstyle.cxx | 133 ++++++ lotuswordpro/source/filter/xfilter/xfshadow.cxx | 116 ++++++ lotuswordpro/source/filter/xfilter/xfstyle.cxx | 99 +++++ lotuswordpro/source/filter/xfilter/xfstylecont.cxx | 251 +++++++++++ .../source/filter/xfilter/xfstylemanager.cxx | 375 +++++++++++++++++ lotuswordpro/source/filter/xfilter/xftable.cxx | 275 ++++++++++++ .../source/filter/xfilter/xftablestyle.cxx | 130 ++++++ lotuswordpro/source/filter/xfilter/xftabstyle.cxx | 101 +++++ lotuswordpro/source/filter/xfilter/xftabstyle.hxx | 100 +++++ .../source/filter/xfilter/xftextboxstyle.cxx | 101 +++++ .../source/filter/xfilter/xftextcontent.cxx | 115 +++++ lotuswordpro/source/filter/xfilter/xftextspan.cxx | 150 +++++++ lotuswordpro/source/filter/xfilter/xftextstyle.cxx | 126 ++++++ lotuswordpro/source/filter/xfilter/xftimestyle.cxx | 150 +++++++ lotuswordpro/source/filter/xfilter/xfutil.cxx | 391 +++++++++++++++++ 69 files changed, 11254 insertions(+) create mode 100644 lotuswordpro/source/filter/xfilter/xfbase64.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfbase64.hxx create mode 100644 lotuswordpro/source/filter/xfilter/xfbgimage.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfborders.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcell.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcellstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfchange.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcolor.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcolstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcolumns.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfcrossref.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdate.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdatestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdocfield.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawline.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawobj.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawpath.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawrect.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfentry.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xffloatframe.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xffont.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xffontdecl.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xffontfactory.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx create mode 100644 lotuswordpro/source/filter/xfilter/xfframe.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfframestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfglobal.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfimage.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfimagestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfindex.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xflist.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfliststyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfmargins.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfmasterpage.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfofficemeta.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfpagemaster.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfparagraph.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfparastyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfrow.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfrowstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx create mode 100644 lotuswordpro/source/filter/xfilter/xfsaxstream.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfsection.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfshadow.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfstylecont.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfstylemanager.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftable.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftablestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftabstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftabstyle.hxx create mode 100644 lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftextcontent.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftextspan.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftextstyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xftimestyle.cxx create mode 100644 lotuswordpro/source/filter/xfilter/xfutil.cxx (limited to 'lotuswordpro/source/filter/xfilter') diff --git a/lotuswordpro/source/filter/xfilter/xfbase64.cxx b/lotuswordpro/source/filter/xfilter/xfbase64.cxx new file mode 100644 index 000000000..1b7224a24 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfbase64.cxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Base64 tool. + ************************************************************************/ +#include +#include +#include "xfbase64.hxx" + +const char aBase64EncodeTable[] = +{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', +'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', +'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', +'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', +'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; + +/** + * @descr Encode 3 byte to 4 byte. + * Please refer to RFC to get the base64 algorithm. + */ +static void Encode_(const sal_uInt8 *src, char* dest) +{ + sal_Int32 nBinaer = (src[ 0] << 16) + + (src[1] << 8) + + (src[2]); + + sal_uInt8 nIndex = ((nBinaer & 0xFC0000) >> 18); + dest[0] = aBase64EncodeTable [nIndex]; + + nIndex = (nBinaer & 0x3F000) >> 12; + dest[1] =aBase64EncodeTable [nIndex]; + + nIndex = (nBinaer & 0xFC0) >> 6; + dest[2] = aBase64EncodeTable [nIndex]; + + nIndex = (nBinaer & 0x3F); + dest[3] = aBase64EncodeTable [nIndex]; +} + +/** + * @descr Base64 encode. + */ +OUString XFBase64::Encode(sal_uInt8 const *buf, sal_Int32 len) +{ + std::unique_ptr buffer; + sal_Int32 nNeeded; + sal_Int32 cycles = len/3; + sal_Int32 remain = len%3; + + if( remain == 0 ) + nNeeded = cycles*4; + else + nNeeded = (cycles+1)*4; + buffer.reset(new char[nNeeded+1]); + + memset(buffer.get(), 0, nNeeded+1); + + for( sal_Int32 i=0; i + +/** + * @brief + * Base64 algorithm implementation. + * I only implements encode function now, i'll add decode if needed later. + * http://www.faqs.org/rfcs/rfc3548.html. + */ + +class XFBase64 +{ +public: + /** + * @descr Encode binary buffer to base64 encoding. + */ + static OUString Encode(sal_uInt8 const* buf, sal_Int32 len); +}; + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfbgimage.cxx b/lotuswordpro/source/filter/xfilter/xfbgimage.cxx new file mode 100644 index 000000000..d4b4e5be6 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfbgimage.cxx @@ -0,0 +1,162 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Background image. + ************************************************************************/ +#include +#include +#include +#include "xfbase64.hxx" + +XFBGImage::XFBGImage() + : m_bUserFileLink(false) + , m_bRepeate(false) + , m_bStretch(false) + , m_bPosition(true) + , m_eHoriAlign(enumXFAlignCenter) + , m_eVertAlign(enumXFAlignCenter) +{} + +void XFBGImage::SetImageData(sal_uInt8 const *buf, int len) +{ + m_strData = XFBase64::Encode(buf,len); + m_bUserFileLink = false; +} + +bool XFBGImage::Equal(IXFStyle * /* pStyle */) +{ + return false; +} + +void XFBGImage::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + if( m_bUserFileLink ) + { + pAttrList->AddAttribute( "xlink:href", m_strFileName); + } + + pAttrList->AddAttribute( "xlink:type", "simple" ); + pAttrList->AddAttribute( "xlink:actuate", "onLoad"); + + if( m_bPosition ) + { + OUString str = GetAlignName(m_eVertAlign) + " "; + if( m_eHoriAlign == enumXFAlignStart ) + str += "left"; + else if( m_eHoriAlign == enumXFAlignCenter ) + str += "center"; + else if( m_eHoriAlign == enumXFAlignEnd ) + str += "right"; + + pAttrList->AddAttribute( "style:position", str ); + pAttrList->AddAttribute( "style:repeat", "no-repeat" ); + } + else if( m_bRepeate ) + pAttrList->AddAttribute( "style:repeat", "repeat" ); + else if( m_bStretch ) + pAttrList->AddAttribute( "style:repeat", "stretch" ); + + pStrm->StartElement( "style:background-image" ); + + if( !m_bUserFileLink ) + { + pAttrList->Clear(); + pStrm->StartElement( "office:binary-data" ); + pStrm->Characters(m_strData); + pStrm->EndElement( "office:binary-data" ); + } + + pStrm->EndElement( "style:background-image" ); +} + +bool operator==(XFBGImage const & img1, XFBGImage const & img2) +{ + if( img1.m_bUserFileLink != img2.m_bUserFileLink ) + return false; + if( img1.m_bUserFileLink ) + { + if( img1.m_strFileName != img2.m_strFileName ) + return false; + } + else + { + //I'll not compare the content of the two buffer,it's time consuming. + return false; + } + if( img1.m_bPosition != img2.m_bPosition ) + return false; + if( img1.m_bRepeate != img2.m_bRepeate ) + return false; + if( img1.m_bStretch != img2.m_bStretch ) + return false; + if( img1.m_bPosition ) + { + if( (img1.m_eHoriAlign != img2.m_eHoriAlign) || (img1.m_eVertAlign != img2.m_eVertAlign) ) + return false; + } + return true; +} + +bool operator!=(XFBGImage const & img1, XFBGImage const & img2) +{ + return !(img1==img2); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfborders.cxx b/lotuswordpro/source/filter/xfilter/xfborders.cxx new file mode 100644 index 000000000..f6027a155 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfborders.cxx @@ -0,0 +1,366 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Border object,now only used by paragraph object. + ************************************************************************/ +#include +#include +#include + +XFBorder::XFBorder() +{ + m_bDouble = false; + m_bSameWidth = false; + m_fWidthInner = 0; + m_fWidthSpace = 0; + m_fWidthOuter = 0; +} + +void XFBorder::SetColor(XFColor const & color) +{ + m_aColor = color; +} + +void XFBorder::SetWidth(double width) +{ + if( !m_bDouble ) + { + m_fWidthInner = width; + m_bSameWidth = true; + } + else if (m_bSameWidth) + { + m_fWidthInner = width; + m_fWidthOuter = width; + m_fWidthSpace = width; + } +} + +void XFBorder::SetDoubleLine(bool dual,bool bSameWidth) +{ + m_bDouble = dual; + m_bSameWidth = bSameWidth; +} + +void XFBorder::SetWidthInner(double inner) +{ + assert(m_bDouble); + m_fWidthInner = inner; +} + +void XFBorder::SetWidthSpace(double space) +{ + assert(m_bDouble); + m_fWidthSpace = space; +} + +void XFBorder::SetWidthOuter(double outer) +{ + assert(m_bDouble); + m_fWidthOuter = outer; +} + +OUString XFBorder::GetLineWidth() +{ + OUString str; + + if( m_bDouble ) + { + str = OUString::number(m_fWidthInner) + "cm " + + OUString::number(m_fWidthSpace) + "cm " + + OUString::number(m_fWidthOuter) + "cm"; + } + return str; +} + +OUString XFBorder::ToString() +{ + OUString str; + + if( m_bDouble ) + { + double width = m_fWidthInner + m_fWidthSpace + m_fWidthOuter; + if( widthGetAttrList(); + + if( !m_aBorderLeft.GetLineWidth().isEmpty() ) + pAttrList->AddAttribute( "style:border-line-width-left", m_aBorderLeft.GetLineWidth() ); + if( !m_aBorderRight.GetLineWidth().isEmpty() ) + pAttrList->AddAttribute( "style:border-line-width-right", m_aBorderRight.GetLineWidth() ); + if( !m_aBorderTop.GetLineWidth().isEmpty() ) + pAttrList->AddAttribute( "style:border-line-width-top", m_aBorderTop.GetLineWidth() ); + if( !m_aBorderBottom.GetLineWidth().isEmpty() ) + pAttrList->AddAttribute( "style:border-line-width-bottom", m_aBorderBottom.GetLineWidth() ); + + if( !m_aBorderLeft.ToString().isEmpty() ) + pAttrList->AddAttribute( "fo:border-left", m_aBorderLeft.ToString() ); + else + pAttrList->AddAttribute( "fo:border-left", "none" ); + + if( !m_aBorderRight.ToString().isEmpty() ) + pAttrList->AddAttribute( "fo:border-right", m_aBorderRight.ToString() ); + else + pAttrList->AddAttribute( "fo:border-right", "none" ); + + if( !m_aBorderTop.ToString().isEmpty() ) + pAttrList->AddAttribute( "fo:border-top", m_aBorderTop.ToString() ); + else + pAttrList->AddAttribute( "fo:border-top", "none" ); + + if( !m_aBorderBottom.ToString().isEmpty() ) + pAttrList->AddAttribute( "fo:border-bottom", m_aBorderBottom.ToString() ); + else + pAttrList->AddAttribute( "fo:border-bottom", "none" ); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx new file mode 100644 index 000000000..dfc5889db --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx @@ -0,0 +1,197 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table cell. + ************************************************************************/ +#include + +#include + +#include +#include +#include +#include +#include + +XFCell::XFCell() + : m_pOwnerRow(nullptr) + , m_nCol(0) + , m_nColSpaned(1) + , m_nRepeated(0) + , m_eValueType(enumXFValueTypeNone) + , m_bProtect(false) +{} + +XFCell::~XFCell() +{ +} + +void XFCell::Add(XFContent *pContent) +{ + if( m_eValueType != enumXFValueTypeNone ) + { + Reset(); + m_eValueType = enumXFValueTypeNone; + } + if (m_pSubTable.is()) + { + throw std::runtime_error("subtable already set"); + } + if (!pContent) + { + throw std::runtime_error("no content"); + } + if( pContent->GetContentType() == enumXFContentTable ) + { + XFTable *pTable = dynamic_cast(pContent); + if( !pTable ) + return; + //the sub table will fill all the cell, there can't be other contents. + pTable->SetOwnerCell(this); + m_pSubTable = pTable; + } + else if( pContent->GetContentType() == enumXFContentText ) + { + XFParagraph *pPara = new XFParagraph(); + pPara->Add(pContent); + XFContentContainer::Add(pPara); + } + else if( pContent->GetContentType() == enumXFContentFrame ) + { + XFParagraph *pPara = new XFParagraph(); + pPara->Add(pContent); + XFContentContainer::Add(pPara); + } + else + { + XFContentContainer::Add(pContent); + } +} + +void XFCell::SetValue(double value) +{ + SetValue(OUString::number(value)); +} + +void XFCell::SetValue(const OUString& value) +{ + m_eValueType = enumXFValueTypeFloat; + m_strValue = value; +} + +OUString XFCell::GetCellName() +{ + XFRow *pRow = m_pOwnerRow; + + if( !pRow ) + return OUString(); + + XFTable *pTable = pRow->GetOwnerTable(); + + if( !pTable ) + return OUString(); + + OUString name; + if( pTable->IsSubTable() ) + { + name = pTable->GetTableName() + "." + OUString::number(m_nCol) + "." + OUString::number(pRow->GetRow()); + } + else + { + name = GetTableColName(m_nCol) + OUString::number(pRow->GetRow()); + } + return name; +} + +void XFCell::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "table:style-name", GetStyleName() ); + if( m_nColSpaned>1 ) + pAttrList->AddAttribute( "table:number-columns-spanned", OUString::number(m_nColSpaned) ); + if( m_nRepeated ) + pAttrList->AddAttribute( "table:number-columns-repeated", OUString::number(m_nRepeated) ); + if( m_eValueType != enumXFValueTypeNone ) + { + pAttrList->AddAttribute( "table:value-type", GetValueType(m_eValueType) ); + pAttrList->AddAttribute( "table:value", m_strValue ); + } + if( !m_strFormula.isEmpty() ) + pAttrList->AddAttribute( "table:formula", m_strFormula ); + + if( m_bProtect ) + pAttrList->AddAttribute( "table:protected", "true" ); + + //for test only. +// pAttrList->AddAttribute( "table:cell-name", GetCellName() ); + + pStrm->StartElement( "table:table-cell" ); + + if( m_pSubTable.is() ) + m_pSubTable->ToXml(pStrm); + else + { + XFContentContainer::ToXml(pStrm); + } + + pStrm->EndElement( "table:table-cell" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx new file mode 100644 index 000000000..e615778a9 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcellstyle.cxx @@ -0,0 +1,245 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table cell style. Number format, string value, and so on... + ************************************************************************/ +#include +#include +#include +#include +#include + +XFCellStyle::XFCellStyle() + : m_eHoriAlign(enumXFAlignNone) + , m_eVertAlign(enumXFAlignNone) +{} + +XFCellStyle::~XFCellStyle() +{ +} + +void XFCellStyle::SetPadding(double left, double right,double top, double bottom) +{ + if( left != -1 ) + m_aPadding.SetLeft(left); + if( right != -1 ) + m_aPadding.SetRight(right); + if( top != -1 ) + m_aPadding.SetTop(top); + if( bottom != -1 ) + m_aPadding.SetBottom( bottom ); +} + +void XFCellStyle::SetBackColor(XFColor const & color) +{ + m_aBackColor = color; +} + +void XFCellStyle::SetBackImage(std::unique_ptr& rImage) +{ + m_xBackImage = std::move(rImage); +} + +void XFCellStyle::SetBorders(XFBorders *pBorders) +{ + m_pBorders.reset( pBorders ); +} + +enumXFStyle XFCellStyle::GetStyleFamily() +{ + return enumXFStyleTableCell; +} + +/** + *Affirm whether two XFCellStyle objects are equal. + */ +bool XFCellStyle::Equal(IXFStyle *pStyle) +{ + if( this == pStyle ) + return true; + if( !pStyle || pStyle->GetStyleFamily() != enumXFStyleTableCell ) + return false; + + XFCellStyle *pOther = dynamic_cast(pStyle); + if( !pOther ) + return false; + + if( m_strDataStyle != pOther->m_strDataStyle ) + return false; + + if( m_strParentStyleName != pOther->m_strParentStyleName ) + return false; + + //align: + if( m_eHoriAlign != pOther->m_eHoriAlign ) + return false; + if( m_eVertAlign != pOther->m_eVertAlign ) + return false; + + if( m_aBackColor != pOther->m_aBackColor ) + return false; + //shadow: + if( m_aShadow != pOther->m_aShadow ) + return false; + //margin: + if( m_aMargin != pOther->m_aMargin ) + return false; + //padding: + if( m_aPadding != pOther->m_aPadding ) + return false; + + //font: + if( m_pFont.is() ) + { + if( !pOther->m_pFont.is() ) + return false; + if(*m_pFont != *pOther->m_pFont ) + return false; + } + else if( pOther->m_pFont.is() ) + return false; + + //border: + if( m_pBorders ) + { + if( !pOther->m_pBorders ) + return false; + if( *m_pBorders != *pOther->m_pBorders ) + return false; + } + else if( pOther->m_pBorders ) + return false; + + //if there is backimage + if (m_xBackImage) + { + if( !pOther->m_xBackImage ) + return false; + if( !m_xBackImage->Equal(pOther) ) + return false; + } + else + { + if( pOther->m_xBackImage ) + return false; + } + + return true; +} + +void XFCellStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + OUString style = GetStyleName(); + + pAttrList->Clear(); + if( !style.isEmpty() ) + pAttrList->AddAttribute("style:name",GetStyleName()); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + + pAttrList->AddAttribute("style:family", "table-cell"); + if( !m_strParentStyleName.isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",m_strParentStyleName); + if( !m_strDataStyle.isEmpty() ) + pAttrList->AddAttribute( "style:data-style-name", m_strDataStyle ); + + pStrm->StartElement("style:style"); + + //Paragraph properties: + pAttrList->Clear(); + + //padding: + m_aPadding.ToXml(pStrm); + //margin: + m_aMargin.ToXml(pStrm); + + //text horizontal align: + if( m_eHoriAlign != enumXFAlignNone ) + { + pAttrList->AddAttribute("fo:text-align", GetAlignName(m_eHoriAlign) ); + } + //text vertical align + if( m_eVertAlign != enumXFAlignNone ) + pAttrList->AddAttribute( "fo:vertical-align", GetAlignName(m_eVertAlign) ); + + //shadow: + m_aShadow.ToXml(pStrm); + //borders: + if( m_pBorders ) + m_pBorders->ToXml(pStrm); + + //background color: + if( m_aBackColor.IsValid() && !m_xBackImage ) + { + pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() ); + } + //Font properties: + if( m_pFont.is() ) + m_pFont->ToXml(pStrm); + + pStrm->StartElement("style:properties"); + + if( m_xBackImage ) + m_xBackImage->ToXml(pStrm); + + pStrm->EndElement("style:properties"); + + pStrm->EndElement("style:style"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfchange.cxx b/lotuswordpro/source/filter/xfilter/xfchange.cxx new file mode 100644 index 000000000..0beef2120 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfchange.cxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * For LWP filter architecture prototype + ************************************************************************/ + +#include +#include + +void XFChangeList::ToXml(IXFStream *pStrm) +{ + if (XFContentContainer::GetCount() == 0) + return; + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + // Add for disable change tracking + pAttrList->AddAttribute( "text:track-changes","false"); + pStrm->StartElement( "text:tracked-changes" ); + XFContentContainer::ToXml(pStrm); + pStrm->EndElement("text:tracked-changes"); +} + +void XFChangeRegion::ToXml(IXFStream * /*pStrm*/) +{ +} + +void XFChangeInsert::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if(m_sID.isEmpty()) + return; + pAttrList->AddAttribute( "text:id",m_sID); + + pStrm->StartElement( "text:changed-region" ); + pStrm->StartElement( "text:insertion" ); + pAttrList->Clear(); + pAttrList->AddAttribute( "office:chg-author",m_sEditor); + pAttrList->AddAttribute( "office:chg-date-time","0000-00-00T00:00:00"); + pStrm->StartElement( "office:change-info" ); + pStrm->EndElement( "office:change-info" ); + pStrm->EndElement( "text:insertion" ); + pStrm->EndElement( "text:changed-region" ); +} + +void XFChangeDelete::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if(m_sID.isEmpty()) + return; + pAttrList->AddAttribute( "text:id",m_sID); + + pStrm->StartElement( "text:changed-region" ); + pStrm->StartElement( "text:deletion" ); + pAttrList->Clear(); + pAttrList->AddAttribute( "office:chg-author",m_sEditor); + pAttrList->AddAttribute( "office:chg-date-time","0000-00-00T00:00:00"); + pStrm->StartElement( "office:change-info" ); + pStrm->EndElement( "office:change-info" ); + + pStrm->EndElement( "text:deletion" ); + pStrm->EndElement( "text:changed-region" ); +} + +void XFChangeStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if(m_sID.isEmpty()) + return; + pAttrList->AddAttribute( "text:change-id",m_sID); + + pStrm->StartElement( "text:change-start" ); + pStrm->EndElement( "text:change-start" ); +} + +void XFChangeEnd::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if(m_sID.isEmpty()) + return; + pAttrList->AddAttribute( "text:change-id",m_sID); + + pStrm->StartElement( "text:change-end" ); + pStrm->EndElement( "text:change-end" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcolor.cxx b/lotuswordpro/source/filter/xfilter/xfcolor.cxx new file mode 100644 index 000000000..c30e35341 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcolor.cxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Color object to serial to xml filter. + ************************************************************************/ +#include +#include + +OUString XFColor::ToString() const +{ + char buf[8] = {}; + sprintf(buf,"#%2x%2x%2x",m_nRed, m_nGreen, m_nBlue); + for( int i=1; i<7;i++ ) + { + if( buf[i] == ' ' ) + buf[i] = '0'; + } + return OUString::createFromAscii(buf); +} + +bool operator==(XFColor const & c1, XFColor const & c2) +{ + return ( + (c1.m_nRed==c2.m_nRed)&& + (c1.m_nGreen==c2.m_nGreen)&& + (c1.m_nBlue==c2.m_nBlue) + ); +} + +bool operator!=(XFColor const & c1, XFColor const & c2) +{ + return !(c1==c2); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx b/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx new file mode 100644 index 000000000..c44720a6b --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcolstyle.cxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Column style object. + ************************************************************************/ +#include +#include + +XFColStyle::XFColStyle() { m_fWidth = 0; } + +XFColStyle::~XFColStyle() {} + +enumXFStyle XFColStyle::GetStyleFamily() { return enumXFStyleTableCol; } + +void XFColStyle::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + + pAttrList->AddAttribute("style:name", GetStyleName()); + pAttrList->AddAttribute("style:family", "table-column"); + pStrm->StartElement("style:style"); + + pAttrList->Clear(); + pAttrList->AddAttribute("style:column-width", OUString::number(m_fWidth) + "cm"); + pStrm->StartElement("style:properties"); + pStrm->EndElement("style:properties"); + + pStrm->EndElement("style:style"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcolumns.cxx b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx new file mode 100644 index 000000000..b5f427d88 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcolumns.cxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Columns styles for section, or paragraph. + ************************************************************************/ +#include +#include + +void XFColumn::SetRelWidth(sal_Int32 width) +{ + m_nRelWidth = width; +} + +void XFColumn::SetMargins(double left, double right) +{ + m_fMarginLeft = left; + m_fMarginRight = right; +} + +void XFColumn::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:rel-width", OUString::number(m_nRelWidth) + "*" ); + pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fMarginLeft) + "cm" ); + pAttrList->AddAttribute( "fo:margin-right", OUString::number(m_fMarginRight) + "cm" ); + + pStrm->StartElement( "style:column" ); + pStrm->EndElement( "style:column" ); +} + +void XFColumnSep::SetRelHeight(sal_Int32 height) +{ + assert(height>=0&&height<=100); + m_nRelHeight = height; +} +void XFColumnSep::SetWidth(double width) +{ + m_fWidth = width; +} +void XFColumnSep::SetColor(XFColor const & color) +{ + m_aColor = color; +} +void XFColumnSep::SetVerticalAlign(enumXFAlignType align) +{ + m_eVertAlign = align; +} + +void XFColumnSep::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:width", OUString::number(m_fWidth) + "cm" ); + if( m_aColor.IsValid() ) + pAttrList->AddAttribute( "style:color", m_aColor.ToString() ); + pAttrList->AddAttribute( "style:height", OUString::number(m_nRelHeight) + "%" ); + //text align: + if( m_eVertAlign == enumXFAlignTop ) + { + pAttrList->AddAttribute("style:vertical-align","top"); + } + else if( m_eVertAlign == enumXFAlignMiddle ) + { + pAttrList->AddAttribute("style:vertical-align","middle"); + } + else if( m_eVertAlign == enumXFAlignBottom ) + { + pAttrList->AddAttribute("style:vertical-align","bottom"); + } + + pStrm->StartElement( "style:column-sep" ); + pStrm->EndElement( "style:column-sep" ); +} + +void XFColumns::SetSeparator(XFColumnSep const & aSeparator) +{ + m_aSeparator = aSeparator; + m_nFlag |= XFCOLUMNS_FLAG_SEPARATOR; +} + +void XFColumns::AddColumn(XFColumn const & column) +{ + m_aColumns.push_back(column); +} + +void XFColumns::SetGap(double fGap) +{ + m_fGap = fGap; + m_nFlag |= XFCOLUMNS_FLAG_GAP; +} + +void XFColumns::SetCount(sal_uInt16 nCount) +{ + m_nCount = nCount; +} + +void XFColumns::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "fo:column-count", OUString::number(m_nCount)); + if( m_nFlag&XFCOLUMNS_FLAG_GAP ) + { + pAttrList->AddAttribute( "fo:column-gap", OUString::number(m_fGap)+"cm" ); + } + + pStrm->StartElement( "style:columns" ); + + if( m_nFlag&XFCOLUMNS_FLAG_SEPARATOR ) //column-sep: + { + m_aSeparator.ToXml(pStrm); + } + + if(!(m_nFlag&XFCOLUMNS_FLAG_GAP) ) + { + for (auto & column : m_aColumns) + { + column.ToXml(pStrm); + } + } + pStrm->EndElement( "style:columns" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx new file mode 100644 index 000000000..8d669c90e --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfconfigmanager.cxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Manager for all config object,include line number config. + ************************************************************************/ +#include + +XFConfigManager::XFConfigManager() {} + +XFConfigManager::~XFConfigManager() {} + +void XFConfigManager::SetLineNumberConfig(XFLineNumberConfig* pLNConfig) +{ + m_pLineNumberConfig.reset(pLNConfig); +} + +void XFConfigManager::SetFootnoteConfig(XFFootnoteConfig* pFNConfig) +{ + m_pFootnoteConfig.reset(pFNConfig); +} + +void XFConfigManager::SetEndnoteConfig(XFEndnoteConfig* pENConfig) +{ + m_pEndnoteConfig.reset(pENConfig); +} + +void XFConfigManager::ToXml(IXFStream* pStrm) +{ + if (m_pLineNumberConfig) + AddStyle(std::move(m_pLineNumberConfig)); + if (m_pFootnoteConfig) + AddStyle(std::move(m_pFootnoteConfig)); + if (m_pEndnoteConfig) + AddStyle(std::move(m_pEndnoteConfig)); + + XFStyleContainer::ToXml(pStrm); + XFStyleContainer::Reset(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx new file mode 100644 index 000000000..14aaea951 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcontentcontainer.cxx @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Container for content.It will destroy all children when destroy. + ************************************************************************/ +#include +#include + +XFContentContainer::XFContentContainer() +{ +} + +XFContentContainer::~XFContentContainer() +{ +} + +void XFContentContainer::Add(XFContent *pContent) +{ + m_aContents.emplace_back(pContent); +} + +void XFContentContainer::Add(const OUString& text) +{ + rtl::Reference xTC(new XFTextContent); + xTC->SetText(text); + Add(xTC.get()); +} + +bool XFContentContainer::HierarchyContains(const XFContent *pContent) const +{ + if (pContent == this) + return true; + + for (int i = 0, nCount = GetCount(); i < nCount; i++) + { + rtl::Reference xContent = GetContent(i); + if (xContent.get() == pContent) + return true; + const XFContentContainer *pChildCont = dynamic_cast(xContent.get()); + if (pChildCont && pChildCont->HierarchyContains(pContent)) + return true; + } + + return false; +} + +int XFContentContainer::GetCount() const +{ + return m_aContents.size(); +} + +void XFContentContainer::Reset() +{ + m_aContents.clear(); +} + +rtl::Reference XFContentContainer::FindFirstContent(enumXFContent type) +{ + rtl::Reference pRet; + rtl::Reference pContent; + + for( int i=0; iGetContentType(); + if( eType == type ) + return pContent; + else + { + XFContentContainer *pChildCont = static_cast(pContent.get()); + if( pChildCont ) + { + pRet = pChildCont->FindFirstContent(type); + if( pRet.is() ) + return pRet; + } + } + } + return pRet; +} + +enumXFContent XFContentContainer::GetContentType() +{ + return enumXFContentContainer; +} + +void XFContentContainer::ToXml(IXFStream *pStrm) +{ + for (auto const& content : m_aContents) + { + XFContent *pContent = content.get(); + if( pContent ) + pContent->DoToXml(pStrm); + } +} + +rtl::Reference XFContentContainer::GetLastContent() +{ + // TODO JNA : if m_aContents size is 0, there's some pb + sal_uInt32 index = m_aContents.size()-1; + if(index >0) + { + return m_aContents[index]; + } + + return nullptr; +} + +void XFContentContainer::RemoveLastContent() +{ + sal_uInt32 index = m_aContents.size()-1; + if(index >0) + { + m_aContents.erase(m_aContents.begin() + index); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfcrossref.cxx b/lotuswordpro/source/filter/xfilter/xfcrossref.cxx new file mode 100644 index 000000000..e04052611 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfcrossref.cxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * index entry object. + ************************************************************************/ + +#include + +#include +#include +#include + +XFCrossRefStart::XFCrossRefStart() + : m_nType(CROSSREF_INVALID) +{ +} + +XFCrossRefStart::~XFCrossRefStart() {} + +void XFCrossRefStart::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + if (m_nType == CROSSREF_TEXT) + { + pAttrList->AddAttribute("text:reference-format", "text"); + } + else if (m_nType == CROSSREF_PAGE) + { + pAttrList->AddAttribute("text:reference-format", "page"); + } + else if (m_nType == CROSSREF_PARANUMBER) + { + pAttrList->AddAttribute("text:reference-format", "chapter"); + } + pAttrList->AddAttribute("text:ref-name", m_strMarkName); + pStrm->StartElement("text:bookmark-ref"); +} + +XFCrossRefEnd::XFCrossRefEnd() {} + +XFCrossRefEnd::~XFCrossRefEnd() {} + +void XFCrossRefEnd::ToXml(IXFStream* pStrm) { pStrm->EndElement("text:bookmark-ref"); } +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdate.cxx b/lotuswordpro/source/filter/xfilter/xfdate.cxx new file mode 100644 index 000000000..73425802f --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdate.cxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Date field with date style. + ************************************************************************/ +#include +#include + +XFDate::XFDate() +{ +} + +XFDate::~XFDate() +{ +} + +void XFDate::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "style:data-style-name", GetStyleName() ); + + pStrm->StartElement( "text:date" ); + if (!m_strText.isEmpty()) + pStrm->Characters(m_strText); + pStrm->EndElement( "text:date" ); +} + +void XFDateStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "style:data-style-name", GetStyleName() ); +/* if (m_bValued) + pAttrList->AddAttribute( "text:date-value", DateTimeToOUString(m_aDateTime) ); + if( m_bFixed ) + pAttrList->AddAttribute( "text:fixed", "true" ); + + pStrm->StartElement( "text:date" ); + if (m_strText.getLength()>0) + pStrm->Characters(m_strText); +*/ + pStrm->StartElement( "text:date" ); +} + +void XFDateEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:date" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx b/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx new file mode 100644 index 000000000..77eeb6aca --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdatestyle.cxx @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Date style. The date format for date field. + ************************************************************************/ +#include +#include + +XFDatePart::XFDatePart() +{ + m_bTexture = false; +} + +void XFDatePart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + switch(m_ePart) + { + case enumXFDateUnknown: + break; + case enumXFDateYear: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:year" ); + pStrm->EndElement( "number:year" ); + break; + case enumXFDateMonth: + pAttrList->Clear(); + if( m_bTexture ) + pAttrList->AddAttribute( "number:textual", "true" ); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:month" ); + pStrm->EndElement( "number:month" ); + break; + case enumXFDateMonthDay: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:day" ); + pStrm->EndElement( "number:day" ); + break; + case enumXFDateWeekDay: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:day-of-week" ); + pStrm->EndElement( "number:day-of-week" ); + break; + case enumXFDateYearWeek: + pAttrList->Clear(); + pStrm->StartElement( "number:week-of-year" ); + pStrm->EndElement( "number:week-of-year" ); + break; + case enumXFDateEra: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:era" ); + pStrm->EndElement( "number:era" ); + break; + case enumXFDateQuarter: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:quarter" ); + pStrm->EndElement( "number:quarter" ); + break; + case enumXFDateHour: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:hours" ); + pStrm->EndElement( "number:hours" ); + break; + case enumXFDateMinute: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:minutes" ); + pStrm->EndElement( "number:minutes" ); + break; + case enumXFDateSecond: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + if( m_nDecimalPos ) + pAttrList->AddAttribute( "number:decimal-places", OUString::number(m_nDecimalPos) ); + pStrm->StartElement( "number:seconds" ); + pStrm->EndElement( "number:seconds" ); + break; + case enumXFDateAmPm: + pStrm->StartElement( "number:am-pm" ); + pStrm->EndElement( "number:am-pm" ); + break; + case enumXFDateText: + pAttrList->Clear(); + pStrm->StartElement( "number:text" ); + pStrm->Characters( m_strText ); + pStrm->EndElement( "number:text" ); + break; + } +} + +XFDateStyle::XFDateStyle() +{ +} + +XFDateStyle::~XFDateStyle() +{ +} + +enumXFStyle XFDateStyle::GetStyleFamily() +{ + return enumXFStyleDate; +} + +void XFDateStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + pAttrList->AddAttribute( "style:family", "data-style" ); + + pStrm->StartElement( "number:date-style" ); + + m_aParts.ToXml(pStrm); + + pStrm->EndElement( "number:date-style" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdocfield.cxx b/lotuswordpro/source/filter/xfilter/xfdocfield.cxx new file mode 100644 index 000000000..da32ed829 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdocfield.cxx @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * doc field. + ************************************************************************/ +#include +#include +#include + +void XFFileName::SetType(const OUString& sType) +{ + m_strType = sType; +} + +void XFFileName::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (m_strType == "FileName") + pAttrList->AddAttribute( "text:display", "name-and-extension" ); + else if (m_strType == "Path") + pAttrList->AddAttribute( "text:display", "path" ); + pStrm->StartElement( "text:file-name" ); + pStrm->EndElement( "text:file-name" ); +} + +void XFWordCount::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:word-count" ); + pStrm->EndElement( "text:word-count" ); +} + +void XFCharCount::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:character-count" ); + pStrm->EndElement( "text:character-count" ); +} + +void XFDescription::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:description" ); + pStrm->EndElement( "text:description" ); +} + +void XFPageCountStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:page-count" ); +} +void XFPageCountEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:page-count" ); +} + +void XFWordCountStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:word-count" ); +} + +void XFCharCountStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:character-count" ); +} + +void XFDescriptionStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:description" ); +} + +void XFWordCountEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:word-count" ); +} + +void XFCharCountEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:character-count" ); +} + +void XFDescriptionEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:description" ); +} + +void XFKeywords::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:keywords" ); + pStrm->EndElement( "text:keywords" ); +} + +void XFTotalEditTime::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:editing-duration" ); + pStrm->EndElement( "text:editing-duration" ); +} +void XFTotalEditTimeStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:editing-duration" ); +} +void XFTotalEditTimeEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:editing-duration" ); +} +void XFCreateTime::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:creation-time" ); + pStrm->EndElement( "text:creation-time" ); +} +void XFLastEditTime::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:modification-time" ); + pStrm->EndElement( "text:modification-time" ); +} + +void XFCreateTimeStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:creation-time" ); +} + +void XFLastEditTimeStart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + if (!m_strStyleName.isEmpty()) + pAttrList->AddAttribute( "style:data-style-name", m_strStyleName ); + pStrm->StartElement( "text:modification-time" ); +} +void XFCreateTimeEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:creation-time" ); +} + +void XFLastEditTimeEnd::ToXml(IXFStream *pStrm) +{ + pStrm->EndElement( "text:modification-time" ); +} + +void XFInitialCreator::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pStrm->StartElement( "text:initial-creator" ); + pStrm->EndElement( "text:initial-creator" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx new file mode 100644 index 000000000..4f086032f --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.cxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Area style of Drawing object. + ************************************************************************/ +#include "xfdrawareastyle.hxx" +#include + +XFDrawAreaStyle::XFDrawAreaStyle() + : m_eAreaStyle(enumXFAreaSolid) + , m_eLineStyle(enumXFAreaLineSingle) + , m_nAngle(0) + , m_fSpace(0.18) +{ +} + +enumXFStyle XFDrawAreaStyle::GetStyleFamily() { return enumXFStyleArea; } + +void XFDrawAreaStyle::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + + pAttrList->AddAttribute("draw:name", GetStyleName()); + + if (m_eLineStyle == enumXFAreaLineSingle) + pAttrList->AddAttribute("draw:style", "single"); + else if (m_eLineStyle == enumXFAreaLineCrossed) + pAttrList->AddAttribute("draw:style", "double"); + else if (m_eLineStyle == enumXFAreaLineTriple) + pAttrList->AddAttribute("draw:style", "triple"); + + pAttrList->AddAttribute("draw:color", m_aLineColor.ToString()); + pAttrList->AddAttribute("draw:rotation", OUString::number(m_nAngle * 10)); + pAttrList->AddAttribute("draw:distance", OUString::number(m_fSpace) + "cm"); + + pStrm->StartElement("draw:hatch"); + pStrm->EndElement("draw:hatch"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx new file mode 100644 index 000000000..6775b049c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawareastyle.hxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Area style of Drawing object. + * Only support fill color and fill pattern now. + ************************************************************************/ +#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDRAWAREASTYLE_HXX +#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFDRAWAREASTYLE_HXX + +#include +#include + +class XFDrawAreaStyle : public XFStyle +{ +public: + XFDrawAreaStyle(); + +public: + void SetAreaStyle(enumXFAreaStyle style); + + void SetLineStyle(enumXFAreaLineStyle style); + + void SetBackColor(XFColor const & color); + + void SetLineColor(XFColor const & color); + + void SetLineAngle(sal_Int32 angle); + + void SetLineSpace(double space); + + enumXFAreaStyle GetAreaStyle() const; + + const XFColor& GetBackColor() const; + + virtual enumXFStyle GetStyleFamily() override; + + virtual void ToXml(IXFStream *pStrm) override; + +private: + enumXFAreaStyle m_eAreaStyle; + enumXFAreaLineStyle m_eLineStyle; + XFColor m_aBackColor; + XFColor m_aLineColor; + sal_Int32 m_nAngle; + double m_fSpace; +}; + +inline void XFDrawAreaStyle::SetAreaStyle(enumXFAreaStyle style) +{ + m_eAreaStyle = style; +} + +inline void XFDrawAreaStyle::SetLineStyle(enumXFAreaLineStyle style) +{ + m_eLineStyle = style; +} + +inline void XFDrawAreaStyle::SetBackColor(XFColor const & color) +{ + m_aBackColor = color; +} + +inline void XFDrawAreaStyle::SetLineColor(XFColor const & color) +{ + m_aLineColor = color; +} + +inline void XFDrawAreaStyle::SetLineAngle(sal_Int32 angle) +{ + m_nAngle = angle; +} + +inline void XFDrawAreaStyle::SetLineSpace(double space) +{ + m_fSpace = space; +} + +inline enumXFAreaStyle XFDrawAreaStyle::GetAreaStyle() const +{ + return m_eAreaStyle; +} + +inline const XFColor& XFDrawAreaStyle::GetBackColor() const +{ + return m_aBackColor; +} + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawline.cxx new file mode 100644 index 000000000..32a68f9df --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawline.cxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Line object. + ************************************************************************/ +#include +#include + +XFDrawLine::XFDrawLine() +{ +} + +void XFDrawLine::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "draw:style-name", GetStyleName() ); + + assert(!m_strName.isEmpty() && "name should not be null."); + if( !m_strName.isEmpty() ) + pAttrList->AddAttribute( "draw:name", m_strName ); + //anchor type: + switch( m_eAnchor ) + { + case enumXFAnchorPara: + pAttrList->AddAttribute( "text:anchor-type", "paragraph" ); + break; + case enumXFAnchorPage: + pAttrList->AddAttribute( "text:anchor-type", "page" ); + break; + case enumXFAnchorChar: + pAttrList->AddAttribute( "text:anchor-type", "char" ); + break; + case enumXFAnchorAsChar: + pAttrList->AddAttribute( "text:anchor-type", "as-char" ); + break; + case enumXFAnchorFrame: + pAttrList->AddAttribute( "text:anchor-type", "frame" ); + break; + default: + break; + } + pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) ); + + pAttrList->AddAttribute( "svg:x1", OUString::number(m_aPoint1.GetX()) + "cm" ); + pAttrList->AddAttribute( "svg:y1", OUString::number(m_aPoint1.GetY()) + "cm" ); + pAttrList->AddAttribute( "svg:x2", OUString::number(m_aPoint2.GetX()) + "cm" ); + pAttrList->AddAttribute( "svg:y2", OUString::number(m_aPoint2.GetY()) + "cm" ); + + //transform + OUString strTransform; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_ROTATE ) + strTransform = "rotate (" + OUString::number(m_fRotate) + ") "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_TRANSLATE ) + strTransform += "translate (" + OUString::number(m_aRotatePoint.GetX()) + "cm " + OUString::number(m_aRotatePoint.GetY()) + "cm) "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWX ) + strTransform += "skewX (" + OUString::number(0) + " "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWY ) + strTransform += "skewY (" + OUString::number(0) + " "; + strTransform = strTransform.trim(); + + if( !strTransform.isEmpty() ) + pAttrList->AddAttribute( "draw:transform", strTransform ); + + pStrm->StartElement( "draw:line" ); + ContentToXml(pStrm); + pStrm->EndElement( "draw:line" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx new file mode 100644 index 000000000..575e6184c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawlinestyle.cxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Line style of Drawing object. + ************************************************************************/ +#include +#include + +XFDrawLineStyle::XFDrawLineStyle() + : m_eLineStyle(enumXFLineSolid) + , m_fWidth(0) + , m_nTransparency(0) + , m_nNumber1(1) + , m_nNumber2(1) + , m_fSpace(0) + , m_fLength1(0) + , m_fLength2(0) +{ +} + +enumXFStyle XFDrawLineStyle::GetStyleFamily() { return enumXFStyleStrokeDash; } + +void XFDrawLineStyle::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute("draw:name", GetStyleName()); + //simple place here: + pAttrList->AddAttribute("draw:style", "rect"); + + if (m_eLineStyle == enumXFLineDot) + { + } + else if (m_eLineStyle == enumXFLineDash) + { + pAttrList->AddAttribute("draw:dots1", OUString::number(m_nNumber1)); + pAttrList->AddAttribute(" draw:dots1-length", OUString::number(m_fLength1) + "cm"); + + pAttrList->AddAttribute("draw:dots2", OUString::number(m_nNumber2)); + pAttrList->AddAttribute(" draw:dots2-length", OUString::number(m_fLength2) + "cm"); + } + else if (m_eLineStyle == enumXFLineDotDash) + { + pAttrList->AddAttribute("draw:dots1", OUString::number(m_nNumber1)); + + pAttrList->AddAttribute("draw:dots2", OUString::number(m_nNumber2)); + pAttrList->AddAttribute(" draw:dots2-length", OUString::number(m_fLength2) + "cm"); + } + else if (m_eLineStyle == enumXFLineDashDot) + { + pAttrList->AddAttribute("draw:dots1", OUString::number(m_nNumber1)); + pAttrList->AddAttribute(" draw:dots1-length", OUString::number(m_fLength1) + "cm"); + + pAttrList->AddAttribute("draw:dots2", OUString::number(m_nNumber2)); + } + + pAttrList->AddAttribute("draw:distance", OUString::number(m_fSpace) + "cm"); + + pStrm->StartElement("draw:stroke-dash"); + pStrm->EndElement("draw:stroke-dash"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx b/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx new file mode 100644 index 000000000..0cac7a8f7 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawobj.cxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Interface for all Drawing object. + ************************************************************************/ +#include +#include + +XFDrawObject::XFDrawObject() +{ + m_fRotate = 0; + m_nDrawFlag = 0; + m_eType = enumXFFrameDrawing; +} + +void XFDrawObject::ContentToXml(IXFStream *pStrm) +{ + XFContentContainer::ToXml(pStrm); +} + +void XFDrawObject::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "draw:style-name", GetStyleName() ); + + assert(!m_strName.isEmpty() && "name should not be null."); + if( !m_strName.isEmpty() ) + pAttrList->AddAttribute( "draw:name", m_strName ); + //anchor type: + switch( m_eAnchor ) + { + case enumXFAnchorPara: + pAttrList->AddAttribute( "text:anchor-type", "paragraph" ); + break; + case enumXFAnchorPage: + pAttrList->AddAttribute( "text:anchor-type", "page" ); + break; + case enumXFAnchorChar: + pAttrList->AddAttribute( "text:anchor-type", "char" ); + break; + case enumXFAnchorAsChar: + pAttrList->AddAttribute( "text:anchor-type", "as-char" ); + break; + case enumXFAnchorFrame: + pAttrList->AddAttribute( "text:anchor-type", "frame" ); + break; + default: + break; + } + pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) ); + + pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" ); + pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" ); + pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" ); + pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" ); + + //transform + OUString strTransform; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_ROTATE ) + strTransform = "rotate (" + OUString::number(m_fRotate) + ") "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_TRANSLATE ) + strTransform += "translate (" + OUString::number(m_aRotatePoint.GetX()) + "cm " + OUString::number(m_aRotatePoint.GetY()) + "cm) "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SCALE ) + strTransform += "scale (" + OUString::number(0) + "cm " + OUString::number(0) + "cm) "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWX ) + strTransform += "skewX (" + OUString::number(0) + " "; + if( m_nDrawFlag&XFDRAWOBJECT_FLAG_SKEWY ) + strTransform += "skewY (" + OUString::number(0) + " "; + strTransform = strTransform.trim(); + + if( !strTransform.isEmpty() ) + pAttrList->AddAttribute( "draw:transform", strTransform ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx new file mode 100644 index 000000000..b85f2d6dc --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx @@ -0,0 +1,155 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Draw path object. + ************************************************************************/ +#include +#include +#include + +XFSvgPathEntry::XFSvgPathEntry() +{ +} + +OUString XFSvgPathEntry::ToString() +{ + assert(!m_strCommand.isEmpty()); + OUStringBuffer str(m_strCommand); + + for (auto const& point : m_aPoints) + { + str.append( OUString::number(point.GetX()*1000) + " " + OUString::number(point.GetY()*1000) + " "); + } + str.stripEnd(' '); + return str.makeStringAndClear(); +} + +XFDrawPath::XFDrawPath() +{ +} + +void XFDrawPath::MoveTo(XFPoint pt) +{ + XFSvgPathEntry entry; + + entry.SetCommand("M"); + entry.AddPoint(pt); + m_aPaths.push_back(entry); +} + +void XFDrawPath::LineTo(XFPoint pt) +{ + XFSvgPathEntry entry; + + entry.SetCommand("L"); + entry.AddPoint(pt); + m_aPaths.push_back(entry); +} + +void XFDrawPath::CurveTo(XFPoint dest, XFPoint ctrl1, XFPoint ctrl2) +{ + XFSvgPathEntry entry; + + entry.SetCommand("C"); + entry.AddPoint(ctrl1); + entry.AddPoint(ctrl2); + entry.AddPoint(dest); + + m_aPaths.push_back(entry); +} + +void XFDrawPath::ClosePath() +{ + XFSvgPathEntry entry; + + entry.SetCommand("Z"); + + m_aPaths.push_back(entry); +} + +void XFDrawPath::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + //view-box: + XFRect rect = m_aRect; + + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); + pAttrList->AddAttribute( "svg:viewBox", strViewBox); + + //points + OUStringBuffer strPath; + for (auto & path : m_aPaths) + { + strPath.append(path.ToString()); + } + if (!strPath.isEmpty()) + strPath.setLength(strPath.getLength()-1); + pAttrList->AddAttribute( "svg:d", strPath.makeStringAndClear()); + + SetPosition(rect); + XFDrawObject::ToXml(pStrm); + + pStrm->StartElement( "draw:path" ); + ContentToXml(pStrm); + pStrm->EndElement( "draw:path" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx new file mode 100644 index 000000000..d0e023994 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + */ +/* + * @file + * Polygon object. + */ +#include +#include +#include + +XFDrawPolygon::XFDrawPolygon() +{ +} + +void XFDrawPolygon::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + //view-box: + XFRect rect = CalcViewBox(); + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); + pAttrList->AddAttribute( "svg:viewBox", strViewBox); + + //points + OUStringBuffer strPoints; + for (auto const& point : m_aPoints) + { + double x = (point.GetX()-rect.GetX())*1000; + double y = (point.GetY()-rect.GetY())*1000; + strPoints.append( OUString::number(x) + " " + OUString::number(y) + " "); + } + strPoints.stripEnd(' '); + pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear()); + + SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight()); + XFDrawObject::ToXml(pStrm); + + pStrm->StartElement( "draw:polygon" ); + ContentToXml(pStrm); + pStrm->EndElement( "draw:polygon" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx new file mode 100644 index 000000000..6f5fb1a0f --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Polyline. + ************************************************************************/ +#include +#include +#include + +XFDrawPolyline::XFDrawPolyline() +{ +} + +void XFDrawPolyline::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + //view-box: + XFRect rect = CalcViewBox(); + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); + pAttrList->AddAttribute( "svg:viewBox", strViewBox); + + //points + OUStringBuffer strPoints; + for (auto const& point : m_aPoints) + { + double x = (point.GetX()-rect.GetX())*1000; + double y = (point.GetY()-rect.GetY())*1000; + strPoints.append( OUString::number(x) + "," + OUString::number(y) + " "); + } + strPoints.stripEnd(' '); + pAttrList->AddAttribute( "draw:points", strPoints.makeStringAndClear()); + + SetPosition(rect.GetX(),rect.GetY(),rect.GetWidth(),rect.GetHeight()); + XFDrawObject::ToXml(pStrm); + + pStrm->StartElement( "draw:polyline" ); + ContentToXml(pStrm); + pStrm->EndElement( "draw:polyline" ); +} + +XFRect XFDrawPolyline::CalcViewBox() +{ + double x1 = 0; + double y1 = 0; + double x2 = 0; + double y2 = 0; + XFPoint aPoint; + + assert(!m_aPoints.empty()); + + x1 = aPoint.GetX(); + x2 = aPoint.GetX(); + y1 = aPoint.GetY(); + y2 = aPoint.GetY(); + for (auto const& point : m_aPoints) + { + if( x1>point.GetX() ) + x1 = point.GetX(); + if( x2point.GetY() ) + y1 = point.GetY(); + if( y2 +#include + +XFDrawRect::XFDrawRect() {} + +void XFDrawRect::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + + XFDrawObject::ToXml(pStrm); + + pStrm->StartElement("draw:rect"); + ContentToXml(pStrm); + pStrm->EndElement("draw:rect"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx new file mode 100644 index 000000000..f824dd5a8 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfdrawstyle.cxx @@ -0,0 +1,327 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Style for all draw object. + ************************************************************************/ +#include +#include +#include +#include "xfdrawareastyle.hxx" +#include +#include "xffontworkstyle.hxx" +#include +XFDrawStyle::XFDrawStyle() + : m_pLineStyle(nullptr) + , m_pAreaStyle(nullptr) + , m_fArrowStartSize(0.3) + , m_fArrowEndSize(0.3) + , m_bArrowStartCenter(false) + , m_bArrowEndCenter(false) + , m_bLineStyleRegistered(false) + , m_bAreaStyleRegistered(false) +{} + +XFDrawStyle::~XFDrawStyle() +{ + // normally don't delete m_pLineStyle, it was managed by XFStyleManager. + if (!m_bLineStyleRegistered) + delete m_pLineStyle; + // normally don't delete m_pAreaStyle, it was managed by XFStyleManager. + if (!m_bAreaStyleRegistered) + delete m_pAreaStyle; +} + +void XFDrawStyle::SetLineStyle(double width, XFColor color) +{ + if( !m_pLineStyle ) + { + m_pLineStyle = new XFDrawLineStyle(); + m_pLineStyle->SetStyleName( XFGlobal::GenStrokeDashName()); + } + m_pLineStyle->SetWidth(width); + m_pLineStyle->SetColor(color); + m_pLineStyle->SetTransparency(0); +} + +void XFDrawStyle::SetLineDashStyle(enumXFLineStyle style, double len1, double len2, double space ) +{ + if( !m_pLineStyle ) + { + m_pLineStyle = new XFDrawLineStyle(); + m_pLineStyle->SetStyleName( XFGlobal::GenStrokeDashName()); + } + m_pLineStyle->SetLineStyle(style); + m_pLineStyle->SetDot1Number(1); + m_pLineStyle->SetDot1Length(len1); + m_pLineStyle->SetDot2Number(1); + m_pLineStyle->SetDot2Length(len2); + m_pLineStyle->SetSpace(space); + XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + m_bLineStyleRegistered = true; + pXFStyleManager->AddStyle(std::unique_ptr(m_pLineStyle)); +} + +void XFDrawStyle::SetFontWorkStyle(enumXFFWStyle eStyle, enumXFFWAdjust eAdjust) +{ + if (!m_pFontWorkStyle) + { + m_pFontWorkStyle.reset( new XFFontWorkStyle() ); + } + + m_pFontWorkStyle->SetButtonForm(0); + m_pFontWorkStyle->SetFWStyleType(eStyle); + m_pFontWorkStyle->SetFWAdjustType(eAdjust); +} + +void XFDrawStyle::SetAreaColor(XFColor const & color) +{ + if( !m_pAreaStyle ) + { + m_pAreaStyle = new XFDrawAreaStyle(); + m_pAreaStyle->SetStyleName( XFGlobal::GenAreaName()); + } + m_pAreaStyle->SetBackColor(color); +} + +void XFDrawStyle::SetAreaLineStyle(enumXFAreaLineStyle style, sal_Int32 angle, double space, XFColor lineColor) +{ + if( !m_pAreaStyle ) + { + m_pAreaStyle = new XFDrawAreaStyle(); + m_pAreaStyle->SetStyleName( XFGlobal::GenAreaName()); + } + m_pAreaStyle->SetAreaStyle(enumXFAreaHatch); + + m_pAreaStyle->SetLineStyle(style); + m_pAreaStyle->SetLineAngle(angle); + m_pAreaStyle->SetLineSpace(space); + m_pAreaStyle->SetLineColor(lineColor); + XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); + m_bAreaStyleRegistered = true; + pXFStyleManager->AddStyle(std::unique_ptr(m_pAreaStyle)); +} + +enumXFStyle XFDrawStyle::GetStyleFamily() +{ + return enumXFStyleGraphics; +} + +/************************************************************************** + *************************************************************************/ +void XFDrawStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:name", GetStyleName() ); + pAttrList->AddAttribute( "style:family", "graphics" ); + pStrm->StartElement( "style:style" ); + + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:run-through", "foreground" ); + pAttrList->AddAttribute( "style:wrap", "none" ); + + //line style: + if( m_pLineStyle ) + { + //1. if is a dash style, register the stroke-dash style first. + if( !m_pLineStyle->IsSolid() ) + { +// pAttrList->Clear(); + pAttrList->AddAttribute( "draw:stroke", "dash" ); + pAttrList->AddAttribute( "draw:stroke-dash", m_pLineStyle->GetStyleName() ); + } + else + { + pAttrList->AddAttribute( "draw:stroke", "solid" ); + } + + if( m_pLineStyle->GetWidth() > 0 ) + pAttrList->AddAttribute( "svg:stroke-width", OUString::number(m_pLineStyle->GetWidth()) + "cm" ); + + XFColor color = m_pLineStyle->GetColor(); + if( color.IsValid() ) + pAttrList->AddAttribute( "svg:stroke-color", color.ToString() ); + + if( m_pLineStyle->GetTransparency()>0 ) + pAttrList->AddAttribute( "svg:stroke-opacity", OUString::number(m_pLineStyle->GetTransparency()) + "%" ); + } + else + pAttrList->AddAttribute( "draw:stroke", "none" ); + //area style: + if( m_pAreaStyle ) + { + if( enumXFAreaSolid == m_pAreaStyle->GetAreaStyle() ) + { + pAttrList->AddAttribute( "draw:fill", "solid" ); + XFColor color = m_pAreaStyle->GetBackColor(); + if( color.IsValid() ) + pAttrList->AddAttribute( "draw:fill-color", color.ToString() ); + } + else if( enumXFAreaHatch == m_pAreaStyle->GetAreaStyle() ) + { + pAttrList->AddAttribute( "draw:fill", "hatch" ); + pAttrList->AddAttribute( "draw:fill-hatch-name", m_pAreaStyle->GetStyleName() ); + XFColor color = m_pAreaStyle->GetBackColor(); + if( color.IsValid() ) + { + pAttrList->AddAttribute( "draw:fill-hatch-solid", "true" ); + pAttrList->AddAttribute( "draw:fill-color", color.ToString() ); + } + } + } + else + pAttrList->AddAttribute( "draw:fill", "none" ); + + if( !m_strArrowStart.isEmpty() ) + { + pAttrList->AddAttribute( "draw:marker-start", m_strArrowStart ); + pAttrList->AddAttribute( "draw:marker-start-width", OUString::number(m_fArrowStartSize)+"cm" ); + if( m_bArrowStartCenter ) + pAttrList->AddAttribute( "draw:draw:marker-start-center", "true" ); + } + if( !m_strArrowEnd.isEmpty() ) + { + pAttrList->AddAttribute( "draw:marker-end", m_strArrowEnd ); + pAttrList->AddAttribute( "draw:marker-end-width", OUString::number(m_fArrowEndSize)+"cm" ); + if( m_bArrowEndCenter ) + pAttrList->AddAttribute( "draw:draw:marker-end-center", "true" ); + } + if (m_pFontWorkStyle) + { + // style + OUString aStr = ""; + switch (m_pFontWorkStyle->GetStyleType()) + { + default: // fall through! + case enumXFFWOff: + break; + case enumXFFWRotate: + aStr = "rotate"; + break; + case enumXFFWUpright: + aStr = "upright"; + break; + case enumXFFWSlantX: + aStr = "slant-x"; + break; + case enumXFFWSlantY: + aStr = "slant-y"; + break; + } + if (!aStr.isEmpty()) + { + pAttrList->AddAttribute("draw:fontwork-style", aStr); + } + + //adjust + aStr.clear(); + switch (m_pFontWorkStyle->GetAdjustType()) + { + default: // fall through + case enumXFFWAdjustAutosize: + aStr = "autosize"; + break; + case enumXFFWAdjustLeft: + aStr = "left"; + break; + case enumXFFWAdjustCenter: + aStr = "center"; + break; + case enumXFFWAdustRight: + aStr = "right"; + break; + } + if (!aStr.isEmpty()) + { + pAttrList->AddAttribute("draw:fontwork-adjust", aStr); + } + + //form + aStr.clear(); + switch (m_pFontWorkStyle->GetButtonForm()) + { + default: // fall through! + case -1: + break; + case 4: + aStr = "top-arc"; + break; + case 5: + aStr = "bottom-arc"; + break; + } + if (!aStr.isEmpty()) + { + pAttrList->AddAttribute("draw:fontwork-form", aStr); + } + + // distance + //pAttrList->AddAttribute("draw:fontwork-distance", + // OUString::number(m_pFontWorkStyle->GetFWDistance())+"cm"); + } + + pStrm->StartElement( "style:properties" ); + + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfentry.cxx b/lotuswordpro/source/filter/xfilter/xfentry.cxx new file mode 100644 index 000000000..d252cc2bc --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfentry.cxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * index entry object. + ************************************************************************/ + +#include + +#include +#include +#include + +XFEntry::XFEntry() + : m_eType(enumXFEntryTOC) + , m_nOutlineLevel(1) +{ +} + +void XFEntry::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute("text:string-value", m_strValue); + + if (m_eType == enumXFEntryTOC) + { + pAttrList->AddAttribute("text:outline-level", OUString::number(m_nOutlineLevel)); + pStrm->StartElement("text:toc-mark"); + // pStrm->Characters(m_strDisplay); + pStrm->EndElement("text:toc-mark"); + } + else if (m_eType == enumXFEntryAlphabetical) + { + pAttrList->AddAttribute("text:key1", m_strKey1); + if (!m_strKey2.isEmpty()) + pAttrList->AddAttribute("text:key2", m_strKey2); + + pStrm->StartElement("text:alphabetical-index-mark"); + // pStrm->Characters(m_strDisplay); + pStrm->EndElement("text:alphabetical-index-mark"); + } + else if (m_eType == enumXFEntryUserIndex) + { + pAttrList->AddAttribute("text:outline-level", OUString::number(m_nOutlineLevel)); + pAttrList->AddAttribute("text:index-name", m_strName); + + pStrm->StartElement("text:user-index-mark"); + // pStrm->Characters(m_strDisplay); + pStrm->EndElement("text:user-index-mark"); + } +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xffloatframe.cxx b/lotuswordpro/source/filter/xfilter/xffloatframe.cxx new file mode 100644 index 000000000..7a27242cd --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xffloatframe.cxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Float frame whose anchor is page. + ************************************************************************/ +#include +#include +#include + +XFFloatFrame::XFFloatFrame(sal_Int32 start, sal_Int32 end, bool all) +{ + m_nStart = start; + m_nEnd = end; + m_bAll = all; + SetAnchorType(enumXFAnchorPage); +} + +void XFFloatFrame::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + for (int i = m_nStart; i <= m_nEnd; i++) + { + XFFrame::SetAnchorPage(i); + XFFrame::ToXml(pStrm); + if (!m_bAll) + i++; + } +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xffont.cxx b/lotuswordpro/source/filter/xfilter/xffont.cxx new file mode 100644 index 000000000..14bb56db6 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xffont.cxx @@ -0,0 +1,315 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Font object to serial to xml filter. + ************************************************************************/ +#include +#include +#include + +XFFont::XFFont() + : m_nFontSize(0) + , m_nFontSizeAsia(0) + , m_nFontSizeComplex(0) + , m_bItalic(false) + , m_bItalicAsia(false) + , m_bItalicComplex(false) + , m_bBold(false) + , m_bBoldAsia(false) + , m_bBoldComplex(false) + , m_eUnderline(enumXFUnderlineNone) + , m_eCrossout(enumXFCrossoutNone) + , m_eTransform(enumXFTransformNone) + , m_bWordByWord(false) + , m_nPosition(33) + , m_nScale(58) + , m_nFlag(0) + , m_bTransparent(false) +{ +} +/* + The Following variable are to be compared: + OUString m_strFontName; + OUString m_strFontNameAsia; + OUString m_strFontNameComplex; + sal_Int16 m_nFontSize; + sal_Int16 m_nFontSizeAsia; + sal_Int16 m_nFontSizeComplex; + sal_Bool m_bItalic; + sal_Bool m_bItalicAsia; + sal_Bool m_bItalicComplex; + sal_Bool m_bBold; + sal_Bool m_bBoldAsia; + sal_Bool m_bBoldComplex; + sal_Int16 m_nUnderline; + sal_uInt32 m_nUnderlineColor; + + sal_uInt32 m_nFlag; +*/ +bool operator==(XFFont const & f1, XFFont const & f2) +{ + //The most possible entry be first: + if( f1.m_nFlag != f2.m_nFlag ) + return false; + + if( f1.m_strFontName != f2.m_strFontName || + f1.m_strFontNameAsia != f2.m_strFontNameAsia || + f1.m_strFontNameComplex != f2.m_strFontNameComplex + ) + return false; + + if( f1.m_nFontSize != f2.m_nFontSize || + f1.m_nFontSizeAsia != f2.m_nFontSizeAsia || + f1.m_nFontSizeComplex != f2.m_nFontSizeComplex + ) + return false; + + if( f1.m_bItalic != f2.m_bItalic || + f1.m_bItalicAsia != f2.m_bItalicAsia || + f1.m_bItalicComplex != f2.m_bItalicComplex + ) + return false; + + if( f1.m_bBold != f2.m_bBold || + f1.m_bBoldAsia != f2.m_bBoldAsia || + f1.m_bBoldComplex != f2.m_bBoldComplex + ) + return false; + + if( f1.m_nFlag&XFFONT_FLAG_UNDERLINE ) + { + if( f1.m_eUnderline != f2.m_eUnderline ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_UNDERLINECOLOR ) + { + if( f1.m_aUnderlineColor != f2.m_aUnderlineColor ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_CROSSOUT ) + { + if( f1.m_eCrossout != f2.m_eCrossout ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_TRANSFORM ) + { + if( f1.m_eTransform != f2.m_eTransform ) + return false; + } + + if( f1.m_bWordByWord != f2.m_bWordByWord ) + return false; + + if( f1.m_nFlag&XFFONT_FLAG_POSITION ) + { + if( f1.m_nPosition != f2.m_nPosition ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_SCALE ) + { + if( f1.m_nScale != f2.m_nScale ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_COLOR ) + { + if( f1.m_aColor != f2.m_aColor ) + return false; + } + + if( f1.m_nFlag&XFFONT_FLAG_BGCOLOR ) + { + if( f1.m_aBackColor != f2.m_aBackColor ) + return false; + } + + return true; +} + +bool operator!=(XFFont const & f1, XFFont const & f2) +{ + return !(f1==f2); +} + +void XFFont::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + if( m_nFlag & XFFONT_FLAG_NAME ) + { + pAttrList->AddAttribute("style:font-name",m_strFontName ); + } + + if( m_nFlag & XFFONT_FLAG_NAME_ASIA ) + { + pAttrList->AddAttribute("style:font-name-asian",m_strFontNameAsia ); + } + + if( m_nFlag & XFFONT_FLAG_NAME_COMPLEX ) + { + pAttrList->AddAttribute("style:font-name-complex", m_strFontNameComplex); + } + + //font size: + if( (m_nFlag & XFFONT_FLAG_SIZE) && m_nFontSize != 0 ) + { + OUString strSize = OUString::number(m_nFontSize) + "pt"; + pAttrList->AddAttribute("fo:font-size",strSize); + } + if( (m_nFlag & XFFONT_FLAG_SIZE_ASIA) && m_nFontSizeAsia ) + { + OUString strSize = OUString::number(m_nFontSizeAsia) + "pt"; + pAttrList->AddAttribute("style:font-size-asian",strSize); + } + if( (m_nFlag & XFFONT_FLAG_SIZE_COMPLEX) && m_nFontSizeComplex ) + { + OUString strSize = OUString::number(m_nFontSizeComplex) + "pt"; + pAttrList->AddAttribute("style:font-size-complex",strSize); + } + + //italic flag: + if( ( m_nFlag & XFFONT_FLAG_ITALIC) && m_bItalic ) + { + pAttrList->AddAttribute("fo:font-style", "italic"); + } + if( (m_nFlag & XFFONT_FLAG_ITALIC_ASIA) && m_bItalicAsia ) + { + pAttrList->AddAttribute("style:font-style-asian", "italic"); + } + if( (m_nFlag & XFFONT_FLAG_ITALIC_COMPLEX) && m_bItalicComplex ) + { + pAttrList->AddAttribute("style:font-style-complex", "italic"); + } + + //Bold flag: + if( (m_nFlag & XFFONT_FLAG_BOLD) && m_bBold ) + { + pAttrList->AddAttribute("fo:font-weight", "bold"); + } + if( (m_nFlag & XFFONT_FLAG_BOLD_ASIA) && m_bBoldAsia ) + { + pAttrList->AddAttribute("style:font-weight-asian", "bold"); + } + if( (m_nFlag & XFFONT_FLAG_BOLD_ASIA) && m_bBoldComplex ) + { + pAttrList->AddAttribute("style:font-weight-complex", "bold"); + } + //underline: + if( (m_nFlag & XFFONT_FLAG_UNDERLINE) && m_eUnderline ) + { + pAttrList->AddAttribute("style:text-underline", GetUnderlineName(m_eUnderline) ); + if( m_nFlag & XFFONT_FLAG_UNDERLINECOLOR ) + { + pAttrList->AddAttribute( "style:text-underline-color", m_aUnderlineColor.ToString() ); + } + else + pAttrList->AddAttribute( "style:text-underline-color", "font-color" ); + } + + //enumCrossoutType m_eCrossout; + if( (m_nFlag & XFFONT_FLAG_CROSSOUT) && m_eCrossout ) + { + pAttrList->AddAttribute("style:text-crossing-out", GetCrossoutName(m_eCrossout) ); + } + + if( m_nFlag & XFFONT_FLAG_UNDERLINE || m_nFlag & XFFONT_FLAG_CROSSOUT ) + { + if( m_bWordByWord ) + pAttrList->AddAttribute("fo:score-spaces", "false" ); + else + pAttrList->AddAttribute("fo:score-spaces", "true" ); + } + + if( (m_nFlag & XFFONT_FLAG_TRANSFORM) && m_eTransform ) + { + //enumTransformSmallCap is different: + if( m_eTransform == enumXFTransformSmallCaps ) + pAttrList->AddAttribute("fo:font-variant", GetTransformName(m_eTransform) ); + else + pAttrList->AddAttribute("fo:text-transform", GetTransformName(m_eTransform) ); + } + + //position & scale: + if( ((m_nFlag & XFFONT_FLAG_SCALE) && m_nScale>0 ) || + ((m_nFlag & XFFONT_FLAG_POSITION) && m_nPosition != 0) + ) + { + OUString tmp = OUString::number(m_nPosition) + "% " + + OUString::number(m_nScale) + "%"; + pAttrList->AddAttribute("style:text-position", tmp ); + } + + //Color: + if( m_nFlag & XFFONT_FLAG_COLOR ) + { + pAttrList->AddAttribute( "fo:color", m_aColor.ToString() ); + } + + if( m_nFlag & XFFONT_FLAG_BGCOLOR ) + { + if (m_bTransparent) + pAttrList->AddAttribute( "style:text-background-color", "transparent"); + else + pAttrList->AddAttribute( "style:text-background-color", m_aBackColor.ToString() ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xffontdecl.cxx b/lotuswordpro/source/filter/xfilter/xffontdecl.cxx new file mode 100644 index 000000000..b971a2073 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xffontdecl.cxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Font decl of all used fonts. + ************************************************************************/ +#include + +XFFontDecl::XFFontDecl(const OUString& name, const OUString& family) +{ + m_strFontName = name; + m_strFontFamily = family; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xffontfactory.cxx b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx new file mode 100644 index 000000000..30a682433 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xffontfactory.cxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Implement for font factory which will manage all font. + ************************************************************************/ +#include + +XFFontFactory::XFFontFactory() {} + +XFFontFactory::~XFFontFactory() {} + +void XFFontFactory::AddFont(rtl::Reference const& pFont) { s_aFonts.push_back(pFont); } + +rtl::Reference XFFontFactory::FindSameFont(rtl::Reference const& pFont) +{ + for (auto const& font : s_aFonts) + { + if (*pFont == *font) + return font; + } + + return nullptr; +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx b/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx new file mode 100644 index 000000000..1554fdaf7 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xffontworkstyle.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Style of Fontwork object. + ************************************************************************/ + +#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX +#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX + +#include +#include + +class XFFontWorkStyle +{ +public: + XFFontWorkStyle() : + m_nButtonForm(-1), + m_eStyleType(enumXFFWOff), + m_eAdjustType(enumXFFWAdjustAutosize) + {} + + inline void SetButtonForm(sal_Int8 nIndex); + inline void SetFWStyleType(enumXFFWStyle eStyle); + inline void SetFWAdjustType(enumXFFWAdjust eAdjust); + + inline sal_Int8 GetButtonForm() const; + inline enumXFFWStyle GetStyleType() const; + inline enumXFFWAdjust GetAdjustType() const; + +private: + sal_Int8 m_nButtonForm; + enumXFFWStyle m_eStyleType; + enumXFFWAdjust m_eAdjustType; +}; + +inline void XFFontWorkStyle::SetButtonForm(sal_Int8 nIndex) +{ + m_nButtonForm = nIndex; +} + +inline void XFFontWorkStyle::SetFWStyleType(enumXFFWStyle eStyle) +{ + m_eStyleType = eStyle; +} + +inline void XFFontWorkStyle::SetFWAdjustType(enumXFFWAdjust eAdjust) +{ + m_eAdjustType = eAdjust; +} + +inline sal_Int8 XFFontWorkStyle::GetButtonForm() const +{ + return m_nButtonForm; +} + +inline enumXFFWStyle XFFontWorkStyle::GetStyleType() const +{ + return m_eStyleType; +} +inline enumXFFWAdjust XFFontWorkStyle::GetAdjustType() const +{ + return m_eAdjustType; +} + +#endif // INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFFONTWORKSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfframe.cxx b/lotuswordpro/source/filter/xfilter/xfframe.cxx new file mode 100644 index 000000000..62bd2caf2 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfframe.cxx @@ -0,0 +1,202 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Frame whose anchor is not page. + ************************************************************************/ +#include +#include +#include + +#define ZINDEX_MIN 0 + +XFFrame::XFFrame() + : XFFrame::XFFrame(false) +{} + +XFFrame::XFFrame(bool isTextBox) + : m_eAnchor(enumXFAnchorPara) + , m_nAnchorPage(0) + , m_strName(XFGlobal::GenFrameName()) // give it a default name + , m_nZIndex(ZINDEX_MIN) + , m_fMinHeight(0) + , m_eType(enumXFFrameTextbox) + , m_nFrameFlag(0) + , m_isTextBox(isTextBox) +{} + +XFFrame::~XFFrame() +{ +} + +void XFFrame::Add(XFContent *pContent) +{ + if (!pContent) + return; + XFContentContainer::Add(pContent); + if( pContent->GetContentType() == enumXFContentFrame ) + { + XFFrame *pFrame = static_cast(pContent); + if( pFrame ) + { + pFrame->SetZIndex(pFrame->m_nZIndex + 1); + } + } + +} + +void XFFrame::SetZIndex(sal_uInt32 zIndex) +{ + if( zIndex == m_nZIndex ) + return; + m_nZIndex = zIndex; + AdjustZIndex(); +} + +enumXFFrameType XFFrame::GetFrameType() const +{ + return m_eType; +} + +enumXFContent XFFrame::GetContentType() +{ + return enumXFContentFrame; +} + +void XFFrame::ToXml(IXFStream *pStrm) +{ + StartFrame(pStrm); + + XFContentContainer::ToXml(pStrm); + + EndFrame(pStrm); +} + +void XFFrame::StartFrame(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "draw:style-name", GetStyleName() ); + + assert(!m_strName.isEmpty() && "name should not be null."); + if( !m_strName.isEmpty() && !m_isTextBox) + pAttrList->AddAttribute( "draw:name", m_strName ); + //anchor type: + switch( m_eAnchor ) + { + case enumXFAnchorPara: + pAttrList->AddAttribute( "text:anchor-type", "paragraph" ); + break; + case enumXFAnchorPage: + pAttrList->AddAttribute( "text:anchor-type", "page" ); + pAttrList->AddAttribute( "text:anchor-page-number", OUString::number(m_nAnchorPage) ); + break; + case enumXFAnchorChar: + pAttrList->AddAttribute( "text:anchor-type", "char" ); + break; + case enumXFAnchorAsChar: + pAttrList->AddAttribute( "text:anchor-type", "as-char" ); + break; + case enumXFAnchorFrame: + pAttrList->AddAttribute( "text:anchor-type", "frame" ); + break; + default: + break; + } + pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" ); + pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" ); + pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" ); + if( m_nFrameFlag& XFFRAME_FLAG_MINHEIGHT ) + { + pAttrList->AddAttribute( "fo:min-height", OUString::number(m_fMinHeight) + "cm" ); + if( m_nFrameFlag&XFFRAME_FLAG_MAXHEIGHT ) + pAttrList->AddAttribute( "fo:max-height", OUString::number(0) + "cm" ); + } + else + pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" ); + + pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) ); + + if( !m_strNextLink.isEmpty() ) + pAttrList->AddAttribute( "draw:chain-next-name", m_strNextLink ); + + pStrm->StartElement( "draw:text-box" ); +} + +void XFFrame::EndFrame(IXFStream *pStrm) +{ + pStrm->EndElement( "draw:text-box" ); +} + +void XFFrame::AdjustZIndex() +{ + for( int i=0; i pContent = GetContent(i); + if( pContent.is() ) + { + if( pContent->GetContentType() == enumXFContentFrame ) + { + XFFrame *pFrame = static_cast(pContent.get()); + pFrame->m_nZIndex = m_nZIndex + 1; + pFrame->AdjustZIndex(); + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfframestyle.cxx b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx new file mode 100644 index 000000000..e3c5b315c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfframestyle.cxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Frame style include position,size,rotation and so on. + ************************************************************************/ +#include +#include +#include +#include +#include +#include + +XFFrameStyle::XFFrameStyle() + : m_eWrap(enumXFWrapNone) + , m_bProtectContent(false) + , m_bProtectSize(false) + , m_bProtectPos(false) + , m_nTransparency(0) + , m_eTextDir(enumXFTextDirNone) + , m_eXPos(enumXFFrameXPosCenter) + , m_eXRel(enumXFFrameXRelParaContent) + , m_eYPos(enumXFFrameYPosTop) + , m_eYRel(enumXFFrameYRelPage) +{} + +XFFrameStyle::~XFFrameStyle() +{ +} + +void XFFrameStyle::SetBorders(std::unique_ptr pBorders) +{ + m_pBorders = std::move(pBorders); +} + +void XFFrameStyle::SetColumns(XFColumns *pColumns) +{ + m_pColumns.reset(pColumns); +} + +void XFFrameStyle::SetShadow(XFShadow *pShadow) +{ + m_pShadow.reset(pShadow); +} + +void XFFrameStyle::SetBackImage(std::unique_ptr& rImage) +{ + m_pBGImage = std::move(rImage); +} + +enumXFStyle XFFrameStyle::GetStyleFamily() +{ + return enumXFStyleGraphics; +} + +void XFFrameStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( GetParentStyleName().getLength() > 0 ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pAttrList->AddAttribute( "style:family", "graphics" ); + //parent style name ignore now. + pStrm->StartElement( "style:style" ); + + m_aMargins.ToXml(pStrm); + + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:run-through", "foreground" ); + + if( m_eWrap == enumXFWrapNone ) + pAttrList->AddAttribute( "style:wrap", "none" ); + else if( m_eWrap == enumXFWrapLeft ) + pAttrList->AddAttribute( "style:wrap", "left" ); + else if( m_eWrap == enumXFWrapRight ) + pAttrList->AddAttribute( "style:wrap", "right" ); + else if( m_eWrap == enumXFWrapParallel ) + pAttrList->AddAttribute( "style:wrap", "parallel" ); + else if( m_eWrap == enumXFWrapRunThrough ) + pAttrList->AddAttribute( "style:wrap", "run-through" ); + else if( m_eWrap == enumXFWrapBest ) + pAttrList->AddAttribute( "style:wrap", "dynamic" ); + //} + //background + if( m_aBackColor.IsValid() ) + { + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + pAttrList->AddAttribute( "style:background-transparency", OUString::number(static_cast(m_nTransparency)) + "%"); + } + + //pad + m_aPad.ToXml(pStrm); + //margin: + m_aMargins.ToXml(pStrm); + //border + if( m_pBorders ) + m_pBorders->ToXml(pStrm); + else + pAttrList->AddAttribute( "fo:border", "none" ); + //shadow + if( m_pShadow ) + m_pShadow->ToXml(pStrm); + //print + pAttrList->AddAttribute( "style:print-content", "true" ); + //text directory + if( m_eTextDir != enumXFTextDirNone ) + pAttrList->AddAttribute( "style:writing-mode", GetTextDirName(m_eTextDir) ); + //protect: + if( m_bProtectContent || m_bProtectSize || m_bProtectPos ) + { + OUString protect; + if( m_bProtectContent ) + protect += "content"; + if( m_bProtectSize ) + { + if( protect.getLength()>0 ) + protect += " "; + protect += "size"; + } + if( m_bProtectPos ) + { + if( protect.getLength()>0 ) + protect += " "; + protect += "position"; + } + pAttrList->AddAttribute( "style:protect", protect ); + } + //vertical pos and horizon pos: + pAttrList->AddAttribute( "style:vertical-pos", GetFrameYPos(m_eYPos) ); + pAttrList->AddAttribute( "style:vertical-rel", GetFrameYRel(m_eYRel) ); + pAttrList->AddAttribute( "style:horizontal-pos", GetFrameXPos(m_eXPos) ); + pAttrList->AddAttribute( "style:horizontal-rel", GetFrameXRel(m_eXRel) ); + + pStrm->StartElement( "style:properties" ); + if( m_pColumns ) + m_pColumns->ToXml(pStrm); + if( m_pBGImage ) + m_pBGImage->ToXml(pStrm); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfglobal.cxx b/lotuswordpro/source/filter/xfilter/xfglobal.cxx new file mode 100644 index 000000000..29bfe08d0 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfglobal.cxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Global functions or include files that are needed. + * It's all for the full filter. + ************************************************************************/ +#include + +int XFGlobal::s_nFrameID = 1; +int XFGlobal::s_nSectionID = 1; +int XFGlobal::s_nNoteID = 1; +int XFGlobal::s_nStrokeDashID = 1; +int XFGlobal::s_nAreaID = 1; +int XFGlobal::s_nImageID = 1; + +OUString XFGlobal::GenSectionName() +{ + //give it an initial name: + OUString sResult = "sect" + OUString::number(s_nSectionID++); + return sResult; +} + +OUString XFGlobal::GenFrameName() +{ + //give it an initial name: + OUString sResult = "frame" + OUString::number(s_nFrameID++); + return sResult; +} + +OUString XFGlobal::GenTableName() +{ + OUString sResult = "table" + OUString::number(s_nFrameID++); + return sResult; +} + +OUString XFGlobal::GenNoteName() +{ + OUString sResult = "ftn" + OUString::number(s_nNoteID++); + return sResult; +} + +OUString XFGlobal::GenStrokeDashName() +{ + OUString sResult = "stroke dash " + OUString::number(s_nStrokeDashID++); + return sResult; +} + +OUString XFGlobal::GenAreaName() +{ + OUString sResult = "draw area" + OUString::number(s_nAreaID++); + return sResult; +} + +OUString XFGlobal::GenImageName() +{ + OUString sResult = "Graphic" + OUString::number(s_nImageID++); + return sResult; +} + +void XFGlobal::Reset() +{ + s_nSectionID = 1; + s_nFrameID = 1; + s_nNoteID = 1; + s_nStrokeDashID = 1; + s_nAreaID = 1; +} + +void XFGlobalReset() +{ + // XFFontFactory::Reset(); + // XFStyleManager::Reset(); + XFGlobal::Reset(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx new file mode 100644 index 000000000..eb061b6d5 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfheaderstyle.cxx @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Header style,exist in page-master object. + ************************************************************************/ +#include +#include + +XFHeaderStyle::XFHeaderStyle(bool isFooter) +{ + m_bIsFooter = isFooter; + m_bDynamicSpace = true; + m_fHeight = -1; + m_fMinHeight = -1; +} + +XFHeaderStyle::~XFHeaderStyle() +{ +} + +void XFHeaderStyle::SetMargins(double left, double right, double bottom) +{ + if( left != -1 ) + m_aMargin.SetLeft(left); + if( right != -1 ) + m_aMargin.SetRight(right); + if( bottom != -1 ) + m_aMargin.SetBottom(bottom); +} +void XFHeaderStyle::SetDynamicSpace(bool dynamic) +{ + m_bDynamicSpace = dynamic; +} + +void XFHeaderStyle::SetHeight(double height) +{ + m_fHeight = height; +} + +void XFHeaderStyle::SetMinHeight(double minHeight) +{ + m_fMinHeight = minHeight; +} + +void XFHeaderStyle::SetShadow(XFShadow *pShadow) +{ + if( pShadow == m_pShadow.get() ) + return; + m_pShadow.reset( pShadow ); +} + +void XFHeaderStyle::SetBorders(std::unique_ptr pBorders) +{ + m_pBorders = std::move(pBorders); +} + +void XFHeaderStyle::SetBackImage(std::unique_ptr& rImage) +{ + m_pBGImage = std::move(rImage); +} + +void XFHeaderStyle::SetBackColor(XFColor color) +{ + m_aBackColor = color; +} + +void XFHeaderStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + if( m_bIsFooter ) + pStrm->StartElement( "style:footer-style" ); + else + pStrm->StartElement( "style:header-style" ); + + //height + if( m_fMinHeight>0 ) + pAttrList->AddAttribute( "fo:min-height", OUString::number(m_fMinHeight) + "cm" ); + else if( m_fHeight>0 ) + pAttrList->AddAttribute( "svg:height", OUString::number(m_fHeight) + "cm" ); + + m_aMargin.ToXml(pStrm); + if(m_pShadow) + m_pShadow->ToXml(pStrm); + m_aPadding.ToXml(pStrm); + if( m_pBorders ) + m_pBorders->ToXml(pStrm); + + if( m_aBackColor.IsValid() ) + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + + if( m_bDynamicSpace ) + pAttrList->AddAttribute( "style:dynamic-spacing", "true" ); + else + pAttrList->AddAttribute( "style:dynamic-spacing", "false" ); + + pStrm->StartElement( "style:properties" ); + + // background image + if( m_pBGImage ) + m_pBGImage->ToXml(pStrm); + + pStrm->EndElement( "style:properties" ); + + if( m_bIsFooter ) + pStrm->EndElement( "style:footer-style" ); + else + pStrm->EndElement( "style:header-style" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfimage.cxx b/lotuswordpro/source/filter/xfilter/xfimage.cxx new file mode 100644 index 000000000..33f483c7c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfimage.cxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Image object. + ************************************************************************/ +#include +#include +#include +#include "xfbase64.hxx" + +XFImage::XFImage() : m_bUseLink(false) +{ + m_eType = enumXFFrameImage; + m_strName = XFGlobal::GenImageName(); +} + +void XFImage::SetFileURL(const OUString& url) +{ + m_strImageFile = url; + m_bUseLink = true; +} + +void XFImage::SetImageData(sal_uInt8 const *buf, int len) +{ + m_strData = XFBase64::Encode(buf, len); + m_bUseLink = false; +} + +/* + + + + */ +void XFImage::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "draw:style-name", GetStyleName() ); + + assert(!m_strName.isEmpty() && "name should not be null."); + if( !m_strName.isEmpty() ) + pAttrList->AddAttribute( "draw:name", m_strName ); + //anchor type: + switch( m_eAnchor ) + { + case enumXFAnchorPara: + pAttrList->AddAttribute( "text:anchor-type", "paragraph" ); + break; + case enumXFAnchorPage: + pAttrList->AddAttribute( "text:anchor-type", "page" ); + pAttrList->AddAttribute( "text:anchor-page-number", OUString::number(m_nAnchorPage) ); + break; + case enumXFAnchorChar: + pAttrList->AddAttribute( "text:anchor-type", "char" ); + break; + case enumXFAnchorAsChar: + pAttrList->AddAttribute( "text:anchor-type", "as-char" ); + break; + case enumXFAnchorFrame: + pAttrList->AddAttribute( "text:anchor-type", "frame" ); + break; + default: + break; + } + pAttrList->AddAttribute( "svg:x", OUString::number(m_aRect.GetX()) + "cm" ); + pAttrList->AddAttribute( "svg:y", OUString::number(m_aRect.GetY()) + "cm" ); + pAttrList->AddAttribute( "svg:width", OUString::number(m_aRect.GetWidth()) + "cm" ); + pAttrList->AddAttribute( "svg:height", OUString::number(m_aRect.GetHeight()) + "cm" ); + pAttrList->AddAttribute( "draw:z-index", OUString::number(m_nZIndex) ); + + if( m_bUseLink ) + { + pAttrList->AddAttribute( "xlink:href", m_strImageFile ); + pAttrList->AddAttribute( "xlink:type", "simple" ); + pAttrList->AddAttribute( "xlink:show", "embed" ); + pAttrList->AddAttribute( "xlink:actuate", "onLoad" ); + } + + pStrm->StartElement( "draw:image" ); + if( !m_bUseLink ) + { + pAttrList->Clear(); + pStrm->StartElement( "office:binary-data" ); + pStrm->Characters(m_strData); + pStrm->EndElement( "office:binary-data" ); + } + pStrm->EndElement( "draw:image" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx b/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx new file mode 100644 index 000000000..0694fdc26 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfimagestyle.cxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Image style object. + ************************************************************************/ +#include +#include +#include +#include +#include + +XFImageStyle::XFImageStyle() + : m_nBrightness(0) + , m_nContrast(0) + , m_fClipLeft(0) + , m_fClipRight(0) + , m_fClipTop(0) + , m_fClipBottom(0) +{} + +void XFImageStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pAttrList->AddAttribute( "style:family", "graphics" ); + //parent style name ignore now. + pStrm->StartElement( "style:style" ); + + m_aMargins.ToXml(pStrm); + + pAttrList->Clear(); + + if( m_eWrap == enumXFWrapBackground ) + { + pAttrList->AddAttribute( "style:run-through", "background" ); + } + else + { + pAttrList->AddAttribute( "style:run-through", "foreground" ); + + if( m_eWrap == enumXFWrapNone ) + pAttrList->AddAttribute( "style:wrap", "none" ); + else if( m_eWrap == enumXFWrapLeft ) + pAttrList->AddAttribute( "style:wrap", "left" ); + else if( m_eWrap == enumXFWrapRight ) + pAttrList->AddAttribute( "style:wrap", "right" ); + else if( m_eWrap == enumXFWrapParallel ) + pAttrList->AddAttribute( "style:wrap", "parallel" ); + else if( m_eWrap == enumXFWrapRunThrough ) + pAttrList->AddAttribute( "style:wrap", "run-through" ); + else if( m_eWrap == enumXFWrapBest ) + pAttrList->AddAttribute( "style:wrap", "dynamic" ); + } + //background + if( m_aBackColor.IsValid() ) + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + //pad + m_aPad.ToXml(pStrm); + //margin: + m_aMargins.ToXml(pStrm); + + if( m_nBrightness ) + pAttrList->AddAttribute( "draw:luminance", OUString::number(m_nBrightness) + "%" ); + if( m_nContrast ) + pAttrList->AddAttribute( "draw:contrast", OUString::number(m_nContrast) + "%" ); + + pAttrList->AddAttribute("draw:color-mode", GetColorMode(enumXFColorStandard)); + //border + if( m_pBorders ) + m_pBorders->ToXml(pStrm); + //shadow + if( m_pShadow ) + m_pShadow->ToXml(pStrm); + + pAttrList->AddAttribute( "style:print-content", "true" ); + //protect: + if( m_bProtectContent || m_bProtectSize || m_bProtectPos ) + { + OUString protect; + if( m_bProtectContent ) + protect += "content"; + if( m_bProtectSize ) + { + if( !protect.isEmpty() ) + protect += " "; + protect += "size"; + } + if( m_bProtectPos ) + { + if( !protect.isEmpty() ) + protect += " "; + protect += "position"; + } + pAttrList->AddAttribute( "style:protect", protect ); + } + //vertical pos and horizon pos: + pAttrList->AddAttribute( "style:vertical-pos", GetFrameYPos(m_eYPos) ); + pAttrList->AddAttribute( "style:vertical-rel", GetFrameYRel(m_eYRel) ); + pAttrList->AddAttribute( "style:horizontal-pos", GetFrameXPos(m_eXPos) ); + pAttrList->AddAttribute( "style:horizontal-rel", GetFrameXRel(m_eXRel) ); + + //clip: + if( FABS(m_fClipLeft)>FLOAT_MIN || FABS(m_fClipRight)>FLOAT_MIN || FABS(m_fClipTop)>FLOAT_MIN || FABS(m_fClipBottom)>FLOAT_MIN ) + { + OUString clip = "rect(" + OUString::number(m_fClipTop) + "cm " + + OUString::number(m_fClipRight) + "cm " + + OUString::number(m_fClipBottom) + "cm " + + OUString::number(m_fClipLeft) + "cm)"; + pAttrList->AddAttribute("fo:clip",clip); + } + + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfindex.cxx b/lotuswordpro/source/filter/xfilter/xfindex.cxx new file mode 100644 index 000000000..902e1e970 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfindex.cxx @@ -0,0 +1,330 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Represents index source, index body and index entry. + ************************************************************************/ +#include +#include + +XFIndex::XFIndex() + : m_eType(enumXFIndexTOC) + , m_bProtect(true) + , m_bSeparator(false) +{} + +XFIndex::~XFIndex() +{ +} + +void XFIndex::AddTemplate(const OUString& level, const OUString& style, XFIndexTemplate* templ) +{ + templ->SetLevel( level ); + if(m_eType != enumXFIndexTOC) // TOC's styles are applied to template entries separately + { + templ->SetStyleName( style ); + } + m_aTemplates.push_back( templ ); +} + +void XFIndex::SetProtected(bool protect) +{ + m_bProtect = protect; +} + +void XFIndex::SetSeparator(bool sep) +{ + m_bSeparator = sep; +} + +void XFIndex::AddTocSource(sal_uInt16 nLevel, const OUString& sStyleName) +{ + if (nLevel > MAX_TOC_LEVEL) + { + return; + } + + m_aTOCSource[nLevel].push_back(sStyleName); +} + +void XFIndex::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + OUString strIndexName; + OUString strTplName; + OUString strSourceName; + + if(m_eType == enumXFIndexTOC ) + { + strIndexName = "text:table-of-content"; + strSourceName = "text:table-of-content-source"; + strTplName = "text:table-of-content-entry-template"; + } + else if( m_eType == enumXFIndexAlphabetical ) + { + strIndexName = "text:alphabetical-index"; + strSourceName = "text:alphabetical-index-source"; + strTplName = "text:alphabetical-index-entry-template"; + } + else if( m_eType == enumXFIndexUserIndex ) + { + strIndexName = "text:user-index"; + strSourceName = "text:text:user-index-source"; + strTplName = "text:user-index-entry-template"; + } + else if( m_eType == enumXFIndexObject ) + { + strIndexName = "text:object-index"; + strSourceName = "text:object-index-source"; + strTplName = "text:object-index-entry-template"; + } + else if( m_eType == enumXFIndexIllustration ) + { + strIndexName = "text:illustration-index"; + strSourceName = "text:illustration-index-source"; + strTplName = "text:illustration-index-entry-template"; + } + else if( m_eType == enumXFIndexTableIndex ) + { + strIndexName = "text:table-index"; + strSourceName = "text:table-index-source"; + strTplName = "text:table-index-entry-template"; + } + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "text:style-name", GetStyleName() ); + if( m_bProtect ) + pAttrList->AddAttribute( "text:protected", "true" ); + else + pAttrList->AddAttribute( "text:protected", "false" ); + + pAttrList->AddAttribute( "text:name", m_strTitle ); + pStrm->StartElement( strIndexName ); + + //text:table-of-content-source: + pAttrList->Clear(); + + if(m_eType == enumXFIndexTOC ) + { + pAttrList->AddAttribute( "text:outline-level", OUString::number(10)); + pAttrList->AddAttribute( "text:use-index-source-styles", "true"); + pAttrList->AddAttribute( "text:use-index-marks", "true"); + pAttrList->AddAttribute( "text:use-outline-level", "false"); + } + if (m_bSeparator) + pAttrList->AddAttribute( "text:alphabetical-separators", "true" ); + + pStrm->StartElement( strSourceName ); + //title template: + pAttrList->Clear(); + + pStrm->StartElement( "text:index-title-template" ); + pStrm->Characters( m_strTitle ); + pStrm->EndElement( "text:index-title-template" ); + + //entry templates: + for (auto const& elem : m_aTemplates) + { + elem->SetTagName( strTplName); + elem->ToXml(pStrm); + } + + // by + if(m_eType == enumXFIndexTOC ) + { + for(sal_uInt16 i=1; i <= MAX_TOC_LEVEL; i++) + { + if (m_aTOCSource[i].empty()) + { + // unnecessary to output this level + continue; + } + + pAttrList->Clear(); + pAttrList->AddAttribute( "text:outline-level", OUString::number(i)); + pStrm->StartElement( "text:index-source-styles" ); + + for (auto const& elemTOCSource : m_aTOCSource[i]) + { + pAttrList->Clear(); + pAttrList->AddAttribute( "text:style-name", elemTOCSource); + pStrm->StartElement( "text:index-source-style" ); + pStrm->EndElement( "text:index-source-style" ); + } + pStrm->EndElement( "text:index-source-styles" ); + } + } + + pStrm->EndElement( strSourceName ); + + //index-body: + pAttrList->Clear(); + pStrm->StartElement( "text:index-body" ); + //index-title: + if(!m_strTitle.isEmpty()) + { + pAttrList->AddAttribute( "text:name", m_strTitle + "_Head" ); + pStrm->StartElement( "text:index-title" ); + pStrm->EndElement( "text:index-title" ); + } + + XFContentContainer::ToXml(pStrm); + pStrm->EndElement( "text:index-body" ); + + pStrm->EndElement( strIndexName ); +} + +void XFIndexTemplate::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "text:outline-level", m_nLevel ); + pAttrList->AddAttribute( "text:style-name", m_strStyle ); + if( m_strTagName.isEmpty() ) + m_strTagName = "text:table-of-content-entry-template"; + pStrm->StartElement( m_strTagName ); + + for( size_t i=0; iClear(); + + switch( m_aEntries[i].first ) + { + case enumXFIndexTemplateChapter: + if(!m_aEntries[i].second.isEmpty()) + pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second ); + + pStrm->StartElement( "text:index-entry-chapter-number" ); + pStrm->EndElement( "text:index-entry-chapter-number" ); + break; + case enumXFIndexTemplateText: + if(!m_aEntries[i].second.isEmpty()) + pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second ); + + pStrm->StartElement( "text:index-entry-text" ); + pStrm->EndElement( "text:index-entry-text" ); + break; + case enumXFIndexTemplateTab: + if( m_eTabType != enumXFTabRight ) + pAttrList->AddAttribute( "style:position", OUString::number(m_fTabLength) + "cm" ); + + if(!m_aEntries[i].second.isEmpty()) + pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second ); + + switch(m_eTabType) + { + case enumXFTabLeft: + pAttrList->AddAttribute( "style:type", "left" ); + break; + case enumXFTabCenter: + pAttrList->AddAttribute( "style:type", "center" ); + break; + case enumXFTabRight: + pAttrList->AddAttribute( "style:type", "right" ); + break; + case enumXFTabChar: + pAttrList->AddAttribute( "style:type", "char" ); + break; + default: + break; + } + //delimiter: + if( m_eTabType == enumXFTabChar ) + pAttrList->AddAttribute( "style:char", m_strTabDelimiter ); + //leader char: + if( !m_strTabLeader.isEmpty() ) + pAttrList->AddAttribute( "style:leader-char", m_strTabLeader ); + + pStrm->StartElement( "text:index-entry-tab-stop" ); + pStrm->EndElement( "text:index-entry-tab-stop" ); + break; + case enumXFIndexTemplatePage: + if(!m_aEntries[i].second.isEmpty()) + pAttrList->AddAttribute( "text:style-name", m_aEntries[i].second ); + + pStrm->StartElement( "text:index-entry-page-number" ); + pStrm->EndElement( "text:index-entry-page-number" ); + break; + case enumXFIndexTemplateLinkStart: + pStrm->StartElement( "text:index-entry-link-start" ); + pStrm->EndElement( "text:index-entry-link-start" ); + break; + case enumXFIndexTemplateLinkEnd: + pStrm->StartElement( "text:index-entry-link-end" ); + pStrm->EndElement( "text:index-entry-link-end" ); + break; + case enumXFIndexTemplateSpan: + pAttrList->Clear(); + pAttrList->AddAttribute("text:style-name", GetStyleName()); + pStrm->StartElement( "text:index-entry-span" ); + pStrm->Characters(m_aTextEntries[i]); + pStrm->EndElement( "text:index-entry-span" ); + break; + case enumXFIndexTemplateBibliography: + pStrm->StartElement( "text:index-entry-bibliography" ); + pStrm->EndElement( "text:index-entry-bibliography" ); + break; + default: + break; + } + } + + pStrm->EndElement( m_strTagName ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xflist.cxx b/lotuswordpro/source/filter/xfilter/xflist.cxx new file mode 100644 index 000000000..ae61aef6c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xflist.cxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * List object. + ************************************************************************/ +#include +#include +#include + +XFList::XFList() +{ + m_bOrdered = true; + m_bContinueNumber = false; +} + +XFList::~XFList() {} + +void XFList::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + assert(nullptr != pAttrList); + + pAttrList->Clear(); + if (!GetStyleName().isEmpty()) + pAttrList->AddAttribute("text:style-name", GetStyleName()); + if (m_bContinueNumber) + pAttrList->AddAttribute("text:continue-numbering", "true"); + + if (m_bOrdered) + pStrm->StartElement("text:ordered-list"); + else + pStrm->StartElement("text:unordered-list"); + + XFContentContainer::ToXml(pStrm); + + if (m_bOrdered) + pStrm->EndElement("text:ordered-list"); + else + pStrm->EndElement("text:unordered-list"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx new file mode 100644 index 000000000..4f4f32ea7 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Styles for ordered list and unordered list. + ************************************************************************/ +#include +#include +#include + +XFListLevel::XFListLevel() + : m_nLevel(0) + , m_nDisplayLevel(0) + , m_fIndent(0) + , m_fMinLabelWidth(0.499) + , m_fMinLabelDistance(0) + , m_eAlign(enumXFAlignStart) + , m_eListType(enumXFListLevelNumber) +{} + +void XFListLevel::ToXml(IXFStream * /*pStrm*/) +{ +} + +void XFListlevelNumber::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "text:level", OUString::number(static_cast(m_nLevel)) ); + //text:style-name,ignore now. + m_aNumFmt.ToXml(pStrm); + if( m_nDisplayLevel ) + pAttrList->AddAttribute( "text:display-levels", OUString::number(static_cast(m_nDisplayLevel)) ); + + pStrm->StartElement( "text:list-level-style-number" ); + + //... + pAttrList->Clear(); + if( m_fIndent > FLOAT_MIN ) + { + pAttrList->AddAttribute( "text:space-before", OUString::number(m_fIndent) + "cm" ); + } + if( m_fMinLabelWidth > FLOAT_MIN ) + { + pAttrList->AddAttribute( "text:min-label-width", OUString::number(m_fMinLabelWidth) + "cm" ); + } + if( m_fMinLabelDistance > FLOAT_MIN ) + { + pAttrList->AddAttribute( "text:min-label-distance", OUString::number(m_fMinLabelDistance) + "cm" ); + } + pAttrList->AddAttribute( "fo:text-align", GetAlignName(m_eAlign) ); + + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "text:list-level-style-number" ); +} + +void XFListLevelBullet::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "text:level", OUString::number(static_cast(m_nLevel)) ); + //text:style-name,ignore now. + m_aNumFmt.ToXml(pStrm); + //bullet-char + pAttrList->AddAttribute( "text:bullet-char", m_chBullet ); + + pStrm->StartElement( "text:list-level-style-bullet" ); + + //... + pAttrList->Clear(); + if( m_fIndent != 0 ) + { + pAttrList->AddAttribute( "text:space-before", OUString::number(m_fIndent) + "cm" ); + } + if( m_fMinLabelWidth != 0 ) + { + pAttrList->AddAttribute( "text:min-label-width", OUString::number(m_fMinLabelWidth) + "cm" ); + } + if( m_fMinLabelDistance != 0 ) + { + pAttrList->AddAttribute( "text:min-label-distance", OUString::number(m_fMinLabelDistance) + "cm" ); + } + + pAttrList->AddAttribute( "fo:text-align", GetAlignName(m_eAlign) ); + + if( !m_strFontName.isEmpty() ) + { + pAttrList->AddAttribute( "style:font-name", m_strFontName ); + } + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "text:list-level-style-bullet" ); +} + +XFListStyle::XFListStyle() +{ + XFNumFmt nf; + nf.SetSuffix( "." ); + nf.SetFormat( "1" ); + + for( int i=0; i<10; i++ ) + { + m_pListLevels[i].reset(new XFListlevelNumber()); + m_pListLevels[i]->SetListlevelType(enumXFListLevelNumber); + m_pListLevels[i]->SetMinLabelWidth(0.499); + m_pListLevels[i]->SetIndent(0.501*(i+1)); + m_pListLevels[i]->SetLevel(i+1); + static_cast(m_pListLevels[i].get())->SetNumFmt(nf); + } +} + +XFListStyle::XFListStyle(const XFListStyle& other):XFStyle(other) +{ + for( int i=0; i<10; i++ ) + { + const enumXFListLevel type = other.m_pListLevels[i]->m_eListType; + if( type == enumXFListLevelNumber ) + { + XFListlevelNumber *pNum = static_cast(other.m_pListLevels[i].get()); + m_pListLevels[i].reset(new XFListlevelNumber(*pNum)); + } + else if( type == enumXFListLevelBullet ) + { + XFListLevelBullet *pBullet = static_cast(other.m_pListLevels[i].get()); + m_pListLevels[i].reset(new XFListLevelBullet(*pBullet)); + } + else + m_pListLevels[i].reset(); + } +} + +XFListStyle::~XFListStyle() +{ +} + +void XFListStyle::SetDisplayLevel(sal_Int32 level, sal_Int16 nDisplayLevel) +{ + assert(level>=1&&level<=10); + + XFListLevel *pLevel = m_pListLevels[level-1].get(); + if( !pLevel ) + { + m_pListLevels[level-1].reset(new XFListlevelNumber()); + pLevel = m_pListLevels[level-1].get(); + pLevel->SetListlevelType(enumXFListLevelNumber); + pLevel->SetLevel(level+1); + pLevel->SetMinLabelWidth(0.499); + pLevel->SetIndent(0.501*(level+1)); + } + pLevel->SetDisplayLevel(nDisplayLevel); +} + +void XFListStyle::SetListPosition(sal_Int32 level, + double indent, + double minLabelWidth, + double minLabelDistance, + enumXFAlignType align + ) +{ + assert(level>=1&&level<=10); + + XFListLevel *pLevel = m_pListLevels[level-1].get(); + if( !pLevel ) + { + m_pListLevels[level-1].reset( new XFListLevelBullet() ); + pLevel = m_pListLevels[level-1].get(); + pLevel->SetListlevelType(enumXFListLevelNumber); + pLevel->SetLevel(level+1); + } + pLevel->SetIndent(indent); + pLevel->SetMinLabelWidth(minLabelWidth); + pLevel->SetMinLabelDistance(minLabelDistance); + pLevel->SetAlignType(align); +} + +void XFListStyle::SetListBullet(sal_Int32 level, + OUString const & bullet, + const OUString& fontname, + const OUString& prefix, + const OUString& suffix + ) +{ + assert(level>=1&&level<=10); + + std::unique_ptr pLevel(new XFListLevelBullet()); + pLevel->SetPrefix(prefix); + pLevel->SetSuffix(suffix); + pLevel->SetBulletChar(bullet); + pLevel->SetFontName(fontname); + + pLevel->SetListlevelType(enumXFListLevelBullet); + pLevel->SetMinLabelWidth(0.499); + pLevel->SetIndent(0.501*level); + pLevel->SetLevel(level); + m_pListLevels[level-1] = std::move(pLevel); +} + +void XFListStyle::SetListNumber(sal_Int32 level, XFNumFmt const & fmt, sal_Int16 start ) +{ + assert(level>=1&&level<=10); + + std::unique_ptr pLevel(new XFListlevelNumber()); + pLevel->SetNumFmt(fmt); + pLevel->SetStartValue(start); + + pLevel->SetListlevelType(enumXFListLevelNumber); + pLevel->SetMinLabelWidth(0.499); + pLevel->SetIndent(0.501*level); + pLevel->SetLevel(level); + m_pListLevels[level-1] = std::move(pLevel); +} + +void XFListStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pStrm->StartElement( "text:list-style" ); + + for(auto const & pLevel : m_pListLevels) + { + if( pLevel ) + pLevel->ToXml(pStrm); + } + + pStrm->EndElement( "text:list-style" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfmargins.cxx b/lotuswordpro/source/filter/xfilter/xfmargins.cxx new file mode 100644 index 000000000..b6aab56d0 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfmargins.cxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Margins object, include left margin,right margin,top margin and bottom margin. + ************************************************************************/ + +#include +#include + +XFMargins::XFMargins() +{ + Reset(); +} + +void XFMargins::Reset() +{ + m_fLeft = 0; + m_fRight = 0; + m_fTop = 0; + m_fBottom = 0; + m_nFlag = 0; +} + +void XFMargins::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + //margin left: + if( m_nFlag&XFMARGINS_FLAG_LEFT ) + { + pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fLeft) + "cm" ); + } + //margin right: + if( m_nFlag&XFMARGINS_FLAG_RIGHT ) + { + pAttrList->AddAttribute("fo:margin-right", OUString::number(m_fRight) + "cm" ); + } + //margin top: + if( m_nFlag&XFMARGINS_FLAG_TOP ) + { + pAttrList->AddAttribute("fo:margin-top", OUString::number(m_fTop) + "cm" ); + } + //margin bottom: + if( m_nFlag&XFMARGINS_FLAG_BOTTOM ) + { + pAttrList->AddAttribute("fo:margin-bottom", OUString::number(m_fBottom) + "cm" ); + } +} + +bool operator==(XFMargins const & indent1, XFMargins const & indent2) +{ + return ( + (indent1.m_nFlag == indent2.m_nFlag) && + (indent1.m_fLeft == indent2.m_fLeft) && + (indent1.m_fRight == indent2.m_fRight) && + (indent1.m_fTop == indent2.m_fTop) && + (indent1.m_fBottom == indent2.m_fBottom) + ); +} +bool operator!=(XFMargins const & indent1, XFMargins const & indent2) +{ + return !(indent1==indent2); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx new file mode 100644 index 000000000..29eb8a9e7 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfmasterpage.cxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Master page object which was used to apply a layout to the pages. + ************************************************************************/ +#include +#include +#include + +void XFMasterPage::SetHeader(rtl::Reference const& rHeader) { m_xHeader = rHeader; } + +void XFMasterPage::SetFooter(rtl::Reference const& rFooter) { m_xFooter = rFooter; } + +enumXFStyle XFMasterPage::GetStyleFamily() { return enumXFStyleMasterPage; } + +void XFMasterPage::SetPageMaster(const OUString& pm) { m_strPageMaster = pm; } + +void XFMasterPage::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute("style:name", m_strStyleName); + pAttrList->AddAttribute("style:page-master-name", m_strPageMaster); + pStrm->StartElement("style:master-page"); + if (m_xHeader) + m_xHeader->ToXml(pStrm); + if (m_xFooter) + m_xFooter->ToXml(pStrm); + pStrm->EndElement("style:master-page"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx b/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx new file mode 100644 index 000000000..169f5e7e5 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfnumberstyle.cxx @@ -0,0 +1,356 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Number style for table cell. + ************************************************************************/ +#include +#include + +XFNumberStyle::XFNumberStyle() + : m_eType(enumXFNumberNumber) + , m_nDecimalDigits(0) + , m_bGroup(false) + , m_aColor(0,0,0) + , m_bRedIfNegative(false) + , m_aNegativeColor(255,0,0) +{} + +enumXFStyle XFNumberStyle::GetStyleFamily() +{ + return enumXFStyleNumber; +} + +bool XFNumberStyle::Equal(IXFStyle *pStyle) +{ + if( !pStyle || pStyle->GetStyleFamily() != enumXFStyleNumber ) + return false; + XFNumberStyle *pOther = dynamic_cast(pStyle); + if( !pOther ) + return false; + + if( m_eType != pOther->m_eType ) + return false; + if( m_nDecimalDigits != pOther->m_nDecimalDigits ) + return false; + if( m_bRedIfNegative != pOther->m_bRedIfNegative ) + return false; + if( m_bGroup != pOther->m_bGroup ) + return false; + if( m_aColor != pOther->m_aColor ) + return false; + if( m_strPrefix != pOther->m_strPrefix ) + return false; + if( m_strSuffix != pOther->m_strSuffix ) + return false; + + if( m_bRedIfNegative ) + { + if( m_aNegativeColor != pOther->m_aNegativeColor ) + return false; + if( m_strNegativePrefix != pOther->m_strNegativePrefix ) + return false; + if( m_strNegativeSuffix != pOther->m_strNegativeSuffix ) + return false; + } + + if( m_eType == enuMXFNumberCurrency ) + { + if( m_strCurrencySymbol != pOther->m_strCurrencySymbol ) + return false; + } + + return true; +} + +void XFNumberStyle::ToXml(IXFStream *pStrm) +{ + // for Text content number format + if (m_eType == enumXFText) + { + ToXml_StartElement(pStrm); + ToXml_EndElement(pStrm); + return; + } + + if( !m_bRedIfNegative ) + { + ToXml_Normal(pStrm); + } + else + { + ToXml_Negative(pStrm); + } +} + +void XFNumberStyle::ToXml_StartElement(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + + pAttrList->AddAttribute( "style:family", "data-style" ); + + if( m_eType == enumXFNumberNumber ) + { + pStrm->StartElement( "number:number-style" ); + } + else if( m_eType == enumXFNumberPercent ) + { + pStrm->StartElement( "number:percentage-style" ); + } + else if( m_eType == enuMXFNumberCurrency ) + { + pStrm->StartElement( "number:currency-style" ); + } + else if( m_eType == enumXFNumberScientific ) + { + pStrm->StartElement( "number:number-style" ); + } + // for Text content number format + else if (m_eType == enumXFText) + { + pStrm->StartElement( "number:text-content"); + } + +} + +void XFNumberStyle::ToXml_EndElement(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:name", GetStyleName() ); + pAttrList->AddAttribute( "style:family", "data-style" ); + + if( m_eType == enumXFNumberNumber ) + { + pStrm->EndElement( "number:number-style" ); + } + else if( m_eType == enumXFNumberPercent ) + { + pStrm->EndElement( "number:percentage-style" ); + } + else if( m_eType == enuMXFNumberCurrency ) + { + pStrm->EndElement( "number:currency-style" ); + } + else if( m_eType == enumXFNumberScientific ) + { + pStrm->EndElement( "number:number-style" ); + } + // for Text content number format + else if (m_eType == enumXFText) + { + pStrm->EndElement( "number:text-content"); + } + // END for Text content number format + +} +void XFNumberStyle::ToXml_Normal(IXFStream *pStrm) +{ + ToXml_StartElement(pStrm); + + ToXml_Content(pStrm,false); + + ToXml_EndElement(pStrm); +} + +void XFNumberStyle::ToXml_Negative(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + OUString strStyleName = GetStyleName(); + OUString strGEStyle = strStyleName + "PO"; + + SetStyleName(strGEStyle); + ToXml_Normal(pStrm); + SetStyleName(strStyleName); + + ToXml_StartElement(pStrm); + + ToXml_Content(pStrm,true); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:condition", "value()>=0" ); + pAttrList->AddAttribute( "style:apply-style-name", strGEStyle ); + pStrm->StartElement( "style:map" ); + pStrm->EndElement( "style:map" ); + + ToXml_EndElement(pStrm); +} + +void XFNumberStyle::ToXml_Content(IXFStream *pStrm, bool nagetive) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + //color: + if( !nagetive ) + pAttrList->AddAttribute( "fo:color", m_aColor.ToString() ); + else + pAttrList->AddAttribute( "fo:color", m_aNegativeColor.ToString() ); + + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + if( !nagetive ) + { + if( !m_strPrefix.isEmpty() ) + { + pStrm->StartElement( "number:text" ); + pStrm->Characters(m_strPrefix); + pStrm->EndElement( "number:text" ); + } + } + else + { + if( m_strNegativePrefix.isEmpty() ) + m_strNegativePrefix = m_strPrefix; + if( !m_strNegativePrefix.isEmpty() ) + { + pStrm->StartElement( "number:text" ); + // pStrm->Characters(m_strNegativePrefix); + pStrm->Characters(m_strNegativePrefix + "-"); + pStrm->EndElement( "number:text" ); + } + else + { + pStrm->StartElement( "number:text" ); + pStrm->Characters("-"); + pStrm->EndElement( "number:text" ); + } + } + + if( m_eType == enuMXFNumberCurrency ) + { + if( !m_strCurrencySymbol.isEmpty() ) + { + pStrm->StartElement( "number:currency-symbol" ); + pStrm->Characters(m_strCurrencySymbol); + pStrm->EndElement( "number:currency-symbol" ); + } + } + + //When category of number format is scientific, the number can not be displayed normally in table. + if ( m_eType == enumXFNumberScientific ) + { + pAttrList->Clear(); + pAttrList->AddAttribute("number:decimal-places", OUString::number(m_nDecimalDigits)); + pAttrList->AddAttribute("number:min-integer-digits", OUString::number(1)); + pAttrList->AddAttribute("number:min-exponent-digits", OUString::number(2)); + pStrm->StartElement( "number:scientific-number" ); + pStrm->EndElement( "number:scientific-number" ); + } + else + { + pAttrList->Clear(); + pAttrList->AddAttribute("number:decimal-places", OUString::number(m_nDecimalDigits)); + pAttrList->AddAttribute("number:min-integer-digits", OUString::number(1)); + + if( m_bGroup ) + pAttrList->AddAttribute("number:grouping","true"); + else + pAttrList->AddAttribute("number:grouping","false"); + + pStrm->StartElement( "number:number" ); + pStrm->EndElement( "number:number" ); + } + + if( !nagetive ) + { + if( !m_strSuffix.isEmpty() ) + { + pStrm->StartElement( "number:text" ); + pStrm->Characters(m_strSuffix); + pStrm->EndElement( "number:text" ); + } + else + { + if( m_eType == enumXFNumberPercent ) + { + pStrm->StartElement( "number:text" ); + pStrm->Characters("%"); + pStrm->EndElement( "number:text" ); + } + } + } + else + { + if( m_strNegativeSuffix.isEmpty() ) + m_strNegativeSuffix = m_strSuffix; + if( !m_strNegativeSuffix.isEmpty() ) + { + pStrm->StartElement( "number:text" ); + pStrm->Characters(m_strNegativeSuffix); + pStrm->EndElement( "number:text" ); + } + else + { + if( m_eType == enumXFNumberPercent ) + { + pStrm->StartElement( "number:text" ); + pStrm->Characters("%"); + pStrm->EndElement( "number:text" ); + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx b/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx new file mode 100644 index 000000000..9867449bc --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfofficemeta.cxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Implementation file for Meta data,pls reference to the header file. + ************************************************************************/ +#include +#include +#include + +void XFOfficeMeta::SetCreator(const OUString& creator) +{ + m_strCreator = creator; +} +void XFOfficeMeta::SetDescription(const OUString& dsr) +{ + m_strDsr = dsr; +} +void XFOfficeMeta::SetKeywords(const OUString& keywords) +{ + m_strKeywords = keywords; +} +void XFOfficeMeta::SetCreationTime(const OUString& crtime) +{ + m_strCrtime = crtime; +} +void XFOfficeMeta::SetLastTime(const OUString& lstime) +{ + m_strLstime = lstime; +} +void XFOfficeMeta::SetEditTime(const OUString& edtime) +{ + m_strEdtime = edtime; +} +void XFOfficeMeta::ToXml(IXFStream *pStream) +{ + IXFAttrList *pAttrList = pStream->GetAttrList(); + + pAttrList->Clear(); + pStream->StartElement( "office:meta" ); + + //generator: + pStream->StartElement( "meta:generator" ); + pStream->Characters( m_strGenerator ); + pStream->EndElement( "meta:generator" ); + + //title + pStream->StartElement( "dc:title" ); + pStream->Characters( m_strTitle ); + pStream->EndElement( "dc:title" ); + + //keywords + pStream->StartElement( "meta:keywords" ); + pStream->StartElement( "meta:keyword" ); + pStream->Characters( m_strKeywords ); + pStream->EndElement( "meta:keyword" ); + pStream->EndElement( "meta:keywords" ); + + //creation time + pStream->StartElement( "meta:creation-date" ); + pStream->Characters( m_strCrtime); + pStream->EndElement( "meta:creation-date" ); + + //last revision time + pStream->StartElement( "dc:date" ); + pStream->Characters( m_strLstime); + pStream->EndElement( "dc:date" ); + //total edit time + pStream->StartElement( "meta:editing-duration" ); + pStream->Characters( m_strEdtime); + pStream->EndElement( "meta:editing-duration" ); + + //description + pStream->StartElement( "dc:description" ); + pStream->Characters( m_strDsr ); + pStream->EndElement( "dc:description" ); + //creator + pStream->StartElement( "meta:initial-creator" ); + pStream->Characters( m_strCreator ); + pStream->EndElement( "meta:initial-creator" ); + + pStream->EndElement( "office:meta" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx new file mode 100644 index 000000000..d6419e1df --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfpagemaster.cxx @@ -0,0 +1,265 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Page master used bye XFMasterPage. + * It is the real object to define header and footer of pages. + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +XFPageMaster::XFPageMaster() : m_fPageWidth(0), m_fPageHeight(0), m_eUsage(enumXFPageUsageNone), +m_eTextDir(enumXFTextDirNone), +m_eSepAlign(enumXFAlignNone), m_fSepWidth(0), m_aSepColor(0), m_fSepSpaceAbove(0), +m_fSepSpaceBelow(0), m_nSepLengthPercent(0) +{ +} + +XFPageMaster::~XFPageMaster() +{ +} + +enumXFStyle XFPageMaster::GetStyleFamily() +{ + return enumXFStylePageMaster; +} + +void XFPageMaster::SetPageWidth(double width) +{ + m_fPageWidth = width; +} + +void XFPageMaster::SetPageHeight(double height) +{ + m_fPageHeight = height; +} + +void XFPageMaster::SetMargins(double left, double right,double top, double bottom) +{ + if( left != -1 ) + m_aMargin.SetLeft(left); + if( right != -1 ) + m_aMargin.SetRight(right); + if( top != -1 ) + m_aMargin.SetTop(top); + if( bottom != -1 ) + m_aMargin.SetBottom(bottom); +} + +void XFPageMaster::SetBorders(std::unique_ptr pBorders) +{ + m_pBorders = std::move( pBorders ); +} + +void XFPageMaster::SetShadow(XFShadow *pShadow) +{ + if( pShadow == m_pShadow.get() ) + return; + m_pShadow.reset( pShadow ); +} + +void XFPageMaster::SetBackColor(XFColor color) +{ + m_aBackColor = color; +} + +void XFPageMaster::SetBackImage(std::unique_ptr& rImage) +{ + m_pBGImage = std::move(rImage); +} + +void XFPageMaster::SetColumns(XFColumns *pColumns) +{ + if( pColumns == m_pColumns.get() ) + return; + m_pColumns.reset(pColumns); +} + + void XFPageMaster::SetHeaderStyle(XFHeaderStyle *pHeaderStyle) +{ + if( pHeaderStyle == m_pHeaderStyle.get() ) + return; + m_pHeaderStyle.reset( pHeaderStyle ); +} + +void XFPageMaster::SetFooterStyle(XFFooterStyle *pFooterStyle) +{ + if( pFooterStyle == m_pFooterStyle.get() ) + return; + m_pFooterStyle.reset( pFooterStyle ); +} + +void XFPageMaster::SetFootNoteSeparator( + enumXFAlignType align, + double width, + sal_Int32 lengthPercent, + double spaceAbove, + double spaceBelow, + XFColor color + ) +{ + m_eSepAlign = align; + m_fSepWidth = width; + m_nSepLengthPercent = lengthPercent; + m_fSepSpaceAbove = spaceAbove; + m_fSepSpaceBelow = spaceBelow; + m_aSepColor = color; +} + +/** + * + + + + + + + + + + + + + */ +void XFPageMaster::ToXml(IXFStream *pStream) +{ + IXFAttrList *pAttrList = pStream->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute("style:name",GetStyleName()); + + if( m_eUsage != enumXFPageUsageNone ) + pAttrList->AddAttribute("style:page-usage", GetPageUsageName(m_eUsage)); + + pStream->StartElement( "style:page-master" ); + + //style:properties + pAttrList->Clear(); + if( m_fPageWidth != 0 ) + pAttrList->AddAttribute( "fo:page-width", OUString::number(m_fPageWidth) + "cm" ); + if( m_fPageHeight != 0 ) + pAttrList->AddAttribute( "fo:page-height", OUString::number(m_fPageHeight) + "cm" ); + + m_aMargin.ToXml(pStream); + + pAttrList->AddAttribute( "style:print-orientation", "portrait" ); + + if( m_pBorders ) + m_pBorders->ToXml(pStream); + if( m_pShadow ) + pAttrList->AddAttribute( "style:shadow", m_pShadow->ToString() ); + + if( m_aBackColor.IsValid() ) + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + + //text directory + if( m_eTextDir != enumXFTextDirNone ) + pAttrList->AddAttribute( "style:writing-mode", GetTextDirName(m_eTextDir) ); + + pStream->StartElement( "style:properties" ); + if( m_pColumns ) + m_pColumns->ToXml(pStream); + + if( m_pBGImage ) + m_pBGImage->ToXml(pStream); + + if( m_eSepAlign || m_nSepLengthPercent>0 || m_fSepSpaceAbove>0 || m_fSepSpaceBelow>0 ) + { + pAttrList->Clear(); + pAttrList->AddAttribute( "style:width", OUString::number(m_fSepWidth) + "cm" ); + pAttrList->AddAttribute( "style:distance-before-sep", OUString::number(m_fSepSpaceAbove) + "cm" ); + pAttrList->AddAttribute( "style:distance-after-sep", OUString::number(m_fSepSpaceBelow) + "cm" ); + pAttrList->AddAttribute( "style:color", m_aSepColor.ToString() ); + if( m_eSepAlign == enumXFAlignStart ) + pAttrList->AddAttribute( "style:adjustment", "left" ); + else if( m_eSepAlign == enumXFAlignCenter ) + pAttrList->AddAttribute( "style:adjustment", "center" ); + else if( m_eSepAlign == enumXFAlignEnd ) + pAttrList->AddAttribute( "style:adjustment", "right" ); + pAttrList->AddAttribute( "style:rel-width", OUString::number(m_nSepLengthPercent) + "%" ); + pStream->StartElement( "style:footnote-sep" ); + pStream->EndElement( "style:footnote-sep" ); + } + + pStream->EndElement( "style:properties" ); + + //header style: + if( m_pHeaderStyle ) + m_pHeaderStyle->ToXml(pStream); + //footer style: + if( m_pFooterStyle ) + m_pFooterStyle->ToXml(pStream); + + pStream->EndElement( "style:page-master" ); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfparagraph.cxx b/lotuswordpro/source/filter/xfilter/xfparagraph.cxx new file mode 100644 index 000000000..bc070e36a --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfparagraph.cxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Paragraph object of OOo, it will output ... element. + ************************************************************************/ +#include +#include +#include + +XFParagraph::XFParagraph() {} + +XFParagraph::~XFParagraph() {} + +enumXFContent XFParagraph::GetContentType() { return enumXFContentPara; } + +/** + * The paragraph object serial function,the output will be like: + * + * text content + * text. + * text content + * + */ +void XFParagraph::ToXml(IXFStream* pStrm) +{ + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + assert(pAttrList); + + pAttrList->Clear(); + if (!GetStyleName().isEmpty()) + pAttrList->AddAttribute("text:style-name", GetStyleName()); + pStrm->StartElement("text:p"); + + XFContentContainer::ToXml(pStrm); + + pStrm->EndElement("text:p"); +} + +bool XFParagraph::HasContents() const { return GetCount() > 0; } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfparastyle.cxx b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx new file mode 100644 index 000000000..4e298a248 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfparastyle.cxx @@ -0,0 +1,461 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Styles for paragraph. + * Styles for paragraph may include many style,include font,indent,margin, + * shadow,line height,and so on. + ************************************************************************/ +#include +#include +#include +#include "xftabstyle.hxx" +#include +#include + +XFParaStyle::XFParaStyle() + : m_eAlignType(enumXFAlignNone) + , m_fTextIndent(0) + , m_nFlag(0) + , m_bNumberRight(false) +{ +} + + +XFParaStyle::XFParaStyle(const XFParaStyle& other) + : XFStyle(other) + , m_eAlignType(other.m_eAlignType) + , m_fTextIndent(other.m_fTextIndent) + , m_aBackColor(other.m_aBackColor) + , m_aMargin(other.m_aMargin) + , m_aPadding(other.m_aPadding) + , m_pFont(other.m_pFont) + , m_aShadow(other.m_aShadow) + , m_aDropcap(other.m_aDropcap) + , m_aLineHeight(other.m_aLineHeight) + , m_aBreaks(other.m_aBreaks) + , m_nFlag(other.m_nFlag) + , m_bNumberRight(other.m_bNumberRight) +{ + if( other.m_pBorders ) + m_pBorders.reset( new XFBorders(*other.m_pBorders) ); + + if( other.m_pBGImage ) + m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) ); + + for (size_t i = 0; i < other.m_aTabs.GetCount(); ++i) + { + const IXFStyle* pStyle = other.m_aTabs.Item(i); + if( pStyle ) + { + const XFTabStyle* pTabStyle = dynamic_cast(pStyle); + if( pTabStyle ) + { + std::unique_ptr pCopyStyle(new XFTabStyle(*pTabStyle)); + m_aTabs.AddStyle(std::move(pCopyStyle)); + } + } + } +} + +XFParaStyle& XFParaStyle::operator=(const XFParaStyle& other) +{ + // Check for self-assignment + if (this != &other) + { + // first , clean member + m_pBGImage.reset(); + m_aTabs.Reset(); + + m_strParentStyleName = other.m_strParentStyleName; + m_nFlag = other.m_nFlag; + m_eAlignType = other.m_eAlignType; + m_fTextIndent = other.m_fTextIndent; + m_bNumberRight = other.m_bNumberRight; + + m_pFont = other.m_pFont; + + if( other.m_pBorders ) + m_pBorders.reset( new XFBorders(*other.m_pBorders) ); + else + m_pBorders.reset(); + m_aBackColor = other.m_aBackColor; + if( other.m_pBGImage ) + m_pBGImage.reset( new XFBGImage(*other.m_pBGImage) ); + else + m_pBGImage.reset(); + + m_aShadow = other.m_aShadow; + m_aMargin = other.m_aMargin; + m_aDropcap = other.m_aDropcap; + m_aLineHeight = other.m_aLineHeight; + m_aPadding = other.m_aPadding; + m_aBreaks = other.m_aBreaks; + + for (size_t i=0; i(pStyle); + if( pTabStyle ) + { + std::unique_ptr pCopyStyle(new XFTabStyle(*pTabStyle)); + m_aTabs.AddStyle(std::move(pCopyStyle)); + } + } + } + } + return *this; +} + +XFParaStyle::~XFParaStyle() +{ +} + +enumXFStyle XFParaStyle::GetStyleFamily() +{ + return enumXFStylePara; +} + +void XFParaStyle::SetFont(rtl::Reference const & pFont) +{ + m_pFont = pFont; +} + +void XFParaStyle::SetIndent(double indent ) +{ + m_fTextIndent = indent; +} + +void XFParaStyle::SetMargins(double left, double right, double top, double bottom) +{ + if( left != -1 ) + m_aMargin.SetLeft(left); + if( right != -1 ) + m_aMargin.SetRight(right); + if( top != -1 ) + m_aMargin.SetTop(top); + if( bottom != -1 ) + m_aMargin.SetBottom( bottom ); +} + +void XFParaStyle::SetShadow(enumXFShadowPos pos, double offset, XFColor const & color) +{ + m_aShadow.SetPosition(pos); + m_aShadow.SetOffset(offset); + m_aShadow.SetColor(color); +} + +void XFParaStyle::SetBackColor(XFColor const & color) +{ + m_aBackColor = color; + m_nFlag |= XFPARA_FLAG_BACKCOLOR; +} + +void XFParaStyle::SetBackImage(std::unique_ptr& rImage) +{ + m_pBGImage = std::move(rImage); +} + +void XFParaStyle::SetBorders(XFBorders *pBorders) +{ + m_pBorders.reset( pBorders ); +} + +void XFParaStyle::SetDropCap(sal_Int16 nLength, + sal_Int16 nLines, + double fDistance + ) +{ + assert(nLength>=1); + assert(nLines>=2); + assert(fDistance>=0); + + m_aDropcap.SetCharCount(nLength); + m_aDropcap.SetLines(nLines); + m_aDropcap.SetDistance(fDistance); +} + +void XFParaStyle::SetLineHeight(enumLHType type, double value) +{ + if( type == enumLHNone ) + { + return; + } + switch(type) + { + case enumLHHeight: + m_aLineHeight.SetHeight(value) ; + break; + case enumLHLeast: + m_aLineHeight.SetLeastHeight(value); + break; + case enumLHPercent: //perhaps i should redesign the interface here,ohm... + m_aLineHeight.SetPercent(static_cast(value)); + break; + case enumLHSpace: + m_aLineHeight.SetSpace(value*0.5666); //don't known why,just suspect. + break; + default: + break; + } +} + +void XFParaStyle::AddTabStyle(enumXFTab type, double len, sal_Unicode leader, sal_Unicode delimiter) +{ + std::unique_ptr tab(new XFTabStyle()); + tab->SetTabType(type); + tab->SetLength(len); + tab->SetLeaderChar(leader); + tab->SetDelimiter(delimiter); + m_aTabs.AddStyle(std::move(tab)); +} + +/** + *Affirm whether two XFParaStyle objects are equal. + */ +bool XFParaStyle::Equal(IXFStyle *pStyle) +{ + if( this == pStyle ) + return true; + if( !pStyle || pStyle->GetStyleFamily() != enumXFStylePara ) + return false; + + XFParaStyle *pOther = static_cast(pStyle); + + if( m_nFlag != pOther->m_nFlag ) + return false; + if( m_strParentStyleName != pOther->m_strParentStyleName ) + return false; + if( m_strMasterPage != pOther->m_strMasterPage ) + return false; + if( m_fTextIndent != pOther->m_fTextIndent ) + return false; + //align: + if( m_eAlignType != pOther->m_eAlignType ) + return false; + + //shadow: + if( m_aShadow != pOther->m_aShadow ) + return false; + //margin: + if( m_aMargin != pOther->m_aMargin ) + return false; + + if( m_aPadding != pOther->m_aPadding ) + return false; + + //dropcap: + if( m_aDropcap != pOther->m_aDropcap ) + return false; + //line height: + if( m_aLineHeight != pOther->m_aLineHeight ) + return false; + //breaks: + if( m_aBreaks != pOther->m_aBreaks ) + return false; + if( m_aTabs != pOther->m_aTabs ) + return false; + + //font: + if( m_pFont.is() ) + { + if( !pOther->m_pFont.is() ) + return false; + if(*m_pFont != *pOther->m_pFont ) + return false; + } + else if( pOther->m_pFont.is() ) + return false; + + //border: + if( m_pBorders ) + { + if( !pOther->m_pBorders ) + return false; + if( *m_pBorders != *pOther->m_pBorders ) + return false; + } + else if( pOther->m_pBorders ) + return false; + + if( m_pBGImage ) + { + if( !pOther->m_pBGImage ) + return false; + if( *m_pBGImage != *pOther->m_pBGImage ) + return false; + } + else if( pOther->m_pBGImage ) + return false;//add end + + //number right + if ( m_bNumberRight != pOther->m_bNumberRight) + return false; + + return true; +} + +void XFParaStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + OUString style = GetStyleName(); + + pAttrList->Clear(); + if( !style.isEmpty() ) + pAttrList->AddAttribute("style:name",GetStyleName()); + pAttrList->AddAttribute("style:family", "paragraph"); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + + if( !m_strMasterPage.isEmpty() ) + pAttrList->AddAttribute("style:master-page-name",m_strMasterPage); + pStrm->StartElement("style:style"); + + //Paragraph properties: + pAttrList->Clear(); + + //text indent: + if( m_fTextIndent ) + { + pAttrList->AddAttribute("fo:text-indent", OUString::number(m_fTextIndent) + "cm" ); + } + //padding: + m_aPadding.ToXml(pStrm); + //margin: + m_aMargin.ToXml(pStrm); + + //text align: + if( m_eAlignType != enumXFAlignNone ) + { + pAttrList->AddAttribute("fo:text-align", GetAlignName(m_eAlignType) ); + } + //line number: + pAttrList->AddAttribute( "text:number-lines", "true" ); + pAttrList->AddAttribute( "text:line-number", OUString::number(0) ); + + //shadow: + m_aShadow.ToXml(pStrm); + //borders: + if( m_pBorders ) + m_pBorders->ToXml(pStrm); + //line height: + m_aLineHeight.ToXml(pStrm); + + //background color: + if( m_nFlag&XFPARA_FLAG_BACKCOLOR && m_aBackColor.IsValid() ) + { + pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() ); + } + //Font properties: + if( m_pFont.is() ) + m_pFont->ToXml(pStrm); + + //page breaks: + m_aBreaks.ToXml(pStrm); + + pStrm->StartElement("style:properties"); + + //dropcap: + m_aDropcap.ToXml(pStrm); + + //tabs: + if( m_aTabs.GetCount() > 0 ) + { + pAttrList->Clear(); + pStrm->StartElement( "style:tab-stops" ); + m_aTabs.ToXml(pStrm); + pStrm->EndElement( "style:tab-stops" ); + } + + //background color: + if( m_pBGImage ) + m_pBGImage->ToXml(pStrm); + + pStrm->EndElement("style:properties"); + + pStrm->EndElement("style:style"); +} + +XFDefaultParaStyle::XFDefaultParaStyle() +{ + m_fTabDistance = 1.28; +} + +enumXFStyle XFDefaultParaStyle::GetStyleFamily() +{ + return enumXFStyleDefaultPara; +} + +void XFDefaultParaStyle::ToXml(IXFStream * pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + pAttrList->AddAttribute("style:family", "paragraph"); + pStrm->StartElement("style:default-style"); + + //Paragraph properties: + pAttrList->Clear(); + + pAttrList->AddAttribute("style:tab-stop-distance", OUString::number(m_fTabDistance) + "cm" ); + + pStrm->StartElement("style:properties"); + pStrm->EndElement("style:properties"); + pStrm->EndElement("style:default-style"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfrow.cxx b/lotuswordpro/source/filter/xfilter/xfrow.cxx new file mode 100644 index 000000000..1bdfb8849 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfrow.cxx @@ -0,0 +1,135 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table object. + ************************************************************************/ + +#include + +#include +#include +#include +#include + +XFRow::XFRow() + : m_pOwnerTable(nullptr) + , m_nRepeat(0) + , m_nRow(0) +{ +} + +XFRow::~XFRow() +{ +} + +void XFRow::AddCell(rtl::Reference const & rCell) +{ + if (!rCell) + return; + sal_Int32 col = m_aCells.size() + 1; + rCell->SetCol(col); + rCell->SetOwnerRow(this); + m_aCells.push_back(rCell); +} + +sal_Int32 XFRow::GetCellCount() const +{ + return m_aCells.size(); +} + +// 1 based +XFCell* XFRow::GetCell(sal_Int32 col) const +{ + assert(col > 0); + size_t nIndex = col - 1; + if (nIndex < m_aCells.size()) + return m_aCells[nIndex].get(); + return nullptr; +} + +void XFRow::ToXml(IXFStream *pStrm) +{ + sal_Int32 lastCol = 0; + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "table:style-name", GetStyleName() ); + if( m_nRepeat ) + pAttrList->AddAttribute( "table:number-rows-repeated", OUString::number(m_nRepeat) ); + pStrm->StartElement( "table:table-row" ); + + for (size_t nIndex = 0, nCount = m_aCells.size(); nIndex < nCount; ++nIndex) + { + XFCell *pCell = m_aCells[nIndex].get(); + if (!pCell) + continue; + int col = nIndex + 1; + if( col>lastCol+1 ) + { + XFCell *pNULLCell = new XFCell(); + if( col>lastCol+2 ) + pNULLCell->SetRepeated(col-lastCol-1); + pNULLCell->ToXml(pStrm); + } + pCell->ToXml(pStrm); + lastCol = col; + } + + pStrm->EndElement( "table:table-row" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx new file mode 100644 index 000000000..99d654da4 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfrowstyle.cxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table row style, ie. table row height. + ************************************************************************/ +#include +#include + +XFRowStyle::XFRowStyle():m_fHeight(0) +{ + m_fHeight = 0; + m_fMinHeight = 0; +} + +enumXFStyle XFRowStyle::GetStyleFamily() +{ + return enumXFStyleTableRow; +} + +void XFRowStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + + pAttrList->AddAttribute( "style:family", "table-row" ); + pStrm->StartElement( "style:style" ); + + pAttrList->Clear(); + if( m_fMinHeight ) + pAttrList->AddAttribute( "style:min-row-height", OUString::number(m_fMinHeight) + "cm" ); + else if( m_fHeight ) + pAttrList->AddAttribute( "style:row-height", OUString::number(m_fHeight) + "cm" ); + + if( m_aBackColor.IsValid() ) + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx new file mode 100644 index 000000000..aa175d849 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Document object of the xml filter framework. + ************************************************************************/ +#include "xfsaxattrlist.hxx" +#include + +XFSaxAttrList::XFSaxAttrList() + : m_xSvAttrList(new SvXMLAttributeList()) +{ +} + +XFSaxAttrList::~XFSaxAttrList() {} + +void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value) +{ + m_xSvAttrList->AddAttribute(name, value); +} + +void XFSaxAttrList::Clear() { m_xSvAttrList->Clear(); } + +css::uno::Reference XFSaxAttrList::GetAttributeList() const +{ + return m_xSvAttrList; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx new file mode 100644 index 000000000..4a727727d --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Wrapper the attribute list of a xml element. + ************************************************************************/ +#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX +#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX + +#include +#include +#include + +class XFSaxAttrList : public IXFAttrList +{ +public: + XFSaxAttrList(); + + virtual ~XFSaxAttrList() override; + +public: + //Interface ISaxAttributeList: + virtual void AddAttribute(const OUString& name, const OUString& value) override; + + virtual void Clear() override; + + css::uno::Reference GetAttributeList() const; + + friend class XFSaxStream; + +private: + rtl::Reference m_xSvAttrList; +}; + +#endif //XFSAXATTRLIST_INC + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx new file mode 100644 index 000000000..700161df2 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Tool for sax writer. + ************************************************************************/ +#include +#include "xfsaxattrlist.hxx" + +#include + +#include +#include +#include + +using namespace ::cppu; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::xml::sax; +using namespace ::com::sun::star::uno; + +XFSaxStream::XFSaxStream(Reference const& xHandler) +{ + m_aHandler = xHandler; + m_pAttrList.reset(new XFSaxAttrList); +} + +XFSaxStream::~XFSaxStream() {} + +void XFSaxStream::StartDocument() +{ + if (m_aHandler.is()) + m_aHandler->startDocument(); +} + +void XFSaxStream::EndDocument() +{ + if (m_aHandler.is()) + m_aHandler->endDocument(); +} + +void XFSaxStream::StartElement(const OUString& oustr) +{ + if (m_aHandler.is()) + m_aHandler->startElement(oustr, m_pAttrList->GetAttributeList()); + m_pAttrList->Clear(); +} + +void XFSaxStream::EndElement(const OUString& oustr) +{ + if (m_aHandler.is()) + m_aHandler->endElement(oustr); + + if (m_pAttrList) + m_pAttrList->Clear(); +} + +void XFSaxStream::Characters(const OUString& oustr) +{ + if (m_aHandler.is()) + m_aHandler->characters(oustr); +} + +IXFAttrList* XFSaxStream::GetAttrList() { return m_pAttrList.get(); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsection.cxx b/lotuswordpro/source/filter/xfilter/xfsection.cxx new file mode 100644 index 000000000..994f9227c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfsection.cxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Section object. + ************************************************************************/ +#include +#include +#include + +XFSection::XFSection() { m_strSectionName = XFGlobal::GenSectionName(); } + +XFSection::~XFSection() {} + +void XFSection::ToXml(IXFStream* pStrm) +{ + assert(!m_strSectionName.isEmpty()); + + IXFAttrList* pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + OUString style = GetStyleName(); + if (!style.isEmpty()) + pAttrList->AddAttribute("text:style-name", style); + //section name + if (!m_strSectionName.isEmpty()) + pAttrList->AddAttribute("text:name", m_strSectionName); + + pStrm->StartElement("text:section"); + if (!m_strSourceLink.isEmpty()) + { + pAttrList->Clear(); + pAttrList->AddAttribute("xlink:href", m_strSourceLink); + pAttrList->AddAttribute("text:filter-name", "wordpro"); + pStrm->StartElement("text:section-source"); + pStrm->EndElement("text:section-source"); + } + + XFContentContainer::ToXml(pStrm); + + pStrm->EndElement("text:section"); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx new file mode 100644 index 000000000..0bf664d6a --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfsectionstyle.cxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Section style,whose family is "section" + ************************************************************************/ +#include +#include +#include + +XFSectionStyle::XFSectionStyle() +{ + m_fMarginLeft = 0; + m_fMarginRight = 0; + m_pColumns = nullptr; +} + +XFSectionStyle::~XFSectionStyle() +{ +} + +enumXFStyle XFSectionStyle::GetStyleFamily() +{ + return enumXFStyleSection; +} + +void XFSectionStyle::SetMarginLeft(double left) +{ + m_fMarginLeft = left; +} + +void XFSectionStyle::SetMarginRight(double right) +{ + m_fMarginRight = right; +} + +void XFSectionStyle::SetColumns(XFColumns *pColumns) +{ + m_pColumns.reset( pColumns ); +} + +void XFSectionStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + pAttrList->AddAttribute( "style:family", "section" ); + + pStrm->StartElement( "style:style" ); + + pAttrList->Clear(); + if( m_fMarginLeft != 0 ) + { + pAttrList->AddAttribute( "fo:margin-left", OUString::number(m_fMarginLeft) + "cm" ); + } + if( m_fMarginRight != 0 ) + { + pAttrList->AddAttribute( "fo:margin-right", OUString::number(m_fMarginRight) + "cm" ); + } + if( m_aBackColor.IsValid() ) + { + pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() ); + } + else + { + pAttrList->AddAttribute( "fo:background-color", "transparent" ); + } + + pStrm->StartElement( "style:properties" ); + + if( m_pColumns ) + m_pColumns->ToXml(pStrm); + + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfshadow.cxx b/lotuswordpro/source/filter/xfilter/xfshadow.cxx new file mode 100644 index 000000000..a5acfb343 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfshadow.cxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Shadow object,now only used by paragraph object. + ************************************************************************/ +#include +#include + +XFShadow::XFShadow() + : m_ePosition(enumXFShadowNone) + , m_fOffset(0.18) + , m_aColor(128,128,0) +{} + +OUString XFShadow::ToString() +{ + OUString buf; + OUString strOff = OUString::number(m_fOffset); + + switch(m_ePosition) + { + case enumXFShadowRightBottom: + buf = m_aColor.ToString() + " " + strOff + "cm " + strOff + "cm"; + break; + case enumXFShadowRightTop: + buf = m_aColor.ToString() + " " + strOff + "cm -" + strOff + "cm"; + break; + case enumXFShadowLeftBottom: + buf = m_aColor.ToString() + " -" + strOff + "cm " + strOff + "cm"; + break; + case enumXFShadowLeftTop: + buf = m_aColor.ToString() + " -" + strOff + "cm -" + strOff + "cm"; + break; + default: + buf = m_aColor.ToString(); + break; + } + + return buf; +} + +void XFShadow::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + if( m_ePosition == enumXFShadowNone ) + return; + else + pAttrList->AddAttribute( "style:shadow", ToString() ); +} + +bool operator==(XFShadow const & s1, XFShadow const & s2) +{ + return (s1.m_ePosition == s2.m_ePosition) && + (s1.m_fOffset == s2.m_fOffset) && + (s1.m_aColor == s2.m_aColor); +} + +bool operator!=(XFShadow const & s1, XFShadow const & s2) +{ + return !(s1==s2); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfstyle.cxx b/lotuswordpro/source/filter/xfilter/xfstyle.cxx new file mode 100644 index 000000000..d6846340e --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfstyle.cxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Base style object . + ************************************************************************/ +#include + +XFStyle::XFStyle() +{ +} + +XFStyle::~XFStyle() +{ +} + +OUString XFStyle::GetStyleName() +{ + return m_strStyleName; +} + +void XFStyle::SetStyleName(const OUString& styleName) +{ + m_strStyleName = styleName; +} + +OUString XFStyle::GetParentStyleName() +{ + return m_strParentStyleName; +} + +void XFStyle::SetParentStyleName(const OUString& styleName) +{ + m_strParentStyleName = styleName; +} + +enumXFStyle XFStyle::GetStyleFamily() +{ + return enumXFStyleUnknown; +} + +bool XFStyle::Equal(IXFStyle * /*pStyle*/) +{ + return false; +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfstylecont.cxx b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx new file mode 100644 index 000000000..c9bcfc3c8 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfstylecont.cxx @@ -0,0 +1,251 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Font object to serial to xml filter. + ************************************************************************/ +#include +#include +#include +#include +#include +#include +#include + +XFStyleContainer::XFStyleContainer(const OUString& strStyleNamePrefix) + :m_strStyleNamePrefix(strStyleNamePrefix) +{ +} + +XFStyleContainer::~XFStyleContainer() +{ +} + +void XFStyleContainer::Reset() +{ + m_aStyles.clear(); +} + +IXFStyleRet XFStyleContainer::AddStyle(std::unique_ptr pStyle) +{ + IXFStyleRet aRet; + + IXFStyle *pConStyle = nullptr; + + if( !pStyle ) + return aRet; + //no matter we want to delete the style or not,XFFont object should be saved first. + ManageStyleFont(pStyle.get()); + + if( pStyle->GetStyleName().isEmpty() ) + pConStyle = FindSameStyle(pStyle.get()); + + if( pConStyle )//such a style has exist: + { + aRet.m_pStyle = pConStyle; + aRet.m_bOrigDeleted = true; + return aRet; + } + else + { + OUString name; + if( pStyle->GetStyleName().isEmpty() ) + { + name = m_strStyleNamePrefix + OUString::number(m_aStyles.size()+1); + pStyle->SetStyleName(name); + } + else + { + name = pStyle->GetStyleName(); + //for name conflict + if(FindStyle( name)) + { + name += OUString::number(m_aStyles.size()+1); + pStyle->SetStyleName(name); + } + } + + //transform the font object to XFFontFactory + aRet.m_pStyle = pStyle.get(); + m_aStyles.push_back(std::move(pStyle)); + return aRet; + } +} + +IXFStyle* XFStyleContainer::FindSameStyle(IXFStyle *pStyle) +{ + for (auto const& style : m_aStyles) + { + assert(style); + if( style->Equal(pStyle) ) + return style.get(); + } + + return nullptr; +} + +IXFStyle* XFStyleContainer::FindStyle(std::u16string_view name) +{ + for (auto const& style : m_aStyles) + { + assert(style); + if( style->GetStyleName() == name ) + return style.get(); + } + + return nullptr; +} + +const IXFStyle* XFStyleContainer::Item(size_t index) const +{ + assert(indexToXml(pStrm); + } +} + +void XFStyleContainer::ManageStyleFont(IXFStyle *pStyle) +{ + rtl::Reference pStyleFont; + rtl::Reference pFactoryFont; + + if( !pStyle ) + return; + + if( pStyle->GetStyleFamily() == enumXFStyleText ) + { + XFTextStyle *pTS = static_cast(pStyle); + pStyleFont = pTS->GetFont(); + if( !pStyleFont.is() ) + return; + LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); + XFFontFactory* pFontFactory = pGlobal->GetXFFontFactory(); + pFactoryFont = pFontFactory->FindSameFont(pStyleFont); + //this font has been exists in the factory: + if( pFactoryFont.is() ) + { + pTS->SetFont(pFactoryFont); + } + else + { + pFontFactory->AddFont(pStyleFont); + } + } + else if( pStyle->GetStyleFamily() == enumXFStylePara ) + { + XFParaStyle *pPS = static_cast(pStyle); + pStyleFont = pPS->GetFont(); + if( !pStyleFont.is() ) + return; + LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); + XFFontFactory* pFontFactory = pGlobal->GetXFFontFactory(); + pFactoryFont = pFontFactory->FindSameFont(pStyleFont); + //this font has been exists in the factory: + if( pFactoryFont.is() ) + { + pPS->SetFont(pFactoryFont); + } + else + { + pFontFactory->AddFont(pStyleFont); + } + } +} + +bool operator==(XFStyleContainer& b1, XFStyleContainer& b2) +{ + if( b1.m_strStyleNamePrefix != b2.m_strStyleNamePrefix ) + return false; + if( b1.m_aStyles.size() != b2.m_aStyles.size() ) + return false; + for( size_t i=0; iEqual(pS2) ) + return false; + } + else + { + if( pS2 ) + return false; + } + } + return true; +} + +bool operator!=(XFStyleContainer& b1, XFStyleContainer& b2) +{ + return !(b1==b2); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx new file mode 100644 index 000000000..7cf97f8a4 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfstylemanager.cxx @@ -0,0 +1,375 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Style manager for the filter. + ************************************************************************/ + +#include + +#include +#include +#include +#include + +XFStyleManager::XFStyleManager() : s_aStdArrowStyles( "arrow" ), s_aTextStyles( "T" ), + s_aParaStyles( "P" ),s_aListStyles( "L" ),s_aSectionStyles( "Sect" ), + s_aPageMasters( "PM" ),s_aMasterpages( "MP" ),s_aDateStyles( "N" ), + s_aGraphicsStyles( "fr" ),s_aTableStyles( "table" ),s_aTableCellStyles( "cell" ), + s_aTableRowStyles( "row" ),s_aTableColStyles( "col" ) +{ +} + +XFStyleManager::~XFStyleManager() +{ + Reset(); +} + +void XFStyleManager::Reset() +{ + s_pOutlineStyle.reset(); + + s_aStdTextStyles.Reset(); + s_aStdParaStyles.Reset(); + s_aStdStrokeDashStyles.Reset(); + s_aStdAreaStyles.Reset(); + s_aStdArrowStyles.Reset(); + s_aTextStyles.Reset(); + s_aParaStyles.Reset(); + s_aListStyles.Reset(); + s_aSectionStyles.Reset(); + s_aPageMasters.Reset(); + s_aMasterpages.Reset(); + s_aDateStyles.Reset(); + s_aGraphicsStyles.Reset(); + s_aConfigManager.Reset(); + //must clear all static containers. + s_aFontDecls.clear(); +} + +void XFStyleManager::AddFontDecl(XFFontDecl const & aFontDecl) +{ + s_aFontDecls.push_back(aFontDecl); +} + +IXFStyleRet XFStyleManager::AddStyle(std::unique_ptr pStyle) +{ + IXFStyleRet aRet; + + assert(pStyle); + OUString name = pStyle->GetStyleName(); + + if( pStyle->GetStyleFamily() == enumXFStyleText ) + { + if( !name.isEmpty() ) + { + aRet = s_aStdTextStyles.AddStyle(std::move(pStyle)); + } + else + { + aRet = s_aTextStyles.AddStyle(std::move(pStyle)); + } + } + else if( pStyle->GetStyleFamily() == enumXFStylePara ) + { + if( !name.isEmpty() ) + { + aRet = s_aStdParaStyles.AddStyle(std::move(pStyle)); + } + else + { + aRet = s_aParaStyles.AddStyle(std::move(pStyle)); + } + } + else if( pStyle->GetStyleFamily() == enumXFStyleDefaultPara ) + { + aRet = s_aStdParaStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleList ) + { + aRet = s_aListStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleSection ) + { + aRet = s_aSectionStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStylePageMaster ) + { + aRet = s_aPageMasters.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleMasterPage ) + { + //Master page don't need name. + aRet = s_aMasterpages.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleDate ) + { + aRet = s_aDateStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleTime ) + { + aRet = s_aDateStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleNumber ) + { + aRet = s_aDateStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStylePercent ) + { + aRet = s_aDateStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleCurrency ) + { + aRet = s_aDateStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleGraphics ) + { + aRet = s_aGraphicsStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleTable ) + { + aRet = s_aTableStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleTableCell ) + { + aRet = s_aTableCellStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleTableRow ) + { + aRet = s_aTableRowStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleTableCol ) + { + aRet = s_aTableColStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleOutline ) + { + s_pOutlineStyle = std::move(pStyle); + } + else if( pStyle->GetStyleFamily() == enumXFStyleStrokeDash ) + { + aRet = s_aStdStrokeDashStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleArea ) + { + aRet = s_aStdAreaStyles.AddStyle(std::move(pStyle)); + } + else if( pStyle->GetStyleFamily() == enumXFStyleArrow ) + { + aRet = s_aStdArrowStyles.AddStyle(std::move(pStyle)); + } + else if (pStyle->GetStyleFamily() == enumXFStyleRuby) + { + aRet = s_aRubyStyles.AddStyle(std::move(pStyle)); + } + + return aRet; +} + +IXFStyle* XFStyleManager::FindStyle(std::u16string_view name) +{ + IXFStyle *pStyle = FindParaStyle(name); + if( pStyle ) + return pStyle; + pStyle = FindTextStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aListStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aSectionStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aPageMasters.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aMasterpages.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aDateStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aGraphicsStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aTableStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aTableCellStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aTableRowStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aTableColStyles.FindStyle(name); + if( pStyle ) + return pStyle; + if(s_pOutlineStyle && s_pOutlineStyle->GetStyleName() == name ) + return s_pOutlineStyle.get(); + pStyle = s_aStdStrokeDashStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aStdAreaStyles.FindStyle(name); + if( pStyle ) + return pStyle; + pStyle = s_aStdArrowStyles.FindStyle(name); + if( pStyle ) + return pStyle; + + return nullptr; +} + +XFParaStyle* XFStyleManager::FindParaStyle(std::u16string_view name) +{ + IXFStyle *pStyle = s_aParaStyles.FindStyle(name); + if( pStyle ) + return static_cast(pStyle); + else + return static_cast(s_aStdParaStyles.FindStyle(name)); +} + +XFTextStyle* XFStyleManager::FindTextStyle(std::u16string_view name) +{ + IXFStyle *pStyle = s_aTextStyles.FindStyle(name); + if( pStyle ) + return static_cast(pStyle); + else + return static_cast(s_aStdTextStyles.FindStyle(name)); +} + +void XFStyleManager::SetLineNumberConfig(XFLineNumberConfig *pLNConf) +{ + s_aConfigManager.SetLineNumberConfig(pLNConf); +} + +void XFStyleManager::SetFootnoteConfig(XFFootnoteConfig *pFNConfig) +{ + s_aConfigManager.SetFootnoteConfig(pFNConfig); +} + +void XFStyleManager::SetEndnoteConfig(XFEndnoteConfig *pENConfig) +{ + s_aConfigManager.SetEndnoteConfig(pENConfig); +} + +void XFStyleManager::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pStrm->StartElement( "office:font-decls" ); + + //font declarations: + for (const auto & fontDecl : s_aFontDecls) + { + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", fontDecl.GetFontName() ); + pAttrList->AddAttribute( "fo:font-family", fontDecl.GetFontFamily() ); + pAttrList->AddAttribute( "style:font-pitch", "variable" ); + pStrm->StartElement( "style:font-decl" ); + pStrm->EndElement( "style:font-decl" ); + } + + pStrm->EndElement( "office:font-decls" ); + + //office:styles: + pAttrList->Clear(); + pStrm->StartElement( "office:styles" ); + + s_aStdParaStyles.ToXml(pStrm); + s_aStdTextStyles.ToXml(pStrm); + s_aStdStrokeDashStyles.ToXml(pStrm); + s_aStdAreaStyles.ToXml(pStrm); + s_aStdArrowStyles.ToXml(pStrm); + //date,time styles: + s_aDateStyles.ToXml(pStrm); + s_aConfigManager.ToXml(pStrm); + //for optimist. + s_aListStyles.ToXml(pStrm); + + if( s_pOutlineStyle ) + s_pOutlineStyle->ToXml(pStrm); + + pStrm->EndElement( "office:styles" ); + + //automatic styles: + pAttrList->Clear(); + pStrm->StartElement( "office:automatic-styles" ); + + s_aTableStyles.ToXml(pStrm); + s_aTableCellStyles.ToXml(pStrm); + s_aTableRowStyles.ToXml(pStrm); + s_aTableColStyles.ToXml(pStrm); + s_aParaStyles.ToXml(pStrm); + s_aTextStyles.ToXml(pStrm); + s_aSectionStyles.ToXml(pStrm); + s_aPageMasters.ToXml(pStrm); + s_aRubyStyles.ToXml(pStrm); + //graphics: + s_aGraphicsStyles.ToXml(pStrm); + + pStrm->EndElement( "office:automatic-styles" ); + + //master:styles + pAttrList->Clear(); + pStrm->StartElement( "office:master-styles" ); + //masters pages: + s_aMasterpages.ToXml(pStrm); + + pStrm->EndElement( "office:master-styles" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx new file mode 100644 index 000000000..976ee8bb9 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftable.cxx @@ -0,0 +1,275 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table object. + ************************************************************************/ +#include +#include +#include +#include +#include + +XFTable::XFTable() +{ + m_strName = XFGlobal::GenTableName(); + m_bSubTable = false; + m_pOwnerCell = nullptr; +} + +XFTable::~XFTable() +{ + m_aRows.clear(); + m_aColumns.clear(); +} + +void XFTable::SetColumnStyle(sal_Int32 col, const OUString& style) +{ + m_aColumns[col] = style; +} + +bool XFTable::ContainsTable(const XFTable* pTable) const +{ + for (auto const& elem : m_aRows) + { + const XFRow *pRow = elem.second.get(); + + for (sal_Int32 i = 0; i < pRow->GetCellCount(); ++i) + { + const XFCell* pCell = pRow->GetCell(i + 1); //starts at 1, not 0 + if (const XFTable* pSubTable = pCell->GetSubTable()) + { + if (pSubTable == pTable) + return true; + if (pSubTable->ContainsTable(pTable)) + return true; + } + if (pCell->HierarchyContains(pTable)) + return true; + } + } + + return false; +} + +void XFTable::AddRow(rtl::Reference const & rRow) +{ + assert(rRow); + + for (sal_Int32 i = 0; i < rRow->GetCellCount(); ++i) + { + XFCell* pFirstCell = rRow->GetCell(i + 1); //starts at 1, not 0 + if (const XFTable* pSubTable = pFirstCell->GetSubTable()) + { + if (pSubTable == this || pSubTable->ContainsTable(this)) + throw std::runtime_error("table is a subtable of itself"); + } + if (pFirstCell->HierarchyContains(this)) + throw std::runtime_error("table is a subtable of itself"); + + } + + int row = rRow->GetRow(); + + if( row<1 ) + rRow->SetRow(m_aRows.size()+1); + + row = rRow->GetRow(); + + rRow->SetOwnerTable(this); + m_aRows[row] = rRow; +} + +void XFTable::AddHeaderRow(XFRow *pRow) +{ + if( !pRow) + return; + if (!m_aHeaderRows.is()) + return; + m_aHeaderRows->Add(pRow); +} + +OUString XFTable::GetTableName() +{ + if( m_bSubTable ) + { + return m_pOwnerCell->GetCellName(); + } + else + return m_strName; +} + +sal_uInt16 XFTable::GetRowCount() +{ + sal_uInt16 rowMax = 0; + for (auto const& row : m_aRows) + { + if (row.first > rowMax) + rowMax = row.first; + } + + return rowMax; +} + +XFRow* XFTable::GetRow(sal_Int32 row) +{ + return m_aRows[row].get(); +} + +sal_Int32 XFTable::GetColumnCount() +{ + int colMax = -1; + for (auto const& column : m_aColumns) + { + if( column.first>colMax ) + colMax = column.first; + } + return colMax; +} + +enumXFContent XFTable::GetContentType() +{ + return enumXFContentTable; +} + +void XFTable::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + //sub table shouldn't use table name. + if( !m_bSubTable ) + pAttrList->AddAttribute( "table:name", m_strName); + + if( !GetStyleName().isEmpty() ) + pAttrList->AddAttribute( "table:style-name", GetStyleName() ); + + if( m_bSubTable ) + pStrm->StartElement( "table:sub-table" ); + else + pStrm->StartElement( "table:table" ); + + //output columns: + { + int lastCol = 0; + for (auto const& column : m_aColumns) + { + sal_Int32 col = column.first; + OUString style = m_aColumns[col]; + + //default col repeated: + if( col >lastCol+1 ) + { + if( col > lastCol + 2 ) + { + if( !m_strDefColStyle.isEmpty() ) + { + pAttrList->AddAttribute( "table:style-name", m_strDefColStyle ); + } + pAttrList->AddAttribute( "table:number-columns-repeated", OUString::number(col-lastCol-1) ); + } + pStrm->StartElement( "table:table-column" ); + pStrm->EndElement( "table:table-column" ); + } + + if( !style.isEmpty() ) + { + pAttrList->AddAttribute( "table:style-name", style ); + } + pStrm->StartElement( "table:table-column" ); + pStrm->EndElement( "table:table-column" ); + lastCol = col; + } + } + + if (m_aHeaderRows.is() && m_aHeaderRows->GetCount()>0) + { + pStrm->StartElement( "table:table-header-rows" ); + m_aHeaderRows->ToXml(pStrm); + pStrm->EndElement( "table:table-header-rows" ); + } + //output rows: + { + int lastRow = 0; + + for (auto const& elem : m_aRows) + { + int row = elem.first; + XFRow *pRow = elem.second.get(); + + //null row repeated: + if( row>lastRow+1 ) + { + XFRow *pNullRow = new XFRow(); + pNullRow->SetStyleName(m_strDefRowStyle); + if( row>lastRow+2) + pNullRow->SetRepeated(row-lastRow-1); + rtl::Reference xCell(new XFCell); + xCell->SetStyleName(m_strDefCellStyle); + pNullRow->AddCell(xCell); + pNullRow->ToXml(pStrm); + } + pRow->ToXml(pStrm); + lastRow = row; + } + } + + if( m_bSubTable ) + pStrm->EndElement( "table:sub-table" ); + else + pStrm->EndElement( "table:table" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftablestyle.cxx b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx new file mode 100644 index 000000000..cf1229f59 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftablestyle.cxx @@ -0,0 +1,130 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Table style. + ************************************************************************/ +#include +#include + +XFTableStyle::XFTableStyle() + : m_fWidth(2) + , m_eAlign(enumXFAlignStart) +{} + +XFTableStyle::~XFTableStyle() +{ +} + +void XFTableStyle::SetBackImage(std::unique_ptr& rImage) +{ + m_pBGImage = std::move(rImage); +} + +enumXFStyle XFTableStyle::GetStyleFamily() +{ + return enumXFStyleTable; +} + +void XFTableStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pAttrList->AddAttribute( "style:family", "table" ); + pStrm->StartElement( "style:style" ); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:width", OUString::number(m_fWidth) + "cm" ); + //text align: + if( m_eAlign == enumXFAlignStart ) + { + pAttrList->AddAttribute("table:align","left"); + } + else if( m_eAlign == enumXFAlignCenter ) + { + pAttrList->AddAttribute("table:align","center"); + } + else if( m_eAlign == enumXFAlignEnd ) + { + pAttrList->AddAttribute("table:align","right"); + } + else if( m_eAlign == enumXFALignMargins ) + { + pAttrList->AddAttribute("table:align","margins"); + } + //background color: + if( m_aBackColor.IsValid() && !m_pBGImage ) + pAttrList->AddAttribute("fo:background-color", m_aBackColor.ToString() ); + //shadow: + m_aShadow.ToXml(pStrm); + //margin: + m_aMargins.ToXml(pStrm); + //breaks: + m_aBreaks.ToXml(pStrm); + + pStrm->StartElement( "style:properties" ); + if( m_pBGImage ) + m_pBGImage->ToXml(pStrm); + + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftabstyle.cxx b/lotuswordpro/source/filter/xfilter/xftabstyle.cxx new file mode 100644 index 000000000..c86d6420f --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftabstyle.cxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Tab style for paragraph.include tab offset and tab char properties. + ************************************************************************/ +#include "xftabstyle.hxx" +#include + +XFTabStyle::XFTabStyle() + : m_eType(enumXFTabNone) + , m_fLength(0) +{} + +void XFTabStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + pAttrList->Clear(); + + pAttrList->AddAttribute( "style:position", OUString::number(m_fLength) + "cm" ); + switch(m_eType) + { + case enumXFTabLeft: + pAttrList->AddAttribute( "style:type", "left" ); + break; + case enumXFTabCenter: + pAttrList->AddAttribute( "style:type", "center" ); + break; + case enumXFTabRight: + pAttrList->AddAttribute( "style:type", "right" ); + break; + case enumXFTabChar: + pAttrList->AddAttribute( "style:type", "char" ); + break; + default: + break; + } + //delimiter: + if( m_eType == enumXFTabChar ) + pAttrList->AddAttribute( "style:char", m_strDelimiter ); + //leader char: + if( !m_strLeader.isEmpty() ) + pAttrList->AddAttribute( "style:leader-char", m_strLeader ); + + pStrm->StartElement( "style:tab-stop" ); + pStrm->EndElement( "style:tab-stop" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftabstyle.hxx b/lotuswordpro/source/filter/xfilter/xftabstyle.hxx new file mode 100644 index 000000000..06304d51c --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftabstyle.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Tab style for paragraph.include tab offset and tab char properties. + ************************************************************************/ +#ifndef INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFTABSTYLE_HXX +#define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFTABSTYLE_HXX + +#include + +class XFTabStyle : public XFStyle +{ +public: + XFTabStyle(); + +public: + void SetTabType(enumXFTab type); + + void SetLength(double len); + + void SetDelimiter(sal_Unicode delimiter); + + void SetLeaderChar(sal_Unicode leader); + + virtual void ToXml(IXFStream* pStrm) override; + +private: + enumXFTab m_eType; + double m_fLength; + OUString m_strDelimiter; + OUString m_strLeader; +}; + +inline void XFTabStyle::SetTabType(enumXFTab type) { m_eType = type; } + +inline void XFTabStyle::SetLength(double len) { m_fLength = len; } + +inline void XFTabStyle::SetDelimiter(sal_Unicode delimiter) +{ + m_strDelimiter = OUString(delimiter); +} + +inline void XFTabStyle::SetLeaderChar(sal_Unicode leader) { m_strLeader = OUString(leader); } + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx b/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx new file mode 100644 index 000000000..a399f4c33 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftextboxstyle.cxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include +#include + +XFTextBoxStyle::XFTextBoxStyle() +{ +} + +XFTextBoxStyle::~XFTextBoxStyle() +{ +} + +enumXFStyle XFTextBoxStyle::GetStyleFamily() +{ + return enumXFStyleGraphics; +} + +void XFTextBoxStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pAttrList->AddAttribute( "style:family", "graphics" ); + //parent style name ignore now. + pStrm->StartElement( "style:style" ); + + pAttrList->Clear(); + pAttrList->AddAttribute( "draw:stroke", "none" ); + pAttrList->AddAttribute( "svg:stroke-color", "#000000" ); + pAttrList->AddAttribute( "draw:fill", "none" ); + pAttrList->AddAttribute( "draw:fill-color", "#ffffff" ); + pAttrList->AddAttribute( "draw:auto-grow-height", "true" ); + pAttrList->AddAttribute( "style:run-through", "foreground" ); + pAttrList->AddAttribute( "style:wrap", "run-through" ); + pAttrList->AddAttribute( "style:wrap", "run-through" ); + pAttrList->AddAttribute( "style:number-wrapped-paragraphs", "no-limit" ); + pAttrList->AddAttribute( "style:wrap-contour", "false" ); + + pStrm->StartElement( "style:properties" ); + pStrm->EndElement( "style:properties" ); + + pStrm->EndElement( "style:style" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftextcontent.cxx b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx new file mode 100644 index 000000000..945b24114 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftextcontent.cxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include +#include +#include + +XFTextContent::XFTextContent(const OUString& text):m_strText(text) +{ +} + +XFTextContent::~XFTextContent() +{ +} + +enumXFContent XFTextContent::GetContentType() +{ + return enumXFContentText; +} + +void XFTextContent::SetText(const OUString& text) +{ + m_strText = text; +} + +void XFTextContent::ToXml(IXFStream *pStrm) +{ +// pStrm->Characters(m_strText); + OUString sSubString; + sal_Int32 nIndex = 0; + sal_Int32 nSize = m_strText.getLength(); + sal_Int32 i,j; + for (i=0; iCharacters(sSubString); + return; + } + else + { + if (nIndex != 0) + pStrm->Characters(sSubString.copy(0,nIndex)); + for (j=nIndex+1;jGetAttrList(); + pAttrList->Clear(); + pAttrList->AddAttribute( "text:c", OUString::number(j-nIndex) ); + pStrm->StartElement( "text:s" ); + pStrm->EndElement( "text:s" ); + + i+=j; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftextspan.cxx b/lotuswordpro/source/filter/xfilter/xftextspan.cxx new file mode 100644 index 000000000..14a6874c2 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftextspan.cxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * An span of text with style. + ************************************************************************/ +#include +#include +#include +#include + +XFTextSpan::XFTextSpan() +{ + +} + +XFTextSpan::XFTextSpan(const OUString& text, + const OUString& style + ) +{ + Add(text); + SetStyleName(style); +} + +XFTextSpan::~XFTextSpan() +{ +} + +enumXFContent XFTextSpan::GetContentType() +{ + return enumXFContentSpan; +} + +void XFTextSpan::Add(XFContent *pContent) +{ + m_aContents.emplace_back(pContent); +} + +void XFTextSpan::Add(const OUString& text) +{ + XFContent *pText = new XFTextContent(text); + Add(pText); +} + +void XFTextSpan::ToXml(IXFStream *pStrm) +{ + OUString style = GetStyleName(); + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + assert(pAttrList); + + pAttrList->Clear(); + if( !style.isEmpty() ) + pAttrList->AddAttribute( "text:style-name", GetStyleName() ); + pStrm->StartElement( "text:span" ); + + for (auto const& content : m_aContents) + { + XFContent *pContent = content.get(); + if( pContent ) + pContent->DoToXml(pStrm); + } + + pStrm->EndElement( "text:span" ); +} + +void XFTextSpanStart::ToXml(IXFStream *pStrm) +{ + OUString style = GetStyleName(); + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + assert(pAttrList); + + pAttrList->Clear(); + if( !style.isEmpty() ) + pAttrList->AddAttribute( "text:style-name", GetStyleName() ); + pStrm->StartElement( "text:span" ); + + for (auto const& content : m_aContents) + { + XFContent *pContent = content.get(); + if( pContent ) + pContent->DoToXml(pStrm); + } +} +void XFTextSpanEnd::ToXml(IXFStream *pStrm) +{ + for (auto const& content : m_aContents) + { + XFContent *pContent = content.get(); + if( pContent ) + pContent->DoToXml(pStrm); + } + pStrm->EndElement( "text:span" ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftextstyle.cxx b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx new file mode 100644 index 000000000..e70603ab2 --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftextstyle.cxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Style for or or + * Now we have only font attributes. + ************************************************************************/ +#include +#include +#include +#include + +XFTextStyle::XFTextStyle() {} + +XFTextStyle::~XFTextStyle() {} + +void XFTextStyle::SetFont(rtl::Reference const& font) { m_pFont = font; } + +bool XFTextStyle::Equal(IXFStyle* pStyle) +{ + if (!pStyle || pStyle->GetStyleFamily() != enumXFStyleText) + { + return false; + } + + XFTextStyle* pOther = dynamic_cast(pStyle); + if (!pOther) + { + return false; + } + + if (m_pFont.is()) + { + if (!pOther->m_pFont.is()) + return false; + if (*m_pFont != *pOther->m_pFont) + return false; + } + else if (pOther->m_pFont.is()) + return false; + + return true; +} + +enumXFStyle XFTextStyle::GetStyleFamily() { return enumXFStyleText; } + +void XFTextStyle::ToXml(IXFStream* strm) +{ + IXFAttrList* pAttrList = strm->GetAttrList(); + OUString style = GetStyleName(); + + pAttrList->Clear(); + if (!style.isEmpty()) + pAttrList->AddAttribute("style:name", GetStyleName()); + if (!GetParentStyleName().isEmpty()) + pAttrList->AddAttribute("style:parent-style-name", GetParentStyleName()); + + pAttrList->AddAttribute("style:family", "text"); + strm->StartElement("style:style"); + + //Font properties: + pAttrList->Clear(); + //font name: + if (m_pFont.is()) + m_pFont->ToXml(strm); + + strm->StartElement("style:properties"); + strm->EndElement("style:properties"); + + strm->EndElement("style:style"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xftimestyle.cxx b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx new file mode 100644 index 000000000..95a8e7acb --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xftimestyle.cxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Time style. The Time format for time field. + ************************************************************************/ + +#include +#include + +XFTimePart::XFTimePart() +{ + m_nDecimalPos = 0; +} + +void XFTimePart::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + switch(m_ePart) + { + case enumXFDateHour: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:hours" ); + pStrm->EndElement( "number:hours" ); + break; + case enumXFDateMinute: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + if( m_nDecimalPos>0 ) + pAttrList->AddAttribute( "number:decimal-places", OUString::number(m_nDecimalPos) ); + + pStrm->StartElement( "number:minutes" ); + pStrm->EndElement( "number:minutes" ); + break; + case enumXFDateSecond: + pAttrList->Clear(); + if( m_bLongFmt ) + pAttrList->AddAttribute( "number:style", "long" ); + pStrm->StartElement( "number:seconds" ); + pStrm->EndElement( "number:seconds" ); + break; + case enumXFDateText: + pAttrList->Clear(); + pStrm->StartElement( "number:text" ); + pStrm->Characters( m_strText ); + pStrm->EndElement( "number:text" ); + break; + default: + break; + } +} + +XFTimeStyle::XFTimeStyle() +{ + m_bAmPm = false; + m_bTruncate = true; +} + +XFTimeStyle::~XFTimeStyle() +{ +} + +enumXFStyle XFTimeStyle::GetStyleFamily() +{ + return enumXFStyleTime; +} + +void XFTimeStyle::ToXml(IXFStream *pStrm) +{ + IXFAttrList *pAttrList = pStrm->GetAttrList(); + + pAttrList->Clear(); + pAttrList->AddAttribute( "style:name", GetStyleName() ); + if( !GetParentStyleName().isEmpty() ) + pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName()); + pAttrList->AddAttribute( "style:family", "data-style" ); + if (!m_bTruncate) + pAttrList->AddAttribute( "number:truncate-on-overflow", "false" ); + pStrm->StartElement( "number:time-style" ); + + for (auto & part : m_aParts) + { + part.ToXml(pStrm); + } + if( m_bAmPm ) + { + pAttrList->Clear(); + pStrm->StartElement( "number:am-pm" ); + pStrm->EndElement( "number:am-pm" ); + } + pStrm->EndElement( "number:time-style" ); +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfutil.cxx b/lotuswordpro/source/filter/xfilter/xfutil.cxx new file mode 100644 index 000000000..dd212b21a --- /dev/null +++ b/lotuswordpro/source/filter/xfilter/xfutil.cxx @@ -0,0 +1,391 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* + * @file + * Util functions for xml filter. + ************************************************************************/ +#include + +OUString GetTableColName(sal_Int32 col) +{ + int remain = 0; + char ch; + std::string strOut; + + if( col <= 26 ) + { + ch = 'A' + col -1; + strOut += ch; + return OUString::createFromAscii(strOut.c_str()); + } + + while( col>26 ) + { + remain = col%26; + col = col/26; + ch = 'A' + remain -1; + strOut += ch; + } + + ch = 'A' + remain -1; + strOut += ch; + return OUString::createFromAscii(strOut.c_str()); +} + +//tool functions: +OUString GetUnderlineName(enumXFUnderline type) +{ + switch(type) + { + case enumXFUnderlineNone: + return "none"; + case enumXFUnderlineSingle: + return "single"; + case enumXFUnderlineDouble: + return "double"; + case enumXFUnderlineDotted: + return "dotted"; + case enumXFUnderlineDash: + return "dash"; + case enumXFUnderlineLongDash: + return "long-dash"; + case enumXFUnderlineDotDash: + return "dot-dash"; + case enumXFUnderlineDotDotDash: + return "dot-dot-dash"; + case enumXFUnderlineWave: + return "wave"; + case enumXFUnderlineBold: + return "bold"; + case enumXFUnderlineBoldDotted: + return "bold-dotted"; + case enumXFUnderlineBoldDash: + return "bold-dash"; + case enumXFUnderlineBoldLongDash: + return "bold-long-dash"; + case enumXFUnderlineBoldDotDash: + return "bold-dot-dash"; + case enumXFUnderlineBoldDotDotDash: + return "bold-dot-dot-dash"; + case enumXFUnderlineBoldWave: + return "bold-wave"; + case enumXFUnderlineDoubleWave: + return "double-wave"; + case enumXFUnderlineSmallWave: + return "small-wave"; + } + return OUString(); +} + +OUString GetCrossoutName(enumXFCrossout type) +{ + switch(type) + { + case enumXFCrossoutSignel: + return "single-line"; + case enumXFCrossoutDouble: + return "double-line"; + case enumXFCrossoutThick: + return "thick-line"; + case enumXFCrossoutSlash: + return "slash"; + case enumXFCrossoutX: + return "X"; + default: + break; + } + return OUString(); +} + +OUString GetTransformName(enumXFTransform type) +{ + switch(type) { + case enumXFTransformUpper: + return "uppercase"; + case enumXFTransformLower: + return "lowercase"; + case enumXFTransformCapitalize: + return "capitalize"; + case enumXFTransformSmallCaps: + return "small-caps"; + default: + break; + } + return OUString(); +} + +OUString GetTextDirName(enumXFTextDir dir) +{ + switch(dir) + { + case enumXFTextDirLR: + return "lr"; + case enumXFTextDirLR_TB: + return "lr-tb"; + case enumXFTextDirPage: + return "page"; + case enumXFTextDirRL: + return "rl"; + case enumXFTextDirRL_TB: + return "rl-tb"; + case enumXFTextDirTB: + return "tb"; + case enumXFTextDirTB_LR: + return "tb-lr"; + case enumXFTextDirTB_RL: + return "tb-rl"; + default: + break; + } + return OUString(); +} + +OUString GetFrameXPos(enumXFFrameXPos pos) +{ + switch(pos) + { + case enumXFFrameXPosLeft: + return "left"; + case enumXFFrameXPosRight: + return "right"; + case enumXFFrameXPosCenter: + return "center"; + case enumXFFrameXPosFromLeft: + return "from-left"; + default: + break; + } + return OUString(); +} + +OUString GetFrameXRel(enumXFFrameXRel rel) +{ + switch(rel) + { + case enumXFFrameXRelPage: + return "page"; + case enumXFFrameXRelPageContent: + return "page-content"; + case enumXFFrameXRelPageEndMargin: + return "page-end-margin"; + case enumXFFrameXRelPageStartMargin: + return "page-start-margin"; + case enumXFFrameXRelPara: + return "paragraph"; + case enumXFFrameXRelParaContent: + return "paragraph-content"; + case enumXFFrameXRelParaEndMargin: + return "paragraph-end-margin"; + case enumXFFrameXRelParaStartMargin: + return "paragraph-start-margin"; + case enumXFFrameXRelChar: + return "char"; + case enumXFFrameXRelFrame: + return "frame"; + case enumXFFrameXRelFrameContent: + return "frame-content"; + case enumXFFrameXRelFrameEndMargin: + return "frame-end-margin"; + case enumXFFrameXRelFrameStartMargin: + return "frame-start-margin"; + default: + break; + } + return OUString(); +} + +OUString GetFrameYPos(enumXFFrameYPos pos) +{ + switch(pos) + { + case enumXFFrameYPosTop: + return "top"; + case enumXFFrameYPosMiddle: + return "middle"; + case enumXFFrameYPosBottom: + return "bottom"; + case enumXFFrameYPosFromTop: + return "from-top"; + case enumXFFrameYPosBelow: + return "below"; + } + return OUString(); +} + +OUString GetFrameYRel(enumXFFrameYRel rel) +{ + switch(rel) + { + case enumXFFrameYRelBaseLine: + return "baseline"; + case enumXFFrameYRelChar: + return "char"; + case enumXFFrameYRelFrame: + return "frame"; + case enumXFFrameYRelFrameContent: + return "frame-content"; + case enumXFFrameYRelLine: + return "line"; + case enumXFFrameYRelPage: + return "page"; + case enumXFFrameYRelPageContent: + return "page-content"; + case enumXFFrameYRelPara: + return "paragraph"; + case enumXFFrameYRelParaContent: + return "paragraph-content"; + case enumXFFrameYRelText: + return "text"; + } + return OUString(); +} + +OUString GetAlignName(enumXFAlignType align) +{ + if( align == enumXFAlignStart ) + return "start"; + else if( align == enumXFAlignCenter ) + return "center"; + else if( align == enumXFAlignEnd ) + return "end"; + else if( align == enumXFAlignJustify ) + return "justify"; + else if( align == enumXFAlignBottom ) + return "bottom"; + else if( align == enumXFAlignTop ) + return "top"; + else if( align == enumXFAlignMiddle ) + return "middle"; + else if( align == enumXFALignMargins ) + return "margins"; + + return OUString(); +} + +OUString GetPageUsageName(enumXFPageUsage usage) +{ + OUString sRet; + switch(usage) + { + case enumXFPageUsageAll: + sRet = "all"; + break; + case enumXFPageUsageLeft: + sRet = "left"; + break; + case enumXFPageUsageRight: + sRet = "right"; + break; + case enumXFPageUsageMirror: + sRet = "mirrored"; + break; + default: + sRet = "mirrored"; + break; + } + return sRet; +} + +OUString GetValueType(enumXFValueType type) +{ + OUString sRet; + switch(type) + { + case enumXFValueTypeBoolean: + sRet = "boolean"; + break; + case enumXFValueTypeCurrency: + sRet = "currency"; + break; + case enumXFValueTypeDate: + sRet = "date"; + break; + case enumXFValueTypeFloat: + sRet = "float"; + break; + case enumXFValueTypePercentage: + sRet = "percentage"; + break; + case enumXFValueTypeString: + sRet = "string"; + break; + case enumXFValueTypeTime: + sRet = "time"; + break; + default: + sRet = "mirrored"; + break; + } + return sRet; +} + +OUString GetColorMode(enumXFColorMode mode) +{ + switch(mode) + { + case enumXFColorStandard: + return "standard"; + case enumXFColorGreyscale: + return "greyscale"; + case enumXFColorWatermark: + return "watermark"; + case enumXFColorMono: + return "mono"; + } + return OUString(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3