From 6759e3cbfc93b6d77fd734d77c347b6295735454 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 Apr 2011 21:19:54 +0100 Subject: fix what there is to fix (cherry picked from commit 278831e37a23e9e2e29ca811c3a5398b7c67464d) --- .../source/filter/LotusWordProImportFilter.cxx | 47 ++-- lotuswordpro/source/filter/benlist.cxx | 5 - lotuswordpro/source/filter/lwp9reader.cxx | 33 +-- lotuswordpro/source/filter/lwpbulletstylemgr.cxx | 6 +- lotuswordpro/source/filter/lwpcelllayout.cxx | 37 ++-- lotuswordpro/source/filter/lwpchangemgr.cxx | 40 +--- lotuswordpro/source/filter/lwpchartstreamtools.cxx | 6 +- lotuswordpro/source/filter/lwpcontent.hxx | 2 +- lotuswordpro/source/filter/lwpdivinfo.hxx | 2 +- lotuswordpro/source/filter/lwpdoc.cxx | 98 ++++----- lotuswordpro/source/filter/lwpdoc.hxx | 4 +- lotuswordpro/source/filter/lwpfilter.cxx | 92 ++++---- lotuswordpro/source/filter/lwpfilter.hxx | 3 +- lotuswordpro/source/filter/lwpfont.cxx | 17 +- lotuswordpro/source/filter/lwpfootnote.cxx | 10 +- lotuswordpro/source/filter/lwpfoundry.cxx | 15 +- lotuswordpro/source/filter/lwpfoundry.hxx | 1 + lotuswordpro/source/filter/lwpframelayout.cxx | 15 +- lotuswordpro/source/filter/lwpfrib.cxx | 36 ++-- lotuswordpro/source/filter/lwpfribframe.cxx | 27 ++- lotuswordpro/source/filter/lwpfribmark.cxx | 10 +- lotuswordpro/source/filter/lwpfribptr.cxx | 30 ++- lotuswordpro/source/filter/lwpgrfobj.cxx | 48 ++--- lotuswordpro/source/filter/lwpidxmgr.cxx | 25 ++- lotuswordpro/source/filter/lwplayout.cxx | 240 +++++++++++---------- lotuswordpro/source/filter/lwplayout.hxx | 2 +- lotuswordpro/source/filter/lwpmarker.cxx | 5 +- lotuswordpro/source/filter/lwpmarker.hxx | 1 - lotuswordpro/source/filter/lwpobjfactory.cxx | 54 +++-- lotuswordpro/source/filter/lwpobjfactory.hxx | 4 +- lotuswordpro/source/filter/lwpobjhdr.cxx | 7 +- lotuswordpro/source/filter/lwpobjhdr.hxx | 2 +- lotuswordpro/source/filter/lwpobjstrm.cxx | 21 +- lotuswordpro/source/filter/lwpoverride.cxx | 2 - lotuswordpro/source/filter/lwppagelayout.cxx | 42 ++-- lotuswordpro/source/filter/lwppara.cxx | 36 ++-- lotuswordpro/source/filter/lwppara.hxx | 2 +- lotuswordpro/source/filter/lwppara1.cxx | 118 ++-------- lotuswordpro/source/filter/lwpparaproperty.cxx | 86 +++----- lotuswordpro/source/filter/lwpparastyle.cxx | 116 +++++----- lotuswordpro/source/filter/lwprowlayout.cxx | 18 +- lotuswordpro/source/filter/lwprowlayout.hxx | 2 +- lotuswordpro/source/filter/lwpsection.hxx | 2 +- lotuswordpro/source/filter/lwpsilverbullet.cxx | 20 +- lotuswordpro/source/filter/lwpstory.cxx | 67 +++--- lotuswordpro/source/filter/lwptable.cxx | 4 +- lotuswordpro/source/filter/lwptablelayout.cxx | 40 ++-- lotuswordpro/source/filter/lwptabrack.cxx | 2 +- lotuswordpro/source/filter/lwptoc.cxx | 8 +- lotuswordpro/source/filter/lwptools.hxx | 13 ++ lotuswordpro/source/filter/utlist.cxx | 7 +- lotuswordpro/source/filter/utlist.hxx | 5 +- lotuswordpro/source/filter/xfilter/xfimage.cxx | 2 +- lotuswordpro/source/filter/xfilter/xfsaxstream.cxx | 15 +- lotuswordpro/util/makefile.mk | 8 +- 55 files changed, 750 insertions(+), 810 deletions(-) diff --git a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx index d0cb7b6fe065..f3eb30bf6537 100644 --- a/lotuswordpro/source/filter/LotusWordProImportFilter.cxx +++ b/lotuswordpro/source/filter/LotusWordProImportFilter.cxx @@ -256,23 +256,13 @@ sal_Bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::s sal_Int32 nLength = aDescriptor.getLength(); const PropertyValue * pValue = aDescriptor.getConstArray(); OUString sURL; - uno::Reference < XInputStream > xInputStream; for ( sal_Int32 i = 0 ; i < nLength; i++) { - if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) ) - pValue[i].Value >>= xInputStream; - else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) ) - pValue[i].Value >>= sURL; - } - if ( !xInputStream.is() ) - { - OSL_ASSERT( 0 ); - return sal_False; + //Note, we should attempt to use InputStream here first! + if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) ) + pValue[i].Value >>= sURL; } - OString sFileName; - sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII); - SvFileStream inputStream( sURL, STREAM_READ ); if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) ) return sal_False; @@ -282,13 +272,10 @@ sal_Bool SAL_CALL LotusWordProImportFilter::importImpl( const Sequence< ::com::s uno::Reference< XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY ); uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY); + if (xImporter.is()) xImporter->setTargetDocument(mxDoc); -/* - SimpleXMLImporter xmlImporter( xInternalHandler, inputStream ); - xmlImporter.import(); - return sal_True; -*/ - return ( ReadWordproFile( &inputStream, xInternalHandler) == 0 ); + + return ( ReadWordproFile( inputStream, xInternalHandler) == 0 ); } @@ -333,18 +320,18 @@ OUString SAL_CALL LotusWordProImportFilter::detect( com::sun::star::uno::Sequenc uno::Reference< com::sun::star::ucb::XCommandEnvironment > xEnv; if (!xInputStream.is()) { - try - { - ::ucbhelper::Content aContent(sURL, xEnv); - xInputStream = aContent.openStream(); - } - catch ( Exception& ) - { - return ::rtl::OUString(); - } + try + { + ::ucbhelper::Content aContent(sURL, xEnv); + xInputStream = aContent.openStream(); + } + catch ( Exception& ) + { + return ::rtl::OUString(); + } - if (!xInputStream.is()) - return ::rtl::OUString(); + if (!xInputStream.is()) + return ::rtl::OUString(); } Sequence< ::sal_Int8 > aData; diff --git a/lotuswordpro/source/filter/benlist.cxx b/lotuswordpro/source/filter/benlist.cxx index 0ce4ac29cfb5..c2ec1235134a 100644 --- a/lotuswordpro/source/filter/benlist.cxx +++ b/lotuswordpro/source/filter/benlist.cxx @@ -68,14 +68,9 @@ FindNamedObject(pCUtList pList, const char * sName, pCBenNamedObjectListElmt pCurrNamedObjectListElmt = (pCBenNamedObjectListElmt) pCurr; - - //Old code -// int Comp = strcmp(sName, pCurrNamedObjectListElmt->GetNamedObject()-> -// GetName()); int Comp = strcmp(sName, pCurrNamedObjectListElmt->GetNamedObject()-> GetNameCStr()); - if (Comp == 0) return pCurrNamedObjectListElmt->GetNamedObject(); else if (Comp < 0) diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx index 16019b34de39..bd1a81dcfb09 100644 --- a/lotuswordpro/source/filter/lwp9reader.cxx +++ b/lotuswordpro/source/filter/lwp9reader.cxx @@ -77,18 +77,22 @@ Lwp9Reader::Lwp9Reader (LwpSvStream* pInputStream, IXFStream* pStream) void Lwp9Reader::Read() { LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(m_pDocStream); - m_pObjMgr = pGlobal->GetLwpObjFactory(); - - //Commented out by , 10/26/2005 - //Read Ole object in LwpOleObject::XFConverter to support Ole in Linux - //ReadOleObjects(); + try + { + m_pObjMgr = pGlobal->GetLwpObjFactory(); - ReadFileHeader(); - //Does not support Word Pro 96 and previous versions - if(LwpFileHeader::m_nFileRevision>=0x000B) + ReadFileHeader(); + //Does not support Word Pro 96 and previous versions + if(LwpFileHeader::m_nFileRevision>=0x000B) + { + ReadIndex(); + ParseDocument(); + } + } + catch(...) { - ReadIndex(); - ParseDocument(); + LwpGlobalMgr::DeleteInstance(); + throw; } LwpGlobalMgr::DeleteInstance(); } @@ -181,14 +185,15 @@ void Lwp9Reader::ParseDocument() WriteDocHeader(); //Get root document - LwpDocument* doc = static_cast ( m_LwpFileHdr.GetDocID()->obj() ); + LwpDocument* doc = dynamic_cast ( m_LwpFileHdr.GetDocID()->obj() ); + + if (!doc) + return; //Parse Doc Data - LwpDocData *pDocData = static_cast((doc->GetDocData())->obj()); + LwpDocData *pDocData = dynamic_cast((doc->GetDocData())->obj()); if (pDocData!=NULL) - { pDocData->Parse(m_pStream); - } //Register Styles RegisteArrowStyles(); diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx index 033a8c7f4427..81ebbd5f175e 100644 --- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx +++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx @@ -547,7 +547,9 @@ rtl::OUString LwpBulletStyleMgr::GetDivisionName() LwpObjectID* pID = pDoc->GetDivInfoID(); if (!pID->IsNull()) { - aRet = static_cast(pID->obj(VO_DIVISIONINFO))->GetDivName(); + LwpDivInfo *pInfo = dynamic_cast(pID->obj(VO_DIVISIONINFO)); + if (pInfo) + aRet = pInfo->GetDivName(); } } @@ -562,7 +564,7 @@ rtl::OUString LwpBulletStyleMgr::GetSectionName(LwpPara* pPara) return rtl::OUString(); } - LwpStory* pStory = static_cast(pStoryID->obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(pStoryID->obj(VO_STORY)); if (!pStory) { return rtl::OUString(); diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx index fcfccca88a98..03895d094670 100644 --- a/lotuswordpro/source/filter/lwpcelllayout.cxx +++ b/lotuswordpro/source/filter/lwpcelllayout.cxx @@ -91,7 +91,7 @@ LwpCellLayout::~LwpCellLayout() */ LwpTableLayout * LwpCellLayout::GetTableLayout() { - LwpRowLayout * pRow = static_cast(GetParent()->obj()); + LwpRowLayout * pRow = dynamic_cast(GetParent()->obj()); if(!pRow) { return NULL; @@ -265,14 +265,14 @@ void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle) */ void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle) { - LwpLayoutNumerics* pLayoutNumerics =(LwpLayoutNumerics*)cLayNumerics.obj(); + LwpLayoutNumerics* pLayoutNumerics = dynamic_cast(cLayNumerics.obj()); if (!pLayoutNumerics) { // if current layout doesn't have format, go to based on layout - LwpCellLayout* pCellLayout = (LwpCellLayout*)m_BasedOnStyle.obj(); + LwpCellLayout* pCellLayout = dynamic_cast(m_BasedOnStyle.obj()); if (pCellLayout) { - pLayoutNumerics = (LwpLayoutNumerics*)pCellLayout->GetNumericsObject()->obj(); + pLayoutNumerics = dynamic_cast(pCellLayout->GetNumericsObject()->obj()); } } @@ -314,7 +314,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI { // if cell layout is aTableID's default cell layout // it can't have any content, bypass these code - LwpTable * pTable = static_cast(aTableID.obj()); + LwpTable * pTable = dynamic_cast(aTableID.obj()); if (!pTable) { assert(sal_False); @@ -331,7 +331,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI } // content of cell - LwpStory* pStory =(LwpStory*) m_Content.obj(); + LwpStory* pStory = dynamic_cast(m_Content.obj()); if (pStory) { pStory->XFConvert(pXFCell); @@ -347,8 +347,8 @@ LwpPara* LwpCellLayout::GetLastParaOfPreviousStory() LwpObjectID* pPreStoryID = this->GetPreviousCellStory(); if (pPreStoryID && !(pPreStoryID->IsNull())) { - LwpStory* pPreStory = static_cast(pPreStoryID->obj(VO_STORY)); - return static_cast(pPreStory->GetLastPara()->obj(VO_PARA)); + LwpStory* pPreStory = dynamic_cast(pPreStoryID->obj(VO_STORY)); + return dynamic_cast(pPreStory->GetLastPara()->obj(VO_PARA)); } else { @@ -571,7 +571,7 @@ void LwpCellLayout::RegisterDefaultCell() */ void LwpCellLayout::RegisterStyle() { - LwpVirtualLayout * pParent = static_cast(GetParent()->obj()); + LwpVirtualLayout * pParent = dynamic_cast(GetParent()->obj()); if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT) { // default cell layout, we must register 4 styles for it @@ -604,15 +604,6 @@ void LwpCellLayout::RegisterStyle() //register child layout style RegisterChildStyle(); - /* - LwpVirtualLayout* pLayout = static_cast(GetChildHead()->obj()); - while(pLayout) - { - pLayout->SetFoundry(m_pFoundry); - pLayout->RegisterStyle(); - pLayout = static_cast(pLayout->GetNext()->obj()); - } - */ } /** * @short Read cell layout @@ -687,7 +678,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID) else { // judge base on - LwpCellLayout * pBase = static_cast(m_BasedOnStyle.obj()); + LwpCellLayout * pBase = dynamic_cast(m_BasedOnStyle.obj()); if (pBase && pBase->IsProtected()) { bProtected = sal_True; @@ -695,7 +686,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID) else { // judge whole table - LwpTable * pTable = static_cast(aTableID.obj()); + LwpTable * pTable = dynamic_cast(aTableID.obj()); LwpTableLayout * pTableLayout = static_cast(pTable->GetTableLayout()); LwpSuperTableLayout * pSuper = pTableLayout->GetSuperTableLayout(); if (pSuper && pSuper->IsProtected()) @@ -907,17 +898,17 @@ XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, { if (!cconnectedlayout.obj()) return NULL; - LwpConnectedCellLayout* pConnCell = static_cast(cconnectedlayout.obj()); + LwpConnectedCellLayout* pConnCell = dynamic_cast(cconnectedlayout.obj()); if (nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID())) return NULL; // if the hidden cell should be displayed for limit of SODC // use the default cell layout XFCell* pXFCell = NULL; - LwpTable *pTable = static_cast(aTableID.obj()); + LwpTable *pTable = dynamic_cast(aTableID.obj()); if (pTable) { - LwpCellLayout *pDefault = static_cast(pTable->GetDefaultCellStyle()->obj()); + LwpCellLayout *pDefault = dynamic_cast(pTable->GetDefaultCellStyle()->obj()); if (pDefault) { pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol); diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx index 7afd992fda65..9e592b0dc8a4 100644 --- a/lotuswordpro/source/filter/lwpchangemgr.cxx +++ b/lotuswordpro/source/filter/lwpchangemgr.cxx @@ -229,45 +229,7 @@ void LwpChangeMgr::ConvertFribContent(XFContentContainer* pCont, LwpFrib* pFrib) } } break; -/* case FRIB_TAG_SECTION: - { - delete pXFPara; - LwpFribSection* pSectionFrib = static_cast(pFrib); - pSectionFrib->ParseSection(); - } - break; - case FRIB_TAG_PAGEBREAK: - { - LwpFribPageBreak* pPageBreak = static_cast(pFrib); - LwpPageLayout* pLayout = static_cast(pPageBreak->GetLayout()->obj()); - if(pLayout) - { - pPageBreak->ParseLayout(); - } - else - { - if (pPageBreak->IsLastFrib() == sal_True) - { - pXFPara->SetStyleName( pPageBreak->GetStyleName() ); - } - else - { - //parse pagebreak - XFParagraph *pNewPara = new XFParagraph(); - pNewPara->SetStyleName(pFrib->GetStyleName()); - pPara->AddXFContent(pNewPara); - } - } - } - break; - case FRIB_TAG_COLBREAK: - { - XFParagraph *pNewPara = new XFParagraph(); - pNewPara->SetStyleName(pFrib->GetStyleName()); - pPara->AddXFContent(pNewPara); - } - break; -*/ case FRIB_TAG_LINEBREAK: + case FRIB_TAG_LINEBREAK: { XFLineBreak *pLineBreak = new XFLineBreak(); pXFPara->Add(pLineBreak); diff --git a/lotuswordpro/source/filter/lwpchartstreamtools.cxx b/lotuswordpro/source/filter/lwpchartstreamtools.cxx index 41719587ed46..d2690c2401f9 100644 --- a/lotuswordpro/source/filter/lwpchartstreamtools.cxx +++ b/lotuswordpro/source/filter/lwpchartstreamtools.cxx @@ -85,11 +85,9 @@ SvStream* LwpChartStreamTools::GetChartStream(LwpSvStream* pDocStream, const cha SvStream* pStream = NULL; pSvStream->Seek(0); OpenStormBento::LtcBenContainer* pContainer = NULL;; - ULONG nRet = OpenStormBento::BenOpenContainer(pSvStream,&pContainer); - if ( 0==nRet ) - { + sal_uLong nRet = OpenStormBento::BenOpenContainer(pSvStream,&pContainer); + if (nRet != OpenStormBento::BenErr_OK) pStream = pContainer->FindValueStreamWithPropertyName(pChartName); - } return pStream; } diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx index 0d64747f2446..61f07569dae6 100644 --- a/lotuswordpro/source/filter/lwpcontent.hxx +++ b/lotuswordpro/source/filter/lwpcontent.hxx @@ -141,7 +141,7 @@ inline OUString LwpContent::GetClassName() inline LwpContent* LwpContent::GetNextEnumerated() { - return static_cast(m_NextEnumerated.obj()); + return dynamic_cast(m_NextEnumerated.obj()); } /** * @brief diff --git a/lotuswordpro/source/filter/lwpdivinfo.hxx b/lotuswordpro/source/filter/lwpdivinfo.hxx index ec0e5968abda..abd247074980 100644 --- a/lotuswordpro/source/filter/lwpdivinfo.hxx +++ b/lotuswordpro/source/filter/lwpdivinfo.hxx @@ -162,7 +162,7 @@ inline sal_Bool LwpDivInfo::IsGotoable() inline LwpDocument* LwpDivInfo::GetDivision() { - return static_cast(m_ParentID.obj()); + return dynamic_cast(m_ParentID.obj()); } #endif diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx index 13c2e76e0dad..5fab1b382662 100644 --- a/lotuswordpro/source/filter/lwpdoc.cxx +++ b/lotuswordpro/source/filter/lwpdoc.cxx @@ -71,7 +71,7 @@ #endif LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm) - : LwpDLNFPVList(objHdr, pStrm), m_pLnOpts(NULL) + : LwpDLNFPVList(objHdr, pStrm), m_pOwnedFoundry(NULL), m_pLnOpts(NULL) {} LwpDocument::~LwpDocument() @@ -80,9 +80,9 @@ LwpDocument::~LwpDocument() { delete m_pLnOpts; } - if(m_pFoundry) + if(m_pOwnedFoundry) { - delete m_pFoundry; + delete m_pOwnedFoundry; } } /** @@ -115,7 +115,7 @@ void LwpDocument::Read() LwpPrinterInfo m_PrtInfo( m_pObjStrm ); } - m_pFoundry = new LwpFoundry(m_pObjStrm, this); + m_pFoundry = m_pOwnedFoundry = new LwpFoundry(m_pObjStrm, this); m_DivOpts.ReadIndexed(m_pObjStrm); @@ -171,7 +171,7 @@ sal_Bool LwpDocument::IsSkippedDivision() { OUString sDivName; sal_uInt8 ret = sal_False; - LwpDivInfo* pDiv = static_cast(GetDivInfoID()->obj(VO_DIVISIONINFO)); + LwpDivInfo* pDiv = dynamic_cast(GetDivInfoID()->obj(VO_DIVISIONINFO)); if (pDiv == NULL) return sal_True; sDivName = pDiv->GetDivName(); @@ -183,10 +183,10 @@ sal_Bool LwpDocument::IsSkippedDivision() || strClassName.equals(A2OUSTR(STR_DivisionGroupEndnote)) || strClassName.equals(A2OUSTR(STR_DocumentEndnote))) { - LwpPageLayout* pPageLayout =static_cast(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT)); + LwpPageLayout* pPageLayout = dynamic_cast(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT)); if(pPageLayout) { - LwpStory* pStory = static_cast(pPageLayout->GetContent()->obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(pPageLayout->GetContent()->obj(VO_STORY)); if(pStory) { //This judgement maybe have problem. If there is only one para in the story, @@ -230,15 +230,15 @@ void LwpDocument::RegisterStyle() void LwpDocument::RegisterTextStyles() { //Register all text styles: para styles, character styles - LwpDLVListHeadHolder* pParaStyleHolder = static_cast(m_pFoundry->GetTextStyleHead()->obj()); + LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast(m_pFoundry->GetTextStyleHead()->obj()); if(pParaStyleHolder) { - LwpTextStyle* pParaStyle = static_cast (pParaStyleHolder->GetHeadID()->obj()); + LwpTextStyle* pParaStyle = dynamic_cast (pParaStyleHolder->GetHeadID()->obj()); while(pParaStyle) { pParaStyle->SetFoundry(m_pFoundry); pParaStyle->RegisterStyle(); - pParaStyle = static_cast(pParaStyle->GetNext()->obj()); + pParaStyle = dynamic_cast(pParaStyle->GetNext()->obj()); } } ChangeStyleName();//add by ,for click here block,05/5/26 @@ -253,15 +253,15 @@ void LwpDocument::RegisterLayoutStyles() m_pFoundry->RegisterAllLayouts(); //set initial pagelayout in story for parsing pagelayout - LwpDivInfo* pDivInfo = static_cast (m_DivInfo.obj( VO_DIVISIONINFO)); + LwpDivInfo* pDivInfo = dynamic_cast (m_DivInfo.obj( VO_DIVISIONINFO)); LwpPageLayout* pPageLayout = NULL; if(pDivInfo) { - pPageLayout =static_cast(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT)); + pPageLayout = dynamic_cast(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT)); if(pPageLayout) { //In Ole division, the content of pagelayout is VO_OLEOBJECT - LwpStory* pStory = static_cast(pPageLayout->GetContent()->obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(pPageLayout->GetContent()->obj(VO_STORY)); if(pStory) { //add all the pagelayout in order into the pagelayout list; @@ -277,16 +277,16 @@ void LwpDocument::RegisterLayoutStyles() void LwpDocument::RegisterStylesInPara() { //Register all automatic styles in para - LwpHeadContent* pContent = static_cast (m_pFoundry->GetContentManager()->GetContentList()->obj()); + LwpHeadContent* pContent = dynamic_cast (m_pFoundry->GetContentManager()->GetContentList()->obj()); if(pContent) { - LwpStory* pStory = static_cast(pContent->GetChildHead()->obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(pContent->GetChildHead()->obj(VO_STORY)); while(pStory) { //Register the child para pStory->SetFoundry(m_pFoundry); pStory->RegisterStyle(); - pStory = static_cast(pStory->GetNext()->obj(VO_STORY)); + pStory = dynamic_cast(pStory->GetNext()->obj(VO_STORY)); } } } @@ -296,17 +296,17 @@ void LwpDocument::RegisterStylesInPara() void LwpDocument::RegisterBulletStyles() { //Register bullet styles - LwpDLVListHeadHolder* mBulletHead = static_cast + LwpDLVListHeadHolder* mBulletHead = dynamic_cast (m_pFoundry->GetBulletManagerID()->obj(VO_HEADHOLDER)); if( mBulletHead ) { - LwpSilverBullet* pBullet = static_cast + LwpSilverBullet* pBullet = dynamic_cast (mBulletHead->GetHeadID()->obj()); while(pBullet) { pBullet->SetFoundry(m_pFoundry); pBullet->RegisterStyle(); - pBullet = static_cast (pBullet->GetNext()->obj()); + pBullet = dynamic_cast (pBullet->GetNext()->obj()); } } } @@ -341,7 +341,7 @@ void LwpDocument::RegisterFootnoteStyles() //Register footnote and endnote configuration for the entire document if(!m_FootnoteOpts.IsNull()) { - LwpFootnoteOptions* pFootnoteOpts = static_cast(m_FootnoteOpts.obj()); + LwpFootnoteOptions* pFootnoteOpts = dynamic_cast(m_FootnoteOpts.obj()); if (pFootnoteOpts) { pFootnoteOpts->SetMasterPage(A2OUSTR("Endnote")); @@ -353,13 +353,13 @@ void LwpDocument::RegisterFootnoteStyles() LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote(); if(this == pEndnoteDiv) { - LwpDLVListHeadTailHolder* pHeadTail = static_cast(GetPageHintsID()->obj()); + LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast(GetPageHintsID()->obj()); if(pHeadTail) { - LwpPageHint* pPageHint =static_cast(pHeadTail->GetTail()->obj()); + LwpPageHint* pPageHint = dynamic_cast(pHeadTail->GetTail()->obj()); if(pPageHint && !pPageHint->GetPageLayoutID()->IsNull()) { - LwpPageLayout* pPageLayout = static_cast(pPageHint->GetPageLayoutID()->obj()); + LwpPageLayout* pPageLayout = dynamic_cast(pPageHint->GetPageLayoutID()->obj()); if(pPageLayout) { pPageLayout->SetFoundry(GetFoundry()); @@ -383,7 +383,7 @@ void LwpDocument::RegisterDefaultParaStyles() LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE(); if(pFirstDoc) { - LwpVerDocument* pVerDoc = static_cast(pFirstDoc->GetVerDoc()->obj()); + LwpVerDocument* pVerDoc = dynamic_cast(pFirstDoc->GetVerDoc()->obj()); if(pVerDoc) { pVerDoc->RegisterStyle(); @@ -400,7 +400,7 @@ void LwpDocument::RegisterDefaultParaStyles() void LwpDocument::ParseDocContent(IXFStream* pOutputStream) { //Parse content in PageLayout - LwpDivInfo* pDivInfo = static_cast (m_DivInfo.obj()); + LwpDivInfo* pDivInfo = dynamic_cast (m_DivInfo.obj()); if(pDivInfo==NULL) return; LwpObject* pLayoutObj = pDivInfo->GetInitialLayoutID()->obj(); @@ -419,7 +419,7 @@ void LwpDocument::ParseDocContent(IXFStream* pOutputStream) */ void LwpDocument::ParseMasterDoc(IXFStream* pOutputStream) { - LwpDivInfo* pDivInfo = static_cast (m_DivInfo.obj()); + LwpDivInfo* pDivInfo = dynamic_cast (m_DivInfo.obj()); if(pDivInfo==NULL) return; LwpAtomHolder* pExternal = pDivInfo->GetExternalName(); if(pExternal && pExternal->HasValue()) @@ -450,7 +450,7 @@ LwpObjectID* LwpDocument::GetValidFootnoteOpts() */ sal_uInt16 LwpDocument::GetEndnoteType() { - LwpDivInfo* pDivInfo =static_cast(GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(GetDivInfoID()->obj()); if (!pDivInfo) return FN_DONTCARE; OUString strClassName = pDivInfo->GetClassName(); @@ -467,10 +467,10 @@ sal_uInt16 LwpDocument::GetEndnoteType() */ LwpDocument* LwpDocument::GetPreviousDivision() { - LwpDocSock* pDocSock = static_cast(GetSocket()->obj()); + LwpDocSock* pDocSock = dynamic_cast(GetSocket()->obj()); if(pDocSock) { - return static_cast(pDocSock->GetPrevious()->obj()); + return dynamic_cast(pDocSock->GetPrevious()->obj()); } return NULL; } @@ -479,10 +479,10 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetNextDivision() { - LwpDocSock* pDocSock = static_cast(GetSocket()->obj()); + LwpDocSock* pDocSock = dynamic_cast(GetSocket()->obj()); if(pDocSock) { - return static_cast(pDocSock->GetNext()->obj()); + return dynamic_cast(pDocSock->GetNext()->obj()); } return NULL; } @@ -491,10 +491,10 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetParentDivision() { - LwpDocSock* pDocSock = static_cast(GetSocket()->obj()); + LwpDocSock* pDocSock = dynamic_cast(GetSocket()->obj()); if(pDocSock) { - return static_cast(pDocSock->GetParent()->obj()); + return dynamic_cast(pDocSock->GetParent()->obj()); } return NULL; } @@ -507,7 +507,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() for (pPrev = GetPreviousDivision(); pPrev; pPrev = pPrev->GetPreviousDivision()) { - LwpDivInfo* pDivInfo =static_cast(pPrev->GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(pPrev->GetDivInfoID()->obj()); if(pDivInfo && pDivInfo->HasContents()) return pPrev; } @@ -522,7 +522,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() for (pNext = GetNextDivision(); pNext; pNext = pNext->GetNextDivision()) { - LwpDivInfo* pDivInfo =static_cast(pNext->GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(pNext->GetDivInfoID()->obj()); if(pDivInfo && pDivInfo->HasContents()) return pNext; } @@ -549,7 +549,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetLastDivisionWithContents() { - LwpDivInfo* pDivInfo =static_cast(GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(GetDivInfoID()->obj()); if(pDivInfo && pDivInfo->HasContents()) { return this; @@ -580,7 +580,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() while (pNext) { - LwpDivInfo* pDivInfo =static_cast(pNext->GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(pNext->GetDivInfoID()->obj()); if (pDivInfo && pDivInfo->HasContents()) pLast = pNext; pNext = pNext->GetNextInGroup(); @@ -594,9 +594,9 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetLastDivision() { - LwpDocSock* pDocSock = static_cast(GetSocket()->obj()); + LwpDocSock* pDocSock = dynamic_cast(GetSocket()->obj()); if(pDocSock) - return static_cast(pDocSock->GetChildTail()->obj()); + return dynamic_cast(pDocSock->GetChildTail()->obj()); return NULL; } @@ -605,9 +605,9 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetFirstDivision() { - LwpDocSock* pDocSock = static_cast(GetSocket()->obj()); + LwpDocSock* pDocSock = dynamic_cast(GetSocket()->obj()); if(pDocSock) - return static_cast(pDocSock->GetChildHead()->obj()); + return dynamic_cast(pDocSock->GetChildHead()->obj()); return NULL; } @@ -630,7 +630,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE() { - LwpDivInfo* pDivInfo =static_cast(GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(GetDivInfoID()->obj()); if(pDivInfo && pDivInfo->HasContents() && !pDivInfo->IsOleDivision()) return this; @@ -669,7 +669,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() */ LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout() { - LwpHeadLayout* pHeadLayout =static_cast(GetFoundry()->GetLayout()->obj()); + LwpHeadLayout* pHeadLayout = dynamic_cast(GetFoundry()->GetLayout()->obj()); if(pHeadLayout) { return pHeadLayout->FindEnSuperTableLayout(); @@ -685,7 +685,7 @@ LwpDocument* LwpDocument::GetPreviousDivision() if(this == pEndDivision) return sal_True; - LwpDivInfo* pDivInfo = static_cast(m_DivInfo.obj()); + LwpDivInfo* pDivInfo = dynamic_cast(m_DivInfo.obj()); if(pDivInfo) { pDivInfo->GetNumberOfPages(nCount); @@ -728,7 +728,7 @@ sal_uInt16 LwpDocument::GetNumberOfPagesBefore() { LwpDocument* pDivision = GetFirstDivision(); - LwpDivInfo* pDivInfo = static_cast(m_DivInfo.obj()); + LwpDivInfo* pDivInfo = dynamic_cast(m_DivInfo.obj()); if(pDivInfo) nNumPages += pDivInfo->GetMaxNumberOfPages(); while(pDivision) @@ -761,13 +761,13 @@ void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont) { LwpDocument* pDivision = GetFirstDivision(); - LwpDivInfo* pDivInfo = static_cast (GetDivInfoID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast (GetDivInfoID()->obj()); if(pDivInfo) { - LwpPageLayout* pPageLayout =static_cast(pDivInfo->GetInitialLayoutID()->obj()); + LwpPageLayout* pPageLayout = dynamic_cast(pDivInfo->GetInitialLayoutID()->obj()); if(pPageLayout) { - LwpStory* pStory = static_cast(pPageLayout->GetContent()->obj()); + LwpStory* pStory = dynamic_cast(pPageLayout->GetContent()->obj()); if(pStory) pStory->XFConvertFrameInPage(pCont); } @@ -784,7 +784,7 @@ void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont) void LwpDocument::ChangeStyleName() { XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager(); - XFTextStyle* pStyle = static_cast(pXFStyleManager->FindStyle(A2OUSTR("ClickHere"))); + XFTextStyle* pStyle = dynamic_cast(pXFStyleManager->FindStyle(A2OUSTR("ClickHere"))); if (pStyle) { pStyle->SetStyleName(A2OUSTR("Placeholder")); diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx index 1995759de7bd..92b41c327a81 100644 --- a/lotuswordpro/source/filter/lwpdoc.hxx +++ b/lotuswordpro/source/filter/lwpdoc.hxx @@ -89,6 +89,8 @@ public: ~LwpDocument(); private: + LwpFoundry* m_pOwnedFoundry; + //Data members in file format LwpObjectID m_DocSockID; sal_uInt16 m_nFlags; @@ -185,7 +187,7 @@ private: void MaxNumberOfPages(sal_uInt16& nNumPages); void XFConvertFrameInPage(XFContentContainer* pCont); void ChangeStyleName(); - sal_Bool IsSkippedDivision();//add by + sal_Bool IsSkippedDivision(); }; inline sal_Bool LwpDocument::IsChildDoc() diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx index 0c4ef8229ff9..4abed4e5391f 100644 --- a/lotuswordpro/source/filter/lwpfilter.cxx +++ b/lotuswordpro/source/filter/lwpfilter.cxx @@ -82,6 +82,8 @@ #include #include +#include + using namespace ::cppu; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; @@ -109,31 +111,19 @@ LWPFilterReader::~LWPFilterReader() sal_Bool LWPFilterReader::filter( const Sequence< PropertyValue >& aDescriptor ) throw( RuntimeException ) { - uno::Reference< XInputStream> xInputStream; ::rtl::OUString sURL; for( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ ) { - if( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) ) - aDescriptor[i].Value >>= xInputStream; + //Note we should attempt to use "InputStream" if it exists first! if( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ) aDescriptor[i].Value >>= sURL; } - if ( !xInputStream.is() ) - { - OSL_ASSERT( 0 ); - return sal_False; - } - - OString sFileName; - sFileName = ::rtl::OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII); - SvFileStream inputStream( sURL, STREAM_READ ); if ( inputStream.IsEof() || ( inputStream.GetError() != SVSTREAM_OK ) ) return sal_False; - - return (ReadWordproFile( &inputStream ,m_DocumentHandler) == 0); + return (ReadWordproFile(inputStream, m_DocumentHandler) == 0); } void LWPFilterReader::cancel() throw (com::sun::star::uno::RuntimeException) @@ -332,41 +322,39 @@ Sequence< OUString> LWPFilterImportFilter::getSupportedServiceNames( void ) thro #include "bento.hxx" using namespace OpenStormBento; #include "explode.hxx" - sal_Bool Decompress(SvStream *pCompressed, SvStream * & pDecompressed) + sal_Bool Decompress(SvStream *pCompressed, SvStream * & pOutDecompressed) { pCompressed->Seek(0); - pDecompressed = new SvMemoryStream(4096, 4096); + std::auto_ptr aDecompressed(new SvMemoryStream(4096, 4096)); unsigned char buffer[512]; pCompressed->Read(buffer, 16); - pDecompressed->Write(buffer, 16); + aDecompressed->Write(buffer, 16); - LwpSvStream * pLwpStream = new LwpSvStream(pCompressed); + boost::scoped_ptr aLwpStream(new LwpSvStream(pCompressed)); LtcBenContainer* pBentoContainer; - /*ULONG ulRet = */ BenOpenContainer(pLwpStream, &pBentoContainer); - LtcUtBenValueStream * pWordProData = (LtcUtBenValueStream *)pBentoContainer->FindValueStreamWithPropertyName("WordProData"); + sal_uLong ulRet = BenOpenContainer(aLwpStream.get(), &pBentoContainer); + if (ulRet != BenErr_OK) + return sal_False; + + boost::scoped_ptr aWordProData((LtcUtBenValueStream *)pBentoContainer->FindValueStreamWithPropertyName("WordProData")); + + if (!aWordProData.get()) + return sal_False; // decompressing - Decompression decompress(pWordProData, pDecompressed); + Decompression decompress(aWordProData.get(), aDecompressed.get()); if (0!= decompress.explode()) - { - delete pDecompressed; - pDecompressed = NULL; - delete pWordProData; - delete pLwpStream; return sal_False; - } - sal_uInt32 nPos = pWordProData->GetSize(); + sal_uInt32 nPos = aWordProData->GetSize(); nPos += 0x10; pCompressed->Seek(nPos); while (sal_uInt32 iRead = pCompressed->Read(buffer, 512)) - { - pDecompressed->Write(buffer, iRead); - } + aDecompressed->Write(buffer, iRead); - delete pWordProData; - delete pLwpStream; + //transfer ownership of aDecompressed's ptr + pOutDecompressed = aDecompressed.release(); return sal_True; } @@ -410,40 +398,38 @@ using namespace OpenStormBento; } return bCompressed; } -int ReadWordproFile(SvStream* pStream, uno::Reference& xHandler) +int ReadWordproFile(SvStream &rStream, uno::Reference& xHandler) { try { - LwpSvStream *pLwpSvStream = NULL; - SvStream * pDecompressed = NULL; - if ( GetLwpSvStream(pStream, pLwpSvStream) && pLwpSvStream) + LwpSvStream *pRawLwpSvStream = NULL; + boost::scoped_ptr aLwpSvStream; + boost::scoped_ptr aCompressedLwpSvStream; + boost::scoped_ptr aDecompressed; + if (GetLwpSvStream(&rStream, pRawLwpSvStream) && pRawLwpSvStream) { - pDecompressed = pLwpSvStream->GetStream(); + SvStream *pDecompressed = pRawLwpSvStream->GetStream(); + if (pDecompressed) + { + aDecompressed.reset(pDecompressed); + aCompressedLwpSvStream.reset(pRawLwpSvStream->GetCompressedStream()); + } } - if (!pLwpSvStream) + + if (!pRawLwpSvStream) { // nothing returned, fail when uncompressing return 1; } - IXFStream *pStrm = new XFSaxStream(xHandler); - Lwp9Reader reader(pLwpSvStream, pStrm); + aLwpSvStream.reset(pRawLwpSvStream); + + boost::scoped_ptr pStrm(new XFSaxStream(xHandler)); + Lwp9Reader reader(aLwpSvStream.get(), pStrm.get()); //Reset all static objects,because this function may be called many times. XFGlobalReset(); reader.Read(); - // added by - - if (pDecompressed) - { - delete pDecompressed; - LwpSvStream * pTemp = pLwpSvStream->GetCompressedStream(); - delete pTemp; - } - delete pLwpSvStream; - // end added by - - delete pStrm; return 0; } catch (...) diff --git a/lotuswordpro/source/filter/lwpfilter.hxx b/lotuswordpro/source/filter/lwpfilter.hxx index 0484f5178cd9..5653fd8d53f3 100644 --- a/lotuswordpro/source/filter/lwpfilter.hxx +++ b/lotuswordpro/source/filter/lwpfilter.hxx @@ -174,9 +174,8 @@ public: uno::Reference< XImporter > rImporter; }; -int ReadWordproFile(String& strName,uno::Reference& XDoc); //test code -int ReadWordproFile(SvStream* pStream, uno::Reference& XDoc); +int ReadWordproFile(SvStream &rStream, uno::Reference& XDoc); #endif diff --git a/lotuswordpro/source/filter/lwpfont.cxx b/lotuswordpro/source/filter/lwpfont.cxx index 85eb7f76881a..e39f8f00cf09 100644 --- a/lotuswordpro/source/filter/lwpfont.cxx +++ b/lotuswordpro/source/filter/lwpfont.cxx @@ -247,7 +247,8 @@ void LwpFontTableEntry::RegisterFontDecl() } LwpFontTable::LwpFontTable() - : m_pFontEntries(NULL) + : m_nCount(0) + , m_pFontEntries(NULL) {} void LwpFontTable::Read(LwpObjectStream *pStrm) @@ -267,10 +268,8 @@ void LwpFontTable::Read(LwpObjectStream *pStrm) OUString LwpFontTable::GetFaceName(sal_uInt16 index) //index: start from 1 { - assert(index>0); - if (index < 1)//add for fix crash - return OUString(); - return m_pFontEntries[index-1].GetFaceName(); + assert(index <= m_nCount && index > 0); + return (index <= m_nCount && index > 0) ? m_pFontEntries[index-1].GetFaceName() : OUString(); } LwpFontTable::~LwpFontTable() @@ -398,7 +397,9 @@ void LwpFontNameManager::Read(LwpObjectStream *pStrm) void LwpFontNameManager::Override(sal_uInt16 index, XFFont* pFont) //index: start from 1 { - if(index<1) return; + if (index > m_nCount || index < 1) + return ; + m_pFontNames[index-1].Override(pFont); if(m_pFontNames[index-1].IsFaceNameOverridden()) pFont->SetFontName(m_FontTbl.GetFaceName(m_pFontNames[index-1].GetFaceID())); @@ -436,7 +437,9 @@ void LwpFontAttrManager::Read(LwpObjectStream *pStrm) { void LwpFontAttrManager::Override(sal_uInt16 index, XFFont* pFont) //index: start from 1 { - if(index<1) return; + if (index > m_nCount || index < 1) + return ; + m_pFontAttrs[index-1].Override(pFont); } diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx index e366bccbc10c..985e3f2b1532 100644 --- a/lotuswordpro/source/filter/lwpfootnote.cxx +++ b/lotuswordpro/source/filter/lwpfootnote.cxx @@ -141,7 +141,7 @@ void LwpFribFootnote::XFConvert(XFContentContainer* pCont) */ LwpFootnote* LwpFribFootnote::GetFootnote() { - return static_cast(m_Footnote.obj()); + return dynamic_cast(m_Footnote.obj()); } @@ -211,7 +211,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout() LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow); if(pRowLayout) { - return static_cast(pRowLayout->GetChildHead()->obj()); + return dynamic_cast(pRowLayout->GetChildHead()->obj()); } } } @@ -410,7 +410,7 @@ LwpTable* LwpFootnote::GetFootnoteTable(LwpEnSuperTableLayout * pLayout) { LwpEndnoteLayout* pEndnoteLayout = static_cast(pLayout->GetMainTableLayout()); if(pEndnoteLayout) - return static_cast(pEndnoteLayout->GetContent()->obj()); + return dynamic_cast(pEndnoteLayout->GetContent()->obj()); } return NULL; } @@ -420,7 +420,7 @@ LwpTable* LwpFootnote::GetFootnoteTable(LwpEnSuperTableLayout * pLayout) */ LwpContent* LwpFootnote::FindFootnoteContent() { - LwpContent* pContent = static_cast(m_Content.obj()); + LwpContent* pContent = dynamic_cast(m_Content.obj()); //if the content has layout, the content has footnote contents; //or looking for the celllayout and return the footnote contents. if(pContent && pContent->GetLayout(NULL)) @@ -429,7 +429,7 @@ LwpContent* LwpFootnote::FindFootnoteContent() LwpCellLayout* pCellLayout = GetCellLayout(); if(pCellLayout) { - pContent =static_cast(pCellLayout->GetContent()->obj()); + pContent = dynamic_cast(pCellLayout->GetContent()->obj()); } return pContent; diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx index 9f898d97a0b4..a2263d98ec91 100644 --- a/lotuswordpro/source/filter/lwpfoundry.cxx +++ b/lotuswordpro/source/filter/lwpfoundry.cxx @@ -75,7 +75,10 @@ #include "lwpglobalmgr.hxx" LwpFoundry::LwpFoundry(LwpObjectStream *pStrm, LwpDocument* pDoc) - : m_pDoc(pDoc), m_pPieceMgr(NULL), m_pStyleMgr(NULL) + : m_pDoc(pDoc) + , m_bRegisteredAll(false) + , m_pPieceMgr(NULL) + , m_pStyleMgr(NULL) { Read(pStrm); m_pDropcapMgr = new LwpDropcapMgr; @@ -184,6 +187,14 @@ void LwpFoundry::ReadStyles(LwpObjectStream *pStrm) void LwpFoundry::RegisterAllLayouts() { + if (m_bRegisteredAll) + { + OSL_FAIL("recursive LwpFoundry::RegisterAllLayouts!\n"); + return; + } + + m_bRegisteredAll = true; + //Register CellStyle LwpObject* pStyle = m_CellStyle.obj(); if( pStyle ) @@ -193,7 +204,7 @@ void LwpFoundry::RegisterAllLayouts() } //register content page layout list: Layout - pStyle = m_Layout.obj(); + pStyle = m_Layout.obj(); if( pStyle ) { pStyle->SetFoundry(this); diff --git a/lotuswordpro/source/filter/lwpfoundry.hxx b/lotuswordpro/source/filter/lwpfoundry.hxx index 765097ae10bd..8e5741c3cd93 100644 --- a/lotuswordpro/source/filter/lwpfoundry.hxx +++ b/lotuswordpro/source/filter/lwpfoundry.hxx @@ -221,6 +221,7 @@ public: void RegisterAllLayouts(); private: LwpDocument* m_pDoc; + bool m_bRegisteredAll; private: //file members LwpVersionManager m_VerMgr; LwpObjectManager m_ObjMgr; diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index c90663abb2dd..e1f35522cd24 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -888,11 +888,16 @@ OUString LwpFrameLayout::GetNextLinkName() LwpObjectID* pObjectID = m_Link.GetNextLayout(); if(!pObjectID->IsNull()) { - LwpLayout* pLayout = static_cast(pObjectID->obj()); - aName = pLayout->GetName()->str(); - //for division name confict - if(pLayout->GetStyleName().getLength() > 0) - aName = pLayout->GetStyleName(); + LwpLayout* pLayout = dynamic_cast(pObjectID->obj()); + if (pLayout) + { + LwpAtomHolder *pHolder = pLayout->GetName(); + if (pHolder) + aName = pHolder->str(); + //for division name confict + if(pLayout->GetStyleName().getLength() > 0) + aName = pLayout->GetStyleName(); + } } return aName; } diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx index 398896fd7f2c..3deedc897777 100644 --- a/lotuswordpro/source/filter/lwpfrib.cxx +++ b/lotuswordpro/source/filter/lwpfrib.cxx @@ -337,26 +337,33 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry) void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo) { - sal_uInt8 Modifier; - sal_uInt8 len; -// sal_Bool ModifyFlag = sal_False; - for(;;) { + sal_uInt8 Modifier(0); + sal_uInt8 len(0); + // Get the modifier type - pObjStrm->QuickRead(&Modifier, sizeof(Modifier)); + if (pObjStrm->QuickRead(&Modifier, sizeof(Modifier)) != sizeof(Modifier)) + break; // Stop when we hit the last modifier if (Modifier == FRIB_MTAG_NONE) break; -// ModifyFlag = sal_True; + // Get the modifier length - pObjStrm->QuickRead(&len, sizeof(len)); + if (pObjStrm->QuickRead(&len, sizeof(len)) != sizeof(len)) + break; switch (Modifier) { case FRIB_MTAG_FONT: - pObjStrm->QuickRead(&pModInfo->FontID,len); + if (len > sizeof(pModInfo->FontID)) + { + OSL_FAIL("FRIB_MTAG_FONT entry wrong size\n"); + pObjStrm->SeekRel(len); + } + else + pObjStrm->QuickRead(&pModInfo->FontID,len); break; case FRIB_MTAG_CHARSTYLE: pModInfo->HasCharStyle = sal_True; @@ -367,15 +374,19 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo) pModInfo->Language.Read(pObjStrm); break; case FRIB_MTAG_CODEPAGE: - pObjStrm->QuickRead(&pModInfo->CodePage,len); + if (len > sizeof(pModInfo->CodePage)) + { + OSL_FAIL("FRIB_MTAG_CODEPAGE entry wrong size\n"); + pObjStrm->SeekRel(len); + } + else + pObjStrm->QuickRead(&pModInfo->CodePage,len); break; - //add by , 02/22/2005 case FRIB_MTAG_ATTRIBUTE: pModInfo->aTxtAttrOverride.Read(pObjStrm); if (pModInfo->aTxtAttrOverride.IsHighLight()) pModInfo->HasHighLight = sal_True; break; - //end add case FRIB_MTAG_REVISION: pModInfo->RevisionType = pObjStrm->QuickReaduInt8(); pModInfo->RevisionFlag = sal_True; @@ -385,10 +396,7 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo) break; } // TODO: read the modifier data - // pObjStrm->SeekRel(len); - } - } //do nothing diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx index abf884bc4fbe..3e617da8cd68 100644 --- a/lotuswordpro/source/filter/lwpfribframe.cxx +++ b/lotuswordpro/source/filter/lwpfribframe.cxx @@ -92,14 +92,21 @@ LwpObject* LwpFribFrame::GetLayout() */ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry) { - if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT) + LwpObject *pObject = m_objLayout.obj(); + + if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT) { - static_cast(m_objLayout.obj())->RegisterStyle(pFoundry); + LwpDropcapLayout *pLayout = dynamic_cast(pObject); + if (!pLayout) + return; + pLayout->RegisterStyle(pFoundry); } else { - //register frame style, , 04/07/2005 - LwpPlacableLayout* pLayout = static_cast(m_objLayout.obj()); + //register frame style + LwpPlacableLayout* pLayout = dynamic_cast(pObject); + if (!pLayout) + return; pLayout->SetFoundry(pFoundry); pLayout->RegisterStyle(); @@ -125,10 +132,12 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry) } void LwpFribFrame::SetParaDropcap(LwpPara* pPara) { - if (m_objLayout.obj()->GetTag() == VO_DROPCAPLAYOUT) + LwpObject *pObject = m_objLayout.obj(); + + if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT) { pPara->SetParaDropcap(sal_True); - pPara->SetDropcapLayout(static_cast(m_objLayout.obj())); + pPara->SetDropcapLayout(dynamic_cast(pObject)); } else pPara->SetParaDropcap(sal_False); @@ -141,7 +150,9 @@ void LwpFribFrame::SetParaDropcap(LwpPara* pPara) void LwpFribFrame::XFConvert(XFContentContainer* pCont) { XFContentContainer* pXFContentContainer = pCont; - LwpVirtualLayout* pLayout = static_cast(GetLayout()); + LwpVirtualLayout* pLayout = dynamic_cast(GetLayout()); + if (!pLayout) + return; sal_uInt8 nType = pLayout->GetRelativeType(); if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType) { @@ -232,7 +243,7 @@ void LwpFribRubyFrame::XFConvert(XFContentContainer* /*pCont*/) LwpRubyLayout* LwpFribRubyFrame::GetLayout() { - return static_cast(m_objLayout.obj()); + return dynamic_cast(m_objLayout.obj()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx index fb2bd846edef..c2780816c232 100644 --- a/lotuswordpro/source/filter/lwpfribmark.cxx +++ b/lotuswordpro/source/filter/lwpfribmark.cxx @@ -94,7 +94,7 @@ void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/) LwpCHBlkMarker* LwpFribCHBlock::GetMarker() { - return static_cast(m_objMarker.obj()); + return dynamic_cast(m_objMarker.obj()); } void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory) @@ -147,7 +147,9 @@ void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry) LwpObjectID* pID = pDoc->GetDivInfoID(); if (!pID->IsNull()) { - sDivision = static_cast(pID->obj(VO_DIVISIONINFO))->GetDivName(); + LwpDivInfo *pDivInvo = dynamic_cast(pID->obj(VO_DIVISIONINFO)); + if (pDivInvo) + sDivision = pDivInvo->GetDivName(); } } @@ -230,7 +232,7 @@ void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/) LwpFieldMark* LwpFribField::GetMarker() { - return static_cast(m_objMarker.obj()); + return dynamic_cast(m_objMarker.obj()); } void LwpFribField::XFConvert(XFContentContainer* pXFPara) @@ -1421,7 +1423,7 @@ LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara ): LwpFrib(pPara) LwpRubyMarker* LwpFribRubyMarker::GetMarker() { - return static_cast(m_objMarker.obj(VO_RUBYMARKER)); + return dynamic_cast(m_objMarker.obj(VO_RUBYMARKER)); } void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/) diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx index 7815cc2c3d34..3511baf03a4f 100644 --- a/lotuswordpro/source/filter/lwpfribptr.cxx +++ b/lotuswordpro/source/filter/lwpfribptr.cxx @@ -90,7 +90,8 @@ LwpFribPtr::LwpFribPtr() : m_pFribs(NULL),m_pXFPara(NULL),m_pPara(NULL) -{} +{ +} LwpFribPtr::~LwpFribPtr() { @@ -226,7 +227,7 @@ void LwpFribPtr::XFConvert() case FRIB_TAG_PAGEBREAK: { LwpFribPageBreak* pPageBreak = static_cast(pFrib); - LwpPageLayout* pLayout = static_cast(pPageBreak->GetLayout()->obj()); + LwpPageLayout* pLayout = dynamic_cast(pPageBreak->GetLayout()->obj()); if(pLayout) { pPageBreak->ParseLayout(); @@ -291,13 +292,8 @@ void LwpFribPtr::XFConvert() { LwpFribFrame* frameFrib= static_cast(pFrib); LwpObject* pLayout = frameFrib->GetLayout(); - if (pLayout->GetTag() == VO_DROPCAPLAYOUT) - { + if (pLayout && pLayout->GetTag() == VO_DROPCAPLAYOUT) m_pPara->GetFoundry()->GetDropcapMgr()->SetXFPara(m_pXFPara); - //LwpObject* pDropCap = frameFrib->GetLayout(); - //pDropCap ->XFConvert(m_pXFPara); - } - //pLayout->XFConvert(m_pXFPara); frameFrib->XFConvert(m_pXFPara); } break; @@ -406,8 +402,9 @@ void LwpFribPtr::FindLayouts() //StartWithinColume type not support now break; } - LwpStory* pStory = static_cast(m_pPara->GetStoryID()->obj()); - pStory->AddPageLayout(pSection->GetPageLayout()); + LwpStory* pStory = dynamic_cast(m_pPara->GetStoryID()->obj()); + if (pStory) + pStory->AddPageLayout(pSection->GetPageLayout()); } } @@ -416,11 +413,12 @@ void LwpFribPtr::FindLayouts() case FRIB_TAG_PAGEBREAK: { LwpFribPageBreak* pPageBreak = static_cast(pFrib); - LwpPageLayout* pLayout = static_cast(pPageBreak->GetLayout()->obj()); + LwpPageLayout* pLayout = dynamic_cast(pPageBreak->GetLayout()->obj()); if(pLayout) { - LwpStory* pStory = static_cast(m_pPara->GetStoryID()->obj()); - pStory->AddPageLayout(pLayout); + LwpStory* pStory = dynamic_cast(m_pPara->GetStoryID()->obj()); + if (pStory) + pStory->AddPageLayout(pLayout); } break; } @@ -614,9 +612,9 @@ void LwpFribPtr::ProcessDropcap(LwpStory* pStory,LwpFrib* pFrib,sal_uInt32 nLen) XFTextStyle* pFribStyle = pXFStyleManager->FindTextStyle(pFrib->GetStyleName()); pFribStyle->GetFont()->SetFontSize(0); - LwpObject* pObj= pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj(); + LwpDropcapLayout* pObj = dynamic_cast(pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj()); if (pObj) - static_cast(pObj)->SetChars(nLen); + pObj->SetChars(nLen); } } } @@ -649,7 +647,7 @@ sal_Bool LwpFribPtr::ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtua case FRIB_TAG_PAGEBREAK: { LwpFribPageBreak* pPageBreak = static_cast(pFrib); - pLayout = static_cast(pPageBreak->GetLayout()->obj()); + pLayout = dynamic_cast(pPageBreak->GetLayout()->obj()); break; } default: diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index 24f33125e6c7..83a3a1f3b9cf 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -94,6 +94,8 @@ LwpGraphicObject::LwpGraphicObject(LwpObjectHeader &objHdr, LwpSvStream* pStrm) , m_bIsLinked(0) , m_bCompressed(0) { + memset(m_sDataFormat, 0, sizeof(m_sDataFormat)); + memset(m_sServerContextFormat, 0, sizeof(m_sServerContextFormat)); } LwpGraphicObject::~LwpGraphicObject() { @@ -207,21 +209,6 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont) { if ((m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w')) { -/* LwpSvStream* pStream = m_pStrm; - //test code - OpenStormBento::LtcBenContainer* pBentoContainer; - ULONG ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); - std::vector vStream; - std::vector::iterator iter; - pBentoContainer->CreateGraphicStreams(&vStream); - for (iter=vStream.begin();iter!=vStream.end();iter++) - { - LwpSdwFileLoader fileLoader(*iter,pOutputStream); - fileLoader.LoadObjectList(); - delete *iter; - } - vStream.clear();*/ - //XFParagraph* pPara = new XFParagraph(); std::vector ::iterator iter; for (iter = m_vXFDrawObjects.begin(); iter != m_vXFDrawObjects.end(); ++iter) @@ -375,24 +362,7 @@ void LwpGraphicObject::RegisterStyle() { this->CreateGrafObject(); } -/* if (m_sServerContextFormat[1]=='s'&&m_sServerContextFormat[2]=='d'&&m_sServerContextFormat[3]=='w') - { - LwpSvStream* pStream = m_pStrm; - //test code - OpenStormBento::LtcBenContainer* pBentoContainer; - ULONG ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); - std::vector vStream; - std::vector::iterator iter; - pBentoContainer->CreateGraphicStreams(&vStream); - for (iter=vStream.begin();iter!=vStream.end();iter++) - { - LwpSdwFileLoader fileLoader(*iter); - fileLoader.RegisterStyle(); - delete *iter; - } - vStream.clear(); - }*/ if (m_sServerContextFormat[1]=='l'&&m_sServerContextFormat[2]=='c'&&m_sServerContextFormat[3]=='h') { LwpVirtualLayout* pMyLayout = GetLayout(NULL); @@ -418,7 +388,10 @@ void LwpGraphicObject::CreateDrawObjects() LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm; OpenStormBento::LtcBenContainer* pBentoContainer; - /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + if (ulRet != OpenStormBento::BenErr_OK) + return; + SvStream* pDrawObjStream = NULL; // get graphic object's bento objet name @@ -463,7 +436,10 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData) LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm; OpenStormBento::LtcBenContainer* pBentoContainer; - /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + if (ulRet != OpenStormBento::BenErr_OK) + return 0; + SvStream* pGrafStream = NULL; // get graphic object's bento objet name @@ -503,7 +479,9 @@ sal_uInt32 LwpGraphicObject::GetGrafData(sal_uInt8*& pGrafData) LwpSvStream* pStream = m_pStrm->GetCompressedStream() ? m_pStrm->GetCompressedStream(): m_pStrm; OpenStormBento::LtcBenContainer* pBentoContainer; - /*ULONG ulRet =*/ OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer); + if (ulRet != OpenStormBento::BenErr_OK) + return 0; SvStream* pGrafStream = NULL; diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index ba0192d56ee9..f798c29cfa08 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -69,6 +69,7 @@ **********************************************************************************************************************/ #include "lwpidxmgr.hxx" +#include "lwptools.hxx" const sal_uInt8 LwpIndexManager::MAXOBJECTIDS = 255; @@ -122,8 +123,11 @@ void LwpIndexManager::Read(LwpSvStream* pStrm) for (sal_uInt16 k = 0; k < m_nLeafCount; k++) { //Read leaf - pStrm->Seek(m_ChildIndex[k]+LwpSvStream::LWP_STREAM_BASE); + sal_Int64 nPos = m_ChildIndex[k]+LwpSvStream::LWP_STREAM_BASE; + sal_Int64 nActualPos = pStrm->Seek(nPos); + if (nPos != nActualPos) + throw BadSeek(); //Old Code //ReadLeafIndex(pStrm); @@ -150,7 +154,7 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm) sal_uInt16 KeyCount = 0; pObjStrm->QuickRead(&KeyCount, sizeof(KeyCount)); - m_nLeafCount = KeyCount + 1; + m_nLeafCount = KeyCount ? KeyCount + 1 : 0; if(KeyCount) { @@ -160,7 +164,6 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm) m_RootObjs.push_back(akey); - //sal_uInt8 k = 0; sal_uInt16 k = 0; for (k = 1; k < KeyCount; k++) @@ -216,7 +219,9 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm) } for (k = 0; k < KeyCount; k++) + { pObjStrm->QuickRead(&(vObjIndexs[k]->offset), sizeof(sal_uInt32)); + } for (k = 0; k < LeafCount; k++) pObjStrm->QuickRead(&(m_TempVec[k]), sizeof(sal_uInt32)); @@ -224,7 +229,13 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm) for( sal_uInt16 j=0; jGetStream()->Seek( m_TempVec[j]+LwpSvStream::LWP_STREAM_BASE); + sal_Int64 nPos = m_TempVec[j]+LwpSvStream::LWP_STREAM_BASE; + sal_Int64 nActualPos = pObjStrm->GetStream()->Seek(nPos); + + if (nPos != nActualPos) + throw BadSeek(); + + ReadLeafIndex(pObjStrm->GetStream()); if(j!=LeafCount-1) @@ -283,7 +294,7 @@ void LwpIndexManager::ReadLeafIndex( LwpSvStream *pStrm ) */ void LwpIndexManager::ReadLeafData( LwpObjectStream *pObjStrm ) { - sal_uInt16 KeyCount; + sal_uInt16 KeyCount=0; pObjStrm->QuickRead(&KeyCount, sizeof(KeyCount)); if(KeyCount) @@ -296,13 +307,13 @@ void LwpIndexManager::ReadLeafData( LwpObjectStream *pObjStrm ) for (sal_uInt8 k = 1; k < KeyCount; k++) { akey = new LwpKey(); - akey->id.ReadCompressed(pObjStrm, m_ObjectKeys[m_nKeyCount+k-1]->id); + akey->id.ReadCompressed(pObjStrm, m_ObjectKeys.at(m_nKeyCount+k-1)->id); m_ObjectKeys.push_back(akey); } for (sal_uInt8 j = 0; j < KeyCount; j++) { - pObjStrm->QuickRead(&(m_ObjectKeys[m_nKeyCount+j]->offset), sizeof(sal_uInt32)); + pObjStrm->QuickRead(&(m_ObjectKeys.at(m_nKeyCount+j)->offset), sizeof(sal_uInt32)); } } m_nKeyCount += KeyCount; diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index af6aa83f40af..1164aee1c707 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -80,7 +80,8 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm) : LwpDLNFPVList(objHdr, pStrm) -{} +{ +} void LwpVirtualLayout::Read() { @@ -138,7 +139,7 @@ sal_Bool LwpVirtualLayout::HonorProtection() if(!(m_nAttributes2 & STYLE2_HONORPROTECTION)) return sal_False; - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { return pParent->HonorProtection(); @@ -166,7 +167,7 @@ sal_Bool LwpVirtualLayout::IsProtected() { sal_Bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0; - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected)) @@ -198,7 +199,7 @@ sal_Bool LwpVirtualLayout::HasProtection() if(m_nAttributes & STYLE_PROTECTED) return sal_True; - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { return pParent->HasProtection(); @@ -229,7 +230,7 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen() if(GetLayoutType()!=LWP_PAGE_LAYOUT) { //get parent - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT)) return pParent->GetUseWhen(); @@ -341,7 +342,7 @@ sal_Bool LwpVirtualLayout::IsMinimumHeight() */ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout() { - return static_cast (GetParent()->obj()); + return dynamic_cast (GetParent()->obj()); } /** @@ -351,12 +352,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout() void LwpVirtualLayout::RegisterChildStyle() { //Register all children styles - LwpVirtualLayout* pLayout = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLayout = dynamic_cast(GetChildHead()->obj()); while(pLayout) { pLayout->SetFoundry(m_pFoundry); pLayout->RegisterStyle(); - pLayout = static_cast(pLayout->GetNext()->obj()); + pLayout = dynamic_cast(pLayout->GetNext()->obj()); } } @@ -370,7 +371,7 @@ sal_Bool LwpVirtualLayout::IsStyleLayout() if (m_nAttributes3 & STYLE3_STYLELAYOUT) return sal_True; - LwpVirtualLayout* pParent =static_cast(GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast(GetParent()->obj()); if (pParent) return pParent->IsStyleLayout(); return sal_False; @@ -386,7 +387,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType) while(pID && !pID->IsNull()) { - LwpVirtualLayout * pLayout = static_cast(pID->obj()); + LwpVirtualLayout * pLayout = dynamic_cast(pID->obj()); if(!pLayout) { break; @@ -446,30 +447,30 @@ LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout if (!pStartLayout && !m_OnlyLayout.IsNull()) /* Looking for the first layout and there's only one layout in the list.*/ - return static_cast(m_OnlyLayout.obj()); + return dynamic_cast(m_OnlyLayout.obj()); - LwpObjectHolder* pObjHolder =static_cast(m_Layouts.GetHead()->obj()); + LwpObjectHolder* pObjHolder = dynamic_cast(m_Layouts.GetHead()->obj()); if(pObjHolder) { - pLayout = static_cast(pObjHolder->GetObject()->obj()); + pLayout = dynamic_cast(pObjHolder->GetObject()->obj()); if(!pStartLayout ) return pLayout; while(pObjHolder && pStartLayout != pLayout) { - pObjHolder = static_cast(pObjHolder->GetNext()->obj()); + pObjHolder = dynamic_cast(pObjHolder->GetNext()->obj()); if(pObjHolder) { - pLayout = static_cast(pObjHolder->GetObject()->obj()); + pLayout = dynamic_cast(pObjHolder->GetObject()->obj()); } } if(pObjHolder) { - pObjHolder = static_cast(pObjHolder->GetNext()->obj()); + pObjHolder = dynamic_cast(pObjHolder->GetNext()->obj()); if(pObjHolder) { - pLayout = static_cast(pObjHolder->GetObject()->obj()); + pLayout = dynamic_cast(pObjHolder->GetObject()->obj()); return pLayout; } } @@ -496,16 +497,27 @@ void LwpHeadLayout::Read() void LwpHeadLayout::RegisterStyle() { //Register all children styles - LwpVirtualLayout* pLayout = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLayout = dynamic_cast(GetChildHead()->obj()); while(pLayout) { pLayout->SetFoundry(m_pFoundry); //if the layout is relative to para, the layout will be registered in para if(!pLayout->IsRelativeAnchored()) { + if (pLayout == this) + { + OSL_FAIL("Layout points to itself"); + break; + } pLayout->RegisterStyle(); } - pLayout = static_cast(pLayout->GetNext()->obj()); + LwpVirtualLayout *pNext = dynamic_cast(pLayout->GetNext()->obj()); + if (pNext == pLayout) + { + OSL_FAIL("Layout points to itself"); + break; + } + pLayout = pNext; } } @@ -515,14 +527,14 @@ void LwpHeadLayout::RegisterStyle() */ LwpVirtualLayout* LwpHeadLayout::FindEnSuperTableLayout() { - LwpVirtualLayout* pLayout = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLayout = dynamic_cast(GetChildHead()->obj()); while(pLayout) { if(pLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT) { return pLayout; } - pLayout = static_cast(pLayout->GetNext()->obj()); + pLayout = dynamic_cast(pLayout->GetNext()->obj()); } return NULL; } @@ -645,12 +657,12 @@ LwpLayoutGeometry* LwpMiddleLayout::GetGeometry() { if( !m_LayGeometry.IsNull() ) { - return ( static_cast (m_LayGeometry.obj()) ); + return ( dynamic_cast (m_LayGeometry.obj()) ); } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetGeometry(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetGeometry() : NULL; } return NULL; } @@ -697,8 +709,9 @@ sal_Bool LwpMiddleLayout::MarginsSameAsParent() } if(!m_BasedOnStyle.IsNull()) { - LwpVirtualLayout* play = static_cast (m_BasedOnStyle.obj()); - play->MarginsSameAsParent(); + LwpVirtualLayout* pLay = dynamic_cast (m_BasedOnStyle.obj()); + if (pLay) + pLay->MarginsSameAsParent(); } return LwpVirtualLayout::MarginsSameAsParent(); @@ -715,7 +728,7 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide) { if ( MarginsSameAsParent() ) { - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { fValue = pParent->GetMarginsValue(nWhichSide); @@ -726,14 +739,14 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide) if(m_nOverrideFlag & OVER_MARGINS) { - LwpLayoutMargins* pMar1 = static_cast (m_LayMargins.obj()); + LwpLayoutMargins* pMar1 = dynamic_cast (m_LayMargins.obj()); if(pMar1) { fValue = pMar1->GetMargins()->GetMarginsValue(nWhichSide); return fValue; } } - LwpVirtualLayout* pStyle = static_cast (m_BasedOnStyle.obj()); + LwpVirtualLayout* pStyle = dynamic_cast (m_BasedOnStyle.obj()); if(pStyle) { fValue = pStyle->GetMarginsValue(nWhichSide); @@ -752,14 +765,14 @@ double LwpMiddleLayout::GetExtMarginsValue(const sal_uInt8 &nWhichSide) double fValue = 0; if(m_nOverrideFlag & OVER_MARGINS) { - LwpLayoutMargins* pMar1 = static_cast (m_LayMargins.obj()); + LwpLayoutMargins* pMar1 = dynamic_cast (m_LayMargins.obj()); if(pMar1) { fValue = pMar1->GetExtMargins()->GetMarginsValue(nWhichSide); return fValue; } } - LwpVirtualLayout* pStyle = static_cast (m_BasedOnStyle.obj()); + LwpVirtualLayout* pStyle = dynamic_cast (m_BasedOnStyle.obj()); if(pStyle) { fValue = pStyle->GetExtMarginsValue(nWhichSide); @@ -777,13 +790,13 @@ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff() { if(m_nOverrideFlag & OVER_BORDERS) { - LwpLayoutBorder* pLayoutBorder = static_cast(m_LayBorderStuff.obj()); - return pLayoutBorder->GetBorderStuff(); + LwpLayoutBorder* pLayoutBorder = dynamic_cast(m_LayBorderStuff.obj()); + return pLayoutBorder ? pLayoutBorder->GetBorderStuff() : NULL; } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetBorderStuff(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetBorderStuff() : NULL; } return NULL; } @@ -798,13 +811,13 @@ LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff() { if(m_nOverrideFlag & OVER_BACKGROUND) { - LwpLayoutBackground* pLayoutBackground = static_cast(m_LayBackgroundStuff.obj()); - return pLayoutBackground->GetBackgoudStuff(); + LwpLayoutBackground* pLayoutBackground = dynamic_cast(m_LayBackgroundStuff.obj()); + return pLayoutBackground ? pLayoutBackground->GetBackgoudStuff() : NULL; } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetBackgroundStuff(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetBackgroundStuff() : NULL; } return NULL; } @@ -905,13 +918,13 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride() if(m_nAttributes & OVER_TABS) { if(!m_TabPiece.IsNull()) - return (LwpTabOverride*)static_cast(m_TabPiece.obj())->GetOverride(); + return (LwpTabOverride*) dynamic_cast(m_TabPiece.obj())->GetOverride(); return NULL; } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetTabOverride(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetTabOverride() : NULL; } return NULL; } @@ -927,7 +940,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleMode(void) if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj()) return GetLayoutScale()->GetScaleMode(); else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScaleMode(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScaleMode(); else return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO); } @@ -945,7 +958,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleTile(void) return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED) ? 1 : 0; else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScaleTile(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScaleTile(); else return 0; } @@ -965,7 +978,7 @@ sal_uInt16 LwpMiddleLayout::GetScaleCenter(void) return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED) ? 1 : 0; else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScaleCenter(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScaleCenter(); else return 0; } @@ -984,7 +997,7 @@ sal_uInt32 LwpMiddleLayout::GetScalePercentage(void) if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj()) return GetLayoutScale()->GetScalePercentage()/10;//m_nScalePercentage 1000 = 100% else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScalePercentage(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScalePercentage(); else return 100; } @@ -1000,7 +1013,7 @@ double LwpMiddleLayout::GetScaleWidth(void) if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj()) return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleWidth()); else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScaleWidth(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScaleWidth(); else return 0; } @@ -1016,7 +1029,7 @@ double LwpMiddleLayout::GetScaleHeight(void) if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj()) return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleHeight()); else if (m_BasedOnStyle.obj()) - return static_cast(m_BasedOnStyle.obj())->GetScaleHeight(); + return dynamic_cast(m_BasedOnStyle.obj())->GetScaleHeight(); else return 0; } @@ -1073,8 +1086,8 @@ sal_Bool LwpMiddleLayout::IsSizeRightToContainer(void) } else if (m_BasedOnStyle.obj()) { - LwpMiddleLayout * pLayout = static_cast(m_BasedOnStyle.obj()); - return pLayout->IsSizeRightToContainer(); + LwpMiddleLayout * pLayout = dynamic_cast(m_BasedOnStyle.obj()); + return pLayout ? pLayout->IsSizeRightToContainer() : sal_False; } else return sal_False; @@ -1092,8 +1105,8 @@ sal_Bool LwpMiddleLayout::IsSizeRightToContent(void) } else if (m_BasedOnStyle.obj()) { - LwpMiddleLayout * pLayout = static_cast(m_BasedOnStyle.obj()); - return pLayout->IsSizeRightToContent(); + LwpMiddleLayout * pLayout = dynamic_cast(m_BasedOnStyle.obj()); + return pLayout ? pLayout->IsSizeRightToContent() : sal_False; } else return sal_False; @@ -1191,8 +1204,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrow() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsAutoGrow(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->IsAutoGrow() : sal_False; } return LwpVirtualLayout::IsAutoGrow(); } @@ -1209,8 +1222,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowDown() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsAutoGrowDown(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->IsAutoGrowDown() : sal_False; } return LwpVirtualLayout::IsAutoGrowDown(); } @@ -1227,8 +1240,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowUp() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsAutoGrowUp(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->IsAutoGrowUp() : sal_False; } return LwpVirtualLayout::IsAutoGrowUp(); } @@ -1245,8 +1258,9 @@ sal_Bool LwpMiddleLayout::IsAutoGrowLeft() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsAutoGrowLeft(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->IsAutoGrowLeft(); } return LwpVirtualLayout::IsAutoGrowLeft(); } @@ -1263,8 +1277,8 @@ sal_Bool LwpMiddleLayout::IsAutoGrowRight() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsAutoGrowRight(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->IsAutoGrowRight() : sal_False; } return LwpVirtualLayout::IsAutoGrowRight(); } @@ -1279,13 +1293,15 @@ sal_uInt8 LwpMiddleLayout::GetContentOrientation() //content orientation in Graphic objects and OLE objects not supported now if((m_nOverrideFlag & OVER_ROTATION)&& !m_LayGeometry.IsNull()) { - LwpLayoutGeometry* pLayGeometry = static_cast (m_LayGeometry.obj()); - return pLayGeometry->GetContentOrientation(); + LwpLayoutGeometry* pLayGeometry = dynamic_cast (m_LayGeometry.obj()); + if (pLayGeometry) + return pLayGeometry->GetContentOrientation(); } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetContentOrientation(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->GetContentOrientation(); } return LwpVirtualLayout::GetContentOrientation(); } @@ -1301,7 +1317,7 @@ sal_Bool LwpMiddleLayout::HonorProtection() if(!(m_nAttributes2 & STYLE2_HONORPROTECTION)) return sal_False; - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { return pParent->HonorProtection(); @@ -1318,8 +1334,9 @@ sal_Bool LwpMiddleLayout::HonorProtection() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->HonorProtection(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->HonorProtection(); } return LwpVirtualLayout::HonorProtection(); @@ -1338,13 +1355,13 @@ sal_Bool LwpMiddleLayout::IsProtected() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - bProtected = pLay->IsProtected(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + bProtected = pLay ? pLay->IsProtected() : sal_False; } else bProtected = LwpVirtualLayout::IsProtected(); - LwpVirtualLayout* pParent = static_cast (GetParent()->obj()); + LwpVirtualLayout* pParent = dynamic_cast (GetParent()->obj()); if(pParent && !pParent->IsHeader()) { /* If a parent's protected then none of its children can be accessed. */ @@ -1380,14 +1397,14 @@ sal_Bool LwpMiddleLayout::IsProtected() */ LwpVirtualLayout* LwpMiddleLayout::GetWaterMarkLayout() { - LwpVirtualLayout* pLay = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast(GetChildHead()->obj()); while(pLay) { if( pLay->IsForWaterMark()) { return pLay; } - pLay = static_cast (pLay->GetNext()->obj()); + pLay = dynamic_cast (pLay->GetNext()->obj()); } return NULL; } @@ -1402,7 +1419,7 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage() if(pLay) { //test BGImage - LwpGraphicObject* pGrfObj = static_cast(pLay->GetContent()->obj()); + LwpGraphicObject* pGrfObj = dynamic_cast(pLay->GetContent()->obj()); if(pGrfObj) { XFBGImage* pXFBGImage = new XFBGImage(); @@ -1465,8 +1482,8 @@ sal_Bool LwpMiddleLayout::GetUsePrinterSettings() } else if( !m_BasedOnStyle.IsNull() ) { - LwpMiddleLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetUsePrinterSettings(); + LwpMiddleLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetUsePrinterSettings() : sal_False; } return sal_False; } @@ -1541,14 +1558,14 @@ sal_uInt16 LwpLayout::GetNumCols() { if(m_nOverrideFlag & OVER_COLUMNS) { - LwpLayoutColumns* pLayColumns = static_cast(m_LayColumns.obj()); + LwpLayoutColumns* pLayColumns = dynamic_cast(m_LayColumns.obj()); if(pLayColumns) { return pLayColumns->GetNumCols(); } } - LwpVirtualLayout* pStyle = static_cast (m_BasedOnStyle.obj()); + LwpVirtualLayout* pStyle = dynamic_cast (m_BasedOnStyle.obj()); if(pStyle) { return pStyle->GetNumCols(); @@ -1566,14 +1583,14 @@ double LwpLayout::GetColWidth(sal_uInt16 nIndex) { if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO)) { - LwpLayoutColumns* pLayColumns = static_cast(m_LayColumns.obj()); + LwpLayoutColumns* pLayColumns = dynamic_cast(m_LayColumns.obj()); if(pLayColumns) { return pLayColumns->GetColWidth(nIndex); } } - LwpVirtualLayout* pStyle = static_cast (m_BasedOnStyle.obj()); + LwpVirtualLayout* pStyle = dynamic_cast (m_BasedOnStyle.obj()); if(pStyle) { return pStyle->GetColWidth(nIndex); @@ -1591,14 +1608,14 @@ double LwpLayout::GetColGap(sal_uInt16 nIndex) { if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO)) { - LwpLayoutColumns* pLayColumns = static_cast(m_LayColumns.obj()); + LwpLayoutColumns* pLayColumns = dynamic_cast(m_LayColumns.obj()); if(pLayColumns) { return pLayColumns->GetColGap(nIndex); } } - LwpVirtualLayout* pStyle = static_cast (m_BasedOnStyle.obj()); + LwpVirtualLayout* pStyle = dynamic_cast (m_BasedOnStyle.obj()); if(pStyle) { return pStyle->GetColGap(nIndex); @@ -1667,7 +1684,7 @@ XFColumnSep* LwpLayout::GetColumnSep() { //Get LwpLayoutGutters - LwpLayoutGutters* pLayoutGutters = static_cast(m_LayGutterStuff.obj()); + LwpLayoutGutters* pLayoutGutters = dynamic_cast(m_LayGutterStuff.obj()); if(!pLayoutGutters) { return NULL; @@ -1750,8 +1767,8 @@ sal_uInt16 LwpLayout::GetUsePage() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetUsePage(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetUsePage() : 0; } return 0; } @@ -1768,8 +1785,8 @@ LwpUseWhen* LwpLayout::VirtualGetUseWhen() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->VirtualGetUseWhen(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->VirtualGetUseWhen() : NULL; } return LwpVirtualLayout::VirtualGetUseWhen(); } @@ -1790,8 +1807,9 @@ sal_Bool LwpLayout::IsUseOnAllPages() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsUseOnAllPages(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->IsUseOnAllPages(); } return LwpVirtualLayout::IsUseOnAllPages(); } @@ -1812,8 +1830,9 @@ sal_Bool LwpLayout::IsUseOnAllEvenPages() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsUseOnAllEvenPages(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->IsUseOnAllEvenPages(); } return LwpVirtualLayout::IsUseOnAllEvenPages(); } @@ -1834,8 +1853,9 @@ sal_Bool LwpLayout::IsUseOnAllOddPages() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsUseOnAllOddPages(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->IsUseOnAllOddPages(); } return LwpVirtualLayout::IsUseOnAllOddPages(); } @@ -1856,8 +1876,9 @@ sal_Bool LwpLayout::IsUseOnPage() } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->IsUseOnPage(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->IsUseOnPage(); } return LwpVirtualLayout::IsUseOnPage(); } @@ -1872,13 +1893,13 @@ LwpShadow* LwpLayout::GetShadow() { if(m_nOverrideFlag & OVER_SHADOW) { - LwpLayoutShadow* pLayoutShadow = static_cast(m_LayShadow.obj()); - return pLayoutShadow->GetShadow(); + LwpLayoutShadow* pLayoutShadow = dynamic_cast(m_LayShadow.obj()); + return pLayoutShadow ? pLayoutShadow->GetShadow() : NULL; } else if( !m_BasedOnStyle.IsNull() ) { - LwpLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetShadow(); + LwpLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetShadow() : NULL; } return NULL; } @@ -1946,11 +1967,11 @@ LwpVirtualLayout* LwpLayout::GetContainerLayout() if(IsRelativeAnchored()) { //get position - LwpPara* pPara = static_cast(GetPosition()->obj()); + LwpPara* pPara = dynamic_cast(GetPosition()->obj()); if(pPara) { LwpStory* pStory = pPara->GetStory(); - return pStory->GetTabLayout(); + return pStory ? pStory->GetTabLayout() : NULL; } } return GetParentLayout(); @@ -2022,8 +2043,9 @@ sal_uInt8 LwpPlacableLayout::GetWrapType() } else if( !m_BasedOnStyle.IsNull() ) { - LwpPlacableLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetWrapType(); + LwpPlacableLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + if (pLay) + return pLay->GetWrapType(); } return LAY_WRAP_AROUND; } @@ -2039,13 +2061,13 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece() { if(m_nOverrideFlag & OVER_PLACEMENT) { - return static_cast(m_LayRelativity.obj()); + return dynamic_cast(m_LayRelativity.obj()); } } else if( !m_BasedOnStyle.IsNull() ) { - LwpPlacableLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetRelativityPiece(); + LwpPlacableLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetRelativityPiece() : NULL; } return NULL; } @@ -2139,8 +2161,8 @@ sal_Int32 LwpPlacableLayout::GetBaseLineOffset() } else if( !m_BasedOnStyle.IsNull() ) { - LwpPlacableLayout* pLay = static_cast ( m_BasedOnStyle.obj() ); - return pLay->GetBaseLineOffset(); + LwpPlacableLayout* pLay = dynamic_cast ( m_BasedOnStyle.obj() ); + return pLay ? pLay->GetBaseLineOffset() : 0; } return 0; diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index 3e82247720a9..056cd6874fda 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -303,7 +303,7 @@ public: XFBGImage* GetXFBGImage(); virtual sal_Bool GetUsePrinterSettings(); - LwpLayoutScale* GetLayoutScale(){return static_cast(m_LayScale.obj());} + LwpLayoutScale* GetLayoutScale(){return dynamic_cast(m_LayScale.obj());} sal_uInt16 GetScaleMode(void); void SetScaleMode(sal_uInt16 nVal); sal_uInt16 GetScaleTile(void); diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx index 48fbfabb7a9b..174ad2f4102e 100644 --- a/lotuswordpro/source/filter/lwpmarker.cxx +++ b/lotuswordpro/source/filter/lwpmarker.cxx @@ -137,7 +137,7 @@ OUString LwpCHBlkMarker::GetPromptText() { LwpStory* pStory = NULL; if (m_objPromptStory.obj()) - pStory = static_cast(m_objPromptStory.obj()); + pStory = dynamic_cast(m_objPromptStory.obj()); if (pStory) return pStory->GetContentText(); return A2OUSTR(""); @@ -380,6 +380,9 @@ sal_Bool LwpBookMark::IsRightName(OUString sName) LwpFieldMark::LwpFieldMark(LwpObjectHeader &objHdr, LwpSvStream *pStrm) : LwpStoryMarker(objHdr,pStrm) + , m_nExtra(0) + , m_nFlag(0) + , m_nFieldType(0) , m_bHasStyle(sal_False) , m_bHasStart(sal_False) , m_pFrib(NULL) diff --git a/lotuswordpro/source/filter/lwpmarker.hxx b/lotuswordpro/source/filter/lwpmarker.hxx index 92e0541b02e2..c99643c080c9 100644 --- a/lotuswordpro/source/filter/lwpmarker.hxx +++ b/lotuswordpro/source/filter/lwpmarker.hxx @@ -203,7 +203,6 @@ public: void Read(); void ParseIndex(OUString& sKey1,OUString& sKey2); void ParseTOC(OUString& sLevel,OUString& sText); -// sal_uInt8 ParseCrossRef(OUString& sMarkName); sal_uInt16 GetFieldType(){return m_nFieldType;} sal_Bool IsFormulaInsert(); sal_Bool IsDateTimeField(sal_uInt8& type,OUString& formula); diff --git a/lotuswordpro/source/filter/lwpobjfactory.cxx b/lotuswordpro/source/filter/lwpobjfactory.cxx index 0036727c03d3..4fddd8a819f6 100644 --- a/lotuswordpro/source/filter/lwpobjfactory.cxx +++ b/lotuswordpro/source/filter/lwpobjfactory.cxx @@ -110,44 +110,28 @@ LwpObjectFactory::LwpObjectFactory(LwpSvStream* pSvStream) : m_nNumObjs(0), m_pSvStream(pSvStream) { - m_ObjList.clear(); + m_IdToObjList.clear(); } LwpObjectFactory::~LwpObjectFactory() { -// m_pMgr = NULL; - if(!m_ObjList.empty()) + if(!m_IdToObjList.empty()) ClearObjectMap(); } -/** - * @descr create the single object factory -*/ -/* -LwpObjectFactory* LwpObjectFactory::Instance(LwpSvStream* pStream) -{ - if(m_pMgr == NULL) - { - if(pStream) - { - m_pMgr = new LwpObjectFactory(pStream); - } - } - return(m_pMgr); -}*/ /** * @descr clear object map and delete all objects */ void LwpObjectFactory::ClearObjectMap() { - LwpObjMap::iterator it = m_ObjList.begin(); - while( it!=m_ObjList.end() ) + LwpIdToObjMap::iterator it = m_IdToObjList.begin(); + while( it!=m_IdToObjList.end() ) { - delete (*it).second; - (*it).second = NULL; + delete it->second; + it->second = NULL; ++it; } - m_ObjList.clear(); + m_IdToObjList.clear(); } /** * @descr read the index manager @@ -713,7 +697,7 @@ LwpObject* LwpObjectFactory::CreateObject(sal_uInt32 type, LwpObjectHeader &objH if(newObj) { newObj->QuickRead(); - m_ObjList.insert(LwpObjMap::value_type(*objHdr.GetID(), newObj)); + m_IdToObjList.insert(LwpIdToObjMap::value_type(*objHdr.GetID(), newObj)); } return(newObj); @@ -730,12 +714,22 @@ LwpObject* LwpObjectFactory::QueryObject(const LwpObjectID &objID) //Read the object from file sal_uInt32 nStreamOffset = m_IndexMgr.GetObjOffset(objID); if(nStreamOffset == BAD_OFFSET) //does not find the offset in index manager + return NULL; + + sal_Int64 nDesiredPos = nStreamOffset + LwpSvStream::LWP_STREAM_BASE; + if (nDesiredPos != m_pSvStream->Seek(nDesiredPos)) + return NULL; + LwpObjectHeader objHdr; + if (!objHdr.Read(*m_pSvStream)) + return NULL; + + LwpObjectID* pId = objHdr.GetID(); + if (pId && (*pId != objID)) { + OSL_FAIL("apparently incorrect objid, invalidating"); return NULL; } - m_pSvStream->Seek( nStreamOffset + LwpSvStream::LWP_STREAM_BASE ); - LwpObjectHeader objHdr; - objHdr.Read(*m_pSvStream); + obj = CreateObject(objHdr.GetTag(), objHdr); } return obj; @@ -746,8 +740,8 @@ LwpObject* LwpObjectFactory::QueryObject(const LwpObjectID &objID) */ LwpObject* LwpObjectFactory::FindObject(const LwpObjectID &objID) { - LwpObjMap::const_iterator it = m_ObjList.find(objID); - if (it != m_ObjList.end()) { + LwpIdToObjMap::const_iterator it = m_IdToObjList.find(objID); + if (it != m_IdToObjList.end()) { return((*it).second); } else @@ -761,7 +755,7 @@ LwpObject* LwpObjectFactory::FindObject(const LwpObjectID &objID) void LwpObjectFactory::ReleaseObject(const LwpObjectID &objID) { LwpObject* obj = FindObject( objID ); - m_ObjList.erase(objID); + m_IdToObjList.erase(objID); if( obj ) delete obj; } diff --git a/lotuswordpro/source/filter/lwpobjfactory.hxx b/lotuswordpro/source/filter/lwpobjfactory.hxx index 16c0cd13c9e9..83da5d24c8cd 100644 --- a/lotuswordpro/source/filter/lwpobjfactory.hxx +++ b/lotuswordpro/source/filter/lwpobjfactory.hxx @@ -101,8 +101,8 @@ private: return(rKey1==rKey2); } }; - typedef boost::unordered_map LwpObjMap; - LwpObjMap m_ObjList; + typedef boost::unordered_map LwpIdToObjMap; + LwpIdToObjMap m_IdToObjList; LwpIndexManager m_IndexMgr; void ClearObjectMap(); diff --git a/lotuswordpro/source/filter/lwpobjhdr.cxx b/lotuswordpro/source/filter/lwpobjhdr.cxx index 271ee9babb84..ef6e253067d1 100644 --- a/lotuswordpro/source/filter/lwpobjhdr.cxx +++ b/lotuswordpro/source/filter/lwpobjhdr.cxx @@ -74,9 +74,8 @@ LwpObjectHeader::LwpObjectHeader() /** * @descr read header from stream */ -void LwpObjectHeader::Read(LwpSvStream &rStrm) +bool LwpObjectHeader::Read(LwpSvStream &rStrm) { - sal_uInt8 nFlagBits = 0; sal_uInt32 nVersionID = 0; sal_uInt32 nRefCount = 0; @@ -84,6 +83,8 @@ void LwpObjectHeader::Read(LwpSvStream &rStrm) sal_uInt32 nNextVersionID = 0; sal_uInt32 nHeaderSize = 0; + sal_Int64 nStartPos = rStrm.Tell(); + if ( LwpFileHeader::m_nFileRevision < 0x000B) { rStrm.Read(&m_nTag, sizeof(m_nTag)); @@ -196,6 +197,8 @@ void LwpObjectHeader::Read(LwpSvStream &rStrm) m_bCompressed = sal_True; } } + sal_Int64 nEndPos = rStrm.Tell(); + return (nStartPos + nHeaderSize == nEndPos); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpobjhdr.hxx b/lotuswordpro/source/filter/lwpobjhdr.hxx index a5fda95aca73..ac0068d7a251 100644 --- a/lotuswordpro/source/filter/lwpobjhdr.hxx +++ b/lotuswordpro/source/filter/lwpobjhdr.hxx @@ -112,7 +112,7 @@ private: }; public: - void Read(LwpSvStream &pStrm); + bool Read(LwpSvStream &pStrm); inline sal_uInt32 GetTag(); inline sal_uInt32 GetSize(); inline LwpObjectID* GetID(); diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx index 8d5567b84e34..2b7df1fae742 100644 --- a/lotuswordpro/source/filter/lwpobjstrm.cxx +++ b/lotuswordpro/source/filter/lwpobjstrm.cxx @@ -100,6 +100,7 @@ void LwpObjectStream::Read2Buffer() if( m_bCompressed ) { sal_uInt8* pCompressBuffer = new sal_uInt8[m_nBufSize]; + memset(pCompressBuffer, 0, m_nBufSize); m_pStrm->Read(pCompressBuffer, m_nBufSize); sal_uInt8 pTempDst[IO_BUFFERSIZE]; @@ -165,6 +166,7 @@ void LwpObjectStream::ReleaseBuffer() */ sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len) { + memset(buf, 0, len); if( len > m_nBufSize - m_nReadPos ) { assert(false); @@ -304,6 +306,8 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s // where zzzzzz is the count - 1 of compressed 0 bytes Cnt = (*pSrc++ & 0x3F) + 1; + if (DstSize+Cnt >= IO_BUFFERSIZE) + throw BadDecompress(); memset(pDst, 0, Cnt); pDst += Cnt; DstSize += Cnt; @@ -317,15 +321,21 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s // and nnn is the count - 1 of following non-zero bytes Cnt = ((*pSrc & 0x38) >> 3) + 1; + if (DstSize+Cnt >= IO_BUFFERSIZE) + throw BadDecompress(); memset(pDst, 0, Cnt); pDst += Cnt; DstSize += Cnt; Cnt = (*pSrc++ & 0x07) + 1; + if (Size < Cnt + 1) + throw BadDecompress(); + Size -= Cnt + 1; + if (DstSize+Cnt >= IO_BUFFERSIZE) + throw BadDecompress(); memcpy(pDst, pSrc, Cnt); pDst += Cnt; DstSize += Cnt; pSrc += Cnt; - Size -= Cnt + 1; break; case 0x80: @@ -344,14 +354,21 @@ sal_uInt16 LwpObjectStream::DecompressBuffer(sal_uInt8* pDst, sal_uInt8* pSrc, s // nnnnnn is the count less 1 of following non-zero bytes Cnt = (*pSrc++ & 0x3F) + 1; + if (Size < Cnt + 1) + throw BadDecompress(); + Size -= Cnt + 1; + if (DstSize+Cnt >= IO_BUFFERSIZE) + throw BadDecompress(); memcpy(pDst, pSrc, Cnt); pDst += Cnt; DstSize += Cnt; pSrc += Cnt; - Size -= Cnt + 1; break; } assert(DstSize < IO_BUFFERSIZE); + if (DstSize >= IO_BUFFERSIZE) + throw BadDecompress(); + } return(static_cast(DstSize)); } diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx index af46e8dd16ed..6c39b477b9e1 100644 --- a/lotuswordpro/source/filter/lwpoverride.cxx +++ b/lotuswordpro/source/filter/lwpoverride.cxx @@ -612,8 +612,6 @@ void LwpIndentOverride::OverrideRelative(sal_uInt16 relative) void LwpSpacingOverride::Override(LwpSpacingOverride* other) { -// if (IsAlwaysOverridden()) -// other->SetAlways(IsAlways());//To be done if (other) { m_pSpacing->Override(other->GetSpacing()); diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 76b2bb982a9f..d3eab7b9d6c3 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -269,7 +269,9 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1) LwpDocument* pDocument = m_pFoundry->GetDocument(); if(pDocument) { - LwpFootnoteOptions* pFootnoteOpts = static_cast(pDocument->GetValidFootnoteOpts()->obj()); + LwpObjectID* pFontnodeId = pDocument->GetValidFootnoteOpts(); + + LwpFootnoteOptions* pFootnoteOpts = pFontnodeId ? dynamic_cast(pFontnodeId->obj()) : NULL; if(pFootnoteOpts) { LwpFootnoteSeparatorOptions* pFootnoteSep = pFootnoteOpts->GetFootnoteSeparator(); @@ -476,8 +478,8 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont) { //get filerpage story from division info LwpDocument* pDoc = m_pFoundry->GetDocument(); - LwpDivInfo* pDivInfo = static_cast(pDoc->GetDivInfoID()->obj()); - LwpStory* pStory = static_cast(pDivInfo->GetFillerPageTextID()->obj()); + LwpDivInfo* pDivInfo = dynamic_cast(pDoc->GetDivInfoID()->obj()); + LwpStory* pStory = dynamic_cast(pDivInfo->GetFillerPageTextID()->obj()); //parse fillerpage story if(pStory) @@ -500,24 +502,24 @@ void LwpPageLayout::ResetXFColumns() LwpHeaderLayout* LwpPageLayout::GetHeaderLayout() { - LwpVirtualLayout* pLay = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast(GetChildHead()->obj()); while(pLay) { if( pLay->GetLayoutType() == LWP_HEADER_LAYOUT ) return ( static_cast (pLay) ); - pLay = static_cast (pLay->GetNext()->obj()); + pLay = dynamic_cast (pLay->GetNext()->obj()); } return NULL; } LwpFooterLayout* LwpPageLayout::GetFooterLayout() { - LwpVirtualLayout* pLay = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast(GetChildHead()->obj()); while(pLay) { if( pLay->GetLayoutType() == LWP_FOOTER_LAYOUT ) return ( static_cast (pLay) ); - pLay = static_cast (pLay->GetNext()->obj()); + pLay = dynamic_cast (pLay->GetNext()->obj()); } return NULL; } @@ -530,7 +532,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout() { if(IsComplex()) { - LwpVirtualLayout* pLay = static_cast(GetChildHead()->obj()); + LwpVirtualLayout* pLay = dynamic_cast(GetChildHead()->obj()); while(pLay) { if( pLay->GetLayoutType() == LWP_PAGE_LAYOUT ) @@ -542,7 +544,7 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout() return pPageLayout; } } - pLay = static_cast (pLay->GetNext()->obj()); + pLay = dynamic_cast (pLay->GetNext()->obj()); } } return NULL; @@ -574,11 +576,11 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber) sal_Int16 nPageNumber = -1; LwpFoundry* pFoundry = this->GetFoundry(); LwpDocument* pDoc = pFoundry->GetDocument(); - LwpDLVListHeadTailHolder* pHeadTail = static_cast(pDoc->GetPageHintsID()->obj()); + LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast(pDoc->GetPageHintsID()->obj()); if(!pHeadTail) return nPageNumber; //get first pagehint - LwpPageHint* pPageHint =static_cast(pHeadTail->GetHead()->obj()); + LwpPageHint* pPageHint = dynamic_cast(pHeadTail->GetHead()->obj()); while(pPageHint) { if(*(this->GetObjectID()) == *(pPageHint->GetPageLayoutID())) @@ -608,7 +610,7 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber) } } - pPageHint = static_cast(pPageHint->GetNext()->obj()); + pPageHint = dynamic_cast(pPageHint->GetNext()->obj()); } if(nPageNumber>=0) { @@ -709,7 +711,7 @@ sal_Bool LwpPageLayout::operator<(LwpPageLayout& Other) */ LwpPara* LwpPageLayout::GetPagePosition() { - LwpPara* pPara = static_cast(GetPosition()->obj()); + LwpPara* pPara = dynamic_cast(GetPosition()->obj()); if(pPara) return pPara; //Get the position from its related section @@ -720,7 +722,7 @@ LwpPara* LwpPageLayout::GetPagePosition() while( (pSection = pFoundry->EnumSections(pSection)) ) { if(pSection->GetPageLayout() == this) - return static_cast(pSection->GetPosition()->obj()); + return dynamic_cast(pSection->GetPosition()->obj()); } } @@ -784,15 +786,15 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1) } //Set left,right,bottom margins - LwpMiddleLayout* parent = static_cast (GetParent()->obj()); + LwpMiddleLayout* parent = dynamic_cast (GetParent()->obj()); //left margin in SODC: the space from the left edge of body to the left edge of header - double left = GetMarginsValue(MARGIN_LEFT) - parent->GetMarginsValue(MARGIN_LEFT); + double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0); if(left<=0) //The left margin in SODC can not be minus value { left = -1; } //left margin in SODC: the space from the right edge of header to the right edge of body - double right = GetMarginsValue(MARGIN_RIGHT) - parent->GetMarginsValue(MARGIN_RIGHT); + double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0); if(right<=0)//The right margin in SODC can not be minus value { right = -1; @@ -952,13 +954,13 @@ void LwpFooterLayout::ParseMargins(XFFooterStyle* pFooterStyle) } //Set left,right,top margins - LwpMiddleLayout* parent = static_cast (GetParent()->obj()); - double left = GetMarginsValue(MARGIN_LEFT) - parent->GetMarginsValue(MARGIN_LEFT); + LwpMiddleLayout* parent = dynamic_cast (GetParent()->obj()); + double left = GetMarginsValue(MARGIN_LEFT) - (parent ? parent->GetMarginsValue(MARGIN_LEFT) : 0); if(left<=0) //The left margin in SODC can not be minus value { left = -1; } - double right = GetMarginsValue(MARGIN_RIGHT) - parent->GetMarginsValue(MARGIN_RIGHT); + double right = GetMarginsValue(MARGIN_RIGHT) - (parent ? parent->GetMarginsValue(MARGIN_RIGHT) : 0); if(right<=0)//The left margin in SODC can not be minus value { right = -1; diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx index 9255d889b007..2ca575028927 100644 --- a/lotuswordpro/source/filter/lwppara.cxx +++ b/lotuswordpro/source/filter/lwppara.cxx @@ -260,12 +260,11 @@ void LwpPara::XFConvert(XFContentContainer* pCont) { m_pXFContainer = pCont; - if (static_cast(m_Story.obj())->GetDropcapFlag() == sal_True) + LwpStory *pStory = dynamic_cast(m_Story.obj()); + + if (pStory && pStory->GetDropcapFlag() == sal_True) { ParseDropcapContent(); - /*LwpObject* pNextPara = GetNext()->obj(); - if(pNextPara) - pNextPara->XFConvert(pCont);*/ return; } @@ -280,8 +279,8 @@ void LwpPara::XFConvert(XFContentContainer* pCont) if(m_SectionStyleName.getLength()>0) { XFSection* pSection = CreateXFSection(); - LwpStory* pStory = static_cast ( m_Story.obj() ); - pStory->AddXFContent(pSection); + if (pStory) + pStory->AddXFContent(pSection); //pSection->Add(pPara); m_pXFContainer = pSection; } @@ -310,24 +309,15 @@ void LwpPara::XFConvert(XFContentContainer* pCont) if (m_pBreaks) AddBreakAfter(m_pXFContainer); - - // maybe useful for futer version - // deleted by - // AddTabStopForTOC(); - - //Caller is responsible for calling the next para object - /*LwpObject* pNextPara = GetNext()->obj(); - if(pNextPara) - pNextPara->XFConvert( m_pXFContainer );*/ } sal_Bool LwpPara::RegisterMasterPage(XFParaStyle* pBaseStyle) { sal_Bool bSuccess = sal_False; //get story - LwpStory* pStory = static_cast(m_Story.obj()); + LwpStory* pStory = dynamic_cast(m_Story.obj()); //if pagelayout is modified, register the pagelayout - if(pStory->IsPMModified()) + if(pStory && pStory->IsPMModified()) { sal_Bool bNewSection = sal_False; bNewSection = pStory->IsNeedSection(); @@ -386,7 +376,7 @@ void LwpPara::RegisterStyle() pOverStyle->SetStyleName(A2OUSTR("")); LwpParaProperty* pProps = m_pProps; sal_uInt32 PropType; - LwpParaStyle* pParaStyle = static_cast(m_ParaStyle.obj()); + LwpParaStyle* pParaStyle = dynamic_cast(m_ParaStyle.obj()); while(pProps) { PropType = pProps->GetType(); @@ -700,7 +690,7 @@ void LwpPara::RegisterStyle() } if (pPara && pPara->GetPrevious()) - pPrePara = static_cast(pPara->GetPrevious()->obj(VO_PARA)); + pPrePara = dynamic_cast(pPara->GetPrevious()->obj(VO_PARA)); else pPrePara=NULL; @@ -759,7 +749,7 @@ void LwpPara::RegisterStyle() if (noSpacing && GetPrevious()) { - LwpPara* pPrePara = static_cast(GetPrevious()->obj()); + LwpPara* pPrePara = dynamic_cast(GetPrevious()->obj()); if (pPrePara && pPrePara->GetBelowSpacing()!=0) { pOverStyle = new XFParaStyle; @@ -840,8 +830,8 @@ void LwpPara::RegisterTabStyle(XFParaStyle* pXFParaStyle) LwpTabOverride aFinaOverride; LwpTabOverride* pBase = NULL; //get the tabrack from the current layout - LwpStory* pStory = static_cast(m_Story.obj()); - LwpMiddleLayout* pLayout = pStory->GetTabLayout(); + LwpStory* pStory = dynamic_cast(m_Story.obj()); + LwpMiddleLayout* pLayout = pStory ? pStory->GetTabLayout() : NULL; if(pLayout) { pBase = pLayout->GetTabOverride(); @@ -925,7 +915,7 @@ LwpVirtualLayout* LwpPara::GetLayoutWithMyStory() LwpStory* pMyStory = NULL; if (!m_Story.IsNull()) { - pMyStory = static_cast(m_Story.obj(VO_STORY)); + pMyStory = dynamic_cast(m_Story.obj(VO_STORY)); if (!pMyStory) { return NULL; diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx index 3f8897339ca4..7540a6fa2534 100644 --- a/lotuswordpro/source/filter/lwppara.hxx +++ b/lotuswordpro/source/filter/lwppara.hxx @@ -386,7 +386,7 @@ inline LwpObjectID* LwpPara::GetStoryID() inline LwpStory* LwpPara::GetStory() { if (m_Story.obj()) - return static_cast(m_Story.obj()); + return dynamic_cast(m_Story.obj()); return NULL; } diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx index 2c287a49265f..b9656ced1521 100644 --- a/lotuswordpro/source/filter/lwppara1.cxx +++ b/lotuswordpro/source/filter/lwppara1.cxx @@ -175,13 +175,13 @@ LwpPara* LwpPara::GetParent() if (level != 1) { - pPara = static_cast(GetPrevious()->obj()); + pPara = dynamic_cast(GetPrevious()->obj()); while (pPara) { otherlevel = pPara->GetLevel(); if ((otherlevel < level) || (otherlevel && (level == 0))) return pPara; - pPara = static_cast(pPara->GetPrevious()->obj()); + pPara = dynamic_cast(pPara->GetPrevious()->obj()); } } return NULL; @@ -237,12 +237,12 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering) //get suffix text frib if ( (pFrib = pFrib->GetNext()) ) { -// if((pFrib->GetType() == FRIB_TAG_TEXT) && -// (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)) if( pFrib->GetType() == FRIB_TAG_TEXT ) { - if ((pFrib->GetNext()->GetType() == FRIB_TAG_TEXT ) || - (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels)) + if ( + (pFrib->GetNext() && pFrib->GetNext()->GetType() == FRIB_TAG_TEXT) || + (pFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels) + ) { pParaNumbering->pSuffix = static_cast(pFrib); } @@ -323,21 +323,21 @@ void LwpPara::OverrideSpacing(LwpSpacingOverride* base,LwpSpacingOverride* over, { if (base)//the latter two parameter never be null { - over->Override(base); + if (over) + over->Override(base); LwpParaStyle::ApplySpacing(this,pOverStyle,base); } else LwpParaStyle::ApplySpacing(this,pOverStyle,over); } -//add by , 01/25/2005 /** * @short: Get parastyle object according to the objID. * @return: pointer to the parastyle. */ LwpParaStyle* LwpPara::GetParaStyle() { - return static_cast(m_ParaStyle.obj(VO_PARASTYLE)); + return dynamic_cast(m_ParaStyle.obj(VO_PARASTYLE)); } /** @@ -488,8 +488,9 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps) m_pBullOver = pFinalBullet.release(); if (!aSilverBulletID.IsNull()) { - m_pSilverBullet = static_cast(aSilverBulletID.obj(VO_SILVERBULLET)); - m_pSilverBullet->SetFoundry(m_pFoundry); + m_pSilverBullet = dynamic_cast(aSilverBulletID.obj(VO_SILVERBULLET)); + if (m_pSilverBullet) + m_pSilverBullet->SetFoundry(m_pFoundry); } m_aSilverBulletID = aSilverBulletID; @@ -506,8 +507,9 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps) { m_bHasBullet = sal_True; - m_pSilverBullet = static_cast(m_aSilverBulletID.obj(VO_SILVERBULLET)); - m_pSilverBullet->SetFoundry(m_pFoundry); + m_pSilverBullet = dynamic_cast(m_aSilverBulletID.obj(VO_SILVERBULLET)); + if (m_pSilverBullet) + m_pSilverBullet->SetFoundry(m_pFoundry); } std::auto_ptr pBulletOverride(pBullOver->clone()); @@ -578,7 +580,7 @@ void LwpPara::FindLayouts() { m_Fribs.SetPara(this); m_Fribs.FindLayouts(); - LwpPara* pNextPara = static_cast(GetNext()->obj()); + LwpPara* pNextPara = dynamic_cast(GetNext()->obj()); if(pNextPara) { pNextPara->FindLayouts(); @@ -640,96 +642,15 @@ sal_Bool LwpPara::ComparePagePosition(LwpVirtualLayout * pPreLayout, LwpVirtualL m_Fribs.SetPara(this); return m_Fribs.ComparePagePosition(pPreLayout, pNextLayout); } -/* -sal_Bool LwpPara::IsNeedTabForTOC() -{ - LwpStory* pStory = GetStory(); - if(pStory) - { - if(GetNext()->IsNull()) - { - LwpVirtualLayout* pLayout = pStory->GetLayout(NULL); - if(pLayout && pLayout->IsCell()) - { - LwpCellLayout * pCell = static_cast(pStory->GetLayout(NULL)); - if (pCell->GetLeaderChar() == 0) - { - return sal_False; - } - return sal_True; - } - } - } - return sal_False; -} - -void LwpPara::AddTabStyleForTOC( ) -{ - if(IsNeedTabForTOC()) - { - XFParaStyle* pParaStyle = new XFParaStyle; - *pParaStyle = *GetXFParaStyle(); - pParaStyle->ClearTabStyles(); - //Add Tab Style; - enumXFTab eType = enumXFTabRight; - - LwpCellLayout * pCell = static_cast(GetStory()->GetLayout(NULL)); - double dLen = pCell->GetActualWidth(); /// todo: get from table - sal_Unicode cLeader = static_cast(pCell->GetLeaderChar()); - pParaStyle->AddTabStyle(eType, dLen, cLeader ); - m_StyleName = XFStyleManager::AddStyle(pParaStyle)->GetStyleName(); - - // Get font info of default text style and set into tab style - XFParaStyle* pBaseStyle = static_cast(m_pFoundry->GetStyleManager()->GetStyle(*m_pFoundry->GetDefaultTextStyle())); - XFTextStyle*pTextStyle = new XFTextStyle; - pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font????? - m_TabStyleName = XFStyleManager::AddStyle(pTextStyle)->GetStyleName(); - } -} -void LwpPara::AddTabStopForTOC() -{ - if(IsNeedTabForTOC()) - { - XFParagraph* pXFPara = GetFribs()->GetXFPara(); - pXFPara->SetStyleName(m_StyleName); - - XFParaStyle* pParaStyle = static_cast(XFStyleManager::FindStyle(m_StyleName)); - if(pParaStyle) - { - XFTextSpan *pSpan = new XFTextSpan; - XFTabStop *pTab = new XFTabStop; - pSpan->Add(pTab); - pSpan->SetStyleName(m_TabStyleName); - enumXFAlignType eType = pParaStyle->GetAlighType(); - - if(eType == enumXFAlignStart || eType == enumXFAlignJustify || eType == enumXFAlignNone) - { - pXFPara->Add(pSpan); - } - else if(eType == enumXFAlignEnd) - { - pXFPara->InsertAtBegin(pSpan); - } - else - { - delete pSpan; // pTabl will be delete inside XFTextSpan - } - - } - - } -} -*/ /** * @short check paragraph alignment */ sal_Bool LwpPara::IsNumberRight() { - LwpObject* pObj = m_ParaStyle.obj(); - if (pObj) + LwpParaStyle* pStyle = dynamic_cast(m_ParaStyle.obj()); + if (pStyle) { - LwpParaStyle* pStyle = static_cast(pObj); return pStyle->IsNumberRight(); } else @@ -740,7 +661,8 @@ sal_Bool LwpPara::IsNumberRight() */ sal_Bool LwpPara::IsInCell() { - LwpVirtualLayout* pLayout = GetStory()->GetLayout(NULL); + LwpStory *pStory = GetStory(); + LwpVirtualLayout* pLayout = pStory ? pStory->GetLayout(NULL) : NULL; if(pLayout && pLayout->IsCell()) return sal_True; return sal_False; diff --git a/lotuswordpro/source/filter/lwpparaproperty.cxx b/lotuswordpro/source/filter/lwpparaproperty.cxx index b6d88b8d758c..dee3323cfb0c 100644 --- a/lotuswordpro/source/filter/lwpparaproperty.cxx +++ b/lotuswordpro/source/filter/lwpparaproperty.cxx @@ -74,13 +74,19 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj for(;;) { - pFile->QuickRead(&tag,sizeof(sal_uInt32)); - // Keep reading properties until we hit the end tag - if (tag == TAG_ENDSUBOBJ) + sal_uInt16 nRead; + + nRead = pFile->QuickRead(&tag,sizeof(sal_uInt32)); + // Keep reading properties until we hit the end tag or + // the stream ends + if (tag == TAG_ENDSUBOBJ || nRead != sizeof(sal_uInt32)) break; // Get the length of this property - pFile->QuickRead(&Len,sizeof(sal_uInt16)); + nRead = pFile->QuickRead(&Len,sizeof(sal_uInt16)); + + if (nRead != sizeof(sal_uInt16)) + break; // Create whatever kind of tag we just found switch (tag) @@ -121,21 +127,8 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj case TAG_PARA_TAB: NewProp = new LwpParaTabRackProperty(pFile); break; -/* -#ifdef KINSOKU - case TAG_PARA_KINSOKU: - NewProp = new CParaKinsokuProperty(pFile); - break; -#endif - case TAG_PARA_PROPLIST: - NewProp = new CParaPropListProperty(pFile,Whole); - break; - - case TAG_PARA_SHOW: - case TAG_PARA_HIDE: - // Ignore these properties -*/ default: + default: pFile->SeekRel(Len); NewProp = NULL; break; @@ -152,24 +145,12 @@ LwpParaProperty* LwpParaProperty::ReadPropertyList(LwpObjectStream* pFile,LwpObj LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile) { -// pFile->SeekRel(3); - LwpObjectID align; - align.ReadIndexed(pFile); - m_pAlignment =static_cast - (static_cast(align.obj(VO_ALIGNMENTPIECE))->GetOverride()); -/* if(pFile->GetFileRevision() < 0x000b) - { - CAlignmentPieceGuts guts; - CAlignmentPiece::QuickReadGuts(pFile, &guts); - cAlignment = GetPieceManager()->GetAlignmentPiece(&guts); - } - else - { - LwpFoundry* OldFoundry = pFile->GetFoundry(); - pFile->SetFoundry(GetPieceManager()->GetFoundry()); - cAlignment.QuickRead(pFile); - pFile->SetFoundry(OldFoundry); - } */ + LwpObjectID align; + align.ReadIndexed(pFile); + + LwpAlignmentPiece *pAlignmentPiece = dynamic_cast(align.obj(VO_ALIGNMENTPIECE)); + m_pAlignment = pAlignmentPiece ? dynamic_cast(pAlignmentPiece->GetOverride()) : NULL; + } LwpParaAlignProperty::~LwpParaAlignProperty(void) @@ -183,10 +164,10 @@ sal_uInt32 LwpParaAlignProperty::GetType(void) LwpParaIndentProperty::LwpParaIndentProperty(LwpObjectStream* pFile) { -// LwpObjectID indent; m_aIndentID.ReadIndexed(pFile); - m_pIndent = static_cast - (static_cast(m_aIndentID.obj(VO_INDENTPIECE))->GetOverride()); + + LwpIndentPiece *pIndentPiece = dynamic_cast(m_aIndentID.obj(VO_INDENTPIECE)); + m_pIndent = pIndentPiece ? dynamic_cast(pIndentPiece->GetOverride()) : NULL; } LwpParaIndentProperty::~LwpParaIndentProperty(void) @@ -202,8 +183,9 @@ LwpParaSpacingProperty::LwpParaSpacingProperty(LwpObjectStream* pFile) { LwpObjectID spacing; spacing.ReadIndexed(pFile); - m_pSpacing = static_cast - (static_cast(spacing.obj(VO_SPACINGPIECE))->GetOverride()); + + LwpSpacingPiece *pSpacingPiece = dynamic_cast(spacing.obj(VO_SPACINGPIECE)); + m_pSpacing = pSpacingPiece ? dynamic_cast(pSpacingPiece->GetOverride()) : NULL; } LwpParaSpacingProperty::~LwpParaSpacingProperty(void) @@ -224,8 +206,8 @@ m_pParaBorderOverride(NULL) if (!aParaBorder.IsNull()) { - m_pParaBorderOverride = static_cast - (static_cast(aParaBorder.obj())->GetOverride()); + LwpParaBorderPiece *pParaBorderPiece = dynamic_cast(aParaBorder.obj()); + m_pParaBorderOverride = pParaBorderPiece ? dynamic_cast(pParaBorderPiece->GetOverride()) : NULL; } } @@ -237,8 +219,8 @@ m_pBreaks(NULL) if (!aBreaks.IsNull()) { - m_pBreaks = static_cast - (static_cast(aBreaks.obj())->GetOverride()); + LwpBreaksPiece *pBreaksPiece = dynamic_cast(aBreaks.obj()); + m_pBreaks = pBreaksPiece ? dynamic_cast(pBreaksPiece->GetOverride()) : NULL; } } @@ -265,9 +247,8 @@ LwpParaNumberingProperty::LwpParaNumberingProperty(LwpObjectStream * pStrm) return; } - m_pNumberingOverride = static_cast - (static_cast(aNumberingPiece.obj(VO_NUMBERINGPIECE))->GetOverride()); - + LwpNumberingPiece *pNumberingPiece = dynamic_cast(aNumberingPiece.obj(VO_NUMBERINGPIECE)); + m_pNumberingOverride = pNumberingPiece ? dynamic_cast(pNumberingPiece->GetOverride()) : NULL; } //end////////////////////////////////////////////////////////////////////// @@ -275,7 +256,9 @@ LwpParaTabRackProperty::LwpParaTabRackProperty(LwpObjectStream* pFile) { LwpObjectID aTabRack; aTabRack.ReadIndexed(pFile); - m_pTabOverride =static_cast(static_cast(aTabRack.obj())->GetOverride()); + + LwpTabPiece *pTabPiece = dynamic_cast(aTabRack.obj()); + m_pTabOverride = pTabPiece ? dynamic_cast(pTabPiece->GetOverride()) : NULL; } LwpParaTabRackProperty::~LwpParaTabRackProperty() @@ -286,8 +269,9 @@ LwpParaBackGroundProperty::LwpParaBackGroundProperty(LwpObjectStream* pFile) { LwpObjectID background; background.ReadIndexed(pFile); - m_pBackground = static_cast( - static_cast(background.obj())->GetOverride()); + + LwpBackgroundPiece *pBackgroundPiece = dynamic_cast(background.obj()); + m_pBackground = pBackgroundPiece ? dynamic_cast(pBackgroundPiece->GetOverride()) : NULL; } LwpParaBackGroundProperty::~LwpParaBackGroundProperty() diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx index a1fc2a3f6578..0d57b1dc9e7b 100644 --- a/lotuswordpro/source/filter/lwpparastyle.cxx +++ b/lotuswordpro/source/filter/lwpparastyle.cxx @@ -157,24 +157,27 @@ void LwpParaStyle::Read() } } -void LwpParaStyle::Apply(XFParaStyle *pParaStyle) +void LwpParaStyle::Apply(XFParaStyle *pParaStyle) { assert(pParaStyle); + if (!pParaStyle) + return; + LwpVirtualPiece *pPiece = NULL; //alignment: - pPiece = (LwpVirtualPiece*)m_AlignmentStyle.obj(); + pPiece = dynamic_cast(m_AlignmentStyle.obj()); if( pPiece ) { - LwpAlignmentOverride *pAlign = (LwpAlignmentOverride*)pPiece->GetOverride(); + LwpAlignmentOverride *pAlign = dynamic_cast(pPiece->GetOverride()); if( pAlign ) ApplyAlignment(pParaStyle,pAlign); } //don't known top and bottom indent now. - pPiece = (LwpVirtualPiece*)m_IndentStyle.obj(); + pPiece = dynamic_cast(m_IndentStyle.obj()); if( pPiece ) { - LwpIndentOverride *pIndent = (LwpIndentOverride*)pPiece->GetOverride(); + LwpIndentOverride *pIndent = dynamic_cast(pPiece->GetOverride()); if( pIndent ) { if (!m_pBulletOverride->IsInValid())//Add by ,for remove bullet indent in named bullet style @@ -189,29 +192,29 @@ void LwpParaStyle::Apply(XFParaStyle *pParaStyle) } } //shadow & borders. - pPiece = (LwpVirtualPiece*)m_BorderStyle.obj(); + pPiece = dynamic_cast(m_BorderStyle.obj()); if( pPiece ) { - LwpParaBorderOverride *pBorder = (LwpParaBorderOverride*)pPiece->GetOverride(); + LwpParaBorderOverride *pBorder = dynamic_cast(pPiece->GetOverride()); if( pBorder ) { this->ApplyParaBorder(pParaStyle, pBorder); } } - pPiece = (LwpVirtualPiece*)m_SpacingStyle.obj(); + pPiece = dynamic_cast(m_SpacingStyle.obj()); if (pPiece) { - LwpSpacingOverride *pSpacing = (LwpSpacingOverride*)pPiece->GetOverride(); + LwpSpacingOverride *pSpacing = dynamic_cast(pPiece->GetOverride()); if( pSpacing) ApplySpacing(NULL,pParaStyle,pSpacing); } //paragraph background. - pPiece = (LwpVirtualPiece*)m_BackgroundStyle.obj(); + pPiece = dynamic_cast(m_BackgroundStyle.obj()); if( pPiece ) { - LwpBackgroundOverride *pBack = (LwpBackgroundOverride*)pPiece->GetOverride(); + LwpBackgroundOverride *pBack = dynamic_cast(pPiece->GetOverride()); if( pBack ) { LwpColor color = pBack->GetBackColor(); @@ -222,19 +225,19 @@ void LwpParaStyle::Apply(XFParaStyle *pParaStyle) //add tab style - pPiece = (LwpVirtualPiece*)m_TabStyle.obj(); + pPiece = dynamic_cast(m_TabStyle.obj()); if( pPiece ) { - LwpTabOverride *pTab=(LwpTabOverride*)pPiece->GetOverride(); + LwpTabOverride *pTab = dynamic_cast(pPiece->GetOverride()); if(pTab) { ApplyTab(pParaStyle,pTab); } } - pPiece = (LwpVirtualPiece*)m_BreaksStyle.obj(); + pPiece = dynamic_cast(m_BreaksStyle.obj()); if( pPiece ) { - LwpBreaksOverride *pBreak=(LwpBreaksOverride*)pPiece->GetOverride(); + LwpBreaksOverride *pBreak = dynamic_cast(pPiece->GetOverride()); if(pBreak) { ApplyBreaks(pParaStyle,pBreak); @@ -587,7 +590,7 @@ void LwpParaStyle::ApplySpacing(LwpPara* pPara, XFParaStyle* pParaStyle, LwpSpac { if (below_val != -1) pPara->SetBelowSpacing(below_val); - LwpPara* pPrePara = static_cast(pPara->GetPrevious()->obj()); + LwpPara* pPrePara = dynamic_cast(pPara->GetPrevious()->obj()); if (pPrePara && above_val != -1) { above_val += pPrePara->GetBelowSpacing(); @@ -613,7 +616,7 @@ void LwpParaStyle::ApplyTab(XFParaStyle *pParaStyle, LwpTabOverride *pTabOverRid return; } - LwpTabRack* pTabRack = static_cast(pTabRackID->obj()); + LwpTabRack* pTabRack = dynamic_cast(pTabRackID->obj()); if(!pTabRack) { //assert(false); @@ -701,58 +704,61 @@ void LwpParaStyle::RegisterStyle() //Add style LwpStyleManager* pStyleMgr = m_pFoundry->GetStyleManager(); pStyleMgr->AddStyle(*GetObjectID(), pStyle); - -/* // add list style for bullet - if (!m_pBulletOverride) - { - return; - } - LwpSilverBullet* pSilverBullet = static_cast(m_pBulletOverride->GetSilverBullet().obj()); - if (!pSilverBullet) - { - return; - } - - pSilverBullet->SetFoundry(m_pFoundry); - pSilverBullet->RegisterStyle();*/ } LwpAlignmentOverride* LwpParaStyle::GetAlignment() { - if (m_AlignmentStyle.obj()!= NULL) - return static_cast(static_cast(m_AlignmentStyle.obj())->GetOverride()); - else + if (m_AlignmentStyle.obj() == NULL) return NULL; + + LwpAlignmentPiece *pPiece = dynamic_cast(m_AlignmentStyle.obj()); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } LwpIndentOverride* LwpParaStyle::GetIndent() { - if (m_IndentStyle.obj() != NULL) - return static_cast(static_cast(m_IndentStyle.obj())->GetOverride()); - else + if (m_IndentStyle.obj() == NULL) return NULL; + + LwpIndentPiece *pPiece = dynamic_cast(m_IndentStyle.obj()); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } LwpSpacingOverride* LwpParaStyle::GetSpacing() { - if (m_SpacingStyle.obj() != NULL) - return static_cast(static_cast(m_SpacingStyle.obj())->GetOverride()); - else + if (m_SpacingStyle.obj() == NULL) return NULL; + + LwpSpacingPiece *pPiece = dynamic_cast(m_SpacingStyle.obj()); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } LwpParaBorderOverride* LwpParaStyle::GetParaBorder() const { - if(m_BorderStyle.IsNull()) return NULL; - return static_cast - (static_cast(m_BorderStyle.obj(VO_PARABORDERPIECE))->GetOverride()); + if(m_BorderStyle.IsNull()) + return NULL; + + LwpParaBorderPiece *pPiece = dynamic_cast(m_BorderStyle.obj(VO_PARABORDERPIECE)); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } LwpBreaksOverride* LwpParaStyle::GetBreaks() const { - if(m_BreaksStyle.IsNull()) return NULL; - return static_cast - (static_cast(m_BreaksStyle.obj(VO_BREAKSPIECE))->GetOverride()); + if(m_BreaksStyle.IsNull()) + return NULL; + + LwpBreaksPiece *pPiece = dynamic_cast(m_BreaksStyle.obj(VO_BREAKSPIECE)); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } LwpBulletOverride* LwpParaStyle::GetBulletOverride() const @@ -762,9 +768,13 @@ LwpBulletOverride* LwpParaStyle::GetBulletOverride() const LwpNumberingOverride* LwpParaStyle::GetNumberingOverride() const { - if(m_NumberingStyle.IsNull()) return NULL; - return static_cast - (static_cast(m_NumberingStyle.obj(VO_NUMBERINGPIECE))->GetOverride()); + if(m_NumberingStyle.IsNull()) + return NULL; + + LwpNumberingPiece *pPiece = dynamic_cast(m_NumberingStyle.obj(VO_NUMBERINGPIECE)); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } @@ -777,10 +787,12 @@ LwpNumberingOverride* LwpParaStyle::GetNumberingOverride() const **************************************************************************/ LwpTabOverride* LwpParaStyle::GetTabOverride() const { - if(m_TabStyle.obj() != NULL) - return (LwpTabOverride*)static_cast(m_TabStyle.obj())->GetOverride(); - else + if(m_TabStyle.obj() == NULL) return NULL; + LwpTabPiece *pPiece = dynamic_cast(m_TabStyle.obj()); + if (pPiece) + return dynamic_cast(pPiece->GetOverride()); + return NULL; } sal_Bool LwpParaStyle::IsNumberRight() diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 5aeb99832a48..05ce115ad078 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -91,14 +91,14 @@ LwpRowLayout::~LwpRowLayout() void LwpRowLayout::SetRowMap(void) { LwpObjectID *pCellID= GetChildHead(); - LwpCellLayout * pCellLayout = static_cast(pCellID->obj()); + LwpCellLayout * pCellLayout = dynamic_cast(pCellID->obj()); while(pCellLayout) { pCellLayout->SetCellMap(); pCellID = pCellLayout->GetNext(); - pCellLayout = static_cast(pCellID->obj()); + pCellLayout = dynamic_cast(pCellID->obj()); } } /** @@ -131,14 +131,14 @@ void LwpRowLayout::RegisterStyle() } // register cells' style LwpObjectID *pCellID= GetChildHead(); - LwpCellLayout * pCellLayout = static_cast(pCellID->obj()); + LwpCellLayout * pCellLayout = dynamic_cast(pCellID->obj()); while(pCellLayout) { pCellLayout->SetFoundry(m_pFoundry); pCellLayout->RegisterStyle(); pCellID = pCellLayout->GetNext(); - pCellLayout = static_cast(pCellID->obj()); + pCellLayout = dynamic_cast(pCellID->obj()); } } @@ -375,7 +375,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI { // add row to table LwpObjectID *pCellID= GetChildHead(); - LwpCellLayout * pCellLayout = static_cast(pCellID->obj()); + LwpCellLayout * pCellLayout = dynamic_cast(pCellID->obj()); nCellStartCol = i;//mark the begin position of cell nCellEndCol = i;//mark the end position of cell while(pCellLayout) @@ -392,7 +392,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI break; } pCellID = pCellLayout->GetNext(); - pCellLayout = static_cast(pCellID->obj()); + pCellLayout = dynamic_cast(pCellID->obj()); } if (!pCellLayout) { @@ -423,7 +423,7 @@ void LwpRowLayout::ConvertCommonRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uI void LwpRowLayout::CollectMergeInfo() { LwpObjectID *pCellID= GetChildHead(); - LwpCellLayout * pCellLayout = static_cast(pCellID->obj()); + LwpCellLayout * pCellLayout = dynamic_cast(pCellID->obj()); while(pCellLayout) { @@ -433,7 +433,7 @@ void LwpRowLayout::CollectMergeInfo() m_ConnCellList.push_back(pConnCell); } pCellID = pCellLayout->GetNext(); - pCellLayout = static_cast(pCellID->obj()); + pCellLayout = dynamic_cast(pCellID->obj()); } } /** @@ -481,7 +481,7 @@ void LwpRowHeadingLayout::Read() LwpRowLayout * LwpRowHeadingLayout::GetRowLayout() { - LwpRowLayout * pRow = static_cast(cRowLayout.obj()); + LwpRowLayout * pRow = dynamic_cast(cRowLayout.obj()); return pRow; } diff --git a/lotuswordpro/source/filter/lwprowlayout.hxx b/lotuswordpro/source/filter/lwprowlayout.hxx index edd28656b25f..a1693f864bca 100644 --- a/lotuswordpro/source/filter/lwprowlayout.hxx +++ b/lotuswordpro/source/filter/lwprowlayout.hxx @@ -85,7 +85,7 @@ public: virtual LWP_LAYOUT_TYPE GetLayoutType () { return LWP_ROW_LAYOUT;} sal_uInt16 GetRowID() { return crowid;} virtual void RegisterStyle(); - inline LwpTableLayout * GetParentTableLayout(){return static_cast(GetParent()->obj());} + inline LwpTableLayout * GetParentTableLayout(){return dynamic_cast(GetParent()->obj());} void SetRowMap(void); protected: void Read(); diff --git a/lotuswordpro/source/filter/lwpsection.hxx b/lotuswordpro/source/filter/lwpsection.hxx index 49532fe8f16b..3141d975b1e9 100644 --- a/lotuswordpro/source/filter/lwpsection.hxx +++ b/lotuswordpro/source/filter/lwpsection.hxx @@ -127,7 +127,7 @@ inline sal_uInt16 LwpSection::GetFlags() */ inline LwpPageLayout* LwpSection::GetPageLayout() { - return static_cast(m_PageLayout.obj()); + return dynamic_cast(m_PageLayout.obj()); } /** diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx index 1ef84591788e..0f25dd1af125 100644 --- a/lotuswordpro/source/filter/lwpsilverbullet.cxx +++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx @@ -245,13 +245,13 @@ LwpPara* LwpSilverBullet::GetBulletPara() { if (!m_pBulletPara) { - LwpStory* pStory = static_cast(m_aStory.obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(m_aStory.obj(VO_STORY)); if (!pStory) { return NULL; } - m_pBulletPara = static_cast(pStory->GetFirstPara()->obj(VO_PARA)); + m_pBulletPara = dynamic_cast(pStory->GetFirstPara()->obj(VO_PARA)); } return m_pBulletPara; @@ -333,7 +333,15 @@ rtl::OUString LwpSilverBullet::GetNumCharByStyleID(LwpFribParaNumber* pParaNumbe */ sal_Bool LwpSilverBullet::IsBulletOrdered() { - return (sal_Bool)(m_pBulletPara->GetFribs()->HasFrib(FRIB_TAG_PARANUMBER) != NULL); + if (!m_pBulletPara) + return sal_False; + + LwpFribPtr* pFribs = m_pBulletPara->GetFribs(); + + if (!pFribs) + return sal_False; + + return (sal_Bool)(pFribs->HasFrib(FRIB_TAG_PARANUMBER) != NULL); } /** @@ -434,7 +442,9 @@ rtl::OUString LwpSilverBullet::GetDivisionName() LwpObjectID* pID = pDoc->GetDivInfoID(); if (!pID->IsNull()) { - aRet = static_cast(pID->obj(VO_DIVISIONINFO))->GetDivName(); + LwpDivInfo *pInfo = dynamic_cast(pID->obj(VO_DIVISIONINFO)); + if (pInfo) + aRet = pInfo->GetDivName(); } } @@ -443,7 +453,7 @@ rtl::OUString LwpSilverBullet::GetDivisionName() rtl::OUString LwpSilverBullet::GetSectionName() { - LwpStory* pStory = static_cast(m_aStory.obj(VO_STORY)); + LwpStory* pStory = dynamic_cast(m_aStory.obj(VO_STORY)); if (!pStory) { return rtl::OUString(); diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx index 084bdc513bda..c9af88c2cfac 100644 --- a/lotuswordpro/source/filter/lwpstory.cxx +++ b/lotuswordpro/source/filter/lwpstory.cxx @@ -99,7 +99,7 @@ void LwpStory::XFConvert(XFContentContainer* pCont) XFConvertFrameInFrame(pCont); //process para list XFContentContainer* pParaCont = pCont; - LwpPara* pPara = static_cast ( GetFirstPara()->obj() ); + LwpPara* pPara = dynamic_cast ( GetFirstPara()->obj() ); while(pPara) { pPara->SetFoundry(m_pFoundry); @@ -107,7 +107,7 @@ void LwpStory::XFConvert(XFContentContainer* pCont) //Get the xfcontainer for the next para pParaCont = pPara->GetXFContainer(); - pPara = static_cast ( pPara->GetNext()->obj() ); + pPara = dynamic_cast ( pPara->GetNext()->obj() ); } //process frame which anchor is to cell after converter all the para @@ -115,12 +115,12 @@ void LwpStory::XFConvert(XFContentContainer* pCont) XFConvertFrameInHeaderFooter(pCont); //Release Lwp Objects - LwpPara* pCur = static_cast (GetFirstPara()->obj()); + LwpPara* pCur = dynamic_cast (GetFirstPara()->obj()); LwpPara* pNext; while(pCur) { pCur->Release(); - pNext = static_cast ( pCur->GetNext()->obj() ); + pNext = dynamic_cast ( pCur->GetNext()->obj() ); LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance(); LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory(); pObjMgr->ReleaseObject(*pCur->GetObjectID()); @@ -130,12 +130,12 @@ void LwpStory::XFConvert(XFContentContainer* pCont) void LwpStory::RegisterStyle() { - LwpPara* pPara = static_cast( GetFirstPara()->obj() ); + LwpPara* pPara = dynamic_cast( GetFirstPara()->obj() ); while(pPara) { pPara->SetFoundry(m_pFoundry); pPara->RegisterStyle(); - pPara = static_cast(pPara->GetNext()->obj()); + pPara = dynamic_cast(pPara->GetNext()->obj()); } } @@ -232,7 +232,7 @@ void LwpStory::SortPageLayout() LwpLayout::UseWhenType eSectionType = static_cast(pLayout)->GetUseWhenType(); //for mirror page, the child is pagelayout LwpVirtualLayout* pParent = pLayout->GetParentLayout(); - if(eSectionType != LwpLayout::StartWithinColume && !pParent->IsPage()) + if(eSectionType != LwpLayout::StartWithinColume && pParent && !pParent->IsPage()) { aLayoutList.push_back(static_cast(pLayout)); } @@ -240,22 +240,23 @@ void LwpStory::SortPageLayout() pLayout = GetLayout(pLayout); } // sort the pagelayout according to their position - LwpPageLayout* pTemp = NULL; std::vector::iterator aIt; - std::vector::iterator bIt; - for( aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt) + if (!aLayoutList.empty()) { - for( bIt = aIt +1; bIt != aLayoutList.end(); ++bIt ) + for( aIt = aLayoutList.begin(); aIt != aLayoutList.end() -1; ++aIt) { - if(**aIt < **bIt) + for( std::vector::iterator bIt = aIt +1; bIt != aLayoutList.end(); ++bIt ) { - continue; - } - else - { - pTemp = *aIt; - *aIt = *bIt; - *bIt = pTemp; + if(**aIt < **bIt) + { + continue; + } + else + { + LwpPageLayout* pTemp = *aIt; + *aIt = *bIt; + *bIt = pTemp; + } } } } @@ -333,7 +334,7 @@ void LwpStory::XFConvertFrame(XFContentContainer* pCont) LwpVirtualLayout* pLayout = GetLayout(NULL); while(pLayout) { - LwpVirtualLayout* pFrameLayout = static_cast(pLayout->GetChildHead()->obj()); + LwpVirtualLayout* pFrameLayout = dynamic_cast(pLayout->GetChildHead()->obj()); while(pFrameLayout) { if((pFrameLayout->IsAnchorPage()&&(pFrameLayout->IsFrame()||pFrameLayout->IsSuperTable()||pFrameLayout->IsGroupHead())) @@ -341,7 +342,7 @@ void LwpStory::XFConvertFrame(XFContentContainer* pCont) { pFrameLayout->XFConvert(pCont); } - pFrameLayout = static_cast(pFrameLayout->GetNext()->obj()); + pFrameLayout = dynamic_cast(pFrameLayout->GetNext()->obj()); } pLayout = GetLayout(pLayout); } @@ -357,7 +358,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont) LwpVirtualLayout* pLayout = GetLayout(NULL); while(pLayout) { - LwpVirtualLayout* pFrameLayout = static_cast(pLayout->GetChildHead()->obj()); + LwpVirtualLayout* pFrameLayout = dynamic_cast(pLayout->GetChildHead()->obj()); while(pFrameLayout) { @@ -369,7 +370,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont) if(pXFFirtPara) pFrameLayout->XFConvert(pXFFirtPara); } - pFrameLayout = static_cast(pFrameLayout->GetNext()->obj()); + pFrameLayout = dynamic_cast(pFrameLayout->GetNext()->obj()); } pLayout = GetLayout(pLayout); } @@ -386,7 +387,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont) LwpVirtualLayout* pLayout = GetLayout(NULL); while(pLayout) { - LwpVirtualLayout* pFrameLayout = static_cast(pLayout->GetChildHead()->obj()); + LwpVirtualLayout* pFrameLayout = dynamic_cast(pLayout->GetChildHead()->obj()); while(pFrameLayout) { if((pFrameLayout->IsAnchorPage() @@ -396,7 +397,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont) { pFrameLayout->XFConvert(pCont); } - pFrameLayout = static_cast(pFrameLayout->GetNext()->obj()); + pFrameLayout = dynamic_cast(pFrameLayout->GetNext()->obj()); } pLayout = GetLayout(pLayout); } @@ -412,14 +413,14 @@ void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont) LwpVirtualLayout* pLayout = GetLayout(NULL); while(pLayout) { - LwpVirtualLayout* pFrameLayout = static_cast(pLayout->GetChildHead()->obj()); + LwpVirtualLayout* pFrameLayout = dynamic_cast(pLayout->GetChildHead()->obj()); while(pFrameLayout) { if(pFrameLayout->IsAnchorFrame()) { pFrameLayout->XFConvert(pCont); } - pFrameLayout = static_cast(pFrameLayout->GetNext()->obj()); + pFrameLayout = dynamic_cast(pFrameLayout->GetNext()->obj()); } pLayout = GetLayout(pLayout); } @@ -435,7 +436,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont) LwpVirtualLayout* pLayout = GetLayout(NULL); while(pLayout) { - LwpVirtualLayout* pFrameLayout = static_cast(pLayout->GetChildHead()->obj()); + LwpVirtualLayout* pFrameLayout = dynamic_cast(pLayout->GetChildHead()->obj()); while(pFrameLayout) { if(pFrameLayout->IsAnchorPage() && (pLayout->IsHeader() || pLayout->IsFooter())) @@ -445,7 +446,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont) if(pXFFirtPara) pFrameLayout->XFConvert(pXFFirtPara); } - pFrameLayout = static_cast(pFrameLayout->GetNext()->obj()); + pFrameLayout = dynamic_cast(pFrameLayout->GetNext()->obj()); } pLayout = GetLayout(pLayout); } @@ -487,12 +488,12 @@ OUString LwpStory::GetContentText(sal_Bool bAllText) { OUString sText = A2OUSTR(""); //process para list - LwpPara* pPara = static_cast(GetFirstPara()->obj()); + LwpPara* pPara = dynamic_cast(GetFirstPara()->obj()); while (pPara) { pPara->SetFoundry(m_pFoundry); sText += pPara->GetContentText(sal_True); - pPara = static_cast(pPara->GetNext()->obj()); + pPara = dynamic_cast(pPara->GetNext()->obj()); } return sText; } @@ -501,7 +502,7 @@ OUString LwpStory::GetContentText(sal_Bool bAllText) LwpObject* pObj = GetFirstPara()->obj(); if(pObj) { - LwpPara* pPara = static_cast(pObj); + LwpPara* pPara = dynamic_cast(pObj); if (pPara->GetNext()->obj() != NULL) return A2OUSTR(""); pPara->SetFoundry(m_pFoundry); @@ -513,7 +514,7 @@ OUString LwpStory::GetContentText(sal_Bool bAllText) } OUString LwpStory::RegisterFirstFribStyle() { - LwpPara* pPara = static_cast(GetFirstPara()->obj()); + LwpPara* pPara = dynamic_cast(GetFirstPara()->obj()); pPara->SetFoundry(m_pFoundry); LwpFribPtr* pFribs = pPara->GetFribs(); if (pFribs) diff --git a/lotuswordpro/source/filter/lwptable.cxx b/lotuswordpro/source/filter/lwptable.cxx index 0584769c8e97..9e6c54b3f82a 100644 --- a/lotuswordpro/source/filter/lwptable.cxx +++ b/lotuswordpro/source/filter/lwptable.cxx @@ -135,9 +135,9 @@ void LwpTable::Parse(IXFStream* /*pOutputStream*/) LwpSuperTableLayout* LwpTable::GetSuperTableLayout() { - LwpTableLayout* pLayout = static_cast(m_Layout.obj()); + LwpTableLayout* pLayout = dynamic_cast(m_Layout.obj()); if(pLayout) - return static_cast(pLayout->GetParent()->obj()); + return dynamic_cast(pLayout->GetParent()->obj()); return NULL; } diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index ffe00f33e17c..e36f9e8feb67 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -118,14 +118,14 @@ LwpTableLayout* LwpSuperTableLayout::GetTableLayout() while(pID && !pID->IsNull()) { - LwpVirtualLayout * pLayout = static_cast(pID->obj()); + LwpLayout* pLayout = dynamic_cast(pID->obj()); if (!pLayout) { break; } if (pLayout->GetLayoutType() == LWP_TABLE_LAYOUT) { - return static_cast(pLayout); + return dynamic_cast(pLayout); } pID = pLayout->GetPrevious(); } @@ -142,7 +142,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() while(pID && !pID->IsNull()) { - LwpVirtualLayout * pLayout = static_cast(pID->obj()); + LwpLayout * pLayout = dynamic_cast(pID->obj()); if (!pLayout) { break; @@ -150,7 +150,7 @@ LwpTableHeadingLayout* LwpSuperTableLayout::GetTableHeadingLayout() if (pLayout->GetLayoutType() == LWP_TABLE_HEADING_LAYOUT) { - return static_cast(pLayout); + return dynamic_cast(pLayout); } pID = pLayout->GetPrevious(); } @@ -235,7 +235,7 @@ double LwpSuperTableLayout::GetTableWidth() for(sal_uInt16 i =0; i< nCol; i++) { LwpObjectID *pColumnID = pTableLayout->GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = static_cast(pColumnID->obj()); + LwpColumnLayout * pColumnLayout = dynamic_cast(pColumnID->obj()); double dColumnWidth = dDefaultWidth; while (pColumnLayout) { @@ -245,7 +245,7 @@ double LwpSuperTableLayout::GetTableWidth() break; } pColumnID = pColumnLayout->GetNext(); - pColumnLayout = static_cast(pColumnID->obj()); + pColumnLayout = dynamic_cast(pColumnID->obj()); } dWidth += dColumnWidth; } @@ -476,7 +476,7 @@ void LwpTableLayout::TraverseTable() // set value LwpObjectID *pRowID = GetChildHead(); - LwpRowLayout * pRowLayout = static_cast(pRowID->obj()); + LwpRowLayout * pRowLayout = dynamic_cast(pRowID->obj()); while (pRowLayout) { pRowLayout->SetRowMap(); @@ -487,7 +487,7 @@ void LwpTableLayout::TraverseTable() // end for 's analysis pRowID = pRowLayout->GetNext(); - pRowLayout = static_cast(pRowID->obj()); + pRowLayout = dynamic_cast(pRowID->obj()); } } @@ -525,7 +525,7 @@ LwpObjectID * LwpTableLayout::SearchCellStoryMap(sal_uInt16 nRow, sal_uInt16 nCo */ LwpSuperTableLayout * LwpTableLayout::GetSuperTableLayout() { - return static_cast(GetParent()->obj()); + return dynamic_cast(GetParent()->obj()); } /** * @short Get table pointer @@ -533,7 +533,7 @@ LwpSuperTableLayout * LwpTableLayout::GetSuperTableLayout() */ LwpTable * LwpTableLayout::GetTable() { - LwpTable *pTable = static_cast(m_Content.obj()); + LwpTable *pTable = dynamic_cast(m_Content.obj()); return pTable; } /** @@ -585,7 +585,7 @@ void LwpTableLayout::RegisterColumns() // Get total width of justifiable columns // NOTICE: all default columns are regarded as justifiable columns LwpObjectID *pColumnID = GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = static_cast(pColumnID->obj()); + LwpColumnLayout * pColumnLayout = dynamic_cast(pColumnID->obj()); while (pColumnLayout) { m_pColumns[pColumnLayout->GetColumnID()] = pColumnLayout; @@ -597,7 +597,7 @@ void LwpTableLayout::RegisterColumns() } pColumnID = pColumnLayout->GetNext(); - pColumnLayout = static_cast(pColumnID->obj()); + pColumnLayout = dynamic_cast(pColumnID->obj()); } // if all columns are not justifiable, the rightmost column will be changed to justifiable @@ -676,14 +676,14 @@ void LwpTableLayout::RegisterRows() // register style of rows LwpObjectID * pRowID = GetChildHead(); - LwpRowLayout * pRowLayout = static_cast(pRowID->obj()); + LwpRowLayout * pRowLayout = dynamic_cast(pRowID->obj()); while (pRowLayout) { pRowLayout->SetFoundry(m_pFoundry); pRowLayout->RegisterStyle(); pRowID = pRowLayout->GetNext(); - pRowLayout = static_cast(pRowID->obj()); + pRowLayout = dynamic_cast(pRowID->obj()); } } /** @@ -716,7 +716,7 @@ void LwpTableLayout::RegisterStyle() LwpObjectID * pID= pTable->GetDefaultCellStyle(); if (pID) { - m_pDefaultCellLayout = static_cast(pID->obj()); + m_pDefaultCellLayout = dynamic_cast(pID->obj()); } // register columns styles @@ -1261,7 +1261,7 @@ void LwpTableLayout::ConvertColumn(XFTable *pXFTable,sal_uInt8 nStartCol,sal_uIn { // add row to table LwpObjectID *pColID = GetColumnLayoutHead(); - LwpColumnLayout * pColumnLayout = static_cast(pColID->obj()); + LwpColumnLayout * pColumnLayout = dynamic_cast(pColID->obj()); while (pColumnLayout) { if (pColumnLayout->GetColumnID() == (iLoop+nStartCol)) @@ -1270,7 +1270,7 @@ void LwpTableLayout::ConvertColumn(XFTable *pXFTable,sal_uInt8 nStartCol,sal_uIn break; } pColID = pColumnLayout->GetNext(); - pColumnLayout = static_cast(pColID->obj()); + pColumnLayout = dynamic_cast(pColID->obj()); } if (!pColumnLayout) { @@ -1403,14 +1403,14 @@ XFCell* LwpTableLayout::GetCellsMap(sal_uInt16 nRow,sal_uInt8 nCol) LwpRowLayout* LwpTableLayout::GetRowLayout(sal_uInt16 nRow) { LwpObjectID *pRowID = GetChildHead(); - LwpRowLayout * pRowLayout = static_cast(pRowID->obj()); + LwpRowLayout * pRowLayout = dynamic_cast(pRowID->obj()); while (pRowLayout) { if(pRowLayout->GetRowID() == nRow) return pRowLayout; pRowID = pRowLayout->GetNext(); - pRowLayout = static_cast(pRowID->obj()); + pRowLayout = dynamic_cast(pRowID->obj()); } return NULL; } @@ -1488,7 +1488,7 @@ LwpRowHeadingLayout * LwpTableHeadingLayout::GetFirstRowHeadingLayout() LwpObjectID *pID = GetChildHead(); if(pID && !pID->IsNull()) { - LwpRowHeadingLayout * pHeadingRow = static_cast(pID->obj()); + LwpRowHeadingLayout * pHeadingRow = dynamic_cast(pID->obj()); return pHeadingRow; } return NULL; diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx index 1659d80bea94..11f20a848fbb 100644 --- a/lotuswordpro/source/filter/lwptabrack.cxx +++ b/lotuswordpro/source/filter/lwptabrack.cxx @@ -116,7 +116,7 @@ LwpTab* LwpTabRack::Lookup(sal_uInt16 nIndex) LwpTabRack* LwpTabRack::GetNext() { - LwpTabRack* pTabRack = static_cast(m_NextID.obj()); + LwpTabRack* pTabRack = dynamic_cast(m_NextID.obj()); return pTabRack; } diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index 9f3f53b2d836..29d8955c41f4 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -377,7 +377,7 @@ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index) LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) { LwpObjectID * pID = m_SearchItems.GetHead(); // not necessary to check pID NULL or not - LwpTocLevelData * pObj = static_cast(pID->obj()); + LwpTocLevelData * pObj = dynamic_cast(pID->obj()); while(pObj) { @@ -387,7 +387,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) } pID = pObj->GetNext(); // not necessary to check pID NULL or not - pObj = static_cast(pID->obj()); + pObj = dynamic_cast(pID->obj()); } return NULL; @@ -401,7 +401,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetSearchLevelPtr(sal_uInt16 index) LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, LwpTocLevelData * pCurData) { LwpObjectID * pID = pCurData->GetNext(); - LwpTocLevelData * pObj = static_cast(pID->obj()); + LwpTocLevelData * pObj = dynamic_cast(pID->obj()); while(pObj) { @@ -411,7 +411,7 @@ LwpTocLevelData * LwpTocSuperLayout::GetNextSearchLevelPtr(sal_uInt16 index, Lwp } pID = pObj->GetNext(); // not necessary to check pID NULL or not - pObj = static_cast(pID->obj()); + pObj = dynamic_cast(pID->obj()); } return NULL; diff --git a/lotuswordpro/source/filter/lwptools.hxx b/lotuswordpro/source/filter/lwptools.hxx index 913cc31b5232..5111582ed9b2 100644 --- a/lotuswordpro/source/filter/lwptools.hxx +++ b/lotuswordpro/source/filter/lwptools.hxx @@ -71,6 +71,7 @@ #include "xfilter/xfdatestyle.hxx" #include "xfilter/xftimestyle.hxx" #include +#include // 01/19/2005 const sal_uInt32 UNITS_PER_INCH = 65536L * 72L; @@ -141,6 +142,18 @@ inline sal_Bool LwpTools::IsEvenNumber(sal_uInt16& nNumber) return nNumber%2? sal_False : sal_True; } +class BadSeek : public std::runtime_error +{ +public: + BadSeek() : std::runtime_error("Lotus Word Pro Bad Seek") { } +}; + +class BadDecompress : public std::runtime_error +{ +public: + BadDecompress() : std::runtime_error("Lotus Word Pro Bad Decompress") { } +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/utlist.cxx b/lotuswordpro/source/filter/utlist.cxx index 0acd2db39862..d68b49cbe20c 100644 --- a/lotuswordpro/source/filter/utlist.cxx +++ b/lotuswordpro/source/filter/utlist.cxx @@ -59,10 +59,11 @@ namespace OpenStormBento { CUtListElmt::CUtListElmt(pCUtList pList) + : cpNext(NULL) + , cpPrev(NULL) { - if (pList == NULL) - cpNext = NULL; - else InsertAfter(pList->GetLast()); + if (pList != NULL) + InsertAfter(pList->GetLast()); } CUtListElmt::~CUtListElmt() diff --git a/lotuswordpro/source/filter/utlist.hxx b/lotuswordpro/source/filter/utlist.hxx index ab53bfc52a8d..1e318bd9726b 100644 --- a/lotuswordpro/source/filter/utlist.hxx +++ b/lotuswordpro/source/filter/utlist.hxx @@ -69,7 +69,10 @@ UtDefClassP(CUtComparableListElmt); class CUtListElmt { public: // Methods - CUtListElmt() { cpNext = NULL; } + CUtListElmt() + : cpNext(NULL) + , cpPrev(NULL) + {} CUtListElmt(pCUtListElmt pPrev) { InsertAfter(pPrev); } CUtListElmt(pCUtList pList); virtual ~CUtListElmt(); diff --git a/lotuswordpro/source/filter/xfilter/xfimage.cxx b/lotuswordpro/source/filter/xfilter/xfimage.cxx index a7332bbacdc7..1bf7c112ee16 100644 --- a/lotuswordpro/source/filter/xfilter/xfimage.cxx +++ b/lotuswordpro/source/filter/xfilter/xfimage.cxx @@ -60,7 +60,7 @@ #include "xfimage.hxx" #include "xfbase64.hxx" -XFImage::XFImage() +XFImage::XFImage() : m_bUseLink(sal_False) { m_eType = enumXFFrameImage; m_strName = XFGlobal::GenImageName(); diff --git a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx index 2b202bfd20c1..b9381d5d09ff 100644 --- a/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx +++ b/lotuswordpro/source/filter/xfilter/xfsaxstream.cxx @@ -94,23 +94,27 @@ XFSaxStream::~XFSaxStream() void XFSaxStream::StartDocument() { - m_aHandler->startDocument(); + if (m_aHandler.is()) + m_aHandler->startDocument(); } void XFSaxStream::EndDocument() { - m_aHandler->endDocument(); + if (m_aHandler.is()) + m_aHandler->endDocument(); } void XFSaxStream::StartElement(const rtl::OUString& oustr) { - m_aHandler->startElement( oustr, m_pAttrList->GetAttributeList() ); + if (m_aHandler.is()) + m_aHandler->startElement( oustr, m_pAttrList->GetAttributeList() ); m_pAttrList->Clear(); } void XFSaxStream::EndElement(const rtl::OUString& oustr) { - m_aHandler->endElement(oustr); + if (m_aHandler.is()) + m_aHandler->endElement(oustr); if( m_pAttrList ) m_pAttrList->Clear(); @@ -118,7 +122,8 @@ void XFSaxStream::EndElement(const rtl::OUString& oustr) void XFSaxStream::Characters(const rtl::OUString& oustr) { - m_aHandler->characters(oustr); + if (m_aHandler.is()) + m_aHandler->characters(oustr); } IXFAttrList* XFSaxStream::GetAttrList() diff --git a/lotuswordpro/util/makefile.mk b/lotuswordpro/util/makefile.mk index 640ba297ae75..b150cc6736dd 100644 --- a/lotuswordpro/util/makefile.mk +++ b/lotuswordpro/util/makefile.mk @@ -36,10 +36,16 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE : target.mk -ALLTAR : $(MISC)/lwpfilter.component +ALLTAR : $(MISC)/lwpfilter.component $(MISC)/qa_lwpfilter.component $(MISC)/lwpfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ lwpfilter.component $(XSLTPROC) --nonet --stringparam uri \ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ $(SOLARENV)/bin/createcomponent.xslt lwpfilter.component + +$(MISC)/qa_lwpfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + lwpfilter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt lwpfilter.component -- cgit From 86a1c5e99ce550145835ebbe8f3afd0d0a4c4c91 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Tue, 12 Apr 2011 11:25:59 +0200 Subject: Our fontconfig baseline is 2.2.0 --- vcl/unx/source/fontmanager/fontconfig.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index c938e25c0aec..f4b690a4fed7 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -49,6 +49,12 @@ using namespace psp; #ifndef FC_FAMILYLANG // TODO: remove when baseline moves to fc>=2.2.97 #define FC_FAMILYLANG "familylang" #endif + #ifndef FC_CAPABILITY // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_CAPABILITY "capability" + #endif + #ifndef FC_STYLELANG // TODO: remove when baseline moves to fc>=2.2.97 + #define FC_STYLELANG "stylelang" + #endif #ifndef FC_HINT_STYLE // TODO: remove when baseline moves to fc>=2.2.91 #define FC_HINT_STYLE "hintstyle" #define FC_HINT_NONE 0 -- cgit From 87c7796cf932f311a7be5a351c10ef94e65cbdd0 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Tue, 12 Apr 2011 11:39:23 +0200 Subject: fix a mixup with calling conventions --- sc/source/ui/vba/vbaworkbook.hxx | 2 +- sc/source/ui/vba/vbaworksheet.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx index 0ec3604da2a6..f51ce051d1a7 100644 --- a/sc/source/ui/vba/vbaworkbook.hxx +++ b/sc/source/ui/vba/vbaworkbook.hxx @@ -86,7 +86,7 @@ public: virtual css::uno::Reference< css::frame::XModel > getDocModel() { return mxModel; } // XUnoTunnel - virtual ::sal_Int64 getSomething(const css::uno::Sequence& rId ) throw(css::uno::RuntimeException); + virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence& rId ) throw(css::uno::RuntimeException); }; #endif /* SC_VBA_WORKBOOK_HXX */ diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index 1affb7f4cbdc..56e9975a3b07 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -173,7 +173,7 @@ public: virtual rtl::OUString& getServiceImplName(); virtual css::uno::Sequence getServiceNames(); // XUnoTunnel - virtual ::sal_Int64 getSomething(const css::uno::Sequence& rId ) throw(css::uno::RuntimeException); + virtual ::sal_Int64 SAL_CALL getSomething(const css::uno::Sequence& rId ) throw(css::uno::RuntimeException); }; #endif /* SC_VBA_WORKSHEET_HXX */ -- cgit -- cgit From 67a8788b210dfa606ad816e62d2d22d23895cf4f Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 12 Apr 2011 13:55:11 +0300 Subject: Use static_cast to resolve ambiguity between NULL and 0 --- svtools/source/filter.vcl/filter/exportdialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index 701619d31f6c..f95490b57731 100644 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, static_cast(NULL), 0, NULL ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } -- cgit From d00bf4bb5ec7b2ca670fe2b4eb385b5634ed3b5d Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 11 Apr 2011 12:22:52 +0200 Subject: reenable ucalc.cxx unittest in gbuild --- sc/CppunitTest_sc_ucalc.mk | 90 +++++++++++++++++++++++++++++++ sc/Module_sc.mk | 6 +++ sc/Package_qa_unit.mk | 44 +++++++++++++++ sc/qa/unit/Makefile | 53 ++++++++++++++++++ sc/qa/unit/makefile.mk | 132 --------------------------------------------- 5 files changed, 193 insertions(+), 132 deletions(-) create mode 100644 sc/CppunitTest_sc_ucalc.mk create mode 100644 sc/Package_qa_unit.mk create mode 100644 sc/qa/unit/Makefile delete mode 100644 sc/qa/unit/makefile.mk diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk new file mode 100644 index 000000000000..0c857abfeb32 --- /dev/null +++ b/sc/CppunitTest_sc_ucalc.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen, Canonical Ltd. +# Portions created by the Initial Developer are Copyright (C) 2010 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sc_ucalc)) + +$(eval $(call gb_CppunitTest_add_package_headers,sc_ucalc,sc_qa_unit)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \ + sc/qa/unit/ucalc \ +)) + +$(eval $(call gb_CppunitTest_set_args,sc_ucalc,\ + --headless \ + --invisible \ + "-env:UNO_TYPES=$(foreach binrdb,udkapi.rdb types.rdb,\ + file://$(if $(filter WNT,$(OS)),/)$(OUTDIR)/bin/$(binrdb))" \ + "-env:UNO_SERVICES=$(foreach rdb,$(OUTDIR)/xml/ure/services.rdb $(WORKDIR)/CustomTarget/sc/qa/unit/services.rdb,\ + file://$(if $(filter WNT,$(OS)),/)$(rdb))" \ + $(foreach dir,URE_INTERNAL_LIB_DIR OOO_BASE_DIR BRAND_BASE_DIR, \ + -env:$(dir)=file://$(if $(filter WNT,$(OS)),/$(OUTDIR)/bin,$(OUTDIR)/lib)) \ +)) + +$(eval $(call gb_CppunitTest_add_library_objects,sc_ucalc,sc)) + +$(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \ + avmedia \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nisolang1 \ + sal \ + salhelper \ + sb \ + sfx \ + sot \ + svl \ + svt \ + svx \ + svxcore \ + tk \ + tl \ + ucbhelper \ + utl \ + vbahelper \ + vcl \ + xo \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_ucalc,\ + -I$(realpath $(SRCDIR)/sc/inc/pch) \ + -I$(realpath $(SRCDIR)/sc/source/ui/inc) \ + -I$(realpath $(SRCDIR)/sc/inc) \ + $$(INCLUDE) \ + -I$(OUTDIR)/inc/offuh \ + -I$(OUTDIR)/inc \ +)) + +# vim: set noet sw=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 6878587be498..9a250165b2d7 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -33,3 +33,9 @@ $(eval $(call gb_Module_add_targets,sc,\ Package_xml \ )) +$(eval $(call gb_Module_add_check_targets,sc,\ + CppunitTest_sc_ucalc \ + Package_qa_unit \ +)) + + diff --git a/sc/Package_qa_unit.mk b/sc/Package_qa_unit.mk new file mode 100644 index 000000000000..8db8cb798f07 --- /dev/null +++ b/sc/Package_qa_unit.mk @@ -0,0 +1,44 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Bjoern Michaelsen (Canonical Ltd.) +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_Package_Package,sc_qa_unit,$(WORKDIR)/CustomTarget/sc/qa/unit)) +$(eval $(call gb_Package_add_customtarget,sc_qa_unit,sc/qa/unit)) + +# dependencies that cause the CustomTarget Makefile to be called recursively for +# (re)build +$(eval $(call gb_CustomTarget_add_outdir_dependencies,sc/qa/unit,\ + $(foreach newcomponentfile,\ + framework/util/fwk \ + sfx2/util/sfx \ + unoxml/source/service/unoxml,\ + $(OUTDIR)/xml/component/$(newcomponentfile).component) \ + $(foreach oldcomponentfile, \ + i18npool \ + ucb1 \ + ucpfile1, \ + $(OUTDIR)/xml/$(oldcomponentfile).component) \ +)) + +# vim: set noet sw=4: diff --git a/sc/qa/unit/Makefile b/sc/qa/unit/Makefile new file mode 100644 index 000000000000..7bdedd0163ce --- /dev/null +++ b/sc/qa/unit/Makefile @@ -0,0 +1,53 @@ +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Bjoern Michaelsen (Canonical Ltd.) +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): Bjoern Michaelsen (Canonical Ltd.) +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +MYDIR := $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) + +all : services.rdb + +services.rdb : $(foreach newcomponentfile,\ + framework/util/fwk \ + sfx2/util/sfx \ + unoxml/source/service/unoxml,\ + $(OUTDIR)/xml/component/$(newcomponentfile).component \ +) + +services.rdb : $(foreach oldcomponentfile, \ + i18npool \ + ucb1 \ + ucpfile1, \ + $(OUTDIR)/xml/$(oldcomponentfile).component \ +) + +services.rdb : + echo '' > $@ + $(gb_AWK) -- \ + '/^<\?xml version.*/ { next; } \ + { gsub(/vnd.sun.star.expand:\$$OOO_BASE_DIR\/program/, "vnd.sun.star.expand:$$OOO_BASE_DIR",$$0); print; }' \ + $^ >> $@ + echo '' >> $@ + +.PHONY : all +# vim: set noet sw=4 ts=4: diff --git a/sc/qa/unit/makefile.mk b/sc/qa/unit/makefile.mk deleted file mode 100644 index d252433fd56b..000000000000 --- a/sc/qa/unit/makefile.mk +++ /dev/null @@ -1,132 +0,0 @@ -# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -# -# Version: MPL 1.1 / GPLv3+ / LGPLv3+ -# -# The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Initial Developer of the Original Code is -# Novell, Inc. -# Portions created by the Initial Developer are Copyright (C) 2010 the -# Initial Developer. All Rights Reserved. -# -# Contributor(s): Michael Meeks -# Caolan McNamara -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 3 or later (the "GPLv3+"), or -# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), -# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable -# instead of those above. -# - -PRJ=..$/.. -PRJNAME=sc -TARGET=qa_unit - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -CFLAGSCXX += $(CPPUNIT_CFLAGS) -I../../source/ui/inc - -SHL1TARGET = $(TARGET) -SHL1OBJS = $(SLO)$/ucalc.obj -SHL1STDLIBS= \ - $(BASICLIB) \ - $(VBAHELPERLIB) \ - $(SFXLIB) \ - $(SVTOOLLIB) \ - $(SVLLIB) \ - $(SVXCORELIB) \ - $(EDITENGLIB) \ - $(SVXLIB) \ - $(BASEGFXLIB) \ - $(DRAWINGLAYERLIB) \ - $(VCLLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(COMPHELPERLIB) \ - $(UCBHELPERLIB) \ - $(TKLIB) \ - $(VOSLIB) \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(UNOTOOLSLIB) \ - $(SOTLIB) \ - $(XMLOFFLIB) \ - $(AVMEDIALIB) \ - $(FORLIB) \ - $(FORUILIB) \ - $(CPPUNITLIB) -SHL1IMPLIB = i$(SHL1TARGET) -SHL1LIBS=$(SLB)$/scalc3.lib $(SLB)$/scalc3c.lib -DEF1NAME = $(SHL1TARGET) -SHL1VERSIONMAP=version.map - -.INCLUDE: target.mk - -.IF "$(OS)" == "WNT" -my_file = file:/// -.ELSE -my_file = file:// -.END - -ALLTAR: test - -test_components = \ - component/framework/util/fwk \ - component/sfx2/util/sfx \ - component/unoxml/source/service/unoxml \ - ucb1 \ - ucpfile1 \ - i18npool - -#Make a services.rdb with the services we know we need to get up and running -$(MISC)/$(TARGET)/services.input : makefile.mk - $(MKDIRHIER) $(@:d) - echo \ - '$(test_components:^"":+".component")' \ - > $@ - -$(MISC)/$(TARGET)/services.rdb .ERRREMOVE : makefile.mk $(MISC)/$(TARGET)/services.input - $(MKDIRHIER) $(@:d) - $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@.tmp \ - $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input - cat $(MISC)/$@.tmp | sed 's|/program/|/|g' > $@ - -#Tweak things so that we use the .res files in the solver -STAR_RESOURCEPATH:=$(PWD)/$(BIN)$(PATH_SEPERATOR)$(SOLARBINDIR) -.EXPORT : STAR_RESOURCEPATH - -.IF "$(OS)" != "DRAGONFLY" - -test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb - @echo ---------------------------------------------------------- - @echo - start unit test \#1 on library $(SHL1TARGETN) - @echo ---------------------------------------------------------- - $(CPPUNITTESTER) $(SHL1TARGETN) --headless --invisible \ - '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(SOLARBINDIR)$/types.rdb' \ - '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\ - -env:URE_INTERNAL_LIB_DIR="$(my_file)$(SOLARSHAREDBIN)" \ - -env:OOO_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)" \ - -env:BRAND_BASE_DIR="$(my_file)$(SOLARSHAREDBIN)" - -.ELSE - -test .PHONY: $(SHL1TARGETN) - @echo ---------------------------------------------------------- - @echo - WARNING!!, test disabled on your platform - @echo - Please test manually, and enable if it works - @echo ---------------------------------------------------------- - -.ENDIF -- cgit From b8d3e53102d3b0f117d4c891e117a139f675da72 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 11 Apr 2011 12:23:46 +0200 Subject: fdo#36128: disabled testCVEs for now in ucalc.cxx as it fails --- sc/qa/unit/ucalc.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d742718417ad..7b998bd08ac4 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -270,7 +270,8 @@ public: CPPUNIT_TEST(testGraphicsInGroup); CPPUNIT_TEST(testStreamValid); CPPUNIT_TEST(testFunctionLists); - CPPUNIT_TEST(testCVEs); + // fdo#36128 disabled for now because it fails + //CPPUNIT_TEST(testCVEs); CPPUNIT_TEST_SUITE_END(); private: -- cgit From d005fb46242a87da2ca4dde41d78c7ed7e32f23c Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Mon, 11 Apr 2011 20:06:16 +0200 Subject: use git hook instead of gitattributes filter for *.po files --- .gitattributes | 1 - g | 6 ------ git-hooks/pre-commit | 10 ++++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitattributes b/.gitattributes index d414da85d0db..416fa8c63b14 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,2 @@ *.doc binary *.sdw binary -*.po filter=po diff --git a/g b/g index 2d601b5e09f8..7fbf6834764d 100755 --- a/g +++ b/g @@ -38,12 +38,6 @@ function update_hooks() if [ "$PWD" != "$RAWBUILDDIR" -a ! -e .gitattributes ]; then ln -s $RAWBUILDDIR/.gitattributes . fi - if [ -z "$(git config filter.po.clean)" ] ; then - git config filter.po.clean 'msgcat - --no-wrap' - fi - if [ -z "$(git config filter.po.smudge)" ] ; then - git config filter.po.smudge cat - fi } # extra params for some commands, like log diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 6817990eeb98..abf1acb8d294 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -150,6 +150,16 @@ while (my $file = ) { } } +# run 'msgcat --nowrap' when committing *.po files +open(FILES, "git diff-index --cached --name-only $against |") || die "Cannot run git diff-index."; +while (my $file = ) { + chomp($file); + if ($file =~ /\.po$/) { + system("msgcat --no-wrap $file > $file.KQnBbK6wQE;mv $file.KQnBbK6wQE $file;"); + system("git add $file"); + } +} + # be strict about tabs - we don't want them at all, setup your editor # correctly ;-) my $err_ext = ""; -- cgit From 5cdd5c77d771b19a11116ef8918a2020b41bb71f Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 5 Apr 2011 11:50:53 +0200 Subject: starting sc_ucalc unit test --- sc/Module_sc.mk | 18 ++++++++++-------- sc/qa/unit/ucalc.cxx | 6 +----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 9a250165b2d7..765d7d65ddd2 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -23,15 +23,16 @@ $(eval $(call gb_Module_Module,sc)) $(eval $(call gb_Module_add_targets,sc,\ - AllLangResTarget_sc \ - Library_sc \ - Library_scd \ - Library_scfilt \ - Library_scui \ - Library_vbaobj \ - Package_uiconfig \ - Package_xml \ + AllLangResTarget_sc \ + Library_sc \ + Library_scd \ + Library_scfilt \ + Library_scui \ + Library_vbaobj \ + Package_uiconfig \ + Package_xml \ )) +# CppunitTest_sc_ucalc \ $(eval $(call gb_Module_add_check_targets,sc,\ CppunitTest_sc_ucalc \ @@ -39,3 +40,4 @@ $(eval $(call gb_Module_add_check_targets,sc,\ )) +# vim: set noet ts=4 sw=4: diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 7b998bd08ac4..a5127138d1ae 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -39,12 +39,8 @@ // the need for manually calling regcomp and knowing what // services we need, and in what .so they are implemented -#include "precompiled_sc.hxx" -#include -#include -#include -#include +#include #include #include -- cgit From 0ebbbaccdb81fa12c75c25b2809558d1421d2bd4 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 12 Apr 2011 18:10:54 +0200 Subject: cleaning Module_sc.mk after cherry-picking --- sc/Module_sc.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 765d7d65ddd2..7cd8ba891ac7 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -32,12 +32,10 @@ $(eval $(call gb_Module_add_targets,sc,\ Package_uiconfig \ Package_xml \ )) -# CppunitTest_sc_ucalc \ $(eval $(call gb_Module_add_check_targets,sc,\ CppunitTest_sc_ucalc \ Package_qa_unit \ )) - # vim: set noet ts=4 sw=4: -- cgit From 84edb157a5b19e4e7b7bd5844ce92681e8db3cbe Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 4 Apr 2011 23:48:57 +0200 Subject: make get_linktargetname public again so unittests can find the object lists --- solenv/gbuild/Executable.mk | 2 +- solenv/gbuild/Library.mk | 5 ++--- solenv/gbuild/StaticLibrary.mk | 5 ++--- solenv/gbuild/TargetLocations.mk | 3 +++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk index 90519f91b382..1ffb1ef09b9f 100644 --- a/solenv/gbuild/Executable.mk +++ b/solenv/gbuild/Executable.mk @@ -58,7 +58,7 @@ $(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)),$(call g endef define gb_Executable_forward_to_Linktarget -gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),Executable/$$(1)$$(gb_Executable_EXT),$$(2),$$(3)) +gb_Executable_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Executable_get_linktargetname,$$(1)),$$(2),$$(3)) endef diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk index 3c8d2f5def81..e6f358a9ef30 100644 --- a/solenv/gbuild/Library.mk +++ b/solenv/gbuild/Library.mk @@ -39,7 +39,6 @@ # gb_Library_Library_platform # gb_Library_TARGETS -gb_Library__get_linktargetname = Library/$(call gb_Library_get_filename,$(1)) # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows .PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) @@ -60,7 +59,7 @@ $$(eval $$(call gb_Output_info,Currently known libraries are: $(sort $(gb_Librar $$(eval $$(call gb_Output_error,Library $(1) must be registered in Repository.mk)) endif $(call gb_Library_get_target,$(1)) : AUXTARGETS := -$(call gb_Library__Library_impl,$(1),$(call gb_Library__get_linktargetname,$(1))) +$(call gb_Library__Library_impl,$(1),$(call gb_Library_get_linktargetname,$(1))) endef @@ -97,7 +96,7 @@ gb_Library__get_layer_componentprefix = \ define gb_Library__forward_to_Linktarget -gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library__get_linktargetname,$$(1)),$$(2),$$(3)) +gb_Library_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_Library_get_linktargetname,$$(1)),$$(2),$$(3)) endef diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk index 717b4717c4d8..d217f584bc80 100644 --- a/solenv/gbuild/StaticLibrary.mk +++ b/solenv/gbuild/StaticLibrary.mk @@ -35,7 +35,6 @@ # gb_StaticLibrary_FILENAMES # gb_StaticLibrary_TARGETS -gb_StaticLibrary__get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1)) # EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows .PHONY : $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) @@ -56,7 +55,7 @@ $$(eval $$(call gb_Output_info,Currently known static libraries are: $(sort $(gb $$(eval $$(call gb_Output_error,Static library $(1) must be registered in Repository.mk)) endif $(call gb_StaticLibrary_get_target,$(1)) : AUXTARGETS := -$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary__get_linktargetname,$(1))) +$(call gb_StaticLibrary__StaticLibrary_impl,$(1),$(call gb_StaticLibrary_get_linktargetname,$(1))) endef @@ -76,7 +75,7 @@ $(call gb_Deliver_add_deliverable,$(call gb_StaticLibrary_get_target,$(1)),$(cal endef define gb_StaticLibrary_forward_to_Linktarget -gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary__get_linktargetname,$$(1)),$$(2),$$(3)) +gb_StaticLibrary_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_StaticLibrary_get_linktargetname,$$(1)),$$(2),$$(3)) endef diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 23df7b159611..42a13bc64add 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -151,6 +151,9 @@ define gb_StaticLibrary_get_filename $(patsubst $(1):%,%,$(filter $(1):%,$(gb_StaticLibrary_FILENAMES))) endef +gb_Executable_get_linktargetname = Executable/$(1)$(gb_Executable_EXT) +gb_Library_get_linktargetname = Library/$(call gb_Library_get_filename,$(1)) +gb_StaticLibrary_get_linktargetname = StaticLibrary/$(call gb_StaticLibrary_get_filename,$(1)) # static members declared here because they are used globally -- cgit From 37d41b23e4c658ad4da412eef86401a7be748b8f Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 5 Apr 2011 09:09:52 +0200 Subject: fixing up extra object list support --- solenv/gbuild/CppunitTest.mk | 18 ++++++++++-------- solenv/gbuild/LinkTarget.mk | 37 +++++++++++++++++++++++++++++++++++++ solenv/gbuild/TargetLocations.mk | 1 + solenv/gbuild/platform/macosx.mk | 2 ++ solenv/gbuild/platform/solaris.mk | 1 + solenv/gbuild/platform/unxgcc.mk | 2 ++ solenv/gbuild/platform/windows.mk | 1 + solenv/gbuild/platform/winmingw.mk | 2 ++ 8 files changed, 56 insertions(+), 8 deletions(-) diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index 59f6f332b3cf..3b6b6a884449 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -82,22 +82,24 @@ $(eval $(foreach method,\ add_cobjects \ add_cxxobject \ add_cxxobjects \ - add_objcxxobject \ - add_objcxxobjects \ add_exception_objects \ + add_executable_objects \ + add_library_objects \ + add_linked_libs \ + add_linked_static_libs \ add_noexception_objects \ + add_objcxxobject \ + add_objcxxobjects \ + add_package_headers \ + add_precompiled_header \ + add_sdi_headers \ set_cflags \ set_cxxflags \ - set_objcxxflags \ set_defs \ set_include \ set_ldflags \ set_library_path_flags \ - add_linked_libs \ - add_linked_static_libs \ - add_package_headers \ - add_sdi_headers \ - add_precompiled_header \ + set_objcxxflags \ ,\ $(call gb_CppunitTest__forward_to_Linktarget,$(method))\ )) diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk index 3572b10a6e30..b71a05de0f17 100644 --- a/solenv/gbuild/LinkTarget.mk +++ b/solenv/gbuild/LinkTarget.mk @@ -262,6 +262,7 @@ $(call gb_LinkTarget_get_clean_target,%) : $(call gb_LinkTarget_get_dep_target,$*) \ $(call gb_LinkTarget_get_headers_target,$*) \ $(call gb_LinkTarget_get_external_headers_target,$*) \ + $(call gb_LinkTarget_get_objects_list,$*) \ $(DLLTARGET) \ $(AUXTARGETS)) && \ cat $${RESPONSEFILE} /dev/null | xargs -n 200 rm -f && \ @@ -284,8 +285,20 @@ $(call gb_Helper_abbreviate_dirs,\ endef +define gb_LinkTarget__command_objectlist +TEMPFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ + $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ + $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ + $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object)))) && \ +$(if $(EXTRAOBJECTLISTS),cat $(EXTRAOBJECTLISTS) >> $${TEMPFILE} && ) \ +mv $${TEMPFILE} $(call gb_LinkTarget_get_objects_list,$(2)) + +endef + $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY) $(call gb_LinkTarget__command,$@,$*) + $(call gb_LinkTarget__command_objectlist,$@,$*) ifeq ($(gb_FULLDEPS),$(true)) $(call gb_LinkTarget_get_target,%) : $(call gb_LinkTarget_get_dep_target,%) @@ -387,6 +400,7 @@ $(call gb_LinkTarget_get_target,$(1)) : PCH_NAME := $(call gb_LinkTarget_get_target,$(1)) : PCHOBJS := $(call gb_LinkTarget_get_headers_target,$(1)) \ $(call gb_LinkTarget_get_target,$(1)) : PDBFILE := +$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS := ifeq ($(gb_FULLDEPS),$(true)) ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),) @@ -408,6 +422,7 @@ $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE := $$(gb_LinkTarget_INCLUDE) $(call gb_LinkTarget_get_dep_target,$(1)) : INCLUDE_STL := $$(gb_LinkTarget_INCLUDE_STL) $(call gb_LinkTarget_get_dep_target,$(1)) : TARGETTYPE := $(call gb_LinkTarget_get_dep_target,$(1)) : PCH_NAME := +$(call gb_LinkTarget_get_dep_target,$(1)) : EXTRAOBJECTLISTS := endif endef @@ -575,6 +590,28 @@ define gb_LinkTarget_add_cobjects $(foreach obj,$(2),$(call gb_LinkTarget_add_cobject,$(1),$(obj),$(3))) endef +define gb_LinkTarget_add_linktarget_objects +$(call gb_LinkTarget_get_target,$(1)) : $(foreach linktarget,$(2),$(call gb_LinkTarget_get_target,$(linktarget))) +$(info gb_LinkTarget_add_linktarget_objects,$(1),$(2)) +$(call gb_LinkTarget_get_target,$(1)) : EXTRAOBJECTLISTS += $(foreach linktarget,$(2),$(call gb_LinkTarget_get_objects_list,$(linktarget))) + +endef + +define gb_LinkTarget_add_library_objects +ifneq (,$$(filter-out $(gb_Library_KNOWNLIBS),$(2))) +$$(eval $$(call gb_Output_info,currently known libraries are: $(sort $(gb_Library_KNOWNLIBS)),ALL)) +$$(eval $$(call gb_Output_error,Cannot import objects library/libraries $$(filter-out $(gb_Library_KNOWNLIBS),$(2)). Libraries must be registered in Repository.mk)) +endif +$(info gb_LinkTarget_add_library_objects,$(1),$(2)) +$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach lib,$(2),$(call gb_Library_get_linktargetname,$(lib)))) + +endef + +define gb_LinkTarget_add_executable_objects +$(call gb_LinkTarget_add_linktarget_objects,$(1),$(foreach exe,$(2),$(call gb_Executable_get_linktargetname,$(lib)))) + +endef + define gb_LinkTarget_add_cxxobjects $(foreach obj,$(2),$(call gb_LinkTarget_add_cxxobject,$(1),$(obj),$(3))) endef diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 42a13bc64add..486a5b6d1218 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -65,6 +65,7 @@ gb_JunitTest_get_userdir = $(WORKDIR)/JunitTest/$(1)/user gb_LinkTarget_get_external_headers_target = $(WORKDIR)/ExternalHeaders/$(1) gb_LinkTarget_get_headers_target = $(WORKDIR)/Headers/$(1) gb_LinkTarget_get_target = $(WORKDIR)/LinkTarget/$(1) +gb_LinkTarget_get_objects_list = $(WORKDIR)/LinkTarget/$(1).objectlist gb_Module_get_check_target = $(WORKDIR)/Module/check/$(1) gb_Module_get_subsequentcheck_target = $(WORKDIR)/Module/subsequentcheck/$(1) gb_Module_get_target = $(WORKDIR)/Module/$(1) diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index cc577cbef1ff..8831f7f974f5 100755 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -270,6 +270,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ -o $(1) \ `cat $${DYLIB_FILE}` && \ @@ -288,6 +289,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ 2> /dev/null) endef diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk index 65b71a3b27cb..9095d609f8e4 100755 --- a/solenv/gbuild/platform/solaris.mk +++ b/solenv/gbuild/platform/solaris.mk @@ -206,6 +206,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ -o $(1)) endef diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index e52684f61ca4..792a4069d27b 100755 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -238,6 +238,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ -Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \ $(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \ -o $(1)) @@ -250,6 +251,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ 2> /dev/null) endef diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk index 52dffb4e77c6..d41a04a12389 100755 --- a/solenv/gbuild/platform/windows.mk +++ b/solenv/gbuild/platform/windows.mk @@ -429,6 +429,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \ $(LDFLAGS) \ @$${RESPONSEFILE} \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ $(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \ $(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \ diff --git a/solenv/gbuild/platform/winmingw.mk b/solenv/gbuild/platform/winmingw.mk index 2ad299ded609..99a2d4d06fcb 100644 --- a/solenv/gbuild/platform/winmingw.mk +++ b/solenv/gbuild/platform/winmingw.mk @@ -400,6 +400,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(gb_MINGWLIBDIR)/crt2.o \ $(MINGW_CLIB_DIR)/crtbegin.o \ @$${RESPONSEFILE} \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ --start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \ --start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \ $(MINGW_CLIB_DIR)/crtend.o \ @@ -423,6 +424,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(gb_MINGWLIBDIR)/dllcrt2.o \ $(MINGW_CLIB_DIR)/crtbegin.o \ @$${RESPONSEFILE} \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ --start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) --end-group \ --start-group $(patsubst %.dll,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_dllname,$(lib)))) --end-group \ $(MINGW_CLIB_DIR)/crtend.o \ -- cgit From c5046e93a828d6d97fc3b3fe2afd6ebcf998f695 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 11 Apr 2011 12:00:55 +0200 Subject: add support for auxiliary arguments to the cppunit tests --- solenv/gbuild/CppunitTest.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index 3b6b6a884449..e9fdb919dd82 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -49,7 +49,7 @@ $(call gb_CppunitTest_get_target,%) : $(gb_CppunitTest_CPPTESTTARGET) $(call gb_Output_announce,$*,$(true),CUT,2) $(call gb_Helper_abbreviate_dirs_native,\ mkdir -p $(dir $@) && \ - $(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) > $@.log 2>&1 || (cat $@.log && false)) + $(gb_CppunitTest_CPPTESTCOMMAND) $(call gb_LinkTarget_get_target,CppunitTest/$(call gb_CppunitTest_get_libfilename,$*)) $(ARGS) > $@.log 2>&1 || (cat $@.log && false)) define gb_CppunitTest_CppunitTest $(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest__get_linktargetname,$(1))) @@ -68,10 +68,16 @@ $(call gb_LinkTarget_set_defs,$(2), \ $(call gb_CppunitTest_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2)) $(call gb_CppunitTest_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2)) $(call gb_CppunitTest_CppunitTest_platform,$(1),$(2),$(gb_CppunitTest_DLLDIR)/$(call gb_CppunitTest_get_libfilename,$(1))) +$(call gb_CppunitTest_get_target,$(1)) : ARGS := $$(eval $$(call gb_Module_register_target,$(call gb_CppunitTest_get_target,$(1)),$(call gb_CppunitTest_get_clean_target,$(1)))) endef +define gb_CppunitTest_set_args +$(call gb_CppunitTest_get_target,$(1)) : ARGS := $(2) + +endef + define gb_CppunitTest__forward_to_Linktarget gb_CppunitTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CppunitTest__get_linktargetname,$$(1)),$$(2),$$(3)) -- cgit From 0812c77743231e553f0ac4b4f1ee2415e675d842 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Mon, 11 Apr 2011 12:02:23 +0200 Subject: set STAR_RESOURCEPATH for cppunit tests to find resources from solver --- solenv/gbuild/CppunitTest.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk index e9fdb919dd82..d7ec6f04ad1f 100644 --- a/solenv/gbuild/CppunitTest.mk +++ b/solenv/gbuild/CppunitTest.mk @@ -36,7 +36,7 @@ export DBGSV_ERROR_OUT # gb_CppunitTest_TARGETTYPE # gb_CppunitTest_get_filename gb_CppunitTest_CPPTESTTARGET := $(call gb_Executable_get_target,cppunit/cppunittester) -gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_CPPTESTTARGET) +gb_CppunitTest_CPPTESTCOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND) $(gb_CppunitTest_GDBTRACE) STAR_RESOURCEPATH=$(dir $(call gb_ResTarget_get_outdir_target,example)) $(gb_CppunitTest_CPPTESTTARGET) gb_CppunitTest__get_linktargetname = CppunitTest/$(call gb_CppunitTest_get_filename,$(1)) .PHONY : $(call gb_CppunitTest_get_clean_target,%) -- cgit From f5963905fdf39aadf1d1ae6538ceb076a9b99e2c Mon Sep 17 00:00:00 2001 From: Katarina Machalkova Date: Thu, 7 Apr 2011 13:11:00 +0200 Subject: Removed duplicate code block (mis-merge, prolly) This fixes build with --enable-kde4 (cherry picked from commit ea898caa151fb8e94b6bdb00b1008b6da98fddad) --- vcl/unx/kde4/KDEXLib.cxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 03bcfca8e47e..ce4ea14dadb5 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -219,16 +219,6 @@ static bool qt_event_filter( void* m ) return false; } -static bool ( *old_qt_event_filter )( void* ); -static bool qt_event_filter( void* m ) -{ - if( old_qt_event_filter != NULL && old_qt_event_filter( m )) - return true; - if( SalKDEDisplay::self() && SalKDEDisplay::self()->checkDirectInputEvent( static_cast< XEvent* >( m ))) - return true; - return false; -} - void KDEXLib::setupEventLoop() { old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter ); -- cgit From 2c2ea10d446b32d24f6268116093969b454f47b8 Mon Sep 17 00:00:00 2001 From: Katarina Machalkova Date: Tue, 12 Apr 2011 23:50:03 +0200 Subject: fdo#35345: Don't overwrite hidden cells in drag-fill operation Also i#89232. Extracting relevant parts from 'calc66' CWS --- sc/inc/dbcolect.hxx | 2 + sc/inc/document.hxx | 2 + sc/inc/table.hxx | 1 + sc/source/core/data/documen3.cxx | 8 ++ sc/source/core/data/table2.cxx | 14 +++ sc/source/core/data/table4.cxx | 263 +++++++++++++++++++++++---------------- sc/source/core/tool/dbcolect.cxx | 21 ++++ 7 files changed, 202 insertions(+), 109 deletions(-) diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx index 8583b710e437..937dcfc89f0c 100644 --- a/sc/inc/dbcolect.hxx +++ b/sc/inc/dbcolect.hxx @@ -44,6 +44,7 @@ class ScDocument; class ScDBData : public ScDataObject, public ScRefreshTimer { +friend class ScDBCollection; private: // DBParam String aName; @@ -214,6 +215,7 @@ public: virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const; ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + ScDBData* GetFilterDBAtTable(SCTAB nTab) const; ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab ); sal_Bool SearchName( const String& rName, sal_uInt16& rIndex ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index f41edffbe291..901bc3615ac2 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -484,6 +484,8 @@ public: ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly = false) const; ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + ScDBData* GetFilterDBAtTable(SCTAB nTab) const; + SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const; diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 14f8ddf821bb..634acac0be6c 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -690,6 +690,7 @@ public: /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). SCROW GetLastChangedRow() const; + sal_Bool IsDataFiltered() const; sal_uInt8 GetColFlags( SCCOL nCol ) const; sal_uInt8 GetRowFlags( SCROW nRow ) const; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 888b1a16d551..583ea6cc8956 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -238,6 +238,14 @@ ScDBData* ScDocument::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nC return NULL; } +ScDBData* ScDocument::GetFilterDBAtTable(SCTAB nTab) const +{ + if (pDBCollection) + return pDBCollection->GetFilterDBAtTable(nTab); + else + return NULL; +} + ScDPCollection* ScDocument::GetDPCollection() { if (!pDPCollection) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 7293cf1eed04..0e4746095de8 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2628,6 +2628,20 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) DecRecalcLevel(); } +sal_Bool ScTable::IsDataFiltered() const +{ + sal_Bool bAnyQuery = sal_False; + ScDBData* pDBData = pDocument->GetFilterDBAtTable(nTab); + if ( pDBData ) + { + ScQueryParam aParam; + pDBData->GetQueryParam( aParam ); + if ( aParam.GetEntry(0).bDoQuery ) + bAnyQuery = sal_True; + } + return bAnyQuery; +} + void ScTable::SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags ) { diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index e7ba2153a3f1..c1e96d43d8e6 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -79,6 +79,7 @@ #include "rangenam.hxx" #include "docpool.hxx" #include "progress.hxx" +#include "segmenttree.hxx" #include @@ -199,7 +200,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, rMinDigits = 0; rListData = NULL; rCmd = FILL_SIMPLE; - if ( nScFillModeMouseModifier & KEY_MOD1 ) + if ( (nScFillModeMouseModifier & KEY_MOD1) || IsDataFiltered() ) return ; // Ctrl-Taste: Copy SCCOL nAddX; @@ -525,10 +526,15 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uLong nIMin = nIStart; sal_uLong nIMax = nIEnd; PutInOrder(nIMin,nIMax); - if (bVertical) - DeleteArea(nCol1, static_cast(nIMin), nCol2, static_cast(nIMax), IDF_AUTOFILL); - else - DeleteArea(static_cast(nIMin), nRow1, static_cast(nIMax), nRow2, IDF_AUTOFILL); + sal_Bool bHasFiltered = IsDataFiltered(); + + if (!bHasFiltered) + { + if (bVertical) + DeleteArea(nCol1, static_cast(nIMin), nCol2, static_cast(nIMax), IDF_AUTOFILL); + else + DeleteArea(static_cast(nIMin), nRow1, static_cast(nIMax), nRow2, IDF_AUTOFILL); + } sal_uLong nProgress = rProgress.GetState(); @@ -575,7 +581,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pNewPattern = NULL; } - if ( bVertical && nISrcStart == nISrcEnd ) + if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered ) { // Attribute komplett am Stueck setzen if (pNewPattern || pSrcPattern != pDocument->GetDefPattern()) @@ -593,37 +599,44 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, break; // Schleife abbrechen } - if ( pSrcPattern != aCol[nCol].GetPattern( static_cast(nRow) ) ) + if (!RowFiltered( nRow )) { - // Vorlage auch uebernehmen - //! am AttrArray mit ApplyPattern zusammenfassen ?? - if ( pStyleSheet ) - aCol[nCol].ApplyStyle( static_cast(nRow), *pStyleSheet ); + if ( bHasFiltered ) + DeleteArea(static_cast(nCol), static_cast(nRow), + static_cast(nCol), static_cast(nRow), IDF_AUTOFILL); - // ApplyPattern statt SetPattern um alte MergeFlags stehenzulassen - if ( pNewPattern ) - aCol[nCol].ApplyPattern( static_cast(nRow), *pNewPattern ); - else - aCol[nCol].ApplyPattern( static_cast(nRow), *pSrcPattern ); - } + if ( pSrcPattern != aCol[nCol].GetPattern( static_cast(nRow) ) ) + { + // Vorlage auch uebernehmen + //! am AttrArray mit ApplyPattern zusammenfassen ?? + if ( pStyleSheet ) + aCol[nCol].ApplyStyle( static_cast(nRow), *pStyleSheet ); - if (nAtSrc==nISrcEnd) - { - if ( nAtSrc != nISrcStart ) - { // mehr als eine Source-Zelle - nAtSrc = nISrcStart; + // ApplyPattern statt SetPattern um alte MergeFlags stehenzulassen + if ( pNewPattern ) + aCol[nCol].ApplyPattern( static_cast(nRow), *pNewPattern ); + else + aCol[nCol].ApplyPattern( static_cast(nRow), *pSrcPattern ); + } + + if (nAtSrc==nISrcEnd) + { + if ( nAtSrc != nISrcStart ) + { // mehr als eine Source-Zelle + nAtSrc = nISrcStart; + bGetPattern = sal_True; + } + } + else if (bPositive) + { + ++nAtSrc; + bGetPattern = sal_True; + } + else + { + --nAtSrc; bGetPattern = sal_True; } - } - else if (bPositive) - { - ++nAtSrc; - bGetPattern = sal_True; - } - else - { - --nAtSrc; - bGetPattern = sal_True; } if (rInner == nIEnd) break; @@ -691,7 +704,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { sal_uLong nSource = nISrcStart; double nDelta; - if ( nScFillModeMouseModifier & KEY_MOD1 ) + if ( (nScFillModeMouseModifier & KEY_MOD1) || bHasFiltered ) nDelta = 0.0; else if ( bPositive ) nDelta = 1.0; @@ -708,6 +721,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScBaseCell* pSrcCell = NULL; CellType eCellType = CELLTYPE_NONE; sal_Bool bIsOrdinalSuffix = false; + sal_Bool bRowFiltered = false; rInner = nIStart; while (true) // #i53728# with "for (;;)" old solaris/x86 compiler mis-optimizes @@ -733,7 +747,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ((ScStringCell*)pSrcCell)->GetString( aValue ); else ((ScEditCell*)pSrcCell)->GetString( aValue ); - if ( !(nScFillModeMouseModifier & KEY_MOD1) ) + if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered ) { nCellDigits = 0; // look at each source cell individually nHeadNoneTail = lcl_DecompValueString( @@ -752,94 +766,103 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, else eCellType = CELLTYPE_NONE; } - switch (eCellType) - { - case CELLTYPE_VALUE: - aCol[nCol].Insert(static_cast(nRow), new ScValueCell(nVal + nDelta)); - break; - case CELLTYPE_STRING: - case CELLTYPE_EDIT: - if ( nHeadNoneTail ) - { - // #i48009# with the "nStringValue+(long)nDelta" expression within the - // lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3), - // so nNextValue is now calculated ahead. - sal_Int32 nNextValue = nStringValue+(sal_Int32)nDelta; - String aStr; - if ( nHeadNoneTail < 0 ) + bRowFiltered = mpFilteredRows->getValue(nRow); + + if (!bRowFiltered) + { + switch (eCellType) + { + case CELLTYPE_VALUE: + aCol[nCol].Insert(static_cast(nRow), new ScValueCell(nVal + nDelta)); + break; + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + if ( nHeadNoneTail ) { - aCol[nCol].Insert( static_cast(nRow), - lcl_getSuffixCell( pDocument, - nNextValue, nCellDigits, aValue, - eCellType, bIsOrdinalSuffix)); + // #i48009# with the "nStringValue+(long)nDelta" expression within the + // lcl_ValueString calls, gcc 3.4.1 makes wrong optimizations (ok in 3.4.3), + // so nNextValue is now calculated ahead. + sal_Int32 nNextValue = nStringValue+(sal_Int32)nDelta; + + String aStr; + if ( nHeadNoneTail < 0 ) + { + aCol[nCol].Insert( static_cast(nRow), + lcl_getSuffixCell( pDocument, + nNextValue, nCellDigits, aValue, + eCellType, bIsOrdinalSuffix)); + } + else + { + aStr = aValue; + aStr += lcl_ValueString( nNextValue, nCellDigits ); + aCol[nCol].Insert( static_cast(nRow), + new ScStringCell( aStr)); + } } else { - aStr = aValue; - aStr += lcl_ValueString( nNextValue, nCellDigits ); - aCol[nCol].Insert( static_cast(nRow), - new ScStringCell( aStr)); - } - } - else - { - ScAddress aDestPos( static_cast(nCol), static_cast(nRow), nTab ); - switch ( eCellType ) - { - case CELLTYPE_STRING: - case CELLTYPE_EDIT: - aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) ); - break; - default: + ScAddress aDestPos( static_cast(nCol), static_cast(nRow), nTab ); + switch ( eCellType ) { - // added to avoid warnings + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + aCol[nCol].Insert( aDestPos.Row(), pSrcCell->CloneWithoutNote( *pDocument ) ); + break; + default: + { + // added to avoid warnings + } } } + break; + case CELLTYPE_FORMULA : + FillFormula( nFormulaCounter, bFirst, + (ScFormulaCell*) pSrcCell, + static_cast(nCol), + static_cast(nRow), (rInner == nIEnd) ); + if (nFormulaCounter - nActFormCnt > nMaxFormCnt) + nMaxFormCnt = nFormulaCounter - nActFormCnt; + break; + default: + { + // added to avoid warnings } - break; - case CELLTYPE_FORMULA : - FillFormula( nFormulaCounter, bFirst, - (ScFormulaCell*) pSrcCell, - static_cast(nCol), - static_cast(nRow), (rInner == nIEnd) ); - if (nFormulaCounter - nActFormCnt > nMaxFormCnt) - nMaxFormCnt = nFormulaCounter - nActFormCnt; - break; - default: - { - // added to avoid warnings } - } - if (nSource==nISrcEnd) - { - if ( nSource != nISrcStart ) - { // mehr als eine Source-Zelle - nSource = nISrcStart; + if (nSource==nISrcEnd) + { + if ( nSource != nISrcStart ) + { // mehr als eine Source-Zelle + nSource = nISrcStart; + bGetCell = sal_True; + } + if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered ) + { + if ( bPositive ) + nDelta += 1.0; + else + nDelta -= 1.0; + } + nFormulaCounter = nActFormCnt; + bFirst = false; + } + else if (bPositive) + { + ++nSource; bGetCell = sal_True; } - if ( !(nScFillModeMouseModifier & KEY_MOD1) ) + else { - if ( bPositive ) - nDelta += 1.0; - else - nDelta -= 1.0; + --nSource; + bGetCell = sal_True; } - nFormulaCounter = nActFormCnt; - bFirst = false; - } - else if (bPositive) - { - ++nSource; - bGetCell = sal_True; - } - else - { - --nSource; - bGetCell = sal_True; } + if (rInner == nIEnd) break; + if (bPositive) ++rInner; else --rInner; + // Progress in der inneren Schleife nur bei teuren Zellen, // und auch dann nicht fuer jede einzelne @@ -847,8 +870,6 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( eCellType == CELLTYPE_FORMULA || eCellType == CELLTYPE_EDIT ) rProgress.SetStateOnPercent( nProgress ); - if (rInner == nIEnd) break; - if (bPositive) ++rInner; else --rInner; } rProgress.SetStateOnPercent( nProgress ); } @@ -936,6 +957,30 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n } else if ( eFillCmd == FILL_SIMPLE ) // Auffuellen mit Muster { + if ((eFillDir == FILL_TO_BOTTOM)||(eFillDir == FILL_TO_TOP)) + { + long nBegin = 0; + long nEnd = 0; + if (nEndY > nRow1) + { + nBegin = nRow2+1; + nEnd = nEndY; + } + else + { + nBegin = nEndY; + nEnd = nRow1 -1; + } + + long nNonFiltered = CountNonFilteredRows(nBegin, nEnd); + long nFiltered = nEnd + 1 - nBegin - nNonFiltered; + + if (nIndex >0) + nIndex = nIndex - nFiltered; + else + nIndex = nIndex + nFiltered; + } + long nPosIndex = nIndex; while ( nPosIndex < 0 ) nPosIndex += nSrcCount; @@ -966,7 +1011,7 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n ((ScStringCell*)pCell)->GetString( aValue ); else ((ScEditCell*)pCell)->GetString( aValue ); - if ( !(nScFillModeMouseModifier & KEY_MOD1) ) + if ( !(nScFillModeMouseModifier & KEY_MOD1) && !IsDataFiltered() ) { sal_Int32 nVal; sal_uInt16 nCellDigits = 0; // look at each source cell individually @@ -987,7 +1032,7 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n { // dabei kann's keinen Ueberlauf geben... double nVal = ((ScValueCell*)pCell)->GetValue(); - if ( !(nScFillModeMouseModifier & KEY_MOD1) ) + if ( !(nScFillModeMouseModifier & KEY_MOD1) && !IsDataFiltered() ) nVal += (double) nDelta; Color* pColor; diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx index 89234f9d4b37..e1b3b219cd19 100644 --- a/sc/source/core/tool/dbcolect.cxx +++ b/sc/source/core/tool/dbcolect.cxx @@ -820,6 +820,27 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO return NULL; } +ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const +{ + ScDBData* pDataEmpty = NULL; + if (pItems) + { + for (sal_uInt16 i = 0; i < nCount; i++) + { + ScDBData* pDBTemp = (ScDBData*)pItems[i]; + if ( pDBTemp->nTable == nTab ) + { + sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam(); + + if ( bFilter ) + return pDBTemp; + } + } + } + + return pDataEmpty; +} + sal_Bool ScDBCollection::SearchName( const String& rName, sal_uInt16& rIndex ) const { if (rtl::OUString(rName)==rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_DB_LOCAL_NONAME))) -- cgit From 18d6092b76696148e0f435af98c83a9e63aaa466 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 13 Apr 2011 02:10:58 -0400 Subject: Silly indentation errors, remove friend statement, bool over sal_Bool. --- sc/inc/dbcolect.hxx | 2 +- sc/inc/table.hxx | 2 +- sc/source/core/data/table2.cxx | 12 ++++++------ sc/source/core/data/table4.cxx | 36 ++++++++++++++++++------------------ sc/source/core/tool/dbcolect.cxx | 7 ++++++- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx index 937dcfc89f0c..8f26f667f5f8 100644 --- a/sc/inc/dbcolect.hxx +++ b/sc/inc/dbcolect.hxx @@ -44,7 +44,6 @@ class ScDocument; class ScDBData : public ScDataObject, public ScRefreshTimer { -friend class ScDBCollection; private: // DBParam String aName; @@ -123,6 +122,7 @@ public: bool operator== (const ScDBData& rData) const; + SCTAB GetTable() const; const String& GetName() const { return aName; } void GetName(String& rName) const { rName = aName; } void SetName(const String& rName) { aName = rName; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 634acac0be6c..5e22e5b1c9b8 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -690,7 +690,7 @@ public: /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). SCROW GetLastChangedRow() const; - sal_Bool IsDataFiltered() const; + bool IsDataFiltered() const; sal_uInt8 GetColFlags( SCCOL nCol ) const; sal_uInt8 GetRowFlags( SCROW nRow ) const; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 0e4746095de8..646be060b6a9 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2628,16 +2628,16 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) DecRecalcLevel(); } -sal_Bool ScTable::IsDataFiltered() const +bool ScTable::IsDataFiltered() const { - sal_Bool bAnyQuery = sal_False; + bool bAnyQuery = false; ScDBData* pDBData = pDocument->GetFilterDBAtTable(nTab); if ( pDBData ) { - ScQueryParam aParam; - pDBData->GetQueryParam( aParam ); - if ( aParam.GetEntry(0).bDoQuery ) - bAnyQuery = sal_True; + ScQueryParam aParam; + pDBData->GetQueryParam( aParam ); + if ( aParam.GetEntry(0).bDoQuery ) + bAnyQuery = true; } return bAnyQuery; } diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index c1e96d43d8e6..55b4da849665 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -769,8 +769,8 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bRowFiltered = mpFilteredRows->getValue(nRow); - if (!bRowFiltered) - { + if (!bRowFiltered) + { switch (eCellType) { case CELLTYPE_VALUE: @@ -958,28 +958,28 @@ String ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW n else if ( eFillCmd == FILL_SIMPLE ) // Auffuellen mit Muster { if ((eFillDir == FILL_TO_BOTTOM)||(eFillDir == FILL_TO_TOP)) - { - long nBegin = 0; - long nEnd = 0; - if (nEndY > nRow1) - { - nBegin = nRow2+1; - nEnd = nEndY; - } - else - { - nBegin = nEndY; - nEnd = nRow1 -1; - } + { + long nBegin = 0; + long nEnd = 0; + if (nEndY > nRow1) + { + nBegin = nRow2+1; + nEnd = nEndY; + } + else + { + nBegin = nEndY; + nEnd = nRow1 -1; + } long nNonFiltered = CountNonFilteredRows(nBegin, nEnd); long nFiltered = nEnd + 1 - nBegin - nNonFiltered; - if (nIndex >0) + if (nIndex > 0) nIndex = nIndex - nFiltered; - else + else nIndex = nIndex + nFiltered; - } + } long nPosIndex = nIndex; while ( nPosIndex < 0 ) diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx index e1b3b219cd19..4118f9dcd7f9 100644 --- a/sc/source/core/tool/dbcolect.cxx +++ b/sc/source/core/tool/dbcolect.cxx @@ -222,6 +222,11 @@ ScDBData& ScDBData::operator= (const ScDBData& rData) return *this; } +SCTAB ScDBData::GetTable() const +{ + return nTable; +} + bool ScDBData::operator== (const ScDBData& rData) const { // Daten, die nicht in den Params sind @@ -828,7 +833,7 @@ ScDBData* ScDBCollection::GetFilterDBAtTable(SCTAB nTab) const for (sal_uInt16 i = 0; i < nCount; i++) { ScDBData* pDBTemp = (ScDBData*)pItems[i]; - if ( pDBTemp->nTable == nTab ) + if ( pDBTemp->GetTable() == nTab ) { sal_Bool bFilter = pDBTemp->HasAutoFilter() || pDBTemp->HasQueryParam(); -- cgit From fa2e1506606c35a6edefe6bc661c23d06909c376 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 13 Apr 2011 10:05:09 +0200 Subject: Fix input list default selection on ww8 import Fix for i#100621 - more correct pre-selection of list item for input fields - aligns import with export at least, though still not perfect - format docs say this is a dynamically-sized value (i.e. we're going to be wrong for item numbers 32 and higher) --- sw/source/filter/ww8/ww8par3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 42ca75e60e95..6d014a08a61a 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2158,7 +2158,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, nType=1; } fUnknown = nHeaderByte & 0x3; - fDropdownIndex = (nHeaderByte & 0xFC) >> 2; + fDropdownIndex = (nHeaderByte & 0x7C) >> 2; *pDataStream >> nField; fToolTip = nField & 0x01; fNoMark = (nField & 0x02)>>1; -- cgit From 50428e32e6ca188dafbcfde5f91338a88313508c Mon Sep 17 00:00:00 2001 From: Robert Dargaud Date: Tue, 12 Apr 2011 18:09:28 +0200 Subject: fix bug #36069 - Date properties in 'Custom Properties' do not scroll in UI --- sfx2/source/dialog/dinfdlg.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 21bd787d6c61..106633b0a9d5 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -2230,8 +2230,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos ) if ( pLine->m_bIsRemoved ) continue; - Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDurationField, - &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; + Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField, + &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL }; Window** pCurrent = pWindows; while ( *pCurrent ) { -- cgit From 535300da9a037edcdf047cc07f3830c70623a146 Mon Sep 17 00:00:00 2001 From: Katarina Machalkova Date: Thu, 7 Apr 2011 13:28:50 +0200 Subject: Fixed more build breakages with --enable-kde4 (cherry picked from commit 5dbb3b7b920045156e998ea2f0a93a870b93f09c) --- vcl/source/gdi/gdimtf.cxx | 2 -- vcl/unx/kde4/KDESalGraphics.cxx | 2 -- 2 files changed, 4 deletions(-) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 849750ea20a9..79b8f417891b 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -439,8 +439,6 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos ) rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); - rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas ); - if( nPos > nObjCount ) nPos = nObjCount; diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 16cb27744394..04f71bfbed3d 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -418,8 +418,6 @@ sal_Bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); QRect rect( 0, 0, width, widgetRect.height()); clipRegion = new QRegion( widgetRect.x(), widgetRect.y(), width, widgetRect.height()); - XRectangle xRect = { widgetRect.x(), widgetRect.y(), width, widgetRect.height() }; - XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion ); QStyleOption option; option.state = QStyle::State_Horizontal; -- cgit From 2b6ad8ed59f47d1de932a2ee8081a884348f1b13 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Wed, 13 Apr 2011 10:58:52 +0200 Subject: Some more OOo -> LO changes --- odk/cfgWin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odk/cfgWin.js b/odk/cfgWin.js index ef4e0b6c9b1c..c7b1b2355de4 100644 --- a/odk/cfgWin.js +++ b/odk/cfgWin.js @@ -2,8 +2,8 @@ // examples of the Office Development Kit. The script duplicates the template // script and inserts the variables into the copied script. // The Script was developed for the operating systems Microsoft Windows. -var regKeyOfficeCurrentUser = "HKEY_CURRENT_USER\\Software\\OpenOffice.org\\UNO\\InstallPath\\"; -var regKeyOfficeLocaleMachine = "HKEY_LOCAL_MACHINE\\Software\\OpenOffice.org\\UNO\\InstallPath\\"; +var regKeyOfficeCurrentUser = "HKEY_CURRENT_USER\\Software\\LibreOffice\\UNO\\InstallPath\\"; +var regKeyOfficeLocaleMachine = "HKEY_LOCAL_MACHINE\\Software\\LibreOffice\\UNO\\InstallPath\\"; var regKeyDotNetInstallRoot = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\.NETFramework\\InstallRoot"; var regKeyDotNet1_1 = "HKLM\\Software\\Microsoft\\.NETFramework\\policy\\v1.1\\4322"; var sDirDotNet1_1 = "v1.1.4322"; -- cgit From abc64a1c4a3235e9aefb92284d8ea7cd7d22899d Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Wed, 13 Apr 2011 11:06:58 +0200 Subject: Even more OOo -> LO changes (in comments now) --- odk/cfgWin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/odk/cfgWin.js b/odk/cfgWin.js index c7b1b2355de4..398599dd9eec 100644 --- a/odk/cfgWin.js +++ b/odk/cfgWin.js @@ -788,22 +788,22 @@ function writeBatFile(fdir, file) "REM are necessary for building the examples of the Office Development Kit.\n" + "REM The Script was developed for the operating systems Windows.\n" + "REM The SDK name\n" + - "REM Example: set OO_SDK_NAME=openoffice3.0_sdk\n" + + "REM Example: set OO_SDK_NAME=libreoffice3.4_sdk\n" + "set OO_SDK_NAME=" + oo_sdk_name + "\n\n" + "REM Installation directory of the Software Development Kit.\n" + - "REM Example: set OO_SDK_HOME=C:\\Program Files\\OpenOffice.org\\Basic 3.0\\sdk\n" + + "REM Example: set OO_SDK_HOME=C:\\Program Files\\LibreOffice 3\\Basis\\sdk\n" + "set OO_SDK_HOME=" + oo_sdk_home + "\n\n" + "REM Office installation directory.\n" + - "REM Example: set OFFICE_HOME=C:\\Program Files\\OpenOffice.org 3\n" + + "REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\n" + "set OFFICE_HOME=" + office_home + "\n\n" + - "REM Example: set OFFICE_HOME=C:\\Program Files\\OpenOffice.org\\Basis 3.0\n" + + "REM Example: set OFFICE_HOME=C:\\Program Files\\LibreOffice 3\\Basis\n" + "set OFFICE_BASE_HOME=" + office_base_home + "\n\n" + "REM URE installation directory.\n" + - "REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\OpenOffice.org\\URE\n" + + "REM Example: set OO_SDK_URE_HOME=C:\\Program Files\\LibreOffice 3\\URE\n" + "set OO_SDK_URE_HOME=" + oo_sdk_ure_home + "\n\n" + "REM Directory of the make command.\n" + -- cgit From 0b5b56be4df609d04151b87cdd6feacfa35cd278 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Wed, 13 Apr 2011 14:02:07 +0200 Subject: switch -ggdb3 to -ggdb2 to significantly reduce binaries sizes http://lists.freedesktop.org/archives/libreoffice/2011-April/010408.html --- solenv/gbuild/platform/unxgcc.mk | 4 ++-- solenv/gbuild/platform/winmingw.mk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 792a4069d27b..70802fe45d47 100755 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -222,8 +222,8 @@ gb_LinkTarget_CFLAGS += -finline-limit=0 -fno-inline -fno-default-inline endif ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CXXFLAGS += -ggdb3 -gb_LinkTarget_CFLAGS += -ggdb3 +gb_LinkTarget_CXXFLAGS += -ggdb2 +gb_LinkTarget_CFLAGS += -ggdb2 endif gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) diff --git a/solenv/gbuild/platform/winmingw.mk b/solenv/gbuild/platform/winmingw.mk index 99a2d4d06fcb..4b223b45af97 100644 --- a/solenv/gbuild/platform/winmingw.mk +++ b/solenv/gbuild/platform/winmingw.mk @@ -376,8 +376,8 @@ gb_LinkTarget_CFLAGS += -finline-limit=0 -fno-inline -fno-default-inline endif ifeq ($(gb_SYMBOL),$(true)) -gb_LinkTarget_CXXFLAGS += -ggdb3 -gb_LinkTarget_CFLAGS += -ggdb3 +gb_LinkTarget_CXXFLAGS += -ggdb2 +gb_LinkTarget_CFLAGS += -ggdb2 endif gb_LinkTarget_INCLUDE :=\ -- cgit From 1da0fa202592350fe3836f4c6b8f8145c15fb166 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Wed, 13 Apr 2011 16:10:45 +0200 Subject: lo-commit-stat: add --rev-list option + use "git log" again to get weekly commit logs + use "git rev-list" only with --rev-list option; useful to list differences between branches --- bin/lo-commit-stat | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat index 5cc772fa7f23..c8b51d9a52a0 100755 --- a/bin/lo-commit-stat +++ b/bin/lo-commit-stat @@ -69,9 +69,9 @@ sub standardize_summary($) sub load_git_log($$$$) { - my ($pdata, $repo_dir, $piece, $pgit_args) = @_; + my ($pdata, $repo_dir, $piece, $git_command) = @_; - my $cmd = "cd $repo_dir && git rev-list --pretty=medium " . join ' ', @{$pgit_args}; + my $cmd = "cd $repo_dir; $git_command"; my $commit_id; my $summary; @@ -146,7 +146,7 @@ sub get_repo_name($) sub load_data($$$$) { - my ($pdata, $top_dir, $piece, $pgit_args) = @_; + my ($pdata, $top_dir, $piece, $git_command) = @_; if (defined $piece) { my $piece_dir; @@ -155,11 +155,11 @@ sub load_data($$$$) } else { $piece_dir = "$top_dir/clone/$piece"; } - load_git_log($pdata, $piece_dir, $piece, $pgit_args); + load_git_log($pdata, $piece_dir, $piece, $git_command); } else { - load_git_log($pdata, $top_dir, $main_repo, $pgit_args); + load_git_log($pdata, $top_dir, $main_repo, $git_command); foreach my $piece (@pieces) { - load_git_log($pdata, "$top_dir/clone/$piece", $piece, $pgit_args); + load_git_log($pdata, "$top_dir/clone/$piece", $piece, $git_command); } } } @@ -298,7 +298,7 @@ sub usage() { print "This script generates LO git commit summary\n\n" . - "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=] --log-suffix= topdir [git_log_param...]\n\n" . + "Usage: lo-commit-stat [--help] [--no-pieces] [--piece=] --log-suffix= topdir [git_arg...]\n\n" . "Options:\n" . " --help print this help\n" . @@ -308,11 +308,15 @@ sub usage() " commit-log--.log; the branch name\n" . " is detected autoamtically\n" . " --bugs print just bug fixes\n" . + " --rev-list use \"git rev-list\" instead of \"git log\"; useful to check\n" . + " differences between branches\n" . " topdir directory with the libreoffice/bootstrap clone; the piece repos\n" . " must be cloned in the main-repo-root/clone/ subdirectories\n" . - " git_log_param extra parameters passed to the git log command to define\n" . - " the area of interest , e.g. --after=\"2010-09-27\" or\n" . - " TAG..HEAD or origin/master ^origin/libreoffice-3-3"; + " git_arg extra parameters passed to the git command to define\n" . + " the area of interest; The default command is \"git log\" and\n" . + " parameters might be, for example, --after=\"2010-09-27\" or\n" . + " TAG..HEAD; with the option --rev-list, useful might be, for,\n" . + " example origin/master ^origin/libreoffice-3-3\n"; } @@ -328,6 +332,7 @@ my $top_dir; my $log_prefix = "commit-log"; my $log_suffix; my $log; +my $git_command = "git log"; my @git_args; my %data; my %print_filters = (); @@ -345,6 +350,8 @@ foreach my $arg (@ARGV) { } elsif ($arg eq '--bugs') { $print_filters{'bug'} = 1; $log_prefix = "bugfixes" + } elsif ($arg eq '--rev-list') { + $git_command = "git rev-list --pretty=medium" } else { if (! defined $top_dir) { $top_dir=$arg; @@ -354,13 +361,15 @@ foreach my $arg (@ARGV) { } } +$git_command .= " " . join ' ', @git_args if (@git_args); + (defined $top_dir) || die "Error: top direcotry is not defined\n"; (-d "$top_dir") || die "Error: not a directory: $top_dir\n"; (-f "$top_dir/.git/config") || die "Error: can't find $top_dir/.git/config\n"; (defined $log_suffix) || die "Error: define log suffix using --log-suffix=\n"; -load_data(\%data, $top_dir,$piece, \@git_args); +load_data(\%data, $top_dir,$piece, $git_command); $log = open_log_file($log_prefix, $log_suffix, $top_dir); print_stat(\%data, \%print_filters, $log); -- cgit From 6eaac0fdd9e55fc874be367a4fce5392a40f6f56 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 13 Apr 2011 15:59:52 +0100 Subject: fix fdo#36209 ( various vba automation related regressions ) --- extensions/source/ole/oleobjw.cxx | 11 ++++++++--- extensions/source/ole/oleobjw.hxx | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 6648d1773560..2b172854b041 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -160,9 +160,14 @@ Any IUnknownWrapper_Impl::queryInterface(const Type& t) return Any(); if ( ( t == getCppuType(static_cast*>( 0)) || t == getCppuType(static_cast*>( 0)) ) && !m_spDispatch) return Any(); - - return WeakImplHelper7::queryInterface(t); + // XDirectInvocation seems to be an oracle replacement for XAutomationInvocation, however it is flawed esecially wrt. assumptions about whether to invoke a + // Put or Get property, the implementation code has no business guessing that, it's up to the caller to decide that. Worse XDirectInvocation duplicates lots of code. + // XAutomationInvocation provides seperate calls for put& get + // properties. Note: Currently the basic runtime doesn't call put properties directly, it should... after all the basic runtime should know whether it is calling a put or get property. + // For the moment for ease of merging we will let the XDirectInvoke and XAuthomationInvocation interfaces stay side by side ( and for the momemnt at least I would prefer the basic + // runtime to call XAutomationInvocation instead of XDirectInvoke + return WeakImplHelper8::queryInterface(t); } Reference SAL_CALL IUnknownWrapper_Impl::getIntrospection(void) diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx index 0be19ddc6cff..1297e1160ab4 100644 --- a/extensions/source/ole/oleobjw.hxx +++ b/extensions/source/ole/oleobjw.hxx @@ -51,7 +51,7 @@ #endif #include #include -#include +#include #include #include @@ -84,7 +84,7 @@ typedef boost::unordered_multimap, +class IUnknownWrapper_Impl : public WeakImplHelper8< XInvocation, XBridgeSupplier2, XInitialization, XAutomationObject, XDefaultProperty, XDefaultMethod, XDirectInvocation, XAutomationInvocation >, public UnoConversionUtilities -- cgit From 049d80d791404a6c691f0fa3fc2fd1380cbe1cb9 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 13 Apr 2011 18:52:58 +0100 Subject: fix for fdo#35108 allow dot net clients to bootstrap libreoffice --- cli_ure/source/native/native_bootstrap.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli_ure/source/native/native_bootstrap.cxx b/cli_ure/source/native/native_bootstrap.cxx index 61117f0b35f0..4c6be73c3a20 100644 --- a/cli_ure/source/native/native_bootstrap.cxx +++ b/cli_ure/source/native/native_bootstrap.cxx @@ -57,7 +57,7 @@ namespace cli_ure { WCHAR * resolveLink(WCHAR * path); } -#define INSTALL_PATH L"Software\\OpenOffice.org\\UNO\\InstallPath" +#define INSTALL_PATH L"Software\\LibreOffice\\UNO\\InstallPath" #define BASIS_LINK L"\\basis-link" #define URE_LINK L"\\ure-link" #define URE_BIN L"\\bin" -- cgit From 164317eda5dacfc8585fafc5f9fba8845bba5313 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 13 Apr 2011 22:35:09 -0400 Subject: Convert OLE links from XLS doc into external ranges on import. Linked cell ranges that are OLE links to other Excel documents were previously ignored on import. Let's import them but convert them into external references which are more robust than OLE links. --- sc/inc/address.hxx | 2 +- sc/source/filter/excel/excform8.cxx | 81 ++++++++++++- sc/source/filter/excel/read.cxx | 4 +- sc/source/filter/excel/xilink.cxx | 230 ++++++++++++++++++++++++++++++++---- sc/source/filter/inc/excform.hxx | 9 +- sc/source/filter/inc/xilink.hxx | 23 ++++ 6 files changed, 318 insertions(+), 31 deletions(-) diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 96842785c8f3..74920c7575b7 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -487,7 +487,7 @@ public: const ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); - sal_uInt16 ParseAny( const String&, ScDocument* = NULL, + SC_DLLPUBLIC sal_uInt16 ParseAny( const String&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); SC_DLLPUBLIC sal_uInt16 ParseCols( const String&, ScDocument* = NULL, const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index aebb75418f36..3cfc20d5aeba 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -42,9 +42,51 @@ #include "externalrefmgr.hxx" #include +#include +using ::rtl::OUString; +using ::rtl::OUStringBuffer; using ::std::vector; +namespace { + +/** + * Extract a file path from OLE link path. An OLE link path is expected to + * be in the following format: + * + * Excel.Sheet.8 \3 [file path] + */ +bool extractFilePath(const OUString& rUrl, OUString& rPath) +{ + const char* prefix = "Excel.Sheet.8\3"; + size_t nPrefixLen = ::std::strlen(prefix); + + sal_Int32 n = rUrl.getLength(); + if (n <= static_cast(nPrefixLen)) + // needs to have the specified prefix. + return false; + + OUStringBuffer aBuf; + const sal_Unicode* p = rUrl.getStr(); + for (size_t i = 0; i < static_cast(n); ++i, ++p) + { + if (i < nPrefixLen) + { + sal_Unicode pc = static_cast(*prefix++); + if (pc != *p) + return false; + + continue; + } + aBuf.append(*p); + } + + rPath = aBuf.makeStringAndClear(); + return true; +} + +} + ExcelToSc8::ExternalTabInfo::ExternalTabInfo() : mnFileId(0), mbExternal(false) { @@ -92,6 +134,20 @@ bool ExcelToSc8::Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& return GetExternalFileIdFromXti(nIxti, rExtInfo.mnFileId); } +bool ExcelToSc8::HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo) +{ + const String* pUrl = rLinkMan.GetSupbookUrl(nXtiIndex); + if (!pUrl) + return false; + + OUString aPath; + if (!extractFilePath(*pUrl, aPath)) + // file path extraction failed. + return false; + + OUString aFileUrl = ScGlobal::GetAbsDocName(aPath, GetDocShell()); + return rExtName.CreateOleData(GetDoc(), aFileUrl, rExtInfo.mnFileId, rExtInfo.maTabName, rExtInfo.maRange); +} // if bAllowArrays is false stream seeks to first byte after // otherwise it will seek to the first byte past additional content after @@ -682,8 +738,29 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aStack << aPool.Store( ocEuroConvert, String() ); } break; - - default: // OLE link + case xlExtOLE: + { + ExternalTabInfo aExtInfo; + if (HandleOleLink(nXtiIndex, *pExtName, aExtInfo)) + { + if (aExtInfo.maRange.aStart == aExtInfo.maRange.aEnd) + { + // single cell + aSRD.InitAddress(aExtInfo.maRange.aStart); + aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aSRD); + } + else + { + // range + aCRD.InitRange(aExtInfo.maRange); + aStack << aPool.StoreExtRef(aExtInfo.mnFileId, aExtInfo.maTabName, aCRD); + } + } + else + aStack << aPool.Store(ocNoName, pExtName->GetName()); + } + break; + default: { aPool << ocBad; aPool >> aStack; diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 70feaa4e4e22..96e68a9df01f 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -1125,8 +1125,8 @@ FltError ImportExcel8::Read( void ) case 0x9D: AutoFilterInfo(); break;// AUTOFILTERINFO case 0x9E: AutoFilter(); break; // AUTOFILTER case 0x0208: Row34(); break; // ROW [ 34 ] - case 0x0021: - case 0x0221: Array34(); break; // ARRAY [ 34 ] + case EXC_ID2_ARRAY: + case EXC_ID3_ARRAY: Array34(); break; // ARRAY [ 34 ] case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ] case 0x04BC: Shrfmla(); break; // SHRFMLA [ 5 ] case 0x0867: SheetProtection(); break; // SHEETPROTECTION diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 634a723238a6..75b0e1b01468 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -44,6 +44,9 @@ #include using ::std::vector; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + // ============================================================================ // *** Helper classes *** @@ -284,7 +287,61 @@ sal_uInt16 XclImpTabInfo::GetCurrentIndex( sal_uInt16 nCreatedId, sal_uInt16 nMa // External names ============================================================= -XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, XclSupbookType eSubType, ExcelToSc* pFormulaConv ) +XclImpExtName::MOper::MOper(XclImpStream& rStrm) : + mxCached(new ScMatrix(0,0)) +{ + SCSIZE nLastCol = rStrm.ReaduInt8(); + SCSIZE nLastRow = rStrm.ReaduInt16(); + mxCached->Resize(nLastCol+1, nLastRow+1); + for (SCSIZE nRow = 0; nRow <= nLastRow; ++nRow) + { + for (SCSIZE nCol = 0; nCol <= nLastCol; ++nCol) + { + sal_uInt8 nOp; + rStrm >> nOp; + switch (nOp) + { + case 0x01: + { + double fVal = rStrm.ReadDouble(); + mxCached->PutDouble(fVal, nCol, nRow); + } + break; + case 0x02: + { + OUString aStr = rStrm.ReadUniString(); + mxCached->PutString(aStr, nCol, nRow); + } + break; + case 0x04: + { + bool bVal = rStrm.ReaduInt8(); + mxCached->PutBoolean(bVal, nCol, nRow); + rStrm.Ignore(7); + } + break; + case 0x10: + { + sal_uInt8 nErr = rStrm.ReaduInt8(); + // TODO: Map the error code from xls to calc. + mxCached->PutError(nErr, nCol, nRow); + rStrm.Ignore(7); + } + break; + default: + rStrm.Ignore(8); + } + } + } +} + +const ScMatrix& XclImpExtName::MOper::GetCache() const +{ + return *mxCached; +} + +XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, XclSupbookType eSubType, ExcelToSc* pFormulaConv ) : + mpMOper(NULL) { sal_uInt16 nFlags; sal_uInt8 nLen; @@ -312,36 +369,45 @@ XclImpExtName::XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm meType = ::get_flagvalue( nFlags, EXC_EXTN_OLE, xlExtOLE, xlExtDDE ); } - if( (meType == xlExtDDE) && (rStrm.GetRecLeft() > 1) ) - mxDdeMatrix.reset( new XclImpCachedMatrix( rStrm ) ); - - if (meType == xlExtName) + switch (meType) { - // TODO: For now, only global external names are supported. In future - // we should extend this to supporting per-sheet external names. - if (mnStorageId == 0) - { - if (pFormulaConv) + case xlExtDDE: + if (rStrm.GetRecLeft() > 1) + mxDdeMatrix.reset(new XclImpCachedMatrix(rStrm)); + break; + case xlExtName: + // TODO: For now, only global external names are supported. In future + // we should extend this to supporting per-sheet external names. + if (mnStorageId == 0) { - const ScTokenArray* pArray = NULL; - sal_uInt16 nFmlaLen; - rStrm >> nFmlaLen; - vector aTabNames; - sal_uInt16 nCount = rSupbook.GetTabCount(); - aTabNames.reserve(nCount); - for (sal_uInt16 i = 0; i < nCount; ++i) - aTabNames.push_back(rSupbook.GetTabName(i)); - - pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames); - if (pArray) - mxArray.reset(pArray->Clone()); + if (pFormulaConv) + { + const ScTokenArray* pArray = NULL; + sal_uInt16 nFmlaLen; + rStrm >> nFmlaLen; + vector aTabNames; + sal_uInt16 nCount = rSupbook.GetTabCount(); + aTabNames.reserve(nCount); + for (sal_uInt16 i = 0; i < nCount; ++i) + aTabNames.push_back(rSupbook.GetTabName(i)); + + pFormulaConv->ConvertExternName(pArray, rStrm, nFmlaLen, rSupbook.GetXclUrl(), aTabNames); + if (pArray) + mxArray.reset(pArray->Clone()); + } } - } + break; + case xlExtOLE: + mpMOper = new MOper(rStrm); + break; + default: + ; } } XclImpExtName::~XclImpExtName() { + delete mpMOper; } void XclImpExtName::CreateDdeData( ScDocument& rDoc, const String& rApplic, const String& rTopic ) const @@ -361,6 +427,124 @@ void XclImpExtName::CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) co pRefMgr->storeRangeNameTokens(nFileId, maName, *mxArray); } +namespace { + +/** + * Decompose the name into sheet name and range name. An OLE link name is + * always formatted like this [ !Sheet1!R1C1:R5C2 ] and it always uses R1C1 + * notation. + */ +bool extractSheetAndRange(const OUString& rName, OUString& rSheet, OUString& rRange) +{ + sal_Int32 n = rName.getLength(); + const sal_Unicode* p = rName.getStr(); + OUStringBuffer aBuf; + bool bInSheet = true; + for (sal_Int32 i = 0; i < n; ++i, ++p) + { + if (i == 0) + { + // first character must be '!'. + if (*p != '!') + return false; + continue; + } + + if (*p == '!') + { + // sheet name to range separator. + if (!bInSheet) + return false; + rSheet = aBuf.makeStringAndClear(); + bInSheet = false; + continue; + } + + aBuf.append(*p); + } + + rRange = aBuf.makeStringAndClear(); + return true; +} + +} + +bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl, + sal_uInt16& rFileId, OUString& rTabName, ScRange& rRange) const +{ + if (!mpMOper) + return false; + + OUString aSheet, aRangeStr; + if (!extractSheetAndRange(maName, aSheet, aRangeStr)) + return false; + + ScRange aRange; + sal_uInt16 nRes = aRange.ParseAny(aRangeStr, &rDoc, formula::FormulaGrammar::CONV_XL_R1C1); + if ((nRes & SCA_VALID) != SCA_VALID) + return false; + + if (aRange.aStart.Tab() != aRange.aEnd.Tab()) + // We don't support multi-sheet range for this. + return false; + + const ScMatrix& rCache = mpMOper->GetCache(); + SCSIZE nC, nR; + rCache.GetDimensions(nC, nR); + if (!nC || !nR) + // cache matrix is empty. + return false; + + ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager(); + sal_uInt16 nFileId = pRefMgr->getExternalFileId(rUrl); + ScExternalRefCache::TableTypeRef xTab = pRefMgr->getCacheTable(nFileId, aSheet, true, NULL); + if (!xTab) + // cache table creation failed. + return false; + + xTab->setWholeTableCached(); + for (SCSIZE i = 0; i < nR; ++i) + { + for (SCSIZE j = 0; j < nC; ++j) + { + SCCOL nCol = aRange.aStart.Col() + j; + SCROW nRow = aRange.aStart.Row() + i; + + ScMatrixValue aVal = rCache.Get(j, i); + switch (aVal.nType) + { + case SC_MATVAL_BOOLEAN: + { + bool b = aVal.GetBoolean(); + ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(b ? 1.0 : 0.0)); + xTab->setCell(nCol, nRow, pToken, 0, false); + } + break; + case SC_MATVAL_VALUE: + { + ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(aVal.fVal)); + xTab->setCell(nCol, nRow, pToken, 0, false); + } + break; + case SC_MATVAL_STRING: + { + const String& rStr = aVal.GetString(); + ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(rStr)); + xTab->setCell(nCol, nRow, pToken, 0, false); + } + break; + default: + ; + } + } + } + + rFileId = nFileId; + rTabName = aSheet; + rRange = aRange; + return true; +} + bool XclImpExtName::HasFormulaTokens() const { return (mxArray.get() != NULL); diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx index 0744bdf52c64..d5c53734b8e6 100644 --- a/sc/source/filter/inc/excform.hxx +++ b/sc/source/filter/inc/excform.hxx @@ -104,6 +104,7 @@ inline sal_Bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uI // ============================================================================ class XclImpLinkManager; +class XclImpExtName; class ExcelToSc8 : public ExcelToSc { @@ -111,9 +112,10 @@ public: struct ExternalTabInfo { - String maTabName; - sal_uInt16 mnFileId; - bool mbExternal; + ScRange maRange; + ::rtl::OUString maTabName; + sal_uInt16 mnFileId; + bool mbExternal; ExternalTabInfo(); }; @@ -128,6 +130,7 @@ private: virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ); + bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo); public: ExcelToSc8( const XclImpRoot& rRoot ); virtual ~ExcelToSc8(); diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx index 2f06ddb2f7b0..2b2e9ac8a03c 100644 --- a/sc/source/filter/inc/xilink.hxx +++ b/sc/source/filter/inc/xilink.hxx @@ -32,6 +32,7 @@ #include #include "xllink.hxx" #include "xiroot.hxx" +#include "scmatrix.hxx" /* ============================================================================ Classes for import of different kinds of internal/external references. @@ -113,6 +114,19 @@ class XclImpSupbook; @descr Supported: External defined names, AddIn names, DDE links and OLE objects. */ class XclImpExtName { + /** + * MOper, multiple operands, stores cached values of external range + * specified in the record. + */ + class MOper + { + public: + MOper(XclImpStream& rStrm); + const ScMatrix& GetCache() const; + private: + ScMatrixRef mxCached; + }; + public: /** Reads the external name from the stream. */ explicit XclImpExtName( const XclImpSupbook& rSupbook, XclImpStream& rStrm, @@ -125,6 +139,14 @@ public: void CreateExtNameData( ScDocument& rDoc, sal_uInt16 nFileId ) const; + /** + * Create OLE link data. OLE link data is converted to external + * reference, since OLE link doesn't work cross-platform, and is not very + * reliable even on Windows. + */ + bool CreateOleData(ScDocument& rDoc, const ::rtl::OUString& rUrl, + sal_uInt16& rFileId, ::rtl::OUString& rTabName, ScRange& rRange) const; + bool HasFormulaTokens() const; inline XclImpExtNameType GetType() const { return meType; } @@ -136,6 +158,7 @@ private: typedef ::std::auto_ptr< ScTokenArray > TokenArrayPtr; XclImpCachedMatrixPtr mxDdeMatrix; /// Cached results of the DDE link. + MOper* mpMOper; /// Cached values for OLE link TokenArrayPtr mxArray; /// Formula tokens for external name. String maName; /// The name of the external name. sal_uInt32 mnStorageId; /// Storage ID for OLE object storages. -- cgit From fb52f6262e933970eaf0e3d2d942c05ad55d8958 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 13 Apr 2011 23:19:36 -0400 Subject: Incorrect index value checking & use operator[] over at(). Take into account that the index value gets subtracted by 1 during index value check. Also, the index access follows after a range value check, so there is no need to call at(), operator[] will do. --- sc/source/filter/excel/xilink.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 75b0e1b01468..492fe5d2033c 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -700,9 +700,9 @@ void XclImpSupbook::ReadExternname( XclImpStream& rStrm, ExcelToSc* pFormulaConv const XclImpExtName* XclImpSupbook::GetExternName( sal_uInt16 nXclIndex ) const { DBG_ASSERT( nXclIndex > 0, "XclImpSupbook::GetExternName - index must be >0" ); - if (meType == EXC_SBTYPE_SELF || nXclIndex >= maExtNameList.size()) + if (meType == EXC_SBTYPE_SELF || nXclIndex > maExtNameList.size()) return NULL; - return &maExtNameList.at( nXclIndex - 1 ); + return &maExtNameList[nXclIndex-1]; } bool XclImpSupbook::GetLinkData( String& rApplic, String& rTopic ) const -- cgit From 02a0cf12ec462ac4f7b3b8f54acbc42f6d7a7e30 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Thu, 14 Apr 2011 07:25:24 +0200 Subject: FALSE/TRUE in strings should not be converted to sal_False/sal_True. --- sw/source/core/doc/docfld.cxx | 4 ++-- sw/source/filter/html/htmlplug.cxx | 2 +- sw/source/ui/fldui/flddb.cxx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 62cc8b4763b5..16e5a7680da7 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -2288,9 +2288,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) } String sTrue( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_True" ))), + RTL_CONSTASCII_STRINGPARAM( "TRUE" ))), sFalse( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_False" ))); + RTL_CONSTASCII_STRINGPARAM( "FALSE" ))); sal_Bool bIsDBMgr = 0 != rDoc.GetNewDBMgr(); sal_uInt16 nWhich, n; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 6c82e8141d88..e559b937a93d 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -78,7 +78,7 @@ using namespace com::sun::star; namespace { -static char const sHTML_O_Hidden_False[] = "sal_False"; +static char const sHTML_O_Hidden_False[] = "FALSE"; } diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 9d1ac103ae29..d6f57df395ef 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -385,7 +385,7 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox ) aValueED.SetText(aEmptyStr); if (bCond) aConditionED.SetText( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_True" ))); + RTL_CONSTASCII_STRINGPARAM( "TRUE" ))); else aConditionED.SetText(aEmptyStr); } -- cgit From 1c47c5cb1f5e2a6e3c7b231ef4e07e77c93ec0d9 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Thu, 14 Apr 2011 10:21:53 +0200 Subject: check if file exists in *.po hook otherwise a removed file would be recreated --- git-hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index abf1acb8d294..bf4eef13440b 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -154,7 +154,7 @@ while (my $file = ) { open(FILES, "git diff-index --cached --name-only $against |") || die "Cannot run git diff-index."; while (my $file = ) { chomp($file); - if ($file =~ /\.po$/) { + if ($file =~ /\.po$/ && -e $file) { system("msgcat --no-wrap $file > $file.KQnBbK6wQE;mv $file.KQnBbK6wQE $file;"); system("git add $file"); } -- cgit From d6c542e9912eee3bff23890108a56a0863b32092 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Apr 2011 13:00:13 +0300 Subject: Revert "Use static_cast to resolve ambiguity between NULL and 0" This was not the actual problem. This reverts commit 0d74c4b027b057c2552311be12571c044f472ad8. --- svtools/source/filter.vcl/filter/exportdialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index f95490b57731..701619d31f6c 100644 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, static_cast(NULL), 0, NULL ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } -- cgit From 5e80c4def467dd793d6192e2f8942bc4f637fa9e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Apr 2011 13:01:34 +0300 Subject: It's the WMF_APMFILEHEADER* parameter that needs a cast, I think --- svtools/source/filter.vcl/filter/exportdialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index 701619d31f6c..66ef0402ff15 100644 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast(NULL) ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } -- cgit From d52aa20175cffb5b356c51c22d9d112b98dff600 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Thu, 14 Apr 2011 12:06:02 +0200 Subject: Added error handling for pthread_mutexattr_settype. This fixes a dead assignment reported by CLang++. --- sal/osl/unx/mutex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c index 9eaa8b598ca1..f10244d7c5ed 100644 --- a/sal/osl/unx/mutex.c +++ b/sal/osl/unx/mutex.c @@ -72,11 +72,11 @@ oslMutex SAL_CALL osl_createMutex() pthread_mutexattr_init(&aMutexAttr); nRet = pthread_mutexattr_settype(&aMutexAttr, PTHREAD_MUTEX_RECURSIVE); - - nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr); + if( nRet == 0 ) + nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr); if ( nRet != 0 ) { - OSL_TRACE("osl_createMutex : mutex init failed. Errno: %d; %s\n", + OSL_TRACE("osl_createMutex : mutex init/setattr failed. Errno: %d; %s\n", nRet, strerror(nRet)); free(pMutex); -- cgit From 0fbc03ec4e294eb4a7fd874984a16fced6cbdb03 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Tue, 12 Apr 2011 00:00:47 -0700 Subject: Added handling for the write errors in receiveFdPipe. Fixed a dead assignment in process.c reported by CLang++ --- sal/osl/unx/process.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index d16c025ddc36..0f48c48a2797 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -376,6 +376,16 @@ static oslSocket receiveFdPipe(int PipeFD) OSL_TRACE("receiveFdPipe : writing back %i",nRetCode); nRead=write(PipeFD,&nRetCode,sizeof(nRetCode)); + if ( nRead < 0 ) + { + OSL_TRACE("write failed (%s)", strerror(errno)); + } + else if ( nRead != sizeof(nRetCode) ) + { + // TODO: Handle this case. + OSL_TRACE("partial write: wrote %d out of %d)", nRead, sizeof(nRetCode)); + } + #if defined(IOCHANNEL_TRANSFER_BSD_RENO) free(cmptr); #endif -- cgit From 3f490e80cfe654757f5b9001cee0236cd43d47ac Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Tue, 12 Apr 2011 06:40:24 -0700 Subject: Fixed a potential null-dereferencing error in osl_closeProfile Store the new profile in a temporary variable and assign it to the old profile after we have checked if it is null. Seen with CLang++. --- sal/osl/unx/profile.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c index c2a0cc490af9..8a76018635a1 100644 --- a/sal/osl/unx/profile.c +++ b/sal/osl/unx/profile.c @@ -274,6 +274,7 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) { osl_TProfileImpl* pProfile = (osl_TProfileImpl*)Profile; + osl_TProfileImpl* pTmpProfile; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_closeProfile\n"); @@ -303,22 +304,22 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) if ( ! ( pProfile->m_Flags & osl_Profile_READLOCK ) && ( pProfile->m_Flags & FLG_MODIFIED ) ) { - pProfile = acquireProfile(Profile,sal_True); + pTmpProfile = acquireProfile(Profile,sal_True); - if ( pProfile != 0 ) + if ( pTmpProfile != 0 ) { - sal_Bool bRet = storeProfile(pProfile, sal_True); + sal_Bool bRet = storeProfile(pTmpProfile, sal_True); OSL_ASSERT(bRet); (void)bRet; } } else { - pProfile = acquireProfile(Profile,sal_False); + pTmpProfile = acquireProfile(Profile,sal_False); } - if ( pProfile == 0 ) + if ( pTmpProfile == 0 ) { pthread_mutex_unlock(&(pProfile->m_AccessLock)); #ifdef TRACE_OSL_PROFILE @@ -327,6 +328,8 @@ sal_Bool SAL_CALL osl_closeProfile(oslProfile Profile) return sal_False; } + pProfile = pTmpProfile; + if (pProfile->m_pFile != NULL) closeFileImpl(pProfile->m_pFile,pProfile->m_Flags); -- cgit From b421cffc60ce5681809e2cf5e3ac10996efab066 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Tue, 12 Apr 2011 06:56:47 -0700 Subject: Fixed some false positives 'dead assignments' seen in CLang++ We removed the OSL_DEBUG_LEVEL > 1 code and replace them with OSL_TRACE. This should provide the same coverage and remove CLang++ complains. --- sal/osl/unx/pipe.c | 4 +--- sal/osl/unx/socket.c | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index e8ab52431744..0622fc52d35d 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -359,12 +359,10 @@ void SAL_CALL osl_closePipe( oslPipe pPipe ) len = sizeof(addr); nRet = connect( fd, (struct sockaddr *)&addr, len); -#if OSL_DEBUG_LEVEL > 1 if ( nRet < 0 ) { - perror("connect in osl_destroyPipe"); + OSL_TRACE("connect in osl_destroyPipe failed with error: %s", strerror(errno)); } -#endif /* OSL_DEBUG_LEVEL */ close(fd); } #endif /* LINUX */ diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index a8e91236b02e..6c102a4b3f9f 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -1705,12 +1705,10 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) socklen_t nSockLen = sizeof(s.aSockAddr); nRet = getsockname(nFD, &s.aSockAddr, &nSockLen); -#if OSL_DEBUG_LEVEL > 1 if ( nRet < 0 ) { - perror("getsockname"); + OSL_TRACE("getsockname call failed with error: %s", strerror(errno)); } -#endif /* OSL_DEBUG_LEVEL */ if ( s.aSockAddr.sa_family == AF_INET ) { @@ -1720,20 +1718,16 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) } nConnFD = socket(AF_INET, SOCK_STREAM, 0); -#if OSL_DEBUG_LEVEL > 1 if ( nConnFD < 0 ) { - perror("socket"); + OSL_TRACE("socket call failed with error: %s", strerror(errno)); } -#endif /* OSL_DEBUG_LEVEL */ nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr)); -#if OSL_DEBUG_LEVEL > 1 if ( nRet < 0 ) { - perror("connect"); + OSL_TRACE("connect call failed with error: %s", strerror(errno)); } -#endif /* OSL_DEBUG_LEVEL */ close(nConnFD); } pSocket->m_bIsAccepting = sal_False; -- cgit From 0e56d8c1d4c56fb3d0fef9956bf6f46434ac8624 Mon Sep 17 00:00:00 2001 From: Julien Chaffraix Date: Tue, 12 Apr 2011 07:59:00 -0700 Subject: No need to check out execv return value. If we ever return from execv, it is an error and the code already handle that. This fixes a dead assignment warning under CLang++. --- sal/osl/unx/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index 0f48c48a2797..e458124e1a73 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -544,8 +544,9 @@ static void ChildStatusProc(void *pData) if (stdError[1] != -1) close( stdError[1] ); } - pid=execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs); - + // No need to check the return value of execv. If we return from + // it, an error has occurred. + execv(data.m_pszArgs[0], (sal_Char **)data.m_pszArgs); } OSL_TRACE("Failed to exec, errno=%d (%s)\n", errno, strerror(errno)); -- cgit From 5bf99da78e9e4646bee0e89ff11caa6d36f0c13c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Apr 2011 13:32:24 +0300 Subject: Revert "It's the WMF_APMFILEHEADER* parameter that needs a cast, I think" Nope, the NULL can't be meaning the WMF_APMFILEHEADER* thing as that is added by external-apm-header.diff. This reverts commit 6107a6b764eecdf3d84fbf5505a8c628d8111811. --- svtools/source/filter.vcl/filter/exportdialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index 66ef0402ff15..701619d31f6c 100644 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast(NULL) ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } -- cgit From c3adad56cc07e775d99947e892e606ef103a1ed2 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Apr 2011 13:34:58 +0300 Subject: The NULL must be a css::uno::Sequence< css::beans::PropertyValue >*, I think --- svtools/source/filter.vcl/filter/exportdialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index 701619d31f6c..12415a943b91 100644 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -521,7 +521,7 @@ Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) Bitmap aRet; Graphic aGraphic; GraphicFilter aFilter( sal_False ); - if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast*>(NULL) ) == GRFILTER_OK ) { aRet = aGraphic.GetBitmap(); } -- cgit From 36310c060512b8bd783c1c9873f7e9b03f070295 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 14 Apr 2011 14:16:39 +0100 Subject: fix accessibility crash two different callbacks connected to the same destination where that destination unset the callback id of one of the callbacks (cherry picked from commit 0929504217c225358388c911d3f81d7626c7776c) --- sd/source/ui/accessibility/AccessibleSlideSorterView.cxx | 14 ++++++++++++-- sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index a4e6eae35faa..44476979b782 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -94,6 +94,7 @@ public: DECL_LINK(SelectionChangeListener, void*); DECL_LINK(BroadcastSelectionChange, void*); DECL_LINK(FocusChangeListener, void*); + DECL_LINK(VisibilityChangeListener, void*); DECL_LINK(UpdateChildrenCallback, void*); private: @@ -970,7 +971,7 @@ void AccessibleSlideSorterView::Implementation::ConnectListeners (void) mrSlideSorter.GetController().GetFocusManager().AddFocusChangeListener( LINK(this,AccessibleSlideSorterView::Implementation,FocusChangeListener)); mrSlideSorter.GetView().AddVisibilityChangeListener( - LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback)); + LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener)); } @@ -983,7 +984,7 @@ void AccessibleSlideSorterView::Implementation::ReleaseListeners (void) mrSlideSorter.GetController().GetSelectionManager()->RemoveSelectionChangeListener( LINK(this,AccessibleSlideSorterView::Implementation,SelectionChangeListener)); mrSlideSorter.GetView().RemoveVisibilityChangeListener( - LINK(this,AccessibleSlideSorterView::Implementation,UpdateChildrenCallback)); + LINK(this,AccessibleSlideSorterView::Implementation,VisibilityChangeListener)); if (mpWindow != NULL) mpWindow->RemoveEventListener( @@ -1132,6 +1133,15 @@ IMPL_LINK(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, voi +IMPL_LINK(AccessibleSlideSorterView::Implementation, VisibilityChangeListener, void*, EMPTYARG ) +{ + UpdateChildren(); + return 1; +} + + + + } // end of namespace ::accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index 11c002c97d1f..7719008b3fe2 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -279,12 +279,13 @@ Reference SlideSorterViewShell::CreateSubController ::com::sun::star::accessibility::XAccessible> SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow) { - OSL_ASSERT(mpSlideSorter.get()!=NULL); // When the view is not set then the initialization is not yet complete // and we can not yet provide an accessibility object. if (mpView == NULL || mpSlideSorter.get() == NULL) return NULL; + OSL_ASSERT(mpSlideSorter.get()!=NULL); + ::accessibility::AccessibleSlideSorterView *pAccessibleView = new ::accessibility::AccessibleSlideSorterView( *mpSlideSorter.get(), -- cgit From 7ea86c48b4bb23cc6e41cebf8c38d90e7979ea30 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 14 Apr 2011 15:19:53 +0200 Subject: fix crash in fdo#36203, the referenced shape didn't contain texbody --- oox/source/drawingml/shape.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 18965ed78d1c..86dea33d8eac 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -198,7 +198,7 @@ void Shape::addShape( void Shape::applyShapeReference( const Shape& rReferencedShape ) { - mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) ); + mpTextBody = TextBodyPtr( rReferencedShape.mpTextBody.get() ? new TextBody( *rReferencedShape.mpTextBody.get() ) : new TextBody() ); maShapeProperties = rReferencedShape.maShapeProperties; mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) ); mpFillPropertiesPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) ); -- cgit From 4db32f1d298df1bbef61bf4c5c6e5fe132a53af6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 13 Apr 2011 20:26:47 +0100 Subject: move this in here so that on windows we convert paths to win format --- solenv/gbuild/platform/windows.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk index d41a04a12389..e0d611c03fb7 100755 --- a/solenv/gbuild/platform/windows.mk +++ b/solenv/gbuild/platform/windows.mk @@ -422,6 +422,7 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(call gb_Helper_convert_native,$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \ $(PCHOBJS))) && \ $(gb_LINK) \ $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \ @@ -429,7 +430,6 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \ $(LDFLAGS) \ @$${RESPONSEFILE} \ - $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ $(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \ $(if $(DLLTARGET),-out:$(DLLTARGET) -implib:$(1),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \ -- cgit From 307498002d6df6eae33983b48a17f0dfab5ad4c0 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 13 Apr 2011 20:55:20 +0100 Subject: windows needs BRAND_BASE_DIR as well --- sc/qa/unit/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/qa/unit/Makefile b/sc/qa/unit/Makefile index 7bdedd0163ce..87694f116f34 100644 --- a/sc/qa/unit/Makefile +++ b/sc/qa/unit/Makefile @@ -45,7 +45,7 @@ services.rdb : echo '' > $@ $(gb_AWK) -- \ '/^<\?xml version.*/ { next; } \ - { gsub(/vnd.sun.star.expand:\$$OOO_BASE_DIR\/program/, "vnd.sun.star.expand:$$OOO_BASE_DIR",$$0); print; }' \ + { gsub(/vnd.sun.star.expand:\$$OOO_BASE_DIR\/program/, "vnd.sun.star.expand:$$OOO_BASE_DIR",$$0); gsub(/vnd.sun.star.expand:\$$BRAND_BASE_DIR\/program/, "vnd.sun.star.expand:$$BRAND_BASE_DIR",$$0); print; }' \ $^ >> $@ echo '' >> $@ -- cgit From 5d771d92ea78efdb8a3834a8e6b2e39a49d0d950 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Apr 2011 15:58:21 -0400 Subject: fdo#34306: Append fake parameter in case of un-even parameter count. GETPIVOTDATA requires an even number of parameters. But in Excel you can leave the last parameter blank, which, when imported to Calc, gets stripped off by the import filter. Rather than supporting an empty parameter like Excel does, which requires a bit more effort both in the import filter and the formula interpreter, let's have the GETPIVOTDATA function compensate for the missing parameter in-situ by adding an imaginary empty string as the extra parameter. --- sc/source/core/tool/interpr2.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index aa06d915cb14..39ab253c8d0f 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2943,7 +2943,11 @@ void ScInterpreter::ScGetPivotData() // there must be an even number of args // target, ref, then field/item pairs if( (nParamCount % 2) == 1) - goto failed; + { + // if not, append an extra fake parameter to compensate for it. + PushString(ScGlobal::GetEmptyString()); + ++nParamCount; + } bool bOldSyntax = false; if ( nParamCount == 2 ) -- cgit From c67cfdb5a783464544f2cf778b19109f06719d44 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Apr 2011 17:36:05 -0400 Subject: Revert "fdo#34306: Append fake parameter in case of un-even parameter count." This reverts commit b45254a0d973e1da278d5e8d269b688628f2603f. This is not the right approach, as re-saving the document to xls would mess it up again. --- sc/source/core/tool/interpr2.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 39ab253c8d0f..aa06d915cb14 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2943,11 +2943,7 @@ void ScInterpreter::ScGetPivotData() // there must be an even number of args // target, ref, then field/item pairs if( (nParamCount % 2) == 1) - { - // if not, append an extra fake parameter to compensate for it. - PushString(ScGlobal::GetEmptyString()); - ++nParamCount; - } + goto failed; bool bOldSyntax = false; if ( nParamCount == 2 ) -- cgit From 0cc476b2b180a840a078960bf83826dc12823646 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 15 Apr 2011 01:16:54 +0200 Subject: Fixed LANG setting in the _imp_setProcessLocale() function. --- sal/osl/unx/nlsupport.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index d1c2c984bd9a..a9b84cbab8dd 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -942,6 +942,16 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) set the current process locale *****************************************************************************/ +static int +_setenv (const char* name, const char* value) +{ +#if defined( AIX ) + return setenv (name, value, 1); +#else + return setenv (name, value); +#endif +} + int _imp_setProcessLocale( rtl_Locale * pLocale ) { char locale_buf[64]; @@ -950,32 +960,14 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) if( NULL != _compose_locale( pLocale, locale_buf, 64 ) ) { /* only change env vars that exist already */ - if( getenv( "LC_ALL" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \ - defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY ) - setenv( "LC_ALL", locale_buf, 1); -#else - setenv( "LC_ALL", locale_buf ); -#endif - } + if( getenv( "LC_ALL" ) ) + _setenv( "LC_ALL", locale_buf ); - if( getenv( "LC_CTYPE" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \ - defined( AIX ) || defined( OPENBSD ) || defined( DRAGONFLY ) - setenv("LC_CTYPE", locale_buf, 1 ); -#else - setenv( "LC_CTYPE", locale_buf ); -#endif - } + if( getenv( "LC_CTYPE" ) ) + _setenv("LC_CTYPE", locale_buf ); - if( getenv( "LANG" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \ - defined( AIX ) || defined( OPENBSD) || defined( DRAGONFLY ) - setenv("LC_CTYPE", locale_buf, 1 ); -#else - setenv( "LANG", locale_buf ); -#endif - } + if( getenv( "LANG" ) ) + _setenv( "LANG", locale_buf ); } return 0; -- cgit From 8728b663a2edcd825f1b0fc7ca34bb1d9627db58 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Apr 2011 19:13:47 -0400 Subject: fdo#34306: Insert a missing token for an ocSep followed by an ocClose. Turns out that this behavior is more compatible with Excel's own formula parser, *and* it fixes the error when parsing the test document from the bug. With this, we don't have to skip the trailing missing parameters when importing XLS docs. --- sc/source/core/tool/compiler.cxx | 1 + sc/source/filter/excel/excform.cxx | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c30f57a03a99..ad3052585784 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3788,6 +3788,7 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula ) eLastOp == ocArrayColSep || eLastOp == ocArrayOpen) && (eOp == ocSep || + eOp == ocClose || eOp == ocArrayRowSep || eOp == ocArrayColSep || eOp == ocArrayClose) ) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 62f3622cd87a..a73e2c81d104 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1589,19 +1589,6 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo } } - // FIXME: ideally we'd want to import all missing args, but this - // conflicts with lots of fn's understanding of nParams - we need - // a function table, and pre-call argument normalisation 1st. - sal_Int16 nLastRemovable = nLast - nMinParamCount; - - // skip missing parameters at end of parameter list - while( nSkipEnd < nLastRemovable && - aPool.IsSingleOp( eParam[ nSkipEnd + 1 ], ocMissing ) ) - nSkipEnd++; - -// fprintf (stderr, "Fn %d nSkipEnd %d nLast %d nMinParamCnt %d %d\n", -// eId, nSkipEnd, nLast, nMinParamCount, nLastRemovable); - // [Parameter{;Parameter}] if( nLast > nSkipEnd ) { -- cgit From 6bd7d86f354d80e0ff6aaa5f3dcc5c4077314d34 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Apr 2011 22:24:41 -0400 Subject: Removed an unused argument from a function. Let's make it simpler. --- sc/source/filter/excel/excform.cxx | 6 +++--- sc/source/filter/excel/excform8.cxx | 2 +- sc/source/filter/inc/excform.hxx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index a73e2c81d104..949cb0fb0615 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -480,7 +480,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s else aIn >> nXclFunc; if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) ) - DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount, pFuncInfo->mnMinParamCount ); + DoMulArgs( pFuncInfo->meOpCode, pFuncInfo->mnMaxParamCount ); else DoMulArgs( ocNoName, 0 ); } @@ -498,7 +498,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s else aIn >> nXclFunc; if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) ) - DoMulArgs( pFuncInfo->meOpCode, nParamCount, pFuncInfo->mnMinParamCount ); + DoMulArgs( pFuncInfo->meOpCode, nParamCount ); else DoMulArgs( ocNoName, 0 ); } @@ -1525,7 +1525,7 @@ sal_Bool ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sa return !rRangeList.empty(); } -void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCount ) +void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz ) { TokenId eParam[ 256 ]; sal_Int32 nLauf; diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 3cfc20d5aeba..f989abc3c196 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -475,7 +475,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aIn >> nParamCount >> nXclFunc; nParamCount &= 0x7F; if( const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromXclFunc( nXclFunc ) ) - DoMulArgs( pFuncInfo->meOpCode, nParamCount, pFuncInfo->mnMinParamCount ); + DoMulArgs( pFuncInfo->meOpCode, nParamCount ); else DoMulArgs( ocNoName, 0 ); } diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx index d5c53734b8e6..ebc3696e9a0f 100644 --- a/sc/source/filter/inc/excform.hxx +++ b/sc/source/filter/inc/excform.hxx @@ -52,7 +52,7 @@ protected: const XclBiff meBiff; // --------------------------------------------------------------- - void DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs, sal_uInt8 mnMinParamCount = 0 ); + void DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs ); void ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const sal_Bool bName ); -- cgit From f671eccb839f4407f7c1e6336e64243b46a6e42e Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 14 Apr 2011 22:46:33 -0400 Subject: New test for function evaluation with missing parameters. --- sc/qa/unit/ucalc.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a5127138d1ae..2e65aeecc465 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -225,6 +225,7 @@ public: void testInput(); void testSUM(); void testVolatileFunc(); + void testFuncParam(); void testNamedRange(); void testCSV(); void testMatrix(); @@ -256,6 +257,7 @@ public: CPPUNIT_TEST(testInput); CPPUNIT_TEST(testSUM); CPPUNIT_TEST(testVolatileFunc); + CPPUNIT_TEST(testFuncParam); CPPUNIT_TEST(testNamedRange); CPPUNIT_TEST(testCSV); CPPUNIT_TEST(testMatrix); @@ -409,6 +411,29 @@ void Test::testVolatileFunc() m_pDoc->DeleteTab(0); } +void Test::testFuncParam() +{ + rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo")); + CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", + m_pDoc->InsertTab (0, aTabName)); + + // First, the normal case, with no missing parameters. + m_pDoc->SetString(0, 0, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=AVERAGE(1;2;3)"))); + m_pDoc->CalcFormulaTree(false, true); + double val; + m_pDoc->GetValue(0, 0, 0, val); + CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 2); + + // Now function with missing parameters. Missing values should be treated + // as zeros. + m_pDoc->SetString(0, 0, 0, OUString(RTL_CONSTASCII_USTRINGPARAM("=AVERAGE(1;;;)"))); + m_pDoc->CalcFormulaTree(false, true); + m_pDoc->GetValue(0, 0, 0, val); + CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 0.25); + + m_pDoc->DeleteTab(0); +} + void Test::testNamedRange() { rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("Sheet1")); -- cgit From 03086ad090941f55e699aa37222a71c037968ecd Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 15 Apr 2011 14:16:37 +0200 Subject: FALSE/TRUE in strings should not be converted to sal_False/sal_True. --- idl/source/objects/slot.cxx | 4 ++-- xmloff/source/text/txtfldi.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 2f4f219c2e6c..8281bce12e61 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -1577,9 +1577,9 @@ void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm, void WriteBool( sal_Bool bSet, SvStream& rStream ) { if ( bSet ) - rStream << "sal_True" << ','; + rStream << "TRUE" << ','; else - rStream << "sal_False" << ','; + rStream << "FALSE" << ','; } void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm ) diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index ca45f0159367..af7677a2cdc6 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -210,7 +210,7 @@ const sal_Char sAPI_is_fixed_language[] = "IsFixedLanguage"; const sal_Char sAPI_is_visible[] = "IsVisible"; const sal_Char sAPI_TextRange[] = "TextRange"; -const sal_Char sAPI_true[] = "sal_True"; +const sal_Char sAPI_true[] = "TRUE"; TYPEINIT1( XMLTextFieldImportContext, SvXMLImportContext); -- cgit From 56c4710008474553665d830b5d307c60cca058ad Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 6 Apr 2011 09:48:50 +0200 Subject: Don't mention that we are updating autogen.lastrun. --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index fcef75a5b2bf..cc7210006971 100755 --- a/autogen.sh +++ b/autogen.sh @@ -97,7 +97,7 @@ if (defined $ENV{NOCONFIGURE}) { print "Skipping configure process."; } else { if ($#cmdline_args > 0) { - print "writing args to autogen.lastrun\n"; +# print "writing args to autogen.lastrun\n"; my $fh; open ($fh, ">autogen.lastrun") || die "can't open autogen.lastrun: $!"; for my $arg (@cmdline_args) { -- cgit From 4d1bdd7a08873b7e7229cc8f2799fce92ddc8a70 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 5 Apr 2011 22:37:12 +0200 Subject: Use cl.exe's -showIncludes to generate dependency files. --- solenv/gbuild/filter-showIncludes.pl | 57 ++++++++++++++++++ solenv/gbuild/platform/windows.mk | 112 ++++++----------------------------- 2 files changed, 75 insertions(+), 94 deletions(-) create mode 100755 solenv/gbuild/filter-showIncludes.pl diff --git a/solenv/gbuild/filter-showIncludes.pl b/solenv/gbuild/filter-showIncludes.pl new file mode 100755 index 000000000000..3079ba007d22 --- /dev/null +++ b/solenv/gbuild/filter-showIncludes.pl @@ -0,0 +1,57 @@ +#!/usr/bin/env perl +# +# filter-showIncludes.pl depfile.d objfile.o orginal.cxx +# +# Create dependency information from the output of cl.exe's showInclude. It +# needs additional information - the output name to which to write, objfile +# that depends on the includes, and the original file name. +# +# It also consolidates the file names to a canonical form, and filters out +# duplicates. +# +# LGPL v3 / GPL v3 / MPL 1.1 +# +# Original author: Jan Holesovsky + +my $outfile = $ARGV[0]; +my $objfile = $ARGV[1]; +my $srcfile = $ARGV[2]; +if ( !defined $outfile || !defined $objfile || !defined $srcfile ) { + die "Not enough parameters to create dependencies."; +} + +open( OUT, "> $outfile" ) or die "Cannot open $outfile for writing."; +print OUT "$objfile: \\\n $srcfile"; + +my %seen; +my $first_line = 1; +while ( ) { + if ( /^Note: including file:/ ) { + s/^Note: including file:\s*//; + s/\r$//; + + chomp; + s/\\/\//g; + + # X: -> /cygdrive/x/ + s/^(.):/\/cygdrive\/\l\1/; + + s/ /\\ /g; + + if ( !defined $seen{$_} ) { + $seen{$_} = 1; + print OUT " \\\n $_"; + } + } + else { + # skip the first line, it always just duplicates what is being + # compiled + print unless ( $first_line ); + } + $first_line = 0; +} + +print OUT "\n"; +close( OUT ) or die "Cannot close $outfile."; + +# vim: shiftwidth=4 softtabstop=4 expandtab: diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk index e0d611c03fb7..f9182c8f30ee 100755 --- a/solenv/gbuild/platform/windows.mk +++ b/solenv/gbuild/platform/windows.mk @@ -213,6 +213,16 @@ endif gb_COMPILERNOOPTFLAGS := -Od +ifeq ($(gb_FULLDEPS),$(true)) +gb_COMPILERDEPFLAGS := -showIncludes +define gb_create_deps +| $(GBUILDDIR)/filter-showIncludes.pl $(2) $(1) $(3) +endef +else +gb_COMPILERDEPFLAGS := +define gb_create_deps +endef +endif # Helper class gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print tolower(substr($$0,1,1)) substr($$0,2) }') @@ -241,27 +251,6 @@ endef # CObject class -ifeq ($(gb_FULLDEPS),$(true)) -define gb_CObject__command_deponcompile -$(call gb_Helper_abbreviate_dirs_native,\ - $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ - $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \ - -I$(dir $(3)) \ - $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \ - $(3) \ - -f - \ - | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ - -v OBJECTFILE=$(1) \ - -v OUTDIR=$(OUTDIR)/ \ - -v WORKDIR=$(WORKDIR)/ \ - -v SRCDIR=$(SRCDIR)/ \ - -v REPODIR=$(REPODIR)/ \ - > $(call gb_CObject_get_dep_target,$(2))) -endef -else -CObject__command_deponcompile = -endif - define gb_CObject__command $(call gb_Output_announce,$(2),$(true),C ,3) $(call gb_Helper_abbreviate_dirs_native,\ @@ -270,37 +259,16 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(gb_CC) \ $(DEFS) $(CFLAGS) -Fd$(PDBFILE) \ $(PCHFLAGS) \ + $(gb_COMPILERDEPFLAGS) \ -I$(realpath $(dir $(3))) \ $(INCLUDE) \ -c $(realpath $(3)) \ - -Fo$(1)) -$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE)) + -Fo$(1)) $(call gb_create_deps,$(1),$(call gb_CObject_get_dep_target,$(2)),$(realpath $(3))) endef # CxxObject class -ifeq ($(gb_FULLDEPS),$(true)) -define gb_CxxObject__command_deponcompile -$(call gb_Helper_abbreviate_dirs_native,\ - $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ - $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \ - -I$(dir $(3)) \ - $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \ - $(3) \ - -f - \ - | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ - -v OBJECTFILE=$(1) \ - -v OUTDIR=$(OUTDIR)/ \ - -v WORKDIR=$(WORKDIR)/ \ - -v SRCDIR=$(SRCDIR)/ \ - -v REPODIR=$(REPODIR)/ \ - > $(call gb_CxxObject_get_dep_target,$(2))) - endef -else -gb_CxxObject__command_deponcompile = -endif - define gb_CxxObject__command $(call gb_Output_announce,$(2),$(true),CXX,3) $(call gb_Helper_abbreviate_dirs_native,\ @@ -309,11 +277,11 @@ $(call gb_Helper_abbreviate_dirs_native,\ $(gb_CXX) \ $(DEFS) $(CXXFLAGS) -Fd$(PDBFILE)\ $(PCHFLAGS) \ + $(gb_COMPILERDEPFLAGS) \ -I$(realpath $(dir $(3))) \ $(INCLUDE_STL) $(INCLUDE) \ -c $(realpath $(3)) \ - -Fo$(1)) -$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE)) + -Fo$(1)) $(call gb_create_deps,$(1),$(call gb_CxxObject_get_dep_target,$(2)),$(realpath $(3))) endef @@ -322,28 +290,6 @@ endef gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \ -Fp$(call gb_PrecompiledHeader_get_target,$(1)) -ifeq ($(gb_FULLDEPS),$(true)) -define gb_PrecompiledHeader__command_deponcompile -$(call gb_Helper_abbreviate_dirs_native,\ - $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ - $(4) $(5) \ - -I$(dir $(3)) \ - $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \ - $(3) \ - -f - \ - | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ - -v OBJECTFILE=$(1) \ - -v OUTDIR=$(OUTDIR)/ \ - -v WORKDIR=$(WORKDIR)/ \ - -v SRCDIR=$(SRCDIR)/ \ - -v REPODIR=$(REPODIR)/ \ - > $(call gb_PrecompiledHeader_get_dep_target,$(2))) -endef -else -gb_PrecompiledHeader__command_deponcompile = -endif - - define gb_PrecompiledHeader__command $(call gb_Output_announce,$(2),$(true),PCH,1) $(call gb_Helper_abbreviate_dirs_native,\ @@ -351,11 +297,11 @@ $(call gb_Helper_abbreviate_dirs_native,\ unset INCLUDE && \ $(gb_CXX) \ $(4) $(5) -Fd$(PDBFILE) \ + $(gb_COMPILERDEPFLAGS) \ -I$(realpath $(dir $(3))) \ $(6) \ -c $(realpath $(3)) \ - -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) -$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6)) + -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(1),$(call gb_PrecompiledHeader_get_dep_target,$(2)),$(realpath $(3))) endef # NoexPrecompiledHeader class @@ -363,28 +309,6 @@ endef gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \ -Fp$(call gb_NoexPrecompiledHeader_get_target,$(1)) -ifeq ($(gb_FULLDEPS),$(true)) -define gb_NoexPrecompiledHeader__command_deponcompile -$(call gb_Helper_abbreviate_dirs_native,\ - $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \ - $(4) $(5) \ - -I$(dir $(3)) \ - $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \ - $(3) \ - -f - \ - | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ - -v OBJECTFILE=$(1) \ - -v OUTDIR=$(OUTDIR)/ \ - -v WORKDIR=$(WORKDIR)/ \ - -v SRCDIR=$(SRCDIR)/ \ - -v REPODIR=$(REPODIR)/ \ - > $(call gb_NoexPrecompiledHeader_get_dep_target,$(2))) -endef -else -gb_NoexPrecompiledHeader__command_deponcompile = -endif - - define gb_NoexPrecompiledHeader__command $(call gb_Output_announce,$(2),$(true),PCH,1) $(call gb_Helper_abbreviate_dirs_native,\ @@ -392,11 +316,11 @@ $(call gb_Helper_abbreviate_dirs_native,\ unset INCLUDE && \ $(gb_CXX) \ $(4) $(5) -Fd$(PDBFILE) \ + $(gb_COMPILERDEPFLAGS) \ -I$(realpath $(dir $(3))) \ $(6) \ -c $(realpath $(3)) \ - -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) -$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6)) + -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(1),$(call gb_NoexPrecompiledHeader,$(2)),$(realpath $(3))) endef -- cgit From 15a1260bd715d04fe4a24f3d4db1b5cb1de6cb70 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Fri, 15 Apr 2011 13:59:52 +0200 Subject: Detect the prefix of the cl.exe -showIncludes output. --- configure.in | 17 ++++++++++++++++- set_soenv.in | 3 ++- solenv/gbuild/filter-showIncludes.pl | 9 +++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index 922e3eceac13..c3741aa87f82 100755 --- a/configure.in +++ b/configure.in @@ -2113,6 +2113,7 @@ fi dnl =================================================================== dnl Check which Microsoft C/C++ or MinGW compiler is used for WINNT dnl =================================================================== +SHOWINCLUDES_PREFIX= if test "$_os" = "WINNT"; then if test "$WITH_MINGW" != "yes"; then AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path]) @@ -2163,7 +2164,7 @@ if test "$_os" = "WINNT"; then fi if test -z "$MSPDB_PATH"; then - AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it's in the path or use --with-mspdb-path]) + AC_MSG_ERROR([You need a mspdb80.dllor mspdb100.dll, make sure it is in the path or use --with-mspdb-path]) fi MSPDB_PATH=`cygpath -d "$MSPDB_PATH"` MSPDB_PATH=`cygpath -u "$MSPDB_PATH"` @@ -2222,6 +2223,19 @@ dnl The following find microsoft, matches nn.nn.nnnn then pulls numbers out else AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home or set path to cl.exe.]) fi + + dnl We need to guess the prefix of the -showIncludes output, it can be + dnl localized + AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)]) + echo "#include " > conftest.c + SHOWINCLUDES_PREFIX=`$CC -c -showIncludes conftest.c 2>/dev/null | \ + grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'` + rm -f conftest.c conftest.obj + if test -z "$SHOWINCLUDES_PREFIX" ; then + AC_MSG_ERROR([cannot determine the -showIncludes prefix]) + else + AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"]) + fi else AC_MSG_CHECKING([the MinGW C++ Compiler]) if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then @@ -2239,6 +2253,7 @@ fi AC_SUBST(COMEX) AC_SUBST(MSPDB_PATH) AC_SUBST(USE_MINGW) +AC_SUBST(SHOWINCLUDES_PREFIX) dnl =================================================================== dnl .NET needs special treatment diff --git a/set_soenv.in b/set_soenv.in index 2303ef62b55b..8e66789e1470 100755 --- a/set_soenv.in +++ b/set_soenv.in @@ -78,7 +78,7 @@ my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL, $SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV, $SOLARDEFIMG, $STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI, $DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH, - $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, + $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $SHOWINCLUDES_PREFIX, $PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB, $JAVALIB, $SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL, $COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME, @@ -659,6 +659,7 @@ elsif ( $platform =~ m/cygwin/ ) $MSPDB_PATH = PathFormat('@MSPDB_PATH@'); $MIDL_PATH = PathFormat('@MIDL_PATH@'); $CSC_PATH = PathFormat('@CSC_PATH@'); + $SHOWINCLUDES_PREFIX = '@SHOWINCLUDES_PREFIX@'; $PSDK_HOME = PathFormat('@PSDK_HOME@'); $DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@'); $USE_DIRECTX5 = ""; diff --git a/solenv/gbuild/filter-showIncludes.pl b/solenv/gbuild/filter-showIncludes.pl index 3079ba007d22..f72a9eb07fd8 100755 --- a/solenv/gbuild/filter-showIncludes.pl +++ b/solenv/gbuild/filter-showIncludes.pl @@ -20,14 +20,19 @@ if ( !defined $outfile || !defined $objfile || !defined $srcfile ) { die "Not enough parameters to create dependencies."; } +my $showincludes_prefix = $ENV{'SHOWINCLUDES_PREFIX'}; +if ( !defined( $showincludes_prefix ) || $showincludes_prefix eq "" ) { + $showincludes_prefix = 'Note: including file:'; +} + open( OUT, "> $outfile" ) or die "Cannot open $outfile for writing."; print OUT "$objfile: \\\n $srcfile"; my %seen; my $first_line = 1; while ( ) { - if ( /^Note: including file:/ ) { - s/^Note: including file:\s*//; + if ( /^$showincludes_prefix/ ) { + s/^$showincludes_prefix\s*//; s/\r$//; chomp; -- cgit From 9d6657398735f7ba81e72df371a1a4c428a3f1cf Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 6 Apr 2011 11:19:15 +0200 Subject: Don't override CC and CXX on Windows when set, handle ccache. This is to allow use of ccache by specifying something like: export CC="ccache C:/path/to/cl.exe" export CXX="ccache C:/patch/to/cl.exe" before running ./autogen.sh --- configure.in | 32 +++++++++++++++++--------------- set_soenv.in | 8 ++------ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/configure.in b/configure.in index c3741aa87f82..18de3ffa733b 100755 --- a/configure.in +++ b/configure.in @@ -2131,7 +2131,7 @@ if test "$_os" = "WINNT"; then else with_cl_home=`cygpath -u "$with_cl_home"` fi - AC_MSG_RESULT([done]) + AC_MSG_RESULT([$with_cl_home]) dnl =========================================================== dnl Check for mspdb80.dll/mspdb100.dll @@ -2172,27 +2172,29 @@ if test "$_os" = "WINNT"; then PATH="$MSPDB_PATH:$PATH" AC_MSG_CHECKING([the Microsoft C/C++ Compiler]) - if test "$CL_X64" = ""; then - if test -x "$with_cl_home/bin/cl.exe"; then - CC="$with_cl_home/bin/cl.exe" + if test -z "$CC"; then + if test "$CL_X64" = ""; then + if test -x "$with_cl_home/bin/cl.exe"; then + CC="$with_cl_home/bin/cl.exe" + fi + else + if test -x "$with_cl_home/bin/amd64/cl.exe"; then + CC="$with_cl_home/bin/amd64/cl.exe" + fi fi - else - if test -x "$with_cl_home/bin/amd64/cl.exe"; then - CC="$with_cl_home/bin/amd64/cl.exe" + if test -z "$CC"; then + AC_PATH_PROG(CC, cl.exe) fi - fi - if test -z "$CC"; then - AC_PATH_PROG(CC, cl.exe) - fi - - if test -e "$CC"; then # This gives us a posix path with 8.3 filename restrictions CC=`cygpath -d "$CC"` CC=`cygpath -u "$CC"` + fi + + if test -n "$CC"; then # Remove /cl.exe from CC case insensitive AC_MSG_RESULT([found ($CC)]) if test "$CL_X64" = ""; then - COMPATH=`echo $CC | $SED 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]]@@'` + COMPATH=`echo $CC | $SED -e 's@\/[[Bb]][[Ii]][[Nn]]\/[[cC]][[lL]]\.[[eE]][[xX]][[eE]].*@@' -e 's@^.* @@'` else if test -n "$with_cl_home"; then COMPATH=`echo $with_cl_home` @@ -2427,7 +2429,7 @@ dnl =================================================================== dnl Testing for c++ compiler and version... dnl =================================================================== if test "$_os" = "WINNT" -a "$WITH_MINGW" != "yes"; then - if test -e "$CC"; then + if test -n "$CC" -a -z "$CXX"; then CXX="$CC" fi fi diff --git a/set_soenv.in b/set_soenv.in index 8e66789e1470..14f59b3494a1 100755 --- a/set_soenv.in +++ b/set_soenv.in @@ -125,12 +125,8 @@ $JDK = '@JDK@'; $JAVAFLAGS = '@JAVAFLAGS@'; $MINGW = '@WITH_MINGW@'; # use MinGW for Windows build $USE_MINGW = '@USE_MINGW@'; # use MinGW in cygwin or pure-mingw -if ( $MINGW eq "yes" ) -{ $CC = '@CC@'; # C compiler - $CXX = '@CXX@'; } # C++ compiler -else -{ $CC = PathFormat('@CC@'); # C compiler - $CXX = PathFormat('@CXX@'); } # C++ compiler +$CC = '@CC@'; # C compiler +$CXX = '@CXX@'; # C++ compiler $MOZILLA_VERSION = '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla $MOZILLA_TOOLKIT = '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla $FLIPCMD = ""; # Flip '/' to '\' wrapper (only for winnt) -- cgit From aec67afa21ac09991af4ceef97b30bc122b2a69d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 15 Apr 2011 13:52:40 +0100 Subject: fix for fdo#34763 add method Copy to ScVbaWorksheets --- sc/source/ui/vba/vbaworksheet.cxx | 117 +++++++++++++++++++++---------------- sc/source/ui/vba/vbaworksheet.hxx | 2 + sc/source/ui/vba/vbaworksheets.cxx | 39 +++++++++++++ sc/source/ui/vba/vbaworksheets.hxx | 1 + 4 files changed, 110 insertions(+), 49 deletions(-) diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 9348f928f13f..f3c5bb18efe2 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -229,6 +229,72 @@ const uno::Sequence& ScVbaWorksheet::getUnoTunnelId() return aSeq; } +uno::Reference< ov::excel::XWorksheet > +ScVbaWorksheet::createSheetCopyInNewDoc(rtl::OUString aCurrSheetName) +{ + uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( ); + uno::Reference xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW); + uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY); + uno::Reference xRange = new ScVbaRange( this, mxContext, xRange1); + if (xRange.is()) + xRange->Select(); + excel::implnCopy(mxModel); + uno::Reference xModel = openNewDoc(aCurrSheetName); + if (xModel.is()) + { + excel::implnPaste(xModel); + } + uno::Reference xSpreadDoc( xModel, uno::UNO_QUERY_THROW ); + uno::Reference xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW ); + uno::Reference xIndex( xSheets, uno::UNO_QUERY_THROW ); + uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + //#TODO #FIXME + //get proper parent for Worksheet + return new ScVbaWorksheet( NULL, mxContext, xSheet, xModel ); +} + +css::uno::Reference< ov::excel::XWorksheet > +ScVbaWorksheet::createSheetCopy(uno::Reference xSheet, bool bAfter) +{ + rtl::OUString aCurrSheetName = getName(); + ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper( xSheet ); + + uno::Reference xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY ); + uno::Reference xSrcDoc( getModel(), uno::UNO_QUERY ); + + SCTAB nDest = 0; + SCTAB nSrc = 0; + rtl::OUString aSheetName = xSheet->getName(); + bool bSameDoc = ( pDestSheet->getModel() == getModel() ); + bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest ); + bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc ); + + // set sheet name to be newSheet name + aSheetName = aCurrSheetName; + if ( bSheetExists && bDestSheetExists ) + { + SCTAB nDummy=0; + if(bAfter) + nDest++; + uno::Reference xSheets = xDestDoc->getSheets(); + if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) ) + getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc); + if ( bSameDoc ) + xSheets->copyByName(aCurrSheetName,aSheetName,nDest); + else + { + ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() ); + ScDocShell* pSrcDocShell = excel::getDocShell( getModel() ); + if ( pDestDocShell && pSrcDocShell ) + pDestDocShell->TransferTab( *pSrcDocShell, static_cast(nSrc), static_cast(nDest), true, true ); + } + } + // return new sheet + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW ); + return xNewSheet; +} + ::rtl::OUString ScVbaWorksheet::getName() throw (uno::RuntimeException) { @@ -571,60 +637,13 @@ void ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException) { uno::Reference xSheet; - rtl::OUString aCurrSheetName =getName(); if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue())) { - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( ); - uno::Reference xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW); - uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY); - uno::Reference xRange = new ScVbaRange( this, mxContext, xRange1); - if (xRange.is()) - xRange->Select(); - excel::implnCopy(mxModel); - uno::Reference xModel = openNewDoc(aCurrSheetName); - if (xModel.is()) - { - excel::implnPaste(xModel); - } + createSheetCopyInNewDoc(getName()); return; } - ScVbaWorksheet* pDestSheet = excel::getImplFromDocModuleWrapper( xSheet ); - - uno::Reference xDestDoc( pDestSheet->getModel(), uno::UNO_QUERY ); - uno::Reference xSrcDoc( getModel(), uno::UNO_QUERY ); - - SCTAB nDest = 0; - SCTAB nSrc = 0; - rtl::OUString aSheetName = xSheet->getName(); - bool bSameDoc = ( pDestSheet->getModel() == getModel() ); - bool bDestSheetExists = ScVbaWorksheets::nameExists (xDestDoc, aSheetName, nDest ); - bool bSheetExists = ScVbaWorksheets::nameExists (xSrcDoc, aCurrSheetName, nSrc ); - - // set sheet name to be newSheet name - aSheetName = aCurrSheetName; - if ( bSheetExists && bDestSheetExists ) - { - SCTAB nDummy=0; - sal_Bool bAfter = After.hasValue(); - if(bAfter) - nDest++; - uno::Reference xSheets = xDestDoc->getSheets(); - if ( bSameDoc || ScVbaWorksheets::nameExists( xDestDoc, aCurrSheetName, nDummy ) ) - getNewSpreadsheetName(aSheetName,aCurrSheetName,xDestDoc); - if ( bSameDoc ) - xSheets->copyByName(aCurrSheetName,aSheetName,nDest); - else - { - ScDocShell* pDestDocShell = excel::getDocShell( pDestSheet->getModel() ); - ScDocShell* pSrcDocShell = excel::getDocShell( getModel() ); - if ( pDestDocShell && pSrcDocShell ) - pDestDocShell->TransferTab( *pSrcDocShell, static_cast(nSrc), static_cast(nDest), true, true ); - } - } - // active the new sheet - uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); - uno::Reference< excel::XWorksheet > xNewSheet( xApplication->Worksheets( uno::makeAny( aSheetName ) ), uno::UNO_QUERY_THROW ); + uno::Reference xNewSheet = createSheetCopy(xSheet, After.hasValue()); xNewSheet->Activate(); } diff --git a/sc/source/ui/vba/vbaworksheet.hxx b/sc/source/ui/vba/vbaworksheet.hxx index 56e9975a3b07..2736083a8561 100644 --- a/sc/source/ui/vba/vbaworksheet.hxx +++ b/sc/source/ui/vba/vbaworksheet.hxx @@ -91,6 +91,8 @@ public: virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet() { return mxSheet; } static const com::sun::star::uno::Sequence& getUnoTunnelId(); + css::uno::Reference< ov::excel::XWorksheet > createSheetCopyInNewDoc( rtl::OUString); + css::uno::Reference< ov::excel::XWorksheet > createSheetCopy(css::uno::Reference< ov::excel::XWorksheet> xSheet, bool bAfter); // Attributes virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index 6a2902a40810..80b6537d865c 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -55,6 +55,8 @@ #include "vbaworkbook.hxx" #include "unonames.hxx" +#include + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -420,6 +422,43 @@ ScVbaWorksheets::Select( const uno::Any& Replace ) throw (uno::RuntimeException) } +void SAL_CALL +ScVbaWorksheets::Copy ( const uno::Any& Before, const uno::Any& After) throw (css::uno::RuntimeException) +{ + uno::Reference xSheet; + sal_Int32 nElems = getCount(); + bool bAfter = After.hasValue(); + std::vector< uno::Reference< excel::XWorksheet > > Sheets; + sal_Int32 nItem = 0; + + for ( nItem = 1; nItem <= nElems; ++nItem) + { + uno::Reference xWorksheet(Item( uno::makeAny( nItem ), uno::Any() ), uno::UNO_QUERY_THROW ); + Sheets.push_back(xWorksheet); + } + bool bNewDoc = (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue())); + + uno::Reference< excel::XWorksheet > xSrcSheet; + if ( bNewDoc ) + { + bAfter = true; + xSrcSheet = Sheets.at(0); + ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper( xSrcSheet ); + xSheet = pSrcSheet->createSheetCopyInNewDoc(xSrcSheet->getName()); + nItem = 1; + } + + for (nItem = 0; nItem < nElems; ++nItem ) + { + xSrcSheet = Sheets[nItem]; + ScVbaWorksheet* pSrcSheet = excel::getImplFromDocModuleWrapper( xSrcSheet ); + if ( bAfter ) + xSheet = pSrcSheet->createSheetCopy(xSheet, bAfter); + else + pSrcSheet->createSheetCopy(xSheet, bAfter); + } +} + //ScVbaCollectionBaseImpl uno::Any SAL_CALL ScVbaWorksheets::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) diff --git a/sc/source/ui/vba/vbaworksheets.hxx b/sc/source/ui/vba/vbaworksheets.hxx index 9854c0447c1d..c15d713e1230 100644 --- a/sc/source/ui/vba/vbaworksheets.hxx +++ b/sc/source/ui/vba/vbaworksheets.hxx @@ -72,6 +72,7 @@ public: virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::uno::RuntimeException); virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Copy ( const css::uno::Any& Before, const css::uno::Any& After) throw (css::uno::RuntimeException); // ScVbaWorksheets_BASE virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); -- cgit From d58e814fd4372127db0915c192e4c20e9a5413c4 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 15 Apr 2011 13:54:24 +0100 Subject: fix for fdo#34763 add method Copy to ScVbaWorksheets --- oovbaapi/ooo/vba/excel/XWorksheets.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/oovbaapi/ooo/vba/excel/XWorksheets.idl b/oovbaapi/ooo/vba/excel/XWorksheets.idl index 13b4f4faf745..17c80ce4547a 100644 --- a/oovbaapi/ooo/vba/excel/XWorksheets.idl +++ b/oovbaapi/ooo/vba/excel/XWorksheets.idl @@ -44,6 +44,7 @@ interface XWorksheets void Delete(); void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName ); void Select( [in] any Replace ); + void Copy( [in] any Before, [in] any After); }; }; }; }; -- cgit From a5c013ec4bc442f92b07af91dcd92b53b60f1113 Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Fri, 15 Apr 2011 09:07:52 -0500 Subject: fix MacOSX breakage due to e75d09e4e89d3eda7ddaa2c085678edf9a21293f it is presumed here that Supported Unix platform are also Posix compliant. --- sal/osl/unx/nlsupport.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index a9b84cbab8dd..6312cc956392 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -945,11 +945,7 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) static int _setenv (const char* name, const char* value) { -#if defined( AIX ) return setenv (name, value, 1); -#else - return setenv (name, value); -#endif } int _imp_setProcessLocale( rtl_Locale * pLocale ) -- cgit From 37d085b1fa30d3169b8d860da16326ffd7173a43 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Fri, 15 Apr 2011 17:50:50 +0200 Subject: process glib events on exit so that waiting asynchronous events are not discarded; helps with updating recently-used.xbel (recently used files in bookmarks format) and possibly with other things --- vcl/unx/gtk/app/gtkdata.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index bd038cc55966..8eb88aaee105 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -568,6 +568,7 @@ GtkXLib::~GtkXLib() #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "GtkXLib::~GtkXLib()\n" ); #endif + Yield( true, true ); StopTimer(); // sanity check: at this point nobody should be yielding, but wake them // up anyway before the condition they're waiting on gets destroyed. -- cgit From 925551e7c6cd6174866708ce362d474280878d96 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 15 Apr 2011 12:43:37 -0400 Subject: fdo#35142: Avoid importing unnamed styles from XLS. This actually causes undefined behavior since every cell is supposed to be associated with some style. One thing affected by this is ODS export (as described in the bug). --- sc/source/filter/excel/xistyle.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index d4eb332b2fb0..11381e54bb4e 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1321,8 +1321,8 @@ void XclImpXF::ApplyPatternToAttrList( pPat = static_cast(&aCache.ApplyTo(*pPat, true)); } - - if (pPat) + // Make sure we skip unnamed styles. + if (pPat && pPat->GetStyleName()) { // Check for a gap between the last entry and this one. bool bHasGap = false; -- cgit From 5ce58b7046d9dbc15b322a0c0324409d140334f9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 15 Apr 2011 20:12:58 +0100 Subject: those TRUE->sal_True conversions look really wrong --- svl/source/items/cenumitm.cxx | 4 ++-- svl/source/items/visitem.cxx | 4 ++-- svl/source/numbers/zforscan.cxx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 1c302f962431..03f3ae784da9 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -287,8 +287,8 @@ UniString CntBoolItem::GetValueTextByVal(sal_Bool bTheValue) const { return bTheValue ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_True")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_False")); + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index 13f19a48800e..599709d70938 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -141,8 +141,8 @@ UniString SfxVisibilityItem::GetValueTextByVal(sal_Bool bTheValue) const { return bTheValue ? - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_True")) : - UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("sal_False")); + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) : + UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE")); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index b7077b00e134..d87157b211d2 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -143,7 +143,7 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const if ( !sKeyword[NF_KEY_TRUE].Len() ) { DBG_ERRORFILE( "InitSpecialKeyword: TRUE_WORD?" ); - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "sal_True" ) ); + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) ); } break; case NF_KEY_FALSE : @@ -153,7 +153,7 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const if ( !sKeyword[NF_KEY_FALSE].Len() ) { DBG_ERRORFILE( "InitSpecialKeyword: FALSE_WORD?" ); - ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "sal_False" ) ); + ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) ); } break; default: -- cgit From 261c4cf54d764d4892ee1ac9fe8e5ec376652355 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 15 Apr 2011 20:14:00 +0100 Subject: those TRUE->sal_True conversions look really wrong --- connectivity/source/parse/sqliterator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 59c7287fcdd8..82677e870aae 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1923,7 +1923,7 @@ void OSQLParseTreeIterator::setOrderByColumnName(const ::rtl::OUString & rColumn cout << "OSQLParseTreeIterator::setOrderByColumnName: " << (const char *) rColumnName << ", " << (const char *) rTableRange << ", " - << (bAscending ? "sal_True" : "sal_False") + << (bAscending ? "true" : "false") << "\n"; #endif } @@ -1945,7 +1945,7 @@ void OSQLParseTreeIterator::setGroupByColumnName(const ::rtl::OUString & rColumn cout << "OSQLParseTreeIterator::setOrderByColumnName: " << (const char *) rColumnName << ", " << (const char *) rTableRange << ", " - << (bAscending ? "sal_True" : "sal_False") + << (bAscending ? "true" : "false") << "\n"; #endif } -- cgit From 600eed413e78c5715c9bea8c08d5227b70590072 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 15 Apr 2011 16:25:33 -0400 Subject: fdo#36124: Fix relative/absolute toggling in R1C1 mode. --- sc/inc/reffind.hxx | 5 +- sc/source/core/tool/reffind.cxx | 196 +++++++++++++++++++++++++++++++++------- sc/source/ui/view/editsh.cxx | 7 +- sc/source/ui/view/viewfun4.cxx | 2 +- 4 files changed, 168 insertions(+), 42 deletions(-) diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx index cc2f330194e9..63dcf12c65e8 100644 --- a/sc/inc/reffind.hxx +++ b/sc/inc/reffind.hxx @@ -42,14 +42,13 @@ private: String aFormula; formula::FormulaGrammar::AddressConvention eConv; ScDocument* pDoc; + ScAddress maPos; xub_StrLen nFound; xub_StrLen nSelStart; xub_StrLen nSelEnd; public: - static const sal_Unicode pDelimiters[]; - - ScRefFinder( const String& rFormula, + ScRefFinder( const String& rFormula, const ScAddress& rPos, ScDocument* pDocument = NULL, formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO ); ~ScRefFinder(); diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index a3b2ce55585d..b6061bc7f230 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -42,16 +42,18 @@ // STATIC DATA ----------------------------------------------------------- +namespace { + // incl. Doppelpunkt -> Doppelte Referenzen werden einzeln behandelt -const sal_Unicode ScRefFinder::pDelimiters[] = { +const sal_Unicode pDelimiters[] = { '=','(',')','+','-','*','/','^','&',' ','{','}','<','>',':', 0 }; // ======================================================================= -inline sal_Bool IsText( sal_Unicode c ) +inline bool IsText( sal_Unicode c ) { - bool bFound = ScGlobal::UnicodeStrChr( ScRefFinder::pDelimiters, c ); + bool bFound = ScGlobal::UnicodeStrChr( pDelimiters, c ); if (bFound) // This is one of delimiters, therefore not text. return false; @@ -61,23 +63,160 @@ inline sal_Bool IsText( sal_Unicode c ) return c != sep; } -inline sal_Bool IsText( sal_Bool& bQuote, sal_Unicode c ) +inline bool IsText( bool& bQuote, sal_Unicode c ) { - if ( c == '\'' ) + if (c == '\'') { bQuote = !bQuote; - return sal_True; + return true; + } + if (bQuote) + return true; + + return IsText(c); +} + +/** + * Find first character position that is considered text. A character is + * considered a text when it's within the ascii range and when it's not a + * delimiter. + */ +xub_StrLen FindStartPos(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos) +{ + while (nStartPos <= nEndPos && !IsText(p[nStartPos])) + ++nStartPos; + + return nStartPos; +} + +xub_StrLen FindEndPosA1(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos) +{ + bool bQuote = false; + xub_StrLen nNewEnd = nStartPos; + while (nNewEnd <= nEndPos && IsText(bQuote, p[nNewEnd])) + ++nNewEnd; + + return nNewEnd; +} + +xub_StrLen FindEndPosR1C1(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos) +{ + xub_StrLen nNewEnd = nStartPos; + p = &p[nStartPos]; + for (; nNewEnd <= nEndPos; ++p, ++nNewEnd) + { + if (*p == '\'') + { + // Skip until the closing quote. + for (; nNewEnd <= nEndPos; ++p, ++nNewEnd) + if (*p == '\'') + break; + } + else if (*p == '[') + { + // Skip until the closing braket. + for (; nNewEnd <= nEndPos; ++p, ++nNewEnd) + if (*p == ']') + break; + } + else if (!IsText(*p)) + break; + } + + return nNewEnd; +} + +/** + * Find last character position that is considred text, from the specified + * start position. + */ +xub_StrLen FindEndPos(const sal_Unicode* p, xub_StrLen nStartPos, xub_StrLen nEndPos, + formula::FormulaGrammar::AddressConvention eConv) +{ + switch (eConv) + { + case formula::FormulaGrammar::CONV_XL_R1C1: + return FindEndPosR1C1(p, nStartPos, nEndPos); + case formula::FormulaGrammar::CONV_OOO: + case formula::FormulaGrammar::CONV_XL_A1: + default: + return FindEndPosA1(p, nStartPos, nEndPos); } - if ( bQuote ) - return sal_True; - return IsText( c ); } -ScRefFinder::ScRefFinder(const String& rFormula, ScDocument* pDocument, - formula::FormulaGrammar::AddressConvention eConvP) : +void ExpandToTextA1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos) +{ + while (rStartPos > 0 && IsText(p[rStartPos - 1]) ) + --rStartPos; + if (rEndPos) + --rEndPos; + while (rEndPos+1 < nLen && IsText(p[rEndPos + 1]) ) + ++rEndPos; +} + +void ExpandToTextR1C1(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos) +{ + // move back the start position to the first text character. + if (rStartPos > 0) + { + for (--rStartPos; rStartPos > 0; --rStartPos) + { + sal_Unicode c = p[rStartPos]; + if (c == '\'') + { + // Skip until the opening quote. + for (--rStartPos; rStartPos > 0; --rStartPos) + { + c = p[rStartPos]; + if (c == '\'') + break; + } + } + else if (c == ']') + { + // Skip until the opening braket. + for (--rStartPos; rStartPos > 0; --rStartPos) + { + if (c == '[') + break; + } + } + else if (!IsText(c)) + { + ++rStartPos; + break; + } + } + } + + // move forward the end position to the last text character. + rEndPos = FindEndPosR1C1(p, rEndPos, nLen-1); +} + +void ExpandToText(const sal_Unicode* p, xub_StrLen nLen, xub_StrLen& rStartPos, xub_StrLen& rEndPos, + formula::FormulaGrammar::AddressConvention eConv) +{ + switch (eConv) + { + case formula::FormulaGrammar::CONV_XL_R1C1: + ExpandToTextR1C1(p, nLen, rStartPos, rEndPos); + break; + case formula::FormulaGrammar::CONV_OOO: + case formula::FormulaGrammar::CONV_XL_A1: + default: + ExpandToTextA1(p, nLen, rStartPos, rEndPos); + } +} + +} + +ScRefFinder::ScRefFinder( + const String& rFormula, const ScAddress& rPos, + ScDocument* pDocument, formula::FormulaGrammar::AddressConvention eConvP) : aFormula( rFormula ), eConv( eConvP ), - pDoc( pDocument ) + pDoc( pDocument ), + maPos(rPos) { nSelStart = nSelEnd = nFound = 0; } @@ -107,15 +246,9 @@ void ScRefFinder::ToggleRel( xub_StrLen nStartPos, xub_StrLen nEndPos ) // Selektion erweitern, und statt Selektion Start- und Endindex if ( nEndPos < nStartPos ) - { - xub_StrLen nTemp = nStartPos; nStartPos = nEndPos; nEndPos = nTemp; - } - while (nStartPos > 0 && IsText(pSource[nStartPos - 1]) ) - --nStartPos; - if (nEndPos) - --nEndPos; - while (nEndPos+1 < nLen && IsText(pSource[nEndPos + 1]) ) - ++nEndPos; + ::std::swap(nEndPos, nStartPos); + + ExpandToText(pSource, nLen, nStartPos, nEndPos, eConv); String aResult; String aExpr; @@ -126,27 +259,20 @@ void ScRefFinder::ToggleRel( xub_StrLen nStartPos, xub_StrLen nEndPos ) xub_StrLen nLoopStart = nStartPos; while ( nLoopStart <= nEndPos ) { - // Formel zerlegen - - xub_StrLen nEStart = nLoopStart; - while ( nEStart <= nEndPos && !IsText(pSource[nEStart]) ) - ++nEStart; - - sal_Bool bQuote = false; - xub_StrLen nEEnd = nEStart; - while ( nEEnd <= nEndPos && IsText(bQuote,pSource[nEEnd]) ) - ++nEEnd; + // Determine the stard and end positions of a text segment. + xub_StrLen nEStart = FindStartPos(pSource, nLoopStart, nEndPos); + xub_StrLen nEEnd = FindEndPos(pSource, nEStart, nEndPos, eConv); aSep = aFormula.Copy( nLoopStart, nEStart-nLoopStart ); aExpr = aFormula.Copy( nEStart, nEEnd-nEStart ); - // Test, ob aExpr eine Referenz ist - - sal_uInt16 nResult = aAddr.Parse( aExpr, pDoc, pDoc->GetAddressConvention() ); + // Check the validity of the expression, and toggle the relative flag. + ScAddress::Details aDetails(eConv, maPos.Row(), maPos.Col()); + sal_uInt16 nResult = aAddr.Parse(aExpr, pDoc, aDetails); if ( nResult & SCA_VALID ) { sal_uInt16 nFlags = lcl_NextFlags( nResult ); - aAddr.Format( aExpr, nFlags, pDoc, pDoc->GetAddressConvention() ); + aAddr.Format(aExpr, nFlags, pDoc, aDetails); xub_StrLen nAbsStart = nStartPos+aResult.Len()+aSep.Len(); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 515b2fc514a9..5464a0f13f52 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -484,13 +484,14 @@ void ScEditShell::Execute( SfxRequest& rReq ) case SID_TOGGLE_REL: { - sal_Bool bOk = false; + bool bOk = false; if (pEngine->GetParagraphCount() == 1) { String aText = pEngine->GetText(); ESelection aSel = pEditView->GetSelection(); // aktuelle View - ScRefFinder aFinder( aText, pViewData->GetDocument() ); + ScDocument* pDoc = pViewData->GetDocument(); + ScRefFinder aFinder(aText, pViewData->GetCurPos(), pDoc, pDoc->GetAddressConvention()); aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos ); if (aFinder.GetFound()) { @@ -503,7 +504,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) pTopView->GetEditEngine()->SetText( aNew ); pTopView->SetSelection( aNewSel ); } - bOk = sal_True; + bOk = true; // Referenz wird selektiert -> beim Tippen nicht ueberschreiben bSetSelIsRef = sal_True; diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index a9d9364a7208..0ccabacf3e67 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -259,7 +259,7 @@ void ScViewFunc::DoRefConversion( sal_Bool bRecord ) String aOld; ((ScFormulaCell*)pCell)->GetFormula(aOld); xub_StrLen nLen = aOld.Len(); - ScRefFinder aFinder( aOld, pDoc ); + ScRefFinder aFinder( aOld, aIter.GetPos(), pDoc, pDoc->GetAddressConvention() ); aFinder.ToggleRel( 0, nLen ); if (aFinder.GetFound()) { -- cgit From 538a42bd83cb664ba2086304d6d621da0376ccf5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 16 Apr 2011 20:39:55 +0100 Subject: fix broken .ott archives (cherry picked from commit 7de0b88ce2dd932915894385b54be1897d5ee053) --- .../wizard/letter/lang/da/pri-bottle_l.ott | Bin 47452 -> 48226 bytes .../templates/wizard/letter/lang/da/pri-mail_l.ott | Bin 23344 -> 24245 bytes .../wizard/letter/lang/da/pri-marine_l.ott | Bin 18528 -> 19385 bytes .../wizard/letter/lang/da/pri-redline_l.ott | Bin 11639 -> 12348 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott index b3219236bfab..20982ffe2acc 100644 Binary files a/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott and b/extras/source/templates/wizard/letter/lang/da/pri-bottle_l.ott differ diff --git a/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott index cbd9f6a7ce64..e8af3babfa2b 100644 Binary files a/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott and b/extras/source/templates/wizard/letter/lang/da/pri-mail_l.ott differ diff --git a/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott index 621ab7725b26..23c7dee5a864 100644 Binary files a/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott and b/extras/source/templates/wizard/letter/lang/da/pri-marine_l.ott differ diff --git a/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott b/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott index a424b6db5159..4e3b151c8f5c 100644 Binary files a/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott and b/extras/source/templates/wizard/letter/lang/da/pri-redline_l.ott differ -- cgit From 2174045ac789e547631a0ea37876d89f5a95e3cc Mon Sep 17 00:00:00 2001 From: Norbert Thiebaud Date: Sun, 17 Apr 2011 13:19:42 -0500 Subject: gcc-4.0 on MacOSX does not support the @file syntax --- solenv/gbuild/platform/macosx.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 8831f7f974f5..2def0c9828f0 100755 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -270,7 +270,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(OBJCXXOBJECTS),$(call gb_ObjCxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ - $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \ -o $(1) \ `cat $${DYLIB_FILE}` && \ -- cgit From 49313fa83b692f27d8e6c3c1f672919fdbeaab0e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 18 Apr 2011 12:21:34 +0300 Subject: Fix from-scratch build breakage: Don't call realpath on Windows path In a from-scratch build, when running the configure script, which then runs the set_soenv script, the default_images symlink (that is passed to this function in the form of a Windows path, for some reason) does not exist yet, and realpath fails anyway. So don't bother calling realpath on Windows paths. Although I don't know whether it then will cause a problem that the cygpath -m call won't be able to expand the symlink as it doesn't exist anyway. This is a mess. And if cygpath -m expands symlinks anyway, why is the realpath needed at all? --- set_soenv.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/set_soenv.in b/set_soenv.in index 14f59b3494a1..01865ded5f8a 100755 --- a/set_soenv.in +++ b/set_soenv.in @@ -2338,7 +2338,7 @@ sub PathFormat # Replace absolute paths or DOS paths with ... if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) { # mixed mode paths - chomp( $variable = qx{realpath "$variable"} ); + chomp( $variable = qx{realpath "$variable"} ) unless ($variable =~ m/:/); chomp( $variable = qx{cygpath -m "$variable"} ); } } -- cgit From f83861020f5daad24669d701c4a6472ac79630b7 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 11 Apr 2011 10:26:49 +0300 Subject: Fix rhino build on Windows --- rhino/makefile.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rhino/makefile.mk b/rhino/makefile.mk index 094e1102ad2f..d7888fc970be 100755 --- a/rhino/makefile.mk +++ b/rhino/makefile.mk @@ -49,12 +49,18 @@ PATCH_FILES=rhino1_5R5.patch \ rhino1_5R5-find_swing.patch \ rhino1_5R5-updateToolTip.patch +.IF "$(OS)"=="WNT" +FIXED_TARFILE_LOCATION=`cygpath -m -s "$(TARFILE_LOCATION)"` +.ELSE +FIXED_TARFILE_LOCATION=$(TARFILE_LOCATION) +.ENDIF + .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj jar .ELSE -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar +BUILD_ACTION=TARFILE_LOCATION="$(FIXED_TARFILE_LOCATION)" $(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dant.build.javac.source=$(JAVA_SOURCE_VER) -Dant.build.javac.target=$(JAVA_TARGET_VER) jar .ENDIF # --- Targets ------------------------------------------------------ -- cgit From 2160141ece2a109826f4231ed5064543dbf18e31 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 11 Apr 2011 10:27:21 +0300 Subject: chmod -x --- rhino/README | 0 rhino/makefile.mk | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 rhino/README mode change 100755 => 100644 rhino/makefile.mk diff --git a/rhino/README b/rhino/README old mode 100755 new mode 100644 diff --git a/rhino/makefile.mk b/rhino/makefile.mk old mode 100755 new mode 100644 -- cgit From 8b645ff23100f48264702ad5597af09ecedcab25 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 18 Apr 2011 13:06:32 +0100 Subject: fdo#36230 Remove unused AGotoCallButton and associated RID_IMGBTN_GOTOCALL id --- basctl/inc/basidesh.hrc | 1 - basctl/source/basicide/baside2.hxx | 1 - basctl/source/basicide/baside2b.cxx | 19 ------------------- basctl/source/basicide/basidesh.src | 5 ----- 4 files changed, 26 deletions(-) diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index 17c8fc8144a1..f3a1e641b8bb 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -53,7 +53,6 @@ #define RID_PRINTDLG_STRLIST ( RID_BASICIDE_START + 78 ) #define RID_IMGBTN_REMOVEWATCH ( RID_BASICIDE_START + 8 ) -#define RID_IMGBTN_GOTOCALL ( RID_BASICIDE_START + 9 ) #define RID_IMG_INSTALLATION ( RID_BASICIDE_START + 20 ) #define RID_IMG_DOCUMENT ( RID_BASICIDE_START + 22 ) #define RID_IMG_MODLIB ( RID_BASICIDE_START + 24 ) diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index c0a045e6382d..6af6c060411a 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -265,7 +265,6 @@ class StackWindow : public BasicDockingWindow { private: SvTreeListBox aTreeListBox; - ImageButton aGotoCallButton; String aStackStr; protected: diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 030a152f3509..7454b1b83358 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1497,7 +1497,6 @@ void WatchWindow::UpdateWatches( bool bBasicStopped ) StackWindow::StackWindow( Window* pParent ) : BasicDockingWindow( pParent ), aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ), - aGotoCallButton( this, IDEResId( RID_IMGBTN_GOTOCALL ) ), aStackStr( IDEResId( RID_STR_STACK ) ) { aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST); @@ -1512,14 +1511,6 @@ StackWindow::StackWindow( Window* pParent ) : SetHelpId( HID_BASICIDE_STACKWINDOW ); - aGotoCallButton.SetClickHdl( LINK( this, StackWindow, ButtonHdl ) ); - aGotoCallButton.SetPosPixel( Point( DWBORDER, 2 ) ); - Size aSz( aGotoCallButton.GetModeImage().GetSizePixel() ); - aSz.Width() += 6; - aSz.Height() += 6; - aGotoCallButton.SetSizePixel( aSz ); - aGotoCallButton.Hide(); - // make stack window keyboard accessible GetSystemWindow()->GetTaskPaneList()->AddWindow( this ); } @@ -1560,16 +1551,6 @@ void StackWindow::Resize() IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, pButton ) { - if ( pButton == &aGotoCallButton ) - { - BasicIDEShell* pIDEShell = IDE_DLL()->GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_GOTOCALL ); - } - } return 0; } IMPL_LINK_INLINE_END( StackWindow, ButtonHdl, ImageButton *, pButton ) diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src index 32220753dd32..368bad4244de 100644 --- a/basctl/source/basicide/basidesh.src +++ b/basctl/source/basicide/basidesh.src @@ -324,11 +324,6 @@ ImageButton RID_IMGBTN_REMOVEWATCH }; QuickHelpText [ en-US ] = "Remove Watch" ; }; -ImageButton RID_IMGBTN_GOTOCALL -{ - HelpId = HID_BASICIDE_GOTOALL ; - SmallStyle = TRUE ; -}; String RID_STR_REMOVEWATCH { -- cgit From 0053c68bdcec3ea60c86d9e1c1a58b95ef5c64de Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Mon, 18 Apr 2011 13:03:02 +0100 Subject: fdo#36230 Remove unused AGotoCallButton and associated RID_IMGBTN_GOTOCALL id --- svx/inc/svx/svxids.hrc | 1 - 1 file changed, 1 deletion(-) diff --git a/svx/inc/svx/svxids.hrc b/svx/inc/svx/svxids.hrc index ff960db1bcb7..0aa6db4e7fb1 100755 --- a/svx/inc/svx/svxids.hrc +++ b/svx/inc/svx/svxids.hrc @@ -237,7 +237,6 @@ #define SID_BASICIDE_MODULEDLG ( SID_BASICIDE_START + 5 ) #define SID_BASICIDE_OBJCAT ( SID_BASICIDE_START + 6 ) #define SID_BASICIDE_REMOVEWATCH ( SID_BASICIDE_START + 7 ) -#define SID_BASICIDE_GOTOCALL ( SID_BASICIDE_START + 8 ) #define SID_BASICIDE_SHOWSBX ( SID_BASICIDE_START + 9 ) #define SID_BASICIDE_HIDECURPAGE ( SID_BASICIDE_START + 10 ) #define SID_BASICIDE_NAMECHANGEDONTAB ( SID_BASICIDE_START + 11 ) -- cgit From 6752ecb98442c6e54ea4f075e0666f22ef64cb57 Mon Sep 17 00:00:00 2001 From: Anthony Durity Date: Mon, 18 Apr 2011 15:00:46 +0300 Subject: Resolves: fdo#36336 fix crash on launch (cherry picked from commit 2cae8853762ba357b19773fe0890996b3c2b95b5) --- vcl/aqua/source/gdi/salgdi.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 4eadc86ff15d..c64601ba48a3 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -154,6 +154,7 @@ const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const return mpCharMap; mpCharMap = new ImplFontCharMap( aCmapResult ); + mpCharMap->AddReference(); return mpCharMap; } -- cgit From c1bc4d8e22ec78aaf53e7c38d569a0c39b63b62c Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Mon, 18 Apr 2011 16:36:58 +0200 Subject: Fix build - the same symbol defined on 2 places. --- accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx | 4 ++-- accessibility/source/extended/AccessibleGridControlTableCell.cxx | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx index 40ca8ef9fbe4..a8d1ac975ad5 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx @@ -40,13 +40,13 @@ namespace accessibility { namespace { - void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) + static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) { if ( _nIndex >= _sText.getLength() ) throw ::com::sun::star::lang::IndexOutOfBoundsException(); } - sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) + static sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) { return _nRow * _nColumnCount + _nColumn; } diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index 68bba16d6a3b..12a70990c41f 100644 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -40,16 +40,13 @@ namespace accessibility { namespace { - void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) + // FIXME this is a copy'n'paste from + // source/extended/AccessibleBrowseBoxTableCell.cxx, get rid of that... + static void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) { if ( _nIndex >= _sText.getLength() ) throw ::com::sun::star::lang::IndexOutOfBoundsException(); } - - sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) - { - return _nRow * _nColumnCount + _nColumn; - } } using namespace ::com::sun::star::lang; using namespace utl; -- cgit From 293096186d2e23a028390ab3916240baa316326a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 12 Apr 2011 15:14:12 +0100 Subject: Resolves: fdo#36128 fix up paths for gbuild --- sc/CppunitTest_sc_ucalc.mk | 2 +- sc/qa/unit/ucalc.cxx | 9 ++++----- sc/source/ui/docshell/impex.cxx | 13 ++++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk index 0c857abfeb32..5a92c164b2a7 100644 --- a/sc/CppunitTest_sc_ucalc.mk +++ b/sc/CppunitTest_sc_ucalc.mk @@ -40,7 +40,7 @@ $(eval $(call gb_CppunitTest_set_args,sc_ucalc,\ --invisible \ "-env:UNO_TYPES=$(foreach binrdb,udkapi.rdb types.rdb,\ file://$(if $(filter WNT,$(OS)),/)$(OUTDIR)/bin/$(binrdb))" \ - "-env:UNO_SERVICES=$(foreach rdb,$(OUTDIR)/xml/ure/services.rdb $(WORKDIR)/CustomTarget/sc/qa/unit/services.rdb,\ + "-env:UNO_SERVICES=$(foreach rdb,$(OUTDIR)/xml/ure/services.rdb $(WORKDIR)/CustomTarget/sc/qa/unit/services.rdb,\ file://$(if $(filter WNT,$(OS)),/)$(rdb))" \ $(foreach dir,URE_INTERNAL_LIB_DIR OOO_BASE_DIR BRAND_BASE_DIR, \ -env:$(dir)=file://$(if $(filter WNT,$(OS)),/$(OUTDIR)/bin,$(OUTDIR)/lib)) \ diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2e65aeecc465..4a07e28cbc55 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -268,8 +268,7 @@ public: CPPUNIT_TEST(testGraphicsInGroup); CPPUNIT_TEST(testStreamValid); CPPUNIT_TEST(testFunctionLists); - // fdo#36128 disabled for now because it fails - //CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST(testCVEs); CPPUNIT_TEST_SUITE_END(); private: @@ -513,15 +512,15 @@ void Test::testCVEs() bool bResult; bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")), - m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5745-1.wb2"))); + m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5745-1.wb2"))); CPPUNIT_ASSERT_MESSAGE("CVE-2007-5745 regression", bResult == true); bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")), - m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5745-2.wb2"))); + m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5745-2.wb2"))); CPPUNIT_ASSERT_MESSAGE("CVE-2007-5745 regression", bResult == true); bResult = testLoad(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Quattro Pro 6.0")), - m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/CVE/CVE-2007-5747-1.wb2"))); + m_aPWDURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/qa/unit/CVE/CVE-2007-5747-1.wb2"))); CPPUNIT_ASSERT_MESSAGE("CVE-2007-5747 regression", bResult == false); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 133cb368e117..6fabe3684d6c 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2084,13 +2084,16 @@ ScFormatFilterPlugin &ScFormatFilter::Get() if (plugin != NULL) return *plugin; + ::rtl::OUString sFilterLib(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY("scfilt"))); static ::osl::Module aModule; - if ( aModule.loadRelative( &thisModule, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "scfilt" ) ) ) ) ) + bool bLoaded = aModule.loadRelative(&thisModule, sFilterLib); + if (!bLoaded) + bLoaded = aModule.load(sFilterLib); + if (bLoaded) { - oslGenericFunction fn = aModule.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScFilterCreate" )) ); - if (fn != NULL) - plugin = reinterpret_cast(fn)(); + oslGenericFunction fn = aModule.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ScFilterCreate" )) ); + if (fn != NULL) + plugin = reinterpret_cast(fn)(); } if (plugin == NULL) plugin = new ScFormatFilterMissing(); -- cgit From 9a2969195d24f322d840845e3780164391cc3b73 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 18 Apr 2011 13:29:36 -0400 Subject: New unit test for toggling relative/absolute reference (Shift-F4). --- sc/qa/unit/ucalc.cxx | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 4a07e28cbc55..ce69fbe53b25 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -57,6 +57,7 @@ #include "scmatrix.hxx" #include "drwlayer.hxx" #include "scitems.hxx" +#include "reffind.hxx" #include "docsh.hxx" #include "funcdesc.hxx" @@ -252,6 +253,13 @@ public: */ void testCVEs(); + /** + * Test toggling relative/absolute flag of cell and cell range references. + * This corresponds with hitting Shift-F4 while the cursor is on a formula + * cell. + */ + void testToggleRefFlag(); + CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testInput); @@ -269,6 +277,7 @@ public: CPPUNIT_TEST(testStreamValid); CPPUNIT_TEST(testFunctionLists); CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST(testToggleRefFlag); CPPUNIT_TEST_SUITE_END(); private: @@ -1640,6 +1649,83 @@ void Test::testGraphicsInGroup() m_pDoc->DeleteTab(0); } +void Test::testToggleRefFlag() +{ + // In this test, there is no need to insert formula string into a cell in + // the document, as ScRefFinder does not depend on the content of the + // document except for the sheet names. + + OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("Test")); + m_pDoc->InsertTab(0, aTabName); + + { + // Calc A1: basic 2D reference + + OUString aFormula(RTL_CONSTASCII_USTRINGPARAM("=B100")); + ScAddress aPos(1, 5, 0); + ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_OOO); + + // Original + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equals(aFinder.GetText())); + + // column relative / row relative -> column absolute / row absolute + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=$B$100")); + + // column absolute / row absolute -> column relative / row absolute + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=B$100")); + + // column relative / row absolute -> column absolute / row relative + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=$B100")); + + // column absolute / row relative -> column relative / row relative + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=B100")); + } + + { + // Excel R1C1: basic 2D reference + + OUString aFormula(RTL_CONSTASCII_USTRINGPARAM("=R2C1")); + ScAddress aPos(3, 5, 0); + ScRefFinder aFinder(aFormula, aPos, m_pDoc, formula::FormulaGrammar::CONV_XL_R1C1); + + // Original + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equals(aFinder.GetText())); + + // column absolute / row absolute -> column relative / row absolute + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R2C[-3]")); + + // column relative / row absolute - > column absolute / row relative + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R[-4]C1")); + + // column absolute / row relative -> column relative / row relative + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R[-4]C[-3]")); + + // column relative / row relative -> column absolute / row absolute + aFinder.ToggleRel(0, aFormula.getLength()); + aFormula = aFinder.GetText(); + CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R2C1")); + } + + // TODO: Add more test cases esp. for 3D references, Excel A1 syntax, and + // partial selection within formula string. + + m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -- cgit From 5d20154c5e553f4ac386172777f18656db117782 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 18 Apr 2011 14:39:36 -0400 Subject: More accurate error messages. --- sc/qa/unit/ucalc.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ce69fbe53b25..4d15f31a6371 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1671,22 +1671,22 @@ void Test::testToggleRefFlag() // column relative / row relative -> column absolute / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=$B$100")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=$B$100")); // column absolute / row absolute -> column relative / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=B$100")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=B$100")); // column relative / row absolute -> column absolute / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=$B100")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=$B100")); // column absolute / row relative -> column relative / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=B100")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=B100")); } { @@ -1702,22 +1702,22 @@ void Test::testToggleRefFlag() // column absolute / row absolute -> column relative / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R2C[-3]")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R2C[-3]")); // column relative / row absolute - > column absolute / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R[-4]C1")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R[-4]C1")); // column absolute / row relative -> column relative / row relative aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R[-4]C[-3]")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R[-4]C[-3]")); // column relative / row relative -> column absolute / row absolute aFinder.ToggleRel(0, aFormula.getLength()); aFormula = aFinder.GetText(); - CPPUNIT_ASSERT_MESSAGE("Does not equal the original text.", aFormula.equalsAscii("=R2C1")); + CPPUNIT_ASSERT_MESSAGE("Wrong conversion.", aFormula.equalsAscii("=R2C1")); } // TODO: Add more test cases esp. for 3D references, Excel A1 syntax, and -- cgit From 552e6234142aa990acd058bf9cab28f117b1bf87 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Mon, 18 Apr 2011 19:36:55 +0200 Subject: sync with unxgcc.mk --- solenv/gbuild/platform/openbsd.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/solenv/gbuild/platform/openbsd.mk b/solenv/gbuild/platform/openbsd.mk index 7386eea20bcc..92654afa5923 100755 --- a/solenv/gbuild/platform/openbsd.mk +++ b/solenv/gbuild/platform/openbsd.mk @@ -50,6 +50,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ -Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \ $(subst -lpthread,$(PTHREAD_LIBS),$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib))))) \ -o $(1)) -- cgit From 1aa690299a69031fcb9c6c3065d84086460ff5bd Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 19 Apr 2011 09:36:12 +0200 Subject: 'paths', not 'pathes'... --- solenv/bin/modules/installer/worker.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index c50813f4ee27..ad4ac9d47de8 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -547,7 +547,7 @@ sub clean_jds_temp_dirs ########################################################### # Setting one language in the language independent -# array of include pathes with $(LANG) +# array of include paths with $(LANG) ########################################################### sub get_language_specific_include_pathes @@ -2314,7 +2314,7 @@ sub add_variables_from_inc_to_hashref } ############################################## -# Collecting all files from include pathes +# Collecting all files from include paths ############################################## sub collect_all_files_from_includepathes @@ -2322,7 +2322,7 @@ sub collect_all_files_from_includepathes my ($patharrayref) = @_; installer::logger::globallog("Reading all directories: Start"); - installer::logger::print_message( "... reading include pathes ...\n" ); + installer::logger::print_message( "... reading include paths ...\n" ); # empty the global @installer::globals::allincludepathes =(); -- cgit From cc38ae1e0b9a382862a07eaaddd75a3b46ee3d33 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 19 Apr 2011 11:51:49 +0300 Subject: Export the two UNO component funcions Fizes zip archive handling which was spectacularly broken in 3.4 beta1 on Windows. --- package/source/manifest/UnoRegister.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/source/manifest/UnoRegister.cxx b/package/source/manifest/UnoRegister.cxx index e8bf0e9604d3..e71f6fe99d6b 100644 --- a/package/source/manifest/UnoRegister.cxx +++ b/package/source/manifest/UnoRegister.cxx @@ -48,7 +48,7 @@ using rtl::OUString; // C functions to implement this as a component -extern "C" void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -61,7 +61,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( * @param pRegistryKey registry data key to read and write component persistent data * @return a component factory (generic uno interface) */ -extern "C" void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; -- cgit From 2dcafc2db999ea8a328236dfed2fb3c013538cea Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 19 Apr 2011 11:57:07 +0100 Subject: Resolves: fdo#36358, firstly lets code what the comment says it wants to do (cherry picked from commit 058335969debe302e23fa2c36d84d3ef55e2b47a) --- sfx2/source/doc/guisaveas.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index f6d3fb221b0a..b69ba87b4f08 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -312,7 +312,7 @@ public: sal_Bool ShowDocumentInfoDialog(); ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, - const sfx2::FileDialogHelper::Context& aCtxt ); + const sfx2::FileDialogHelper::Context& rCtxt ); ::rtl::OUString GetReccomendedName( const ::rtl::OUString& aSuggestedName, const ::rtl::OUString& aTypeName ); @@ -885,10 +885,8 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) eCtxt = sfx2::FileDialogHelper::SD_EXPORT; - if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) + else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) eCtxt = sfx2::FileDialogHelper::SI_EXPORT; - if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) - eCtxt = sfx2::FileDialogHelper::SW_EXPORT; if ( eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) pFileDlg->SetContext( eCtxt ); @@ -1144,7 +1142,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } //------------------------------------------------------------------------- -::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& aCtxt ) +::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& rCtxt ) { ::rtl::OUString aReccomendedDir; @@ -1175,8 +1173,12 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } else { - // pb: set graphic path if context == SD_EXPORT or SI_EXPORT else work path - ::rtl::OUString aConfigSuggestion( ( aCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) ? SvtPathOptions().GetGraphicPath() : SvtPathOptions().GetWorkPath() ); + ::rtl::OUString aConfigSuggestion; + // Set graphic path if context == SD_EXPORT or SI_EXPORT else work path + if (rCtxt == sfx2::FileDialogHelper::SD_EXPORT || rCtxt == sfx2::FileDialogHelper::SI_EXPORT) + aConfigSuggestion = SvtPathOptions().GetGraphicPath(); + else + aConfigSuggestion = SvtPathOptions().GetWorkPath(); aReccomendedDir = INetURLObject( aConfigSuggestion ).GetMainURL( INetURLObject::NO_DECODE ); } -- cgit From 89dab1e5777213b840d193411d8832644c0f20c3 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 19 Apr 2011 12:08:24 +0100 Subject: Resolves: fdo#36358 Just use the same export dir as save as for all apps I believe the original idea was that draw/impress export graphics and so default output dir is the gallery as you might want to export them in there. Catch is that we cane export in some many different formats there there isn't a good fit for the whole collection, so lets just use the same dir for all apps (cherry picked from commit 364dd193486949af59596de7ce5bd83f4db54149) --- sfx2/source/doc/guisaveas.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index b69ba87b4f08..87fb028cd1f3 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -311,8 +311,7 @@ public: sal_Bool ShowDocumentInfoDialog(); - ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, - const sfx2::FileDialogHelper::Context& rCtxt ); + ::rtl::OUString GetReccomendedDir( const ::rtl::OUString& aSuggestedDir ); ::rtl::OUString GetReccomendedName( const ::rtl::OUString& aSuggestedName, const ::rtl::OUString& aTypeName ); @@ -884,9 +883,11 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, } if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ) - eCtxt = sfx2::FileDialogHelper::SD_EXPORT; + eCtxt = sfx2::FileDialogHelper::SD_EXPORT; else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) - eCtxt = sfx2::FileDialogHelper::SI_EXPORT; + eCtxt = sfx2::FileDialogHelper::SI_EXPORT; + else if( aDocServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) + eCtxt = sfx2::FileDialogHelper::SW_EXPORT; if ( eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) pFileDlg->SetContext( eCtxt ); @@ -957,7 +958,7 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, } } - ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir, eCtxt ); + ::rtl::OUString aReccomendedDir = GetReccomendedDir( aSuggestedDir ); if ( aReccomendedDir.getLength() ) pFileDlg->SetDisplayDirectory( aReccomendedDir ); ::rtl::OUString aReccomendedName = GetReccomendedName( aSuggestedName, aAdjustToType ); @@ -1142,7 +1143,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } //------------------------------------------------------------------------- -::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir, const sfx2::FileDialogHelper::Context& rCtxt ) +::rtl::OUString ModelData_Impl::GetReccomendedDir( const ::rtl::OUString& aSuggestedDir ) { ::rtl::OUString aReccomendedDir; @@ -1173,13 +1174,7 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() } else { - ::rtl::OUString aConfigSuggestion; - // Set graphic path if context == SD_EXPORT or SI_EXPORT else work path - if (rCtxt == sfx2::FileDialogHelper::SD_EXPORT || rCtxt == sfx2::FileDialogHelper::SI_EXPORT) - aConfigSuggestion = SvtPathOptions().GetGraphicPath(); - else - aConfigSuggestion = SvtPathOptions().GetWorkPath(); - aReccomendedDir = INetURLObject( aConfigSuggestion ).GetMainURL( INetURLObject::NO_DECODE ); + aReccomendedDir = INetURLObject( SvtPathOptions().GetWorkPath() ).GetMainURL( INetURLObject::NO_DECODE ); } return aReccomendedDir; -- cgit From e596738017fe395052b46640a8ec13916f660af2 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Tue, 19 Apr 2011 13:47:38 +0200 Subject: bump PRODUCTVERSION to 3.4 also in solenv/inc/productversion.mk (fdo#36277) --- solenv/inc/productversion.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/inc/productversion.mk b/solenv/inc/productversion.mk index bba3d4c14d27..002c63ad71d6 100644 --- a/solenv/inc/productversion.mk +++ b/solenv/inc/productversion.mk @@ -28,5 +28,5 @@ PRODUCTLIST = libreoffice broffice # default values to minimize maintainance effort -PRODUCTVERSION = 3.3 +PRODUCTVERSION = 3.4 PRODUCTVERSIONSHORT = 3 -- cgit From 61f9d4d28fa07cb3833bd3418c8b4f93b7b53b99 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 18 Apr 2011 14:27:59 +0200 Subject: implement w:evenAndOddHeaders (and settings.xml too) --- sw/source/filter/ww8/docxexport.cxx | 39 +++++++++++++++++++++++++++++++++++++ sw/source/filter/ww8/docxexport.hxx | 16 +++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 0bd0908ed9e5..9f0489716fc0 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -215,6 +215,9 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST ) WriteHeaderFooter( rFirstPageFmt, false, "first" ); + if ( nHeadFootFlags & ( nsHdFtFlags::WW8_FOOTER_EVEN | nsHdFtFlags::WW8_HEADER_EVEN )) + settings.evenAndOddHeaders = true; + #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "DocxExport::WriteHeadersFooters() - nBreakCode introduced, but ignored\n" ); #endif @@ -339,6 +342,8 @@ void DocxExport::ExportDocument_Impl() WriteFonts(); + WriteSettings(); + delete pStyles, pStyles = NULL; delete m_pSections, m_pSections = NULL; } @@ -642,6 +647,28 @@ void DocxExport::WriteProperties( ) m_pFilter->exportDocumentProperties( xDocProps ); } +void DocxExport::WriteSettings() +{ + if( !settings.hasData()) + return; + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" ), + S( "settings.xml" ) ); + + ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + S( "word/settings.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ) ); + + pFS->startElementNS( XML_w, XML_settings, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); + + if( settings.evenAndOddHeaders ) + pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND ); + + pFS->endElementNS( XML_w, XML_settings ); +} + VMLExport& DocxExport::VMLExporter() { return *m_pVMLExport; @@ -726,4 +753,16 @@ DocxExport::~DocxExport() delete m_pDrawingML, m_pDrawingML = NULL; } +DocxSettingsData::DocxSettingsData() +: evenAndOddHeaders( false ) +{ +} + +bool DocxSettingsData::hasData() const +{ + if( evenAndOddHeaders ) + return true; + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 4838d55868c4..ee84dcd33b42 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -58,6 +58,14 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } +/// Data to be written in the document settings part of the document +struct DocxSettingsData +{ + DocxSettingsData(); + bool hasData() const; /// returns true if there are any non-default settings (i.e. something to write) + bool evenAndOddHeaders; +}; + /// The class that does all the actual DOCX export-related work. class DocxExport : public MSWordExportBase { @@ -85,6 +93,8 @@ class DocxExport : public MSWordExportBase /// Exporter of the VML shapes. oox::vml::VMLExport *m_pVMLExport; + DocxSettingsData settings; + public: DocxExportFilter& GetFilter() { return *m_pFilter; }; @@ -192,6 +202,9 @@ private: /// Write docProps/core.xml void WriteProperties(); + /// Write word/settings.xml + void WriteSettings(); + /// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...) sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer ); @@ -210,6 +223,9 @@ public: /// Reference to the VMLExport instance for the main document. oox::vml::VMLExport& VMLExporter(); + /// Data to be exported in the settings part of the document + DocxSettingsData& settingsData(); + private: /// No copying. DocxExport( const DocxExport& ); -- cgit From 778230d04455625b6e151c1e5e5fbd9a20abd1c5 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 18 Apr 2011 17:05:04 +0200 Subject: a more reliable way to detect w:titlePg (bnc#654230) --- sw/source/filter/ww8/wrtw8sty.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 83cece4881dc..7549cd367986 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1594,6 +1594,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } + bool titlePage = false; if ( bOutPgDscSet ) { // es ist ein Follow gesetzt und dieser zeigt nicht auf sich @@ -1620,10 +1621,19 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt pPdFmt = &rFollowFmt; // has different headers/footers for the title page - AttrOutput().SectionTitlePage(); + titlePage = true; } } + // The code above tries to detect if this is first page headers/footers, + // but it doesn't work even for quite trivial testcases. As I don't actually + // understand that code, I'll keep it. The simple and (at least for me) reliable way + // to detect for first page seems to be just RES_POOLPAGE_FIRST. + if( pPd->GetPoolFmtId() == RES_POOLPAGE_FIRST ) + titlePage = true; + if( titlePage ) + AttrOutput().SectionTitlePage(); + const SfxItemSet* pOldI = pISet; AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt ); @@ -1707,7 +1717,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt if ( !pPd->IsFooterShared() || bLeftRightPgChain ) MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN ); - if ( pPdFmt != pPdFirstPgFmt ) + if ( titlePage ) { // es gibt eine ErsteSeite: MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST ); -- cgit From 1641896c1341790083eefb08e1d8234704d8d1c2 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 18 Apr 2011 17:46:54 +0200 Subject: avoid first-page header/footer extending to all pages (bnc#654230) --- sw/source/filter/ww8/wrtw8sty.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 7549cd367986..17716b65cc05 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1708,22 +1708,26 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt if ( nBreakCode != 0 ) { - MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD ); - MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD ); - - if ( !pPd->IsHeaderShared() || bLeftRightPgChain ) - MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN ); - - if ( !pPd->IsFooterShared() || bLeftRightPgChain ) - MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN ); - if ( titlePage ) { // es gibt eine ErsteSeite: MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST ); MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST ); } + // write other headers/footers only if it's not the first page - I'm not quite sure + // this is technically correct, but it avoids first-page headers/footers + // extending to all pages (bnc#654230) + if( pPdFmt != pPdFirstPgFmt ) + { + MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD ); + MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD ); + + if ( !pPd->IsHeaderShared() || bLeftRightPgChain ) + MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN ); + if ( !pPd->IsFooterShared() || bLeftRightPgChain ) + MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN ); + } AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags ); } -- cgit From 043155c1cc8199b5280686d780e4d54c5de8cd99 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 18 Apr 2011 18:44:36 +0200 Subject: make left/right page style be followed by the other one so that the document is automatically set to alternating left/right pages --- sw/source/core/doc/poolfmt.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 1fbe5340b7bc..ca115007c9eb 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -1520,7 +1520,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) aSet.Put( aUL ); bSetLeft = sal_False; if( pNewPgDsc ) + { pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT ); + // this relies on GetPageDescFromPool() not going into infinite recursion + // (by this point RES_POOLPAGE_LEFT will not reach this place again) + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT )); + } } break; case RES_POOLPAGE_RIGHT: // Rechte Seite @@ -1530,7 +1535,10 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) aSet.Put( aUL ); bSetLeft = sal_False; if( pNewPgDsc ) + { pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT ); + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT )); + } } break; -- cgit From f11a0e77f41981e47babf79db991066277bb4416 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Tue, 19 Apr 2011 17:32:44 +0200 Subject: fix build with older gcc that does not read options via @file needed to fix build on SLED10 with gcc-4.1.2 we want to use @$(extraobjectlist) in the long run --- solenv/gbuild/platform/unxgcc.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 70802fe45d47..d3b63edc0185 100755 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -229,6 +229,8 @@ endif gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC))) gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC))) +# note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10 +# we want to use @$(extraobjectlist) in the long run define gb_LinkTarget__command_dynamiclink $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) && \ @@ -238,7 +240,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \ - $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \ + $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \ -Wl$(COMMA)--start-group $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) -Wl$(COMMA)--end-group \ $(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \ -o $(1)) -- cgit From c3bcb02fb86d98990bbe0bed3dcd9d00ca4402f1 Mon Sep 17 00:00:00 2001 From: Petr Mladek Date: Tue, 19 Apr 2011 18:13:06 +0200 Subject: bump product version to 3.4.0beta2, release number to 2 --- instsetoo_native/util/openoffice.lst | 16 ++++++++-------- solenv/inc/minor.mk | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 573ff7563a64..38a5cc5b4658 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -57,7 +57,7 @@ LibreOffice PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 3 @@ -125,7 +125,7 @@ LibreOffice_wJRE PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 3 @@ -189,7 +189,7 @@ LibreOffice_Dev PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 BASISROOTNAME LibO-dev UNIXBASISROOTNAME lo-dev POSTVERSIONEXTENSION @@ -266,7 +266,7 @@ URE PRODUCTEXTENSION BRANDPACKAGEVERSION 3 LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 LICENSENAME LGPL SETSTATICPATH 1 NOVERSIONINDIRNAME 1 @@ -305,7 +305,7 @@ LibreOffice_SDK PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 POSTVERSIONEXTENSION SDK POSTVERSIONEXTENSIONUNIX sdk BRANDPACKAGEVERSION 3 @@ -351,7 +351,7 @@ LibreOffice_Dev_SDK PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 BASISROOTNAME LibO-dev UNIXBASISROOTNAME lo-dev POSTVERSIONEXTENSION SDK @@ -404,7 +404,7 @@ OxygenOffice PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 3 @@ -473,7 +473,7 @@ OxygenOffice_wJRE PRODUCTVERSION 3.4 PRODUCTEXTENSION LONG_PRODUCTEXTENSION - SHORT_PRODUCTEXTENSION beta1 + SHORT_PRODUCTEXTENSION beta2 POSTVERSIONEXTENSION POSTVERSIONEXTENSIONUNIX BRANDPACKAGEVERSION 3 diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index e33ce16abc3f..6d45a96930c9 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=300 -RSCREVISION=300m103(Build:1) -BUILD=1 +RSCREVISION=300m103(Build:2) +BUILD=2 LAST_MINOR=m103 SOURCEVERSION=DEV300 -- cgit From dcb67a54aa02a0fed9b24b27f682626d3860a092 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Tue, 19 Apr 2011 18:42:53 +0200 Subject: fix typos in messages --- bin/lo-commit-stat | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/lo-commit-stat b/bin/lo-commit-stat index c8b51d9a52a0..51029fff25cd 100755 --- a/bin/lo-commit-stat +++ b/bin/lo-commit-stat @@ -39,7 +39,7 @@ sub search_bugs($$$$) $line =~ s/\s*-\s*$bug_orig\s*//; $line =~ s/\(?$bug_orig\)?[:,]?\s*//; - # bnc# is prefered over n# for novell bugs + # bnc# is preferred over n# for novell bugs $bug =~ s/^n\#/bnc#/; # save the bug number %{$pdata->{$piece}{$commit_id}{'bugs'}} = () if (! defined %{$pdata->{$piece}{$commit_id}{'bugs'}}); @@ -113,7 +113,7 @@ sub load_git_log($$$$) } $line = search_bugs($pdata, $piece, $commit_id, $line); - # FIXME: need to be implemeted + # FIXME: need to be implemented # search_keywords($pdata, $line); unless (defined $pdata->{$piece}{$commit_id}{'summary'}) { @@ -201,7 +201,7 @@ sub open_log_file($$$) if (-f $logfilename) { print "WARNING: The log file already exists: $logfilename\n"; - print "Do you want to ovewrite it? (Y/n)?\n"; + print "Do you want to overwrite it? (Y/n)?\n"; my $answer = ; chomp $answer; $answer = "y" unless ($answer); @@ -256,7 +256,7 @@ sub print_stat($$$) my ($pdata, $pprint_filters, $log) = @_; foreach my $piece ( sort { $a cmp $b } keys %{$pdata}) { - # check if this peice has any entries at all + # check if this piece has any entries at all my $piece_title = "+ $piece"; if ( %{$pdata->{$piece}} ) { my $old_summary=""; @@ -303,10 +303,10 @@ sub usage() "Options:\n" . " --help print this help\n" . " --no-pieces read changes just from the main repository, ignore other cloned repos\n" . - " --piece= summarize just chnages from the given piece\n" . + " --piece= summarize just changes from the given piece\n" . " --log-suffix= suffix of the log file name; the result will be\n" . " commit-log--.log; the branch name\n" . - " is detected autoamtically\n" . + " is detected automatically\n" . " --bugs print just bug fixes\n" . " --rev-list use \"git rev-list\" instead of \"git log\"; useful to check\n" . " differences between branches\n" . @@ -315,7 +315,7 @@ sub usage() " git_arg extra parameters passed to the git command to define\n" . " the area of interest; The default command is \"git log\" and\n" . " parameters might be, for example, --after=\"2010-09-27\" or\n" . - " TAG..HEAD; with the option --rev-list, useful might be, for,\n" . + " TAG..HEAD; with the option --rev-list, useful might be, for\n" . " example origin/master ^origin/libreoffice-3-3\n"; } @@ -363,7 +363,7 @@ foreach my $arg (@ARGV) { $git_command .= " " . join ' ', @git_args if (@git_args); -(defined $top_dir) || die "Error: top direcotry is not defined\n"; +(defined $top_dir) || die "Error: top directory is not defined\n"; (-d "$top_dir") || die "Error: not a directory: $top_dir\n"; (-f "$top_dir/.git/config") || die "Error: can't find $top_dir/.git/config\n"; -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit -- cgit