| imagesdocumenthandler.cxx (07a3d7f1) | imagesdocumenthandler.cxx (46d9d397) |
|---|---|
| 1/************************************************************** | 1/************************************************************** |
| 2 * | 2 * |
| 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
| 10 * | 10 * |
| 11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 * | 12 * |
| 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
| 19 * | 19 * |
| 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <stdio.h> --- 84 unchanged lines hidden (view full) --- 112 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_IMAGECONTAINER }, 113 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_IMAGES }, 114 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_ENTRY }, 115 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_EXTERNALIMAGES }, 116 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_EXTERNALENTRY }, 117 { OReadImagesDocumentHandler::IMG_NS_XLINK, ATTRIBUTE_HREF }, 118 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKCOLOR }, 119 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_COMMAND }, | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <stdio.h> --- 84 unchanged lines hidden (view full) --- 112 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_IMAGECONTAINER }, 113 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_IMAGES }, 114 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_ENTRY }, 115 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_EXTERNALIMAGES }, 116 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_EXTERNALENTRY }, 117 { OReadImagesDocumentHandler::IMG_NS_XLINK, ATTRIBUTE_HREF }, 118 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKCOLOR }, 119 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_COMMAND }, |
| 120 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_BITMAPINDEX }, 121 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKURL }, 122 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKMODE }, | 120 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_BITMAPINDEX }, 121 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKURL }, 122 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_MASKMODE }, |
| 123 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_HIGHCONTRASTURL }, 124 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_HIGHCONTRASTMASKURL } 125}; 126 127 128OReadImagesDocumentHandler::OReadImagesDocumentHandler( ImageListsDescriptor& aItems ) : 129 ThreadHelpBase( &Application::GetSolarMutex() ), 130 m_aImageList( aItems ), --- 119 unchanged lines hidden (view full) --- 250 case IMG_ATTRIBUTE_MASKCOLOR: 251 { 252 ::rtl::OUString aColor = xAttribs->getValueByIndex( n ); 253 254 if ( aColor.getLength() > 0 ) 255 { 256 if ( aColor.getStr()[0] == '#' ) 257 { | 123 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_HIGHCONTRASTURL }, 124 { OReadImagesDocumentHandler::IMG_NS_IMAGE, ATTRIBUTE_HIGHCONTRASTMASKURL } 125}; 126 127 128OReadImagesDocumentHandler::OReadImagesDocumentHandler( ImageListsDescriptor& aItems ) : 129 ThreadHelpBase( &Application::GetSolarMutex() ), 130 m_aImageList( aItems ), --- 119 unchanged lines hidden (view full) --- 250 case IMG_ATTRIBUTE_MASKCOLOR: 251 { 252 ::rtl::OUString aColor = xAttribs->getValueByIndex( n ); 253 254 if ( aColor.getLength() > 0 ) 255 { 256 if ( aColor.getStr()[0] == '#' ) 257 { |
| 258 // the color value is given as #rrggbb and used the hexadecimal system!! | 258 // the color value is given as #rrggbb and uses the hexadecimal system! |
| 259 sal_uInt32 nColor = aColor.copy( 1 ).toInt32( 16 ); 260 261 m_pImages->aMaskColor = Color( COLORDATA_RGB( nColor ) ); 262 } 263 } 264 } 265 break; 266 --- 356 unchanged lines hidden (view full) --- 623 624//_________________________________________________________________________________________________________________ 625// OWriteImagesDocumentHandler 626//_________________________________________________________________________________________________________________ 627 628OWriteImagesDocumentHandler::OWriteImagesDocumentHandler( 629 const ImageListsDescriptor& aItems, 630 Reference< XDocumentHandler > rWriteDocumentHandler ) : | 259 sal_uInt32 nColor = aColor.copy( 1 ).toInt32( 16 ); 260 261 m_pImages->aMaskColor = Color( COLORDATA_RGB( nColor ) ); 262 } 263 } 264 } 265 break; 266 --- 356 unchanged lines hidden (view full) --- 623 624//_________________________________________________________________________________________________________________ 625// OWriteImagesDocumentHandler 626//_________________________________________________________________________________________________________________ 627 628OWriteImagesDocumentHandler::OWriteImagesDocumentHandler( 629 const ImageListsDescriptor& aItems, 630 Reference< XDocumentHandler > rWriteDocumentHandler ) : |
| 631 ThreadHelpBase( &Application::GetSolarMutex() ), | 631 ThreadHelpBase( &Application::GetSolarMutex() ), |
| 632 m_aImageListsItems( aItems ), 633 m_xWriteDocumentHandler( rWriteDocumentHandler ) 634{ 635 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 636 m_xEmptyList = Reference< XAttributeList >( (XAttributeList *) pList, UNO_QUERY ); 637 m_aAttributeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); 638 m_aXMLImageNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_IMAGE_PREFIX )); 639 m_aXMLXlinkNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_XLINK_PREFIX )); --- 61 unchanged lines hidden (view full) --- 701//_________________________________________________________________________________________________________________ 702 703void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor* pImageList ) throw 704( SAXException, RuntimeException ) 705{ 706 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 707 Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 708 | 632 m_aImageListsItems( aItems ), 633 m_xWriteDocumentHandler( rWriteDocumentHandler ) 634{ 635 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 636 m_xEmptyList = Reference< XAttributeList >( (XAttributeList *) pList, UNO_QUERY ); 637 m_aAttributeType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA )); 638 m_aXMLImageNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_IMAGE_PREFIX )); 639 m_aXMLXlinkNS = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_XLINK_PREFIX )); --- 61 unchanged lines hidden (view full) --- 701//_________________________________________________________________________________________________________________ 702 703void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor* pImageList ) throw 704( SAXException, RuntimeException ) 705{ 706 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 707 Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 708 |
| 709 // save required attributes | 709 // save required attributes |
| 710 pList->AddAttribute( m_aAttributeXlinkType, 711 m_aAttributeType, 712 m_aAttributeValueSimple ); 713 714 pList->AddAttribute( m_aXMLXlinkNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HREF )), 715 m_aAttributeType, 716 pImageList->aURL ); 717 --- 33 unchanged lines hidden (view full) --- 751 752 if ( pImageList->aHighContrastURL.Len() > 0 ) 753 { 754 pList->AddAttribute( m_aXMLImageNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HIGHCONTRASTURL )), 755 m_aAttributeType, 756 pImageList->aHighContrastURL ); 757 } 758 | 710 pList->AddAttribute( m_aAttributeXlinkType, 711 m_aAttributeType, 712 m_aAttributeValueSimple ); 713 714 pList->AddAttribute( m_aXMLXlinkNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HREF )), 715 m_aAttributeType, 716 pImageList->aURL ); 717 --- 33 unchanged lines hidden (view full) --- 751 752 if ( pImageList->aHighContrastURL.Len() > 0 ) 753 { 754 pList->AddAttribute( m_aXMLImageNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HIGHCONTRASTURL )), 755 m_aAttributeType, 756 pImageList->aHighContrastURL ); 757 } 758 |
| 759 m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_IMAGES )), xList ); 760 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); | 759 m_xWriteDocumentHandler->startElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_IMAGES )), xList ); 760 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); |
| 761 762 ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList; 763 if ( pImageItemList ) 764 { 765 for ( sal_uInt16 i = 0; i < pImageItemList->Count(); i++ ) 766 WriteImage( (*pImageItemList)[i] ); 767 } 768 --- 40 unchanged lines hidden (view full) --- 809} 810 811void OWriteImagesDocumentHandler::WriteExternalImage( const ExternalImageItemDescriptor* pExternalImage ) throw 812( SAXException, RuntimeException ) 813{ 814 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 815 Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 816 | 761 762 ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList; 763 if ( pImageItemList ) 764 { 765 for ( sal_uInt16 i = 0; i < pImageItemList->Count(); i++ ) 766 WriteImage( (*pImageItemList)[i] ); 767 } 768 --- 40 unchanged lines hidden (view full) --- 809} 810 811void OWriteImagesDocumentHandler::WriteExternalImage( const ExternalImageItemDescriptor* pExternalImage ) throw 812( SAXException, RuntimeException ) 813{ 814 ::comphelper::AttributeList* pList = new ::comphelper::AttributeList; 815 Reference< XAttributeList > xList( (XAttributeList *) pList , UNO_QUERY ); 816 |
| 817 // save required attributes | 817 // save required attributes |
| 818 pList->AddAttribute( m_aAttributeXlinkType, 819 m_aAttributeType, 820 m_aAttributeValueSimple ); 821 822 if ( pExternalImage->aURL.Len() > 0 ) 823 { 824 pList->AddAttribute( m_aXMLXlinkNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HREF )), 825 m_aAttributeType, --- 11 unchanged lines hidden (view full) --- 837 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 838 839 m_xWriteDocumentHandler->endElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_EXTERNALENTRY )) ); 840 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 841} 842 843} // namespace framework 844 | 818 pList->AddAttribute( m_aAttributeXlinkType, 819 m_aAttributeType, 820 m_aAttributeValueSimple ); 821 822 if ( pExternalImage->aURL.Len() > 0 ) 823 { 824 pList->AddAttribute( m_aXMLXlinkNS + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_HREF )), 825 m_aAttributeType, --- 11 unchanged lines hidden (view full) --- 837 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 838 839 m_xWriteDocumentHandler->endElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_EXTERNALENTRY )) ); 840 m_xWriteDocumentHandler->ignorableWhitespace( ::rtl::OUString() ); 841} 842 843} // namespace framework 844 |
| 845 846 847 | |