From 44ccce1e58ad84329f5d5d9f233c5ae844422218 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:27:09 -0400 Subject: #i3687# #i97416#: initial porting of patches from ooo-build. --- sc/source/ui/dbgui/asciiopt.cxx | 16 ++++ sc/source/ui/dbgui/asciiopt.hrc | 1 + sc/source/ui/dbgui/asciiopt.src | 17 ++-- sc/source/ui/dbgui/csvgrid.cxx | 3 +- sc/source/ui/dbgui/csvruler.cxx | 75 ++++++++++++++++ sc/source/ui/dbgui/scuiasciiopt.cxx | 166 +++++++++++++++++++++++++++++++++--- sc/source/ui/docshell/impex.cxx | 22 +++-- sc/source/ui/inc/asciiopt.hxx | 3 + sc/source/ui/inc/csvruler.hxx | 1 + sc/source/ui/inc/impex.hxx | 2 +- sc/source/ui/inc/scuiasciiopt.hxx | 2 + 11 files changed, 280 insertions(+), 28 deletions(-) diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index a2a20a047a3e..fbe13bbd0370 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -56,6 +56,7 @@ ScAsciiOptions::ScAsciiOptions() : bFixedLen ( FALSE ), aFieldSeps ( ';' ), bMergeFieldSeps ( FALSE ), + bQuotedFieldAsText(false), cTextSep ( cDefaultTextSep ), eCharSet ( gsl_getSystemTextEncoding() ), bCharSetSystem ( FALSE ), @@ -71,6 +72,7 @@ ScAsciiOptions::ScAsciiOptions(const ScAsciiOptions& rOpt) : bFixedLen ( rOpt.bFixedLen ), aFieldSeps ( rOpt.aFieldSeps ), bMergeFieldSeps ( rOpt.bMergeFieldSeps ), + bQuotedFieldAsText(rOpt.bQuotedFieldAsText), cTextSep ( rOpt.cTextSep ), eCharSet ( rOpt.eCharSet ), bCharSetSystem ( rOpt.bCharSetSystem ), @@ -155,6 +157,7 @@ ScAsciiOptions& ScAsciiOptions::operator=( const ScAsciiOptions& rCpy ) bFixedLen = rCpy.bFixedLen; aFieldSeps = rCpy.aFieldSeps; bMergeFieldSeps = rCpy.bMergeFieldSeps; + bQuotedFieldAsText = rCpy.bQuotedFieldAsText; cTextSep = rCpy.cTextSep; eCharSet = rCpy.eCharSet; bCharSetSystem = rCpy.bCharSetSystem; @@ -169,6 +172,7 @@ BOOL ScAsciiOptions::operator==( const ScAsciiOptions& rCmp ) const if ( bFixedLen == rCmp.bFixedLen && aFieldSeps == rCmp.aFieldSeps && bMergeFieldSeps == rCmp.bMergeFieldSeps && + bQuotedFieldAsText == rCmp.bQuotedFieldAsText && cTextSep == rCmp.cTextSep && eCharSet == rCmp.eCharSet && bCharSetSystem == rCmp.bCharSetSystem && @@ -286,6 +290,13 @@ void ScAsciiOptions::ReadFromString( const String& rString ) pColFormat = NULL; } } + + // Import quoted field as text. + if (nCount >= 6) + { + aToken = rString.GetToken(5, ','); + bQuotedFieldAsText = aToken.EqualsAscii("true") ? true : false; + } } @@ -357,6 +368,11 @@ String ScAsciiOptions::WriteToString() const aOutStr += String::CreateFromInt32(pColFormat[nInfo]); } + aOutStr += ','; + + // Import quoted field as text. + aOutStr += String::CreateFromAscii(bQuotedFieldAsText ? "true" : "false"); + return aOutStr; } diff --git a/sc/source/ui/dbgui/asciiopt.hrc b/sc/source/ui/dbgui/asciiopt.hrc index 29dca4596441..3177a1be7b78 100644 --- a/sc/source/ui/dbgui/asciiopt.hrc +++ b/sc/source/ui/dbgui/asciiopt.hrc @@ -56,4 +56,5 @@ #define FT_AT_ROW 59 #define NF_AT_ROW 60 #define CB_ASONCE 90 +#define CB_QUOTED_AS_TEXT 91 #define STR_TEXTTOCOLUMNS 100 diff --git a/sc/source/ui/dbgui/asciiopt.src b/sc/source/ui/dbgui/asciiopt.src index b9854c175344..a510471bb799 100644 --- a/sc/source/ui/dbgui/asciiopt.src +++ b/sc/source/ui/dbgui/asciiopt.src @@ -34,24 +34,24 @@ ModalDialog RID_SCDLG_ASCII { OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 320 , 247 ) ; + Size = MAP_APPFONT ( 320 , 264 ) ; Text [ en-US ] = "Text Import" ; Moveable = TRUE ; FixedLine FL_WIDTH { - Pos = MAP_APPFONT ( 6 , 132 ) ; + Pos = MAP_APPFONT ( 6 , 147 ) ; Size = MAP_APPFONT ( 252 , 8 ) ; Text [ en-US ] = "Fields" ; }; FixedText FT_TYPE { - Pos = MAP_APPFONT ( 12 , 145 ) ; + Pos = MAP_APPFONT ( 12 , 160 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; Text [ en-US ] = "Column t~ype"; }; ListBox LB_TYPE1 { - Pos = MAP_APPFONT ( 76 , 143 ) ; + Pos = MAP_APPFONT ( 76 , 158 ) ; Size = MAP_APPFONT ( 60 , 68 ) ; TabStop = TRUE ; DropDown = TRUE ; @@ -194,7 +194,7 @@ ModalDialog RID_SCDLG_ASCII HelpId = HID_SC_ASCII_TABCTR ; Border = TRUE ; DialogControl = TRUE ; - Pos = MAP_APPFONT ( 12 , 159 ) ; + Pos = MAP_APPFONT ( 12 , 176 ) ; Size = MAP_APPFONT ( 243 , 82 ) ; }; CheckBox CB_ASONCE @@ -204,6 +204,13 @@ ModalDialog RID_SCDLG_ASCII TabStop = TRUE ; Text [ en-US ] = "Merge ~delimiters" ; }; + CheckBox CB_QUOTED_AS_TEXT + { + Pos = MAP_APPFONT ( 20 , 129 ) ; + Size = MAP_APPFONT ( 130 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Quoted field as text" ; + }; String STR_TEXTTOCOLUMNS { Text [ en-US ] = "Text to Columns" ; diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index ddbfb4426df8..5725645100d3 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -737,7 +737,8 @@ void ScCsvGrid::ImplSetTextLineSep( while( *pChar && (nColIx < sal::static_int_cast(CSV_MAXCOLCOUNT)) ) { // scan for next cell text - pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep ); + bool bIsQuoted = false; + pChar = ScImportExport::ScanNextFieldFromString( pChar, aCellText, cTextSep, pSepChars, bMergeSep, bIsQuoted ); // update column width sal_Int32 nWidth = Max( CSV_MINCOLWIDTH, aCellText.Len() + sal_Int32( 1 ) ); diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 6f97ecd4c9d9..90acf4a45358 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -37,8 +37,76 @@ #include "AccessibleCsvControl.hxx" +#include +#include +#include +#include "miscuno.hxx" + +using namespace rtl; +using namespace com::sun::star::uno; + + + +// ============================================================================ +#define SEP_PATH "Office.Calc/Dialogs/CSVImport" +#define FIXED_WIDTH_LIST "FixedWidthList" + + // ============================================================================ +static void load_FixedWidthList(ScCsvSplits &aSplits) +{ + String sSplits; + OUString sFixedWidthLists; + + SequenceaValues; + const Any *pProperties; + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); + + pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getConstArray(); + + if( pProperties[0].hasValue() ) + { + aSplits.Clear(); + pProperties[0] >>= sFixedWidthLists; + + sSplits = String( sFixedWidthLists ); + + // String ends with a semi-colon so there is no 'int' after the last one. + for(int i=0;i aValues; + Any *pProperties; + Sequence aNames(1); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); + + pNames[0] = OUString::createFromAscii( FIXED_WIDTH_LIST ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getArray(); + pProperties[0] <<= sFixedWidthLists; + + aItem.PutProperties(aNames, aValues); +} + ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) : ScCsvControl( rParent ), mnPosCursorLast( 1 ) @@ -48,6 +116,13 @@ ScCsvRuler::ScCsvRuler( ScCsvControl& rParent ) : InitSizeData(); maBackgrDev.SetFont( GetFont() ); maRulerDev.SetFont( GetFont() ); + + load_FixedWidthList( maSplits ); +} + +ScCsvRuler::~ScCsvRuler() +{ + save_FixedWidthList( maSplits ); } diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 6bc96c13d5b6..9d782347b5ea 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -44,6 +44,12 @@ // ause #include "editutil.hxx" +#include +#include +#include +#include "miscuno.hxx" + + //! TODO make dynamic #ifdef WIN const SCSIZE ASCIIDLG_MAXROWS = 10000; @@ -51,6 +57,20 @@ const SCSIZE ASCIIDLG_MAXROWS = 10000; const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT; #endif + +using namespace rtl; +using namespace com::sun::star::uno; + +// Defines - CSV Import Preserve Options +#define FIXED_WIDTH "FixedWidth" +#define FROM_ROW "FromRow" +#define CHAR_SET "CharSet" +#define SEPARATORS "Separators" +#define TEXT_SEPARATORS "TextSeparators" +#define MERGE_DELIMITERS "MergeDelimiters" +#define QUOTED_AS_TEXT "QuotedFieldAsText" +#define SEP_PATH "Office.Calc/Dialogs/CSVImport" + // ============================================================================ void lcl_FillCombo( ComboBox& rCombo, const String& rList, sal_Unicode cSelect ) @@ -98,11 +118,82 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList ) return c; } +static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, + bool &bMergeDelimiters, bool& bQuotedAsText, bool &bFixedWidth, + sal_Int32 &nFromRow, sal_Int32 &nCharSet ) +{ + SequenceaValues; + const Any *pProperties; + Sequence aNames(7); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); + + pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS ); + pNames[1] = OUString::createFromAscii( SEPARATORS ); + pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS ); + pNames[3] = OUString::createFromAscii( FIXED_WIDTH ); + pNames[4] = OUString::createFromAscii( FROM_ROW ); + pNames[5] = OUString::createFromAscii( CHAR_SET ); + pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getConstArray(); + if( pProperties[1].hasValue() ) + pProperties[1] >>= sFieldSeparators; + + if( pProperties[2].hasValue() ) + pProperties[2] >>= sTextSeparators; + + if( pProperties[0].hasValue() ) + bMergeDelimiters = ScUnoHelpFunctions::GetBoolFromAny( pProperties[0] ); + + if( pProperties[3].hasValue() ) + bFixedWidth = ScUnoHelpFunctions::GetBoolFromAny( pProperties[3] ); + + if( pProperties[4].hasValue() ) + pProperties[4] >>= nFromRow; + + if( pProperties[5].hasValue() ) + pProperties[5] >>= nCharSet; + + if ( pProperties[6].hasValue() ) + pProperties[6] >>= bQuotedAsText; +} + +static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText, + bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet ) +{ + OUString sFieldSeparators = OUString( maSeparators ); + OUString sTextSeparators = OUString( maTxtSep ); + Sequence aValues; + Any *pProperties; + Sequence aNames(7); + OUString* pNames = aNames.getArray(); + ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); + + pNames[0] = OUString::createFromAscii( MERGE_DELIMITERS ); + pNames[1] = OUString::createFromAscii( SEPARATORS ); + pNames[2] = OUString::createFromAscii( TEXT_SEPARATORS ); + pNames[3] = OUString::createFromAscii( FIXED_WIDTH ); + pNames[4] = OUString::createFromAscii( FROM_ROW ); + pNames[5] = OUString::createFromAscii( CHAR_SET ); + pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT ); + aValues = aItem.GetProperties( aNames ); + pProperties = aValues.getArray(); + pProperties[1] <<= sFieldSeparators; + pProperties[2] <<= sTextSeparators; + ScUnoHelpFunctions::SetBoolInAny( pProperties[0], bMergeDelimiters ); + ScUnoHelpFunctions::SetBoolInAny( pProperties[3], bFixedWidth ); + pProperties[4] <<= nFromRow; + pProperties[5] <<= nCharSet; + pProperties[6] <<= static_cast(bQuotedAsText); + + aItem.PutProperties(aNames, aValues); +} // ---------------------------------------------------------------------------- ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, - SvStream* pInStream, sal_Unicode cSep ) : + SvStream* pInStream, sal_Unicode /*cSep*/ ) : ModalDialog ( pParent, ScResId( RID_SCDLG_ASCII ) ), mpDatStream ( pInStream ), mnStreamPos( pInStream ? pInStream->Tell() : 0 ), @@ -128,6 +219,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aCkbOther ( this, ScResId( CKB_OTHER ) ), aEdOther ( this, ScResId( ED_OTHER ) ), aCkbAsOnce ( this, ScResId( CB_ASONCE) ), + aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ), aFtTextSep ( this, ScResId( FT_TEXTSEP ) ), aCbTextSep ( this, ScResId( CB_TEXTSEP ) ), @@ -146,14 +238,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aFldSepList ( ScResId( SCSTR_FIELDSEP ) ), aTextSepList( ScResId( SCSTR_TEXTSEP ) ), mcTextSep ( ScAsciiOptions::cDefaultTextSep ), - maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ) + maStrTextToColumns( ScResId( STR_TEXTTOCOLUMNS ) ), + mbFileImport(true) { FreeResource(); + mbFileImport = aDatName.Len() > 0; String aName = GetText(); // aDatName is empty if invoked during paste from clipboard. - BOOL bClipboard = (aDatName.Len() == 0); - if (!bClipboard) + if (mbFileImport) { aName.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" - [")); aName += aDatName; @@ -161,20 +254,51 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, } SetText( aName ); - switch(cSep) + + OUString sFieldSeparators; + OUString sTextSeparators; + bool bMergeDelimiters = false; + bool bFixedWidth = false; + bool bQuotedFieldAsText = true; + sal_Int32 nFromRow = 1; + sal_Int32 nCharSet = -1; + if (mbFileImport) + // load separators only when importing csv files. + load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, + bQuotedFieldAsText, bFixedWidth, nFromRow, nCharSet); + maFieldSeparators = String(sFieldSeparators); + + if( bMergeDelimiters ) + aCkbAsOnce.Check(); + if (bQuotedFieldAsText) + aCkbQuotedAsText.Check(); + if( bFixedWidth ) + aRbFixed.Check(); + if( nFromRow != 1 ) + aNfRow.SetValue( nFromRow ); + + ByteString bString(maFieldSeparators,RTL_TEXTENCODING_MS_1252); + const sal_Char *aSep = bString.GetBuffer(); + int len = maFieldSeparators.Len(); + for (int i = 0; i < len; ++i) { - case '\t': aCkbTab.Check(); break; - case ';': aCkbSemicolon.Check(); break; - case ',': aCkbComma.Check(); break; - case ' ': aCkbSpace.Check(); break; - default: - aCkbOther.Check(); - aEdOther.SetText( cSep ); + switch( aSep[i] ) + { + case '\t': aCkbTab.Check(); break; + case ';': aCkbSemicolon.Check(); break; + case ',': aCkbComma.Check(); break; + case ' ': aCkbSpace.Check(); break; + default: + aCkbOther.Check(); + aEdOther.SetText( aEdOther.GetText() + OUString( aSep[i] ) ); + } } + + // Get Separators from the dialog maFieldSeparators = GetSeparators(); // Clipboard is always Unicode, else detect. - BOOL bPreselectUnicode = bClipboard; + bool bPreselectUnicode = !mbFileImport; // Sniff for Unicode / not if( !bPreselectUnicode && mpDatStream ) { @@ -210,6 +334,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, // *** Separator characters *** lcl_FillCombo( aCbTextSep, aTextSepList, mcTextSep ); + aCbTextSep.SetText( sTextSeparators ); Link aSeparatorHdl =LINK( this, ScImportAsciiDlg, SeparatorHdl ); aCbTextSep.SetSelectHdl( aSeparatorHdl ); @@ -218,6 +343,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aCkbSemicolon.SetClickHdl( aSeparatorHdl ); aCkbComma.SetClickHdl( aSeparatorHdl ); aCkbAsOnce.SetClickHdl( aSeparatorHdl ); + aCkbQuotedAsText.SetClickHdl( aSeparatorHdl ); aCkbSpace.SetClickHdl( aSeparatorHdl ); aCkbOther.SetClickHdl( aSeparatorHdl ); aEdOther.SetModifyHdl( aSeparatorHdl ); @@ -230,6 +356,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aLbCharSet.InsertTextEncoding( RTL_TEXTENCODING_DONTKNOW, aCharSetUser ); aLbCharSet.SelectTextEncoding( bPreselectUnicode ? RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() ); + + if( nCharSet >= 0 ) + aLbCharSet.SelectEntryPos( nCharSet ); + SetSelectedCharSet(); aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) ); @@ -261,6 +391,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, ScImportAsciiDlg::~ScImportAsciiDlg() { + if (mbFileImport) + save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), + aCkbQuotedAsText.IsChecked(), aRbFixed.IsChecked(), + aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos()); delete[] mpRowPosArray; } @@ -346,6 +480,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) { rOpt.SetFieldSeps( GetSeparators() ); rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() ); + rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked()); rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) ); } } @@ -357,6 +492,10 @@ void ScImportAsciiDlg::SetTextToColumnsMode() aLbCharSet.Disable(); aFtRow.Disable(); aNfRow.Disable(); + + // Quoted field as text option is not used for text to columns mode. + aCkbQuotedAsText.Check(false); + aCkbQuotedAsText.Disable(); } void ScImportAsciiDlg::SetSelectedCharSet() @@ -393,6 +532,7 @@ void ScImportAsciiDlg::SetupSeparatorCtrls() aCkbOther.Enable( bEnable ); aEdOther.Enable( bEnable ); aCkbAsOnce.Enable( bEnable ); + aCkbQuotedAsText.Enable( bEnable ); aFtTextSep.Enable( bEnable ); aCbTextSep.Enable( bEnable ); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 67186f84a84a..a351c1f1b3fd 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -905,12 +905,10 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm ) // -bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, - const String& rStr, BYTE nColFormat, - ::utl::TransliterationWrapper& rTransliteration, - CalendarWrapper& rCalendar, - ::utl::TransliterationWrapper* pSecondTransliteration, - CalendarWrapper* pSecondCalendar ) +static bool lcl_PutString( + ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat, + ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar, + ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar ) { bool bMultiLine = false; if ( nColFormat == SC_COL_SKIP || !rStr.Len() || !ValidCol(nCol) || !ValidRow(nRow) ) @@ -1281,7 +1279,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) // SC_COL_SKIP. while (*p && nCol <= MAXCOL+1) { - p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge ); + bool bIsQuoted = false; + p = ScImportExport::ScanNextFieldFromString( p, aCell, cStr, pSeps, bMerge, bIsQuoted ); BYTE nFmt = SC_COL_STANDARD; for ( i=nInfoStart; i MAXCOL) bOverflow = TRUE; // display warning on import else if (!bDetermineRange) + { + if (bIsQuoted && pExtOptions && pExtOptions->IsQuotedAsText()) + nFmt = SC_COL_TEXT; + bMultiLine |= lcl_PutString( pDoc, nCol, nRow, nTab, aCell, nFmt, aTransliteration, aCalendar, pEnglishTransliteration, pEnglishCalendar); + } ++nCol; } @@ -1375,11 +1379,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) // static const sal_Unicode* ScImportExport::ScanNextFieldFromString( const sal_Unicode* p, - String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps ) + String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted ) { + rbIsQuoted = false; rField.Erase(); if ( *p == cStr ) // String in Anfuehrungszeichen { + rbIsQuoted = true; const sal_Unicode* p1; p1 = p = lcl_ScanString( p, rField, cStr, DQM_ESCAPE ); while ( *p && !ScGlobal::UnicodeStrChr( pSeps, *p ) ) diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx index a26929dc92ea..40c95f0f0702 100644 --- a/sc/source/ui/inc/asciiopt.hxx +++ b/sc/source/ui/inc/asciiopt.hxx @@ -65,6 +65,7 @@ private: BOOL bFixedLen; String aFieldSeps; BOOL bMergeFieldSeps; + bool bQuotedFieldAsText; sal_Unicode cTextSep; CharSet eCharSet; BOOL bCharSetSystem; @@ -93,6 +94,7 @@ public: BOOL GetCharSetSystem() const { return bCharSetSystem; } const String& GetFieldSeps() const { return aFieldSeps; } BOOL IsMergeSeps() const { return bMergeFieldSeps; } + bool IsQuotedAsText() const { return bQuotedFieldAsText; } sal_Unicode GetTextSep() const { return cTextSep; } BOOL IsFixedLen() const { return bFixedLen; } USHORT GetInfoCount() const { return nInfoCount; } @@ -105,6 +107,7 @@ public: void SetFixedLen( BOOL bSet ) { bFixedLen = bSet; } void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; } void SetMergeSeps( BOOL bSet ) { bMergeFieldSeps = bSet; } + void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; } void SetTextSep( sal_Unicode c ) { cTextSep = c; } void SetStartRow( long nRow) { nStartRow= nRow; } diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx index cb79644f3aed..9c84f41368c8 100644 --- a/sc/source/ui/inc/csvruler.hxx +++ b/sc/source/ui/inc/csvruler.hxx @@ -71,6 +71,7 @@ private: // ------------------------------------------------------------------------ public: explicit ScCsvRuler( ScCsvControl& rParent ); + ~ScCsvRuler(); // common ruler handling -------------------------------------------------- public: diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx index fb4dcaa83958..c31094fd3fb8 100644 --- a/sc/source/ui/inc/impex.hxx +++ b/sc/source/ui/inc/impex.hxx @@ -110,7 +110,7 @@ public: static BOOL IsFormatSupported( ULONG nFormat ); static const sal_Unicode* ScanNextFieldFromString( const sal_Unicode* p, - String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, BOOL bMergeSeps ); + String& rField, sal_Unicode cStr, const sal_Unicode* pSeps, bool bMergeSeps, bool& rbIsQuoted ); static void WriteUnicodeOrByteString( SvStream& rStrm, const String& rString, BOOL bZero = FALSE ); static void WriteUnicodeOrByteEndl( SvStream& rStrm ); static inline BOOL IsEndianSwap( const SvStream& rStrm ); diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 89b7ff9f8a0a..33bc48b7122a 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -64,6 +64,7 @@ class ScImportAsciiDlg : public ModalDialog CheckBox aCkbOther; Edit aEdOther; CheckBox aCkbAsOnce; + CheckBox aCkbQuotedAsText; FixedText aFtTextSep; ComboBox aCbTextSep; @@ -87,6 +88,7 @@ class ScImportAsciiDlg : public ModalDialog CharSet meCharSet; /// Selected char set. bool mbCharSetSystem; /// Is System char set selected? + bool mbFileImport; /// Is this dialog involked for csv file import ? public: ScImportAsciiDlg( -- cgit v1.2.3 From 57dbf3a5787c444efb079fee63ad822c2a93fae4 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:27:09 -0400 Subject: #i3687# #i97416#: initial porting of patches from ooo-build. --- .../registry/schema/org/openoffice/Office/Calc.xcs | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index fd7c52ef4df2..560ca9518c9b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1019,6 +1019,81 @@ NULL + + + Contains the dialogs settings. + + + + Contains setting for Text CSV Import + + + + muthusuba + Merge Delimiter check box status + + + false + + + + kyoshida + If true, quoted field is always imported as text + with no exception. + + + true + + + + muthusuba + List of Separators - as a String + + + ; + + + + muthusuba + Text Separators + + + " + + + + muthusuba + Fixed width + + + false + + + + muthusuba + From Row + + + 1 + + + + muthusuba + Char Set + + + -1 + + + + muthusuba + Fixed Width List of separators + + + + + + Contains settings that affect cell calculation. -- cgit v1.2.3 From b559137b68a273ef543711995ebf4f140cfe9149 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:41:15 -0400 Subject: #i102141# initial port of patches from ooo-build, to implement a new HTML option dialog & associated changes in the core. --- sc/inc/column.hxx | 4 +- sc/inc/document.hxx | 4 +- sc/inc/filter.hxx | 8 ++- sc/inc/sc.hrc | 3 + sc/inc/scabstdlg.hxx | 11 ++++ sc/inc/stringutil.hxx | 56 +++++++++++++++++ sc/inc/table.hxx | 3 +- sc/source/core/data/column3.cxx | 103 +++++++++++++++++++++---------- sc/source/core/data/document.cxx | 5 +- sc/source/core/data/table2.cxx | 6 +- sc/source/core/tool/makefile.mk | 2 + sc/source/core/tool/stringutil.cxx | 101 +++++++++++++++++++++++++++++++ sc/source/filter/html/htmlimp.cxx | 10 ++-- sc/source/filter/inc/eeimport.hxx | 4 +- sc/source/filter/inc/ftools.hxx | 4 +- sc/source/filter/inc/htmlimp.hxx | 3 +- sc/source/filter/rtf/eeimpars.cxx | 9 +-- sc/source/ui/attrdlg/scdlgfact.cxx | 31 ++++++++++ sc/source/ui/attrdlg/scdlgfact.hxx | 10 ++++ sc/source/ui/dbgui/langchooser.cxx | 120 +++++++++++++++++++++++++++++++++++++ sc/source/ui/dbgui/langchooser.src | 112 ++++++++++++++++++++++++++++++++++ sc/source/ui/dbgui/makefile.mk | 5 +- sc/source/ui/docshell/docsh.cxx | 49 ++++++++++++++- sc/source/ui/docshell/impex.cxx | 2 +- sc/source/ui/inc/docsh.hxx | 1 + sc/source/ui/inc/langchooser.hrc | 42 +++++++++++++ sc/source/ui/inc/langchooser.hxx | 76 +++++++++++++++++++++++ sc/source/ui/unoobj/filtuno.cxx | 31 ++++++++-- sc/util/makefile.mk | 1 + 29 files changed, 758 insertions(+), 58 deletions(-) create mode 100644 sc/inc/stringutil.hxx create mode 100644 sc/source/core/tool/stringutil.cxx create mode 100644 sc/source/ui/dbgui/langchooser.cxx create mode 100644 sc/source/ui/dbgui/langchooser.src create mode 100644 sc/source/ui/inc/langchooser.hrc create mode 100644 sc/source/ui/inc/langchooser.hxx diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index c66ecb960e7d..93861d7436cb 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -241,7 +241,9 @@ public: // TRUE = Zahlformat gesetzt BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString, - formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO ); + formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO, + SvNumberFormatter* pFormatter = NULL, + bool bDetectNumberFormat = true ); void SetValue( SCROW nRow, const double& rVal); void SetError( SCROW nRow, const USHORT nError); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 17c3234a7723..ca56205d74a0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -721,7 +721,9 @@ public: SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, ULONG nFormatIndex, BOOL bForceTab = FALSE); // return TRUE = Zahlformat gesetzt - SC_DLLPUBLIC BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); + SC_DLLPUBLIC BOOL SetString( + SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true ); SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal ); void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT nError); diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx index 157795db2a42..8284447f2f05 100644 --- a/sc/inc/filter.hxx +++ b/sc/inc/filter.hxx @@ -42,6 +42,7 @@ class SvStream; class ScAddress; class ScDocument; class ScRange; +class SvNumberFormatter; // Return-Werte Im-/Exportfilter (ULONG) @@ -92,7 +93,9 @@ class ScEEAbsImport { virtual ~ScEEAbsImport() {} virtual ULONG Read( SvStream& rStream, const String& rBaseURL ) = 0; virtual ScRange GetRange() = 0; - virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 ) = 0; + virtual void WriteToDocument( + BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0, + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0; }; class ScFormatFilterPlugin { @@ -109,7 +112,8 @@ class ScFormatFilterPlugin { virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos, const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL ) = 0; virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ) = 0; - virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE ) = 0; + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, + BOOL bCalcWidthHeight = TRUE, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0; // various import helpers virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 8fb6b929337b..ba3420f1d9c3 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1650,6 +1650,9 @@ #define MID_3 3 #define MID_4 4 +// Language chooser for text import filters. +#define RID_SCDLG_LANG_CHOOSER (SC_OOO_BUILD_START + 12) + #endif diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index f9895ff15ebb..89c33bcae13f 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -41,6 +41,7 @@ #include "sc.hrc" #include "global.hxx" #include "pivot.hxx" +#include "i18npool/lang.h" class ScAsciiOptions; class ScAutoFormat; @@ -289,6 +290,14 @@ class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportO public: virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0; }; + +class AbstractScLangChooserDlg : public VclAbstractDialog //add for ScLangChooserDlg +{ +public: + virtual LanguageType GetLanguageType() const = 0; + virtual bool IsDateConversionSet() const = 0; +}; + //-------Scabstract fractory --------------------------- class ScAbstractDialogFactory { @@ -299,6 +308,8 @@ public: SvStream* pInStream, int nId, sal_Unicode cSep = '\t') = 0; + virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ) = 0; + virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, const ScAutoFormatData* pSelFormatData, diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx new file mode 100644 index 000000000000..c50c0d8cf156 --- /dev/null +++ b/sc/inc/stringutil.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: table.hxx,v $ + * $Revision: 1.35 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_STRINGUTIL_HXX +#define SC_STRINGUTIL_HXX + +#include "rtl/ustring.hxx" + +class ScStringUtil +{ +public: + /** + * Check if a given string is a simple decimal number (e.g. 12.345). We + * don't do any elaborate parsing here; we only check for the simplest + * case of decimal number format. + * + * @param rStr string to parse + * @param dsep decimal separator + * @param gsep group separator (aka thousands separator) + * @param rVal value of successfully parsed number + * + * @return true if the string is a valid number, false otherwise. + */ + static bool parseSimpleNumber( + const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal); +}; + + +#endif diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 7d9bf90a3d81..fd1f806b688d 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -260,7 +260,8 @@ public: void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell ); void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell); // TRUE = Zahlformat gesetzt - BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ); + BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true ); void SetValue( SCCOL nCol, SCROW nRow, const double& rVal ); void SetError( SCCOL nCol, SCROW nRow, USHORT nError); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 5726862366cf..19768160c573 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -54,6 +54,13 @@ #include "markdata.hxx" #include "detfunc.hxx" // fuer Notizen bei DeleteRange #include "postit.hxx" +#include "stringutil.hxx" + +#include + +using ::com::sun::star::i18n::LocaleDataItem; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; // Err527 Workaround extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx @@ -1244,7 +1251,8 @@ void ScColumn::StartListeningInArea( SCROW nRow1, SCROW nRow2 ) // TRUE = Zahlformat gesetzt BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, - formula::FormulaGrammar::AddressConvention eConv ) + formula::FormulaGrammar::AddressConvention eConv, + SvNumberFormatter* pFormatter, bool bDetectNumberFormat ) { BOOL bNumFmtSet = FALSE; if (VALIDROW(nRow)) @@ -1256,7 +1264,8 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, double nVal; sal_uInt32 nIndex, nOldIndex = 0; sal_Unicode cFirstChar; - SvNumberFormatter* pFormatter = pDocument->GetFormatTable(); + if (!pFormatter) + pFormatter = pDocument->GetFormatTable(); SfxObjectShell* pDocSh = pDocument->GetDocumentShell(); if ( pDocSh ) bIsLoading = pDocSh->IsLoading(); @@ -1323,46 +1332,78 @@ BOOL ScColumn::SetString( SCROW nRow, SCTAB nTabP, const String& rString, if ( !bIsText ) nIndex = nOldIndex = pFormatter->GetStandardIndex(); } - if ( !bIsText && - pFormatter->IsNumberFormat(rString, nIndex, nVal) ) - { // Zahl - pNewCell = new ScValueCell( nVal ); - if ( nIndex != nOldIndex) + + do + { + if (bIsText) + break; + + if (bDetectNumberFormat) { - // #i22345# New behavior: Apply the detected number format only if - // the old one was the default number, date, time or boolean format. - // Exception: If the new format is boolean, always apply it. + if (!pFormatter->IsNumberFormat(rString, nIndex, nVal)) + break; - BOOL bOverwrite = FALSE; - const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex ); - if ( pOldFormat ) + pNewCell = new ScValueCell( nVal ); + if ( nIndex != nOldIndex) { - short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED; - if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE || - nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL ) + // #i22345# New behavior: Apply the detected number format only if + // the old one was the default number, date, time or boolean format. + // Exception: If the new format is boolean, always apply it. + + BOOL bOverwrite = FALSE; + const SvNumberformat* pOldFormat = pFormatter->GetEntry( nOldIndex ); + if ( pOldFormat ) { - if ( nOldIndex == pFormatter->GetStandardFormat( - nOldType, pOldFormat->GetLanguage() ) ) + short nOldType = pOldFormat->GetType() & ~NUMBERFORMAT_DEFINED; + if ( nOldType == NUMBERFORMAT_NUMBER || nOldType == NUMBERFORMAT_DATE || + nOldType == NUMBERFORMAT_TIME || nOldType == NUMBERFORMAT_LOGICAL ) { - bOverwrite = TRUE; // default of these types can be overwritten + if ( nOldIndex == pFormatter->GetStandardFormat( + nOldType, pOldFormat->GetLanguage() ) ) + { + bOverwrite = TRUE; // default of these types can be overwritten + } } } - } - if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL ) - { - bOverwrite = TRUE; // overwrite anything if boolean was detected - } + if ( !bOverwrite && pFormatter->GetType( nIndex ) == NUMBERFORMAT_LOGICAL ) + { + bOverwrite = TRUE; // overwrite anything if boolean was detected + } - if ( bOverwrite ) - { - ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT, - (UINT32) nIndex) ); - bNumFmtSet = TRUE; + if ( bOverwrite ) + { + ApplyAttr( nRow, SfxUInt32Item( ATTR_VALUE_FORMAT, + (UINT32) nIndex) ); + bNumFmtSet = TRUE; + } } } + else + { + // Only check if the string is a regular number. + const LocaleDataWrapper* pLocale = pFormatter->GetLocaleData(); + if (!pLocale) + break; + + LocaleDataItem aLocaleItem = pLocale->getLocaleItem(); + const OUString& rDecSep = aLocaleItem.decimalSeparator; + const OUString& rGroupSep = aLocaleItem.thousandSeparator; + if (rDecSep.getLength() != 1 || rGroupSep.getLength() != 1) + break; + + sal_Unicode dsep = rDecSep.getStr()[0]; + sal_Unicode gsep = rGroupSep.getStr()[0]; + + if (!ScStringUtil::parseSimpleNumber(rString, dsep, gsep, nVal)) + break; + + pNewCell = new ScValueCell(nVal); + } } - else // Text - pNewCell = new ScStringCell( rString ); + while (false); + + if (!pNewCell) + pNewCell = new ScStringCell(rString); } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 90eb1597023d..34420b3cd639 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2343,10 +2343,11 @@ void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, BOOL bForceT } -BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString ) +BOOL ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + SvNumberFormatter* pFormatter, bool bDetectNumberFormat ) { if ( ValidTab(nTab) && pTab[nTab] ) - return pTab[nTab]->SetString( nCol, nRow, nTab, rString ); + return pTab[nTab]->SetString( nCol, nRow, nTab, rString, pFormatter, bDetectNumberFormat ); else return FALSE; } diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index cf204765b3b0..2385ce67066c 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -846,10 +846,12 @@ void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pC } -BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString ) +BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString, + SvNumberFormatter* pFormatter, bool bDetectNumberFormat ) { if (ValidColRow(nCol,nRow)) - return aCol[nCol].SetString( nRow, nTabP, rString ); + return aCol[nCol].SetString( + nRow, nTabP, rString, pDocument->GetAddressConvention(), pFormatter, bDetectNumberFormat ); else return FALSE; } diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk index 8a4b1b44fd12..4e661abf14fc 100644 --- a/sc/source/core/tool/makefile.mk +++ b/sc/source/core/tool/makefile.mk @@ -107,6 +107,7 @@ SLOFILES = \ $(SLO)$/refupdat.obj \ $(SLO)$/scmatrix.obj \ $(SLO)$/sctictac.obj \ + $(SLO)$/stringutil.obj \ $(SLO)$/subtotal.obj \ $(SLO)$/token.obj \ $(SLO)$/unitconv.obj \ @@ -130,6 +131,7 @@ EXCEPTIONSFILES= \ $(SLO)$/lookupcache.obj \ $(SLO)$/prnsave.obj \ $(SLO)$/reftokenhelper.obj \ + $(SLO)$/stringutil.obj \ $(SLO)$/token.obj # [kh] POWERPC compiler problem diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx new file mode 100644 index 000000000000..e78c6edc88d7 --- /dev/null +++ b/sc/source/core/tool/stringutil.cxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: table.hxx,v $ + * $Revision: 1.35 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +// System - Includes ----------------------------------------------------- + +#include "stringutil.hxx" +#include "rtl/ustrbuf.hxx" + +using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +bool ScStringUtil::parseSimpleNumber( + const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal) +{ + OUStringBuffer aBuf; + sal_Int32 n = rStr.getLength(); + const sal_Unicode* p = rStr.getStr(); + sal_Int32 nPosDSep = -1, nPosGSep = -1; + for (sal_Int32 i = 0; i < n; ++i) + { + sal_Unicode c = p[i]; + if (sal_Unicode('0') <= c && c <= sal_Unicode('9')) + { + // this is a digit. + aBuf.append(c); + } + else if (c == dsep) + { + // this is a decimal separator. + + if (nPosDSep >= 0) + // a second decimal separator -> not a valid number. + return false; + if (nPosGSep >= 0 && i - nPosGSep != 4) + // the number has a group separator and the decimal sep is not + // positioned correctly. + return false; + + nPosDSep = i; + aBuf.append(c); + } + else if (c == gsep) + { + // this is a group (thousand) separator. + if (i == 0) + return false; + + if (nPosGSep >= 0 && i - nPosGSep != 4) + { + // this group separator is not positioned correctly relative + // to the last group separator. + return false; + } + + nPosGSep = i; + } + else if (c == sal_Unicode('-') || c == sal_Unicode('+')) + { + // A sign must be the first character if it's given. + if (i == 0) + aBuf.append(c); + else + return false; + } + else + return false; + } + + rVal = aBuf.makeStringAndClear().toDouble(); + return true; +} diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 5591e8ec993e..781f8709a8b8 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -63,13 +63,14 @@ //------------------------------------------------------------------------ FltError ScFormatFilterPluginImpl::ScImportHTML( SvStream &rStream, const String& rBaseURL, ScDocument *pDoc, - ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight ) + ScRange& rRange, double nOutputFactor, BOOL bCalcWidthHeight, SvNumberFormatter* pFormatter, + bool bConvertDate ) { ScHTMLImport aImp( pDoc, rBaseURL, rRange, bCalcWidthHeight ); FltError nErr = (FltError) aImp.Read( rStream, rBaseURL ); ScRange aR = aImp.GetRange(); rRange.aEnd = aR.aEnd; - aImp.WriteToDocument( TRUE, nOutputFactor ); + aImp.WriteToDocument( TRUE, nOutputFactor, pFormatter, bConvertDate ); return nErr; } @@ -137,9 +138,10 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const String& rName, const delete pRangeData; } -void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor ) +void ScHTMLImport::WriteToDocument( + BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate ) { - ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor ); + ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor, pFormatter, bConvertDate ); const ScHTMLParser* pParser = GetParser(); const ScHTMLTable* pGlobTable = pParser->GetGlobalTable(); diff --git a/sc/source/filter/inc/eeimport.hxx b/sc/source/filter/inc/eeimport.hxx index a601c7a20cbf..74c4e297e785 100644 --- a/sc/source/filter/inc/eeimport.hxx +++ b/sc/source/filter/inc/eeimport.hxx @@ -63,7 +63,9 @@ public: virtual ULONG Read( SvStream& rStream, const String& rBaseURL ); virtual ScRange GetRange() { return maRange; } virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, - double nOutputFactor = 1.0 ); + double nOutputFactor = 1.0, + SvNumberFormatter* pFormatter = NULL, + bool bConvertDate = true ); }; #endif diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 393775e721f7..3b9fac62ee92 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -522,7 +522,9 @@ class ScFormatFilterPluginImpl : public ScFormatFilterPlugin { virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos, const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, UINT32 nDifOption = SC_DIFOPT_EXCEL ); virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ); - virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE ); + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, + double nOutputFactor = 1.0, BOOL bCalcWidthHeight = TRUE, + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ); virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ); virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScRange& rRange, BOOL bCalcWidthHeight ); diff --git a/sc/source/filter/inc/htmlimp.hxx b/sc/source/filter/inc/htmlimp.hxx index d50998ba295c..eb5b5e41a164 100644 --- a/sc/source/filter/inc/htmlimp.hxx +++ b/sc/source/filter/inc/htmlimp.hxx @@ -45,7 +45,8 @@ public: virtual ~ScHTMLImport(); const ScHTMLParser* GetParser() const { return (ScHTMLParser*)mpParser; } - virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0 ); + virtual void WriteToDocument( BOOL bSizeColsRows = FALSE, double nOutputFactor = 1.0, + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ); static String GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrigName ); }; diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 9c28cf49d729..895ce471f53a 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -129,7 +129,7 @@ ULONG ScEEImport::Read( SvStream& rStream, const String& rBaseURL ) } -void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor ) +void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor, SvNumberFormatter* pFormatter, bool bConvertDate ) { ScProgress* pProgress = new ScProgress( mpDoc->GetDocumentShell(), ScGlobal::GetRscString( STR_LOAD_DOC ), mpParser->Count() ); @@ -150,7 +150,8 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor ) nLastMergedRow = SCROW_MAX; BOOL bHasGraphics = FALSE; ScEEParseEntry* pE; - SvNumberFormatter* pFormatter = mpDoc->GetFormatTable(); + if (!pFormatter) + pFormatter = mpDoc->GetFormatTable(); bool bNumbersEnglishUS = (pFormatter->GetLanguage() != LANGUAGE_ENGLISH_US); if (bNumbersEnglishUS) { @@ -335,7 +336,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor ) else if ( !pE->aSel.HasRange() ) { // maybe ALT text of IMG or similar - mpDoc->SetString( nCol, nRow, nTab, pE->aAltText ); + mpDoc->SetString( nCol, nRow, nTab, pE->aAltText, pFormatter ); // wenn SelRange komplett leer kann nachfolgender Text im gleichen Absatz liegen! } else @@ -380,7 +381,7 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor ) if (bNumbersEnglishUS && !bEnUsRecognized) mpDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aStr)); else - mpDoc->SetString( nCol, nRow, nTab, aStr ); + mpDoc->SetString( nCol, nRow, nTab, aStr, pFormatter, bConvertDate ); } } else diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 60b101d482c0..9690470ebfc8 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -74,6 +74,7 @@ #include "validate.hxx" //add for ScValidationDlg #include "validate.hrc" //add for ScValidationDlg #include "sortdlg.hxx" //add for ScSortDlg +#include "langchooser.hxx" #include "opredlin.hxx" //add for ScRedlineOptionsTabPage #include "tpcalc.hxx" //add for ScTpCalcOptions #include "tpprint.hxx" //add for ScTpPrintOptions @@ -115,6 +116,7 @@ IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); //add for ScNewScenarioDlg IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg +IMPL_ABSTDLG_BASE(AbstractScLangChooserDlg_Impl); IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg // AbstractTabDialog_Impl begin @@ -620,6 +622,20 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption pDlg->GetImportOptions(rOptions); } // add for AbstractScImportOptionsDlg_Impl end + +//add for AbstractScLangChooserDlg_Impl begin +LanguageType AbstractScLangChooserDlg_Impl::GetLanguageType() const +{ + return pDlg->getLanguageType(); +} + +bool AbstractScLangChooserDlg_Impl::IsDateConversionSet() const +{ + return pDlg->isDateConversionSet(); +} + +//add for AbstractScLangChooserDlg_Impl end + // =========================Factories for createdialog =================== //add for ScImportAsciiDlg begin @@ -642,6 +658,21 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg } // ScImportAsciiDlg end +AbstractScLangChooserDlg * ScAbstractDialogFactory_Impl::CreateScLangChooserDlg( Window* pParent, int nId ) +{ + ScLangChooserDlg* pDlg = NULL; + switch (nId) + { + case RID_SCDLG_LANG_CHOOSER: + pDlg = new ScLangChooserDlg(pParent); + break; + default: + ; + } + + return pDlg ? new AbstractScLangChooserDlg_Impl(pDlg) : NULL; +} + //add for ScAutoFormatDlg begin AbstractScAutoFormatDlg * ScAbstractDialogFactory_Impl::CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 40f6d3bee976..dfdcbcced3e9 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -64,6 +64,7 @@ class ScStringInputDlg; class ScImportOptionsDlg; class SfxTabDialog; class ScSortWarningDlg; +class ScLangChooserDlg; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ DialogClass* pDlg; \ @@ -343,6 +344,13 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add virtual void GetImportOptions( ScImportOptions& rOptions ) const; }; +class AbstractScLangChooserDlg_Impl : public AbstractScLangChooserDlg +{ + DECL_ABSTDLG_BASE( AbstractScLangChooserDlg_Impl, ScLangChooserDlg) + virtual LanguageType GetLanguageType() const; + virtual bool IsDateConversionSet() const; +}; + //add for ScAttrDlg , ScHFEditDlg, ScStyleDlg, ScSubTotalDlg, ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg class AbstractTabDialog_Impl : public SfxAbstractTabDialog { @@ -384,6 +392,8 @@ public: SvStream* pInStream, int nId, sal_Unicode cSep = '\t'); + virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ); + virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, const ScAutoFormatData* pSelFormatData, diff --git a/sc/source/ui/dbgui/langchooser.cxx b/sc/source/ui/dbgui/langchooser.cxx new file mode 100644 index 000000000000..6640afc3bd3f --- /dev/null +++ b/sc/source/ui/dbgui/langchooser.cxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + +//------------------------------------------------------------------------ + +#include "langchooser.hxx" +#include "langchooser.hrc" + +#include "scresid.hxx" +#include "vcl/window.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/svapp.hxx" + +ScLangChooserDlg::ScLangChooserDlg(Window* pParent) : + ModalDialog(pParent, ScResId(RID_SCDLG_LANG_CHOOSER)), + + maBtnOk(this, ScResId(BTN_OK)), + maBtnCancel(this, ScResId(BTN_CANCEL)), + maBtnHelp(this, ScResId(BTN_HELP)), + maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), + maRbAutomatic(this, ScResId(RB_AUTOMATIC)), + maRbCustom(this, ScResId(RB_CUSTOM)), + maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), + maFlOption(this, ScResId(FL_OPTION)), + maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) +{ + init(); +} + +ScLangChooserDlg::~ScLangChooserDlg() +{ +} + +short ScLangChooserDlg::Execute() +{ + return ModalDialog::Execute(); +} + +LanguageType ScLangChooserDlg::getLanguageType() const +{ + if (maRbAutomatic.IsChecked()) + return LANGUAGE_SYSTEM; + + return maLbCustomLang.GetSelectLanguage(); +} + +bool ScLangChooserDlg::isDateConversionSet() const +{ + return maBtnConvertDate.IsChecked(); +} + +void ScLangChooserDlg::init() +{ + Link aLink = LINK( this, ScLangChooserDlg, OKHdl ); + maBtnOk.SetClickHdl(aLink); + aLink = LINK( this, ScLangChooserDlg, RadioHdl ); + maRbAutomatic.SetClickHdl(aLink); + maRbCustom.SetClickHdl(aLink); + + maRbAutomatic.Check(true); + + maLbCustomLang.SetLanguageList( + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); + + LanguageType eLang = Application::GetSettings().GetLanguage(); + maLbCustomLang.SelectLanguage(eLang); + maLbCustomLang.Disable(); +} + +IMPL_LINK( ScLangChooserDlg, OKHdl, OKButton*, EMPTYARG ) +{ + EndDialog(RET_OK); + return 0; +} + +IMPL_LINK( ScLangChooserDlg, RadioHdl, RadioButton*, pBtn ) +{ + if (pBtn == &maRbAutomatic) + { + maLbCustomLang.Disable(); + } + else if (pBtn == &maRbCustom) + { + maLbCustomLang.Enable(); + } + return 0; +} + diff --git a/sc/source/ui/dbgui/langchooser.src b/sc/source/ui/dbgui/langchooser.src new file mode 100644 index 000000000000..313084299aba --- /dev/null +++ b/sc/source/ui/dbgui/langchooser.src @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "langchooser.hrc" + +ModalDialog RID_SCDLG_LANG_CHOOSER +{ + Text [ en-US ] = "Select Language" ; + Size = MAP_APPFONT ( 190 , 101 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + OutputSize = TRUE ; + + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 135, 6 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 135, 23 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 135, 43 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + FixedLine FL_CHOOSE_LANG + { + Pos = MAP_APPFONT( 6, 3 ) ; + Size = MAP_APPFONT( 125, 14 ) ; + + Text [ en-US ] = "Select the language to use for import" ; + }; + + RadioButton RB_AUTOMATIC + { + Pos = MAP_APPFONT( 12, 20 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Automatic" ; + }; + + RadioButton RB_CUSTOM + { + Pos = MAP_APPFONT( 12, 34 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Custom" ; + }; + + ListBox LB_CUSTOM_LANG + { + Pos = MAP_APPFONT( 20, 50 ) ; + Size = MAP_APPFONT( 100, 55 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + + FixedLine FL_OPTION + { + Pos = MAP_APPFONT( 6, 70 ); + Size = MAP_APPFONT( 125, 14 ); + + Text [ en-US ] = "Options" ; + }; + + CheckBox BTN_CONVERT_DATE + { + Pos = MAP_APPFONT( 12, 86 ); + Size = MAP_APPFONT( 125, 10 ); + TabStop = TRUE ; + + Text [ en-US ] = "Detect special numbers (such as dates)." ; + }; +}; + diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index 5d716552ca71..5bf847ef9a93 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -53,6 +53,7 @@ SLOFILES = \ $(SLO)$/pfiltdlg.obj \ $(SLO)$/dbnamdlg.obj \ $(SLO)$/expftext.obj \ + $(SLO)$/langchooser.obj \ $(SLO)$/subtdlg.obj \ $(SLO)$/tpsubt.obj \ $(SLO)$/fieldwnd.obj \ @@ -85,6 +86,7 @@ EXCEPTIONSFILES= \ SRS1NAME=$(TARGET) SRC1FILES = \ + langchooser.src \ pivot.src \ pvfundlg.src \ dpgroupdlg.src \ @@ -114,7 +116,8 @@ LIB1OBJFILES = \ $(SLO)$/csvruler.obj \ $(SLO)$/csvgrid.obj \ $(SLO)$/csvtablebox.obj \ - $(SLO)$/asciiopt.obj + $(SLO)$/asciiopt.obj \ + $(SLO)$/langchooser.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c62c2dc41fdf..ed7952db9695 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -129,6 +129,8 @@ #include using namespace com::sun::star; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; // STATIC DATA ----------------------------------------------------------- @@ -794,6 +796,34 @@ BOOL __EXPORT ScDocShell::LoadFrom( SfxMedium& rMedium ) return bRet; } +static void lcl_parseHtmlFilterOption(const OUString& rOption, LanguageType& rLang, bool& rDateConvert) +{ + OUStringBuffer aBuf; + OUString aTokens[2]; + sal_Int32 n = rOption.getLength(); + const sal_Unicode* p = rOption.getStr(); + sal_Int32 nTokenId = 0; + for (sal_Int32 i = 0; i < n; ++i) + { + const sal_Unicode c = p[i]; + if (c == sal_Unicode(' ')) + { + if (aBuf.getLength()) + aTokens[nTokenId++] = aBuf.makeStringAndClear(); + } + else + aBuf.append(c); + + if (nTokenId >= 2) + break; + } + + if (aBuf.getLength()) + aTokens[nTokenId] = aBuf.makeStringAndClear(); + + rLang = static_cast(aTokens[0].toInt32()); + rDateConvert = static_cast(aTokens[1].toInt32()); +} BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium ) { @@ -1167,12 +1197,24 @@ BOOL __EXPORT ScDocShell::ConvertFrom( SfxMedium& rMedium ) SvStream* pInStream = rMedium.GetInStream(); if (pInStream) { + LanguageType eLang = LANGUAGE_SYSTEM; + bool bDateConvert = false; + SfxItemSet* pSet = rMedium.GetItemSet(); + const SfxPoolItem* pItem; + if ( pSet && SFX_ITEM_SET == + pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) ) + { + String aFilterOption = (static_cast(pItem))->GetValue(); + lcl_parseHtmlFilterOption(aFilterOption, eLang, bDateConvert); + } + pInStream->Seek( 0 ); ScRange aRange; // HTML macht eigenes ColWidth/RowHeight CalcOutputFactor(); + SvNumberFormatter aNumFormatter(aDocument.GetServiceManager(), eLang); eError = ScFormatFilter::Get().ScImportHTML( *pInStream, rMedium.GetBaseURL(), &aDocument, aRange, - GetOutputFactor(), !bWebQuery ); + GetOutputFactor(), !bWebQuery, &aNumFormatter, bDateConvert ); if (eError != eERR_OK) { if (!GetError()) @@ -2149,6 +2191,11 @@ String ScDocShell::GetOwnFilterName() // static return String::CreateFromAscii(pFilterSc50); } +String ScDocShell::GetHtmlFilterName() +{ + return String::CreateFromAscii(pFilterHtml); +} + String ScDocShell::GetWebQueryFilterName() // static { return String::CreateFromAscii(pFilterHtmlWebQ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index a351c1f1b3fd..288ad755cb52 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2044,7 +2044,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin { virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress&, const CharSet, UINT32 ) RETURN_ERROR virtual FltError ScImportRTF( SvStream&, const String&, ScDocument*, ScRange& ) RETURN_ERROR - virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL ) RETURN_ERROR + virtual FltError ScImportHTML( SvStream&, const String&, ScDocument*, ScRange&, double, BOOL, SvNumberFormatter*, bool ) RETURN_ERROR virtual ScEEAbsImport *CreateRTFImport( ScDocument*, const ScRange& ) { return NULL; } virtual ScEEAbsImport *CreateHTMLImport( ScDocument*, const String&, const ScRange&, BOOL ) { return NULL; } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index b8b8d10f0c6e..85903014aa39 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -405,6 +405,7 @@ public: static ScDocShell* GetShellByNum( USHORT nDocNo ); static String GetOwnFilterName(); + static String GetHtmlFilterName(); static String GetWebQueryFilterName(); static String GetAsciiFilterName(); static String GetLotusFilterName(); diff --git a/sc/source/ui/inc/langchooser.hrc b/sc/source/ui/inc/langchooser.hrc new file mode 100644 index 000000000000..93c554ef5c45 --- /dev/null +++ b/sc/source/ui/inc/langchooser.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 + +#define FL_CHOOSE_LANG 4 +#define RB_AUTOMATIC 5 +#define RB_CUSTOM 6 +#define LB_CUSTOM_LANG 7 +#define FL_OPTION 8 +#define BTN_CONVERT_DATE 9 diff --git a/sc/source/ui/inc/langchooser.hxx b/sc/source/ui/inc/langchooser.hxx new file mode 100644 index 000000000000..4ff849fc2bc0 --- /dev/null +++ b/sc/source/ui/inc/langchooser.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_UI_LANGCHOOSER_HXX +#define SC_UI_LANGCHOOSER_HXX + +#include "vcl/dialog.hxx" +#include "vcl/button.hxx" +#include "vcl/fixed.hxx" +#include "i18npool/lang.h" +#include "svx/langbox.hxx" + +class ScLangChooserDlg : public ModalDialog +{ +public: + ScLangChooserDlg(Window* pParent); + virtual ~ScLangChooserDlg(); + + virtual short Execute(); + + LanguageType getLanguageType() const; + bool isDateConversionSet() const; + +private: + void init(); + +private: + OKButton maBtnOk; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + FixedLine maFlChooseLang; + + RadioButton maRbAutomatic; + RadioButton maRbCustom; + + SvxLanguageBox maLbCustomLang; + + FixedLine maFlOption; + + CheckBox maBtnConvertDate; + + DECL_LINK( OKHdl, OKButton* ); + + DECL_LINK( RadioHdl, RadioButton* ); +}; + + +#endif diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index eb415d1d3ff3..0fab38c8c1da 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -51,7 +51,12 @@ #include "sc.hrc" //CHINA001 #include "scabstdlg.hxx" //CHINA001 +#include "i18npool/lang.h" + +#include + using namespace ::com::sun::star; +using ::rtl::OUStringBuffer; //------------------------------------------------------------------------ @@ -146,6 +151,10 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL; String aFilterString( aFilterName ); + + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "ScAbstractFactory create fail!"); + if ( !bExport && aFilterString == ScDocShell::GetAsciiFilterName() ) { // ascii import is special... @@ -164,8 +173,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) pInStream = utl::UcbStreamHelper::CreateStream( xInputStream ); //CHINA001 ScImportAsciiDlg* pDlg = new ScImportAsciiDlg( NULL, aPrivDatName, pInStream, cAsciiDel ); - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 AbstractScImportAsciiDlg* pDlg = pFact->CreateScImportAsciiDlg( NULL, aPrivDatName, pInStream, RID_SCDLG_ASCII, cAsciiDel); DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 if ( pDlg->Execute() == RET_OK ) @@ -178,6 +185,24 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) delete pDlg; delete pInStream; } + else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) + { + // HTML import. + ::std::auto_ptr pDlg( + pFact->CreateScLangChooserDlg(NULL, RID_SCDLG_LANG_CHOOSER)); + + if (pDlg->Execute() == RET_OK) + { + LanguageType eLang = pDlg->GetLanguageType(); + OUStringBuffer aBuf; + + aBuf.append(String::CreateFromInt32(static_cast(eLang))); + aBuf.append(sal_Unicode(' ')); + aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0')); + aFilterOptions = aBuf.makeStringAndClear(); + nRet = ui::dialogs::ExecutableDialogResults::OK; + } + } else { sal_Bool bMultiByte = sal_True; @@ -249,8 +274,6 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) //CHINA001 &aOptions, &aTitle, bMultiByte, bDBEnc, //CHINA001 !bExport ); //CHINA001 - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 AbstractScImportOptionsDlg* pDlg = pFact->CreateScImportOptionsDlg( NULL, RID_SCDLG_IMPORTOPT, bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc, diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index 3fc0712cd996..a7c981a11a95 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -277,6 +277,7 @@ LIB8OBJFILES = \ $(SLO)$/dapidata.obj \ $(SLO)$/crdlg.obj \ $(SLO)$/scuiasciiopt.obj \ + $(SLO)$/langchooser.obj \ $(SLO)$/scuiautofmt.obj \ $(SLO)$/dpgroupdlg.obj \ $(SLO)$/editfield.obj -- cgit v1.2.3 From a742f365f721d0f9c32122dafb19ec30c04be03a Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:41:15 -0400 Subject: #i102141# initial port of patches from ooo-build, to implement a new HTML option dialog & associated changes in the core. --- filter/source/config/fragments/filters/HTML__StarCalc_.xcu | 4 ++-- filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu index f691055e00cf..01d88c818c09 100644 --- a/filter/source/config/fragments/filters/HTML__StarCalc_.xcu +++ b/filter/source/config/fragments/filters/HTML__StarCalc_.xcu @@ -1,6 +1,6 @@ - IMPORT EXPORT ALIEN - + IMPORT EXPORT ALIEN USEOPTIONS + com.sun.star.comp.Calc.FilterOptionsDialog 0 diff --git a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu index 1a3aa01e5717..8808adc140a1 100644 --- a/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu +++ b/filter/source/config/fragments/filters/calc_HTML_WebQuery.xcu @@ -1,6 +1,6 @@ - IMPORT ALIEN - + IMPORT ALIEN USEOPTIONS + com.sun.star.comp.Calc.FilterOptionsDialog 0 -- cgit v1.2.3 From a1bfe5a5d9abacf9e68f7b87d9b213d65efdbb75 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:43:32 -0400 Subject: #i97416# initial porting of patches from ooo-build, to implement modified csv import option dialog. --- sc/source/core/tool/stringutil.cxx | 42 ++++++- sc/source/ui/dbgui/asciiopt.cxx | 38 +++++- sc/source/ui/dbgui/asciiopt.hrc | 72 ++++++----- sc/source/ui/dbgui/asciiopt.src | 231 +++++++++++++++++++++--------------- sc/source/ui/dbgui/scuiasciiopt.cxx | 65 ++++++++-- sc/source/ui/docshell/impex.cxx | 62 ++++++---- sc/source/ui/inc/asciiopt.hxx | 8 +- sc/source/ui/inc/scuiasciiopt.hxx | 9 ++ 8 files changed, 355 insertions(+), 172 deletions(-) diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx index e78c6edc88d7..28a4bc6755c2 100644 --- a/sc/source/core/tool/stringutil.cxx +++ b/sc/source/core/tool/stringutil.cxx @@ -35,6 +35,7 @@ #include "stringutil.hxx" #include "rtl/ustrbuf.hxx" +#include "rtl/math.hxx" using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -42,17 +43,28 @@ using ::rtl::OUStringBuffer; bool ScStringUtil::parseSimpleNumber( const OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal) { + if (gsep == 0x00A0) + // unicode space to ascii space + gsep = 0x0020; + OUStringBuffer aBuf; sal_Int32 n = rStr.getLength(); const sal_Unicode* p = rStr.getStr(); sal_Int32 nPosDSep = -1, nPosGSep = -1; + sal_uInt32 nDigitCount = 0; + for (sal_Int32 i = 0; i < n; ++i) { sal_Unicode c = p[i]; + if (c == 0x00A0) + // unicode space to ascii space + c = 0x0020; + if (sal_Unicode('0') <= c && c <= sal_Unicode('9')) { // this is a digit. aBuf.append(c); + ++nDigitCount; } else if (c == dsep) { @@ -61,28 +73,35 @@ bool ScStringUtil::parseSimpleNumber( if (nPosDSep >= 0) // a second decimal separator -> not a valid number. return false; + if (nPosGSep >= 0 && i - nPosGSep != 4) // the number has a group separator and the decimal sep is not // positioned correctly. return false; nPosDSep = i; + nPosGSep = -1; aBuf.append(c); + nDigitCount = 0; } else if (c == gsep) { // this is a group (thousand) separator. + if (i == 0) + // not allowed as the first character. return false; - if (nPosGSep >= 0 && i - nPosGSep != 4) - { - // this group separator is not positioned correctly relative - // to the last group separator. + if (nPosDSep >= 0) + // not allowed after the decimal separator. + return false; + + if (nPosGSep >= 0 && nDigitCount != 3) + // must be exactly 3 digits since the last group separator. return false; - } nPosGSep = i; + nDigitCount = 0; } else if (c == sal_Unicode('-') || c == sal_Unicode('+')) { @@ -96,6 +115,17 @@ bool ScStringUtil::parseSimpleNumber( return false; } - rVal = aBuf.makeStringAndClear().toDouble(); + // finished parsing the number. + + if (nPosGSep >= 0 && nDigitCount != 3) + // must be exactly 3 digits since the last group separator. + return false; + + rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; + sal_Int32 nParseEnd = 0; + rVal = ::rtl::math::stringToDouble(aBuf.makeStringAndClear(), dsep, gsep, &eStatus, &nParseEnd); + if (eStatus != rtl_math_ConversionStatus_Ok) + return false; + return true; } diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index fbe13bbd0370..8af7e3e97b06 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -57,8 +57,10 @@ ScAsciiOptions::ScAsciiOptions() : aFieldSeps ( ';' ), bMergeFieldSeps ( FALSE ), bQuotedFieldAsText(false), + bDetectSpecialNumber(false), cTextSep ( cDefaultTextSep ), eCharSet ( gsl_getSystemTextEncoding() ), + eLang ( LANGUAGE_SYSTEM ), bCharSetSystem ( FALSE ), nStartRow ( 1 ), nInfoCount ( 0 ), @@ -73,8 +75,10 @@ ScAsciiOptions::ScAsciiOptions(const ScAsciiOptions& rOpt) : aFieldSeps ( rOpt.aFieldSeps ), bMergeFieldSeps ( rOpt.bMergeFieldSeps ), bQuotedFieldAsText(rOpt.bQuotedFieldAsText), + bDetectSpecialNumber(rOpt.bDetectSpecialNumber), cTextSep ( rOpt.cTextSep ), eCharSet ( rOpt.eCharSet ), + eLang ( rOpt.eLang ), bCharSetSystem ( rOpt.bCharSetSystem ), nStartRow ( rOpt.nStartRow ), nInfoCount ( rOpt.nInfoCount ) @@ -252,13 +256,20 @@ void ScAsciiOptions::ReadFromString( const String& rString ) eCharSet = ScGlobal::GetCharsetValue( aToken ); } + // Language + if (nCount >= 4) + { + aToken = rString.GetToken(3, ','); + eLang = static_cast(aToken.ToInt32()); + } + // // Startzeile // - if ( nCount >= 4 ) + if ( nCount >= 5 ) { - aToken = rString.GetToken(3,','); + aToken = rString.GetToken(4,','); nStartRow = aToken.ToInt32(); } @@ -266,12 +277,12 @@ void ScAsciiOptions::ReadFromString( const String& rString ) // Spalten-Infos // - if ( nCount >= 5 ) + if ( nCount >= 6 ) { delete[] pColStart; delete[] pColFormat; - aToken = rString.GetToken(4,','); + aToken = rString.GetToken(5,','); nSub = aToken.GetTokenCount('/'); nInfoCount = nSub / 2; if (nInfoCount) @@ -292,11 +303,18 @@ void ScAsciiOptions::ReadFromString( const String& rString ) } // Import quoted field as text. - if (nCount >= 6) + if (nCount >= 7) { - aToken = rString.GetToken(5, ','); + aToken = rString.GetToken(6, ','); bQuotedFieldAsText = aToken.EqualsAscii("true") ? true : false; } + + // Detect special nubmers. + if (nCount >= 8) + { + aToken = rString.GetToken(7, ','); + bDetectSpecialNumber = aToken.EqualsAscii("true") ? true : false; + } } @@ -347,6 +365,10 @@ String ScAsciiOptions::WriteToString() const aOutStr += ScGlobal::GetCharsetString( eCharSet ); aOutStr += ','; // Token-Ende + // Language + aOutStr += String::CreateFromInt32(eLang); + aOutStr += ','; + // // Startzeile // @@ -372,6 +394,10 @@ String ScAsciiOptions::WriteToString() const // Import quoted field as text. aOutStr += String::CreateFromAscii(bQuotedFieldAsText ? "true" : "false"); + aOutStr += ','; + + // Detect special nubmers. + aOutStr += String::CreateFromAscii(bDetectSpecialNumber ? "true" : "false"); return aOutStr; } diff --git a/sc/source/ui/dbgui/asciiopt.hrc b/sc/source/ui/dbgui/asciiopt.hrc index 3177a1be7b78..0264fd0fb4ec 100644 --- a/sc/source/ui/dbgui/asciiopt.hrc +++ b/sc/source/ui/dbgui/asciiopt.hrc @@ -29,32 +29,46 @@ ************************************************************************/ #include "sc.hrc" //#define RID_SCDLG_ASCII 256 -#define RB_SEPARATED 1 -#define RB_FIXED 2 -#define FT_CHARSET 3 -#define LB_CHARSET 4 -#define FL_SEPOPT 5 -#define FT_FIELDSEP 6 -#define CB_FIELDSEP 7 -#define FT_TEXTSEP 8 -#define CB_TEXTSEP 9 -#define FL_FIELDOPT 10 -#define FT_TYPE 12 -#define FT_PREVIEW 13 -#define LB_TYPE1 23 -#define FL_WIDTH 30 -#define BTN_OK 31 -#define BTN_CANCEL 32 -#define BTN_HELP 33 -#define CTR_TABLEBOX 41 -#define CKB_TAB 51 -#define CKB_SPACE 52 -#define CKB_SEMICOLON 53 -#define CKB_COMMA 54 -#define CKB_OTHER 55 -#define ED_OTHER 56 -#define FT_AT_ROW 59 -#define NF_AT_ROW 60 -#define CB_ASONCE 90 -#define CB_QUOTED_AS_TEXT 91 -#define STR_TEXTTOCOLUMNS 100 +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 + +#define FL_FIELDOPT 4 +#define FT_CHARSET 5 +#define LB_CHARSET 6 +#define FT_CUSTOMLANG 7 +#define LB_CUSTOMLANG 8 +#define FT_AT_ROW 9 +#define NF_AT_ROW 10 + +#define FL_SEPOPT 11 +#define RB_FIXED 12 +#define RB_SEPARATED 13 +#define CKB_TAB 14 +#define CKB_COMMA 15 +#define CKB_OTHER 16 +#define ED_OTHER 17 +#define CKB_SEMICOLON 18 +#define CKB_SPACE 19 +#define CB_ASONCE 20 +#define CB_TEXTSEP 21 +#define FT_TEXTSEP 22 + +#define FL_OTHER_OPTIONS 23 +#define CB_QUOTED_AS_TEXT 24 +#define CB_DETECT_SPECIAL_NUMBER 25 + +#define FL_WIDTH 26 +#define FT_TYPE 27 +#define LB_TYPE1 28 +#define CTR_TABLEBOX 29 +#define STR_TEXTTOCOLUMNS 30 + + + + + + + + + diff --git a/sc/source/ui/dbgui/asciiopt.src b/sc/source/ui/dbgui/asciiopt.src index a510471bb799..57c338f0f70d 100644 --- a/sc/source/ui/dbgui/asciiopt.src +++ b/sc/source/ui/dbgui/asciiopt.src @@ -34,55 +34,44 @@ ModalDialog RID_SCDLG_ASCII { OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 320 , 264 ) ; + Size = MAP_APPFONT ( 320 , 305 ) ; Text [ en-US ] = "Text Import" ; Moveable = TRUE ; - FixedLine FL_WIDTH - { - Pos = MAP_APPFONT ( 6 , 147 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Fields" ; - }; - FixedText FT_TYPE - { - Pos = MAP_APPFONT ( 12 , 160 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Column t~ype"; - }; - ListBox LB_TYPE1 + + OKButton BTN_OK { - Pos = MAP_APPFONT ( 76 , 158 ) ; - Size = MAP_APPFONT ( 60 , 68 ) ; + Pos = MAP_APPFONT ( 264 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; - DropDown = TRUE ; + DefButton = TRUE ; }; - FixedLine FL_SEPOPT + CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Separator options" ; + Pos = MAP_APPFONT ( 264 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; }; - RadioButton RB_FIXED + HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 243 , 10 ) ; - Text [ en-US ] = "~Fixed width" ; + Pos = MAP_APPFONT ( 264 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; - RadioButton RB_SEPARATED + + FixedLine FL_FIELDOPT { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 243 , 10 ) ; - Text [ en-US ] = "~Separated by" ; - TabStop = TRUE ; - Check = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Import" ; }; + FixedText FT_CHARSET { Pos = MAP_APPFONT ( 12 , 16 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; Text [ en-US ] = "Ch~aracter set" ; }; + ListBox LB_CHARSET { Pos = MAP_APPFONT ( 76 , 14 ) ; @@ -91,75 +80,81 @@ ModalDialog RID_SCDLG_ASCII DropDown = TRUE ; Sort = TRUE; }; - FixedLine FL_FIELDOPT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 252 , 8 ) ; - Text [ en-US ] = "Import" ; - }; - FixedText FT_TEXTSEP + + FixedText FT_CUSTOMLANG { - Pos = MAP_APPFONT ( 156 , 114 ) ; + Pos = MAP_APPFONT ( 12 , 32 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "Te~xt delimiter" ; + Text [ en-US ] = "Language" ; }; - ComboBox CB_TEXTSEP + + ListBox LB_CUSTOMLANG { - Pos = MAP_APPFONT ( 218 , 112 ) ; - Size = MAP_APPFONT ( 37 , 94 ) ; + Pos = MAP_APPFONT ( 76 , 30 ) ; + Size = MAP_APPFONT ( 130 , 61 ) ; TabStop = TRUE ; DropDown = TRUE ; + Sort = TRUE; }; - OKButton BTN_OK + + FixedText FT_AT_ROW { - Pos = MAP_APPFONT ( 264 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "From ro~w" ; }; - CancelButton BTN_CANCEL + + NumericField NF_AT_ROW { - Pos = MAP_APPFONT ( 264 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Border = TRUE ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 76 , 46 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; TabStop = TRUE ; + Spin = TRUE ; + Repeat = TRUE ; + Minimum = 1 ; }; - HelpButton BTN_HELP + + FixedLine FL_SEPOPT { - Pos = MAP_APPFONT ( 264 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; + Pos = MAP_APPFONT ( 6 , 63 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Separator options" ; }; - CheckBox CKB_TAB + RadioButton RB_FIXED { - Pos = MAP_APPFONT ( 20 , 86 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; + Pos = MAP_APPFONT ( 12 , 75 ) ; + Size = MAP_APPFONT ( 243 , 10 ) ; + Text [ en-US ] = "~Fixed width" ; TabStop = TRUE ; - Text [ en-US ] = "~Tab" ; }; - CheckBox CKB_SEMICOLON + RadioButton RB_SEPARATED { - Pos = MAP_APPFONT ( 20 , 99 ) ; - Size = MAP_APPFONT ( 68 , 10 ) ; + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 243 , 10 ) ; + Text [ en-US ] = "~Separated by" ; TabStop = TRUE ; - Text [ en-US ] = "S~emicolon" ; + Check = TRUE ; }; - CheckBox CKB_COMMA + + CheckBox CKB_TAB { - Pos = MAP_APPFONT ( 92 , 86 ) ; + Pos = MAP_APPFONT ( 20 , 102 ) ; Size = MAP_APPFONT ( 68 , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "~Comma" ; + Text [ en-US ] = "~Tab" ; }; - CheckBox CKB_SPACE + CheckBox CKB_COMMA { - Pos = MAP_APPFONT ( 92 , 99 ) ; + Pos = MAP_APPFONT ( 92 , 102 ) ; Size = MAP_APPFONT ( 68 , 10 ) ; TabStop = TRUE ; - Text [ en-US ] = "S~pace" ; + Text [ en-US ] = "~Comma" ; }; CheckBox CKB_OTHER { - Pos = MAP_APPFONT ( 164 , 86 ) ; + Pos = MAP_APPFONT ( 164 , 102 ) ; Size = MAP_APPFONT ( 50 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Other" ; @@ -167,50 +162,100 @@ ModalDialog RID_SCDLG_ASCII Edit ED_OTHER { Border = TRUE ; - Pos = MAP_APPFONT ( 218 , 84 ) ; + Pos = MAP_APPFONT ( 218 , 100 ) ; Size = MAP_APPFONT ( 37 , 12 ) ; TabStop = TRUE ; MaxTextLength = 10 ; }; - FixedText FT_AT_ROW - { - Pos = MAP_APPFONT ( 12 , 32 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "From ro~w" ; - }; - NumericField NF_AT_ROW + + CheckBox CKB_SEMICOLON { - Border = TRUE ; - SVLook = TRUE ; - Pos = MAP_APPFONT ( 76 , 30 ) ; - Size = MAP_APPFONT ( 30 , 12 ) ; + Pos = MAP_APPFONT ( 20 , 115 ) ; + Size = MAP_APPFONT ( 68 , 10 ) ; TabStop = TRUE ; - Spin = TRUE ; - Repeat = TRUE ; - Minimum = 1 ; + Text [ en-US ] = "S~emicolon" ; }; - Control CTR_TABLEBOX + CheckBox CKB_SPACE { - HelpId = HID_SC_ASCII_TABCTR ; - Border = TRUE ; - DialogControl = TRUE ; - Pos = MAP_APPFONT ( 12 , 176 ) ; - Size = MAP_APPFONT ( 243 , 82 ) ; + Pos = MAP_APPFONT ( 92 , 115 ) ; + Size = MAP_APPFONT ( 68 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "S~pace" ; }; + CheckBox CB_ASONCE { - Pos = MAP_APPFONT ( 20 , 114 ) ; + Pos = MAP_APPFONT ( 20 , 130 ) ; Size = MAP_APPFONT ( 130 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Merge ~delimiters" ; }; + + ComboBox CB_TEXTSEP + { + Pos = MAP_APPFONT ( 218 , 128 ) ; + Size = MAP_APPFONT ( 37 , 94 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TEXTSEP + { + Pos = MAP_APPFONT ( 156 , 130 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Te~xt delimiter" ; + }; + + FixedLine FL_OTHER_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 146 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Other options" ; + }; + CheckBox CB_QUOTED_AS_TEXT { - Pos = MAP_APPFONT ( 20 , 129 ) ; + Pos = MAP_APPFONT ( 20 , 158 ) ; Size = MAP_APPFONT ( 130 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Quoted field as text" ; }; + + CheckBox CB_DETECT_SPECIAL_NUMBER + { + Pos = MAP_APPFONT ( 20 , 171 ) ; + Size = MAP_APPFONT ( 130 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Detect special numbers" ; + }; + + FixedLine FL_WIDTH + { + Pos = MAP_APPFONT ( 6 , 187 ) ; + Size = MAP_APPFONT ( 252 , 8 ) ; + Text [ en-US ] = "Fields" ; + }; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 12 , 200 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Column t~ype"; + }; + ListBox LB_TYPE1 + { + Pos = MAP_APPFONT ( 76 , 198 ) ; + Size = MAP_APPFONT ( 60 , 68 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Control CTR_TABLEBOX + { + HelpId = HID_SC_ASCII_TABCTR ; + Border = TRUE ; + DialogControl = TRUE ; + Pos = MAP_APPFONT ( 12 , 216 ) ; + Size = MAP_APPFONT ( 243 , 82 ) ; + }; + String STR_TEXTTOCOLUMNS { Text [ en-US ] = "Text to Columns" ; diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 9d782347b5ea..0136e29ccc91 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -69,6 +69,8 @@ using namespace com::sun::star::uno; #define TEXT_SEPARATORS "TextSeparators" #define MERGE_DELIMITERS "MergeDelimiters" #define QUOTED_AS_TEXT "QuotedFieldAsText" +#define DETECT_SPECIAL_NUM "DetectSpecialNumbers" +#define LANGUAGE "Language" #define SEP_PATH "Office.Calc/Dialogs/CSVImport" // ============================================================================ @@ -119,12 +121,13 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList ) } static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparators, - bool &bMergeDelimiters, bool& bQuotedAsText, bool &bFixedWidth, - sal_Int32 &nFromRow, sal_Int32 &nCharSet ) + bool &bMergeDelimiters, bool& bQuotedAsText, bool& bDetectSpecialNum, + bool &bFixedWidth, sal_Int32 &nFromRow, sal_Int32 &nCharSet, + sal_Int32& nLanguage ) { SequenceaValues; const Any *pProperties; - Sequence aNames(7); + Sequence aNames(9); OUString* pNames = aNames.getArray(); ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); @@ -135,6 +138,8 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato pNames[4] = OUString::createFromAscii( FROM_ROW ); pNames[5] = OUString::createFromAscii( CHAR_SET ); pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT ); + pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM ); + pNames[8] = OUString::createFromAscii( LANGUAGE ); aValues = aItem.GetProperties( aNames ); pProperties = aValues.getConstArray(); if( pProperties[1].hasValue() ) @@ -157,16 +162,23 @@ static void load_Separators( OUString &sFieldSeparators, OUString &sTextSeparato if ( pProperties[6].hasValue() ) pProperties[6] >>= bQuotedAsText; + + if ( pProperties[7].hasValue() ) + pProperties[7] >>= bDetectSpecialNum; + + if ( pProperties[8].hasValue() ) + pProperties[8] >>= nLanguage; } -static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText, - bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet ) +static void save_Separators( + String maSeparators, String maTxtSep, bool bMergeDelimiters, bool bQuotedAsText, + bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow, sal_Int32 nCharSet, sal_Int32 nLanguage ) { OUString sFieldSeparators = OUString( maSeparators ); OUString sTextSeparators = OUString( maTxtSep ); Sequence aValues; Any *pProperties; - Sequence aNames(7); + Sequence aNames(9); OUString* pNames = aNames.getArray(); ScLinkConfigItem aItem( OUString::createFromAscii( SEP_PATH ) ); @@ -177,6 +189,8 @@ static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDe pNames[4] = OUString::createFromAscii( FROM_ROW ); pNames[5] = OUString::createFromAscii( CHAR_SET ); pNames[6] = OUString::createFromAscii( QUOTED_AS_TEXT ); + pNames[7] = OUString::createFromAscii( DETECT_SPECIAL_NUM ); + pNames[8] = OUString::createFromAscii( LANGUAGE ); aValues = aItem.GetProperties( aNames ); pProperties = aValues.getArray(); pProperties[1] <<= sFieldSeparators; @@ -186,6 +200,8 @@ static void save_Separators( String maSeparators, String maTxtSep, bool bMergeDe pProperties[4] <<= nFromRow; pProperties[5] <<= nCharSet; pProperties[6] <<= static_cast(bQuotedAsText); + pProperties[7] <<= static_cast(bDetectSpecialNum); + pProperties[8] <<= nLanguage; aItem.PutProperties(aNames, aValues); } @@ -204,6 +220,8 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aFlFieldOpt ( this, ScResId( FL_FIELDOPT ) ), aFtCharSet ( this, ScResId( FT_CHARSET ) ), aLbCharSet ( this, ScResId( LB_CHARSET ) ), + aFtCustomLang( this, ScResId( FT_CUSTOMLANG ) ), + aLbCustomLang( this, ScResId( LB_CUSTOMLANG ) ), aFtRow ( this, ScResId( FT_AT_ROW ) ), aNfRow ( this, ScResId( NF_AT_ROW ) ), @@ -219,7 +237,10 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aCkbOther ( this, ScResId( CKB_OTHER ) ), aEdOther ( this, ScResId( ED_OTHER ) ), aCkbAsOnce ( this, ScResId( CB_ASONCE) ), + aFlOtherOpt ( this, ScResId( FL_OTHER_OPTIONS ) ), + aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ), + aCkbDetectNumber( this, ScResId(CB_DETECT_SPECIAL_NUMBER) ), aFtTextSep ( this, ScResId( FT_TEXTSEP ) ), aCbTextSep ( this, ScResId( CB_TEXTSEP ) ), @@ -260,18 +281,22 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, bool bMergeDelimiters = false; bool bFixedWidth = false; bool bQuotedFieldAsText = true; + bool bDetectSpecialNum = false; sal_Int32 nFromRow = 1; sal_Int32 nCharSet = -1; + sal_Int32 nLanguage = 0; if (mbFileImport) // load separators only when importing csv files. load_Separators (sFieldSeparators, sTextSeparators, bMergeDelimiters, - bQuotedFieldAsText, bFixedWidth, nFromRow, nCharSet); + bQuotedFieldAsText, bDetectSpecialNum, bFixedWidth, nFromRow, nCharSet, nLanguage); maFieldSeparators = String(sFieldSeparators); if( bMergeDelimiters ) aCkbAsOnce.Check(); if (bQuotedFieldAsText) aCkbQuotedAsText.Check(); + if (bDetectSpecialNum) + aCkbDetectNumber.Check(); if( bFixedWidth ) aRbFixed.Check(); if( nFromRow != 1 ) @@ -344,6 +369,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aCkbComma.SetClickHdl( aSeparatorHdl ); aCkbAsOnce.SetClickHdl( aSeparatorHdl ); aCkbQuotedAsText.SetClickHdl( aSeparatorHdl ); + aCkbDetectNumber.SetClickHdl( aSeparatorHdl ); aCkbSpace.SetClickHdl( aSeparatorHdl ); aCkbOther.SetClickHdl( aSeparatorHdl ); aEdOther.SetModifyHdl( aSeparatorHdl ); @@ -363,6 +389,11 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, SetSelectedCharSet(); aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) ); + aLbCustomLang.SetLanguageList( + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); + aLbCustomLang.InsertLanguage(LANGUAGE_SYSTEM); + aLbCustomLang.SelectLanguage(static_cast(nLanguage), true); + // *** column type ListBox *** xub_StrLen nCount = aColumnUser.GetTokenCount(); for (xub_StrLen i=0; i(aLbCustomLang.GetSelectLanguage()) ); delete[] mpRowPosArray; } @@ -473,6 +505,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) { rOpt.SetCharSet( meCharSet ); rOpt.SetCharSetSystem( mbCharSetSystem ); + rOpt.SetLanguage(aLbCustomLang.GetSelectLanguage()); rOpt.SetFixedLen( aRbFixed.IsChecked() ); rOpt.SetStartRow( (long)aNfRow.GetValue() ); maTableBox.FillColumnData( rOpt ); @@ -480,9 +513,11 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) { rOpt.SetFieldSeps( GetSeparators() ); rOpt.SetMergeSeps( aCkbAsOnce.IsChecked() ); - rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked()); rOpt.SetTextSep( lcl_CharFromCombo( aCbTextSep, aTextSepList ) ); } + + rOpt.SetQuotedAsText(aCkbQuotedAsText.IsChecked()); + rOpt.SetDetectSpecialNumber(aCkbDetectNumber.IsChecked()); } void ScImportAsciiDlg::SetTextToColumnsMode() @@ -490,12 +525,19 @@ void ScImportAsciiDlg::SetTextToColumnsMode() SetText( maStrTextToColumns ); aFtCharSet.Disable(); aLbCharSet.Disable(); + aFtCustomLang.Disable(); + aLbCustomLang.SelectLanguage(LANGUAGE_SYSTEM); + aLbCustomLang.Disable(); aFtRow.Disable(); aNfRow.Disable(); - // Quoted field as text option is not used for text to columns mode. + // Quoted field as text option is not used for text-to-columns mode. aCkbQuotedAsText.Check(false); aCkbQuotedAsText.Disable(); + + // Always detect special numbers for text-to-columns mode. + aCkbDetectNumber.Check(); + aCkbDetectNumber.Disable(); } void ScImportAsciiDlg::SetSelectedCharSet() @@ -532,7 +574,6 @@ void ScImportAsciiDlg::SetupSeparatorCtrls() aCkbOther.Enable( bEnable ); aEdOther.Enable( bEnable ); aCkbAsOnce.Enable( bEnable ); - aCkbQuotedAsText.Enable( bEnable ); aFtTextSep.Enable( bEnable ); aCbTextSep.Enable( bEnable ); } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 288ad755cb52..5b70cf2f02ae 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -907,6 +907,7 @@ BOOL ScImportExport::Text2Doc( SvStream& rStrm ) static bool lcl_PutString( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rStr, BYTE nColFormat, + SvNumberFormatter* pFormatter, bool bDetectNumFormat, ::utl::TransliterationWrapper& rTransliteration, CalendarWrapper& rCalendar, ::utl::TransliterationWrapper* pSecondTransliteration, CalendarWrapper* pSecondCalendar ) { @@ -924,10 +925,10 @@ static bool lcl_PutString( { //! SetString mit Extra-Flag ??? - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - sal_uInt32 nEnglish = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US); + SvNumberFormatter* pDocFormatter = pDoc->GetFormatTable(); + sal_uInt32 nEnglish = pDocFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US); double fVal; - if ( pFormatter->IsNumberFormat( rStr, nEnglish, fVal ) ) + if ( pDocFormatter->IsNumberFormat( rStr, nEnglish, fVal ) ) { // Zahlformat wird nicht auf englisch gesetzt pDoc->SetValue( nCol, nRow, nTab, fVal ); @@ -1063,9 +1064,9 @@ static bool lcl_PutString( } } - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pDocFormatter = pDoc->GetFormatTable(); if ( nYear < 100 ) - nYear = pFormatter->ExpandTwoDigitYear( nYear ); + nYear = pDocFormatter->ExpandTwoDigitYear( nYear ); CalendarWrapper* pCalendar = (bSecondCal ? pSecondCalendar : &rCalendar); sal_Int16 nNumMonths = pCalendar->getNumberOfMonthsInYear(); @@ -1101,7 +1102,7 @@ static bool lcl_PutString( pCalendar->setValue( i18n::CalendarFieldIndex::MILLISECOND, nMilli ); if ( pCalendar->isValid() ) { - double fDiff = DateTime(*pFormatter->GetNullDate()) - + double fDiff = DateTime(*pDocFormatter->GetNullDate()) - pCalendar->getEpochStart(); // #i14974# must use getLocalDateTime to get the same // date values as set above @@ -1113,10 +1114,10 @@ static bool lcl_PutString( LanguageType eDocLang = eLatin; //! which language for date formats? short nType = (nFound > 3 ? NUMBERFORMAT_DATETIME : NUMBERFORMAT_DATE); - ULONG nFormat = pFormatter->GetStandardFormat( nType, eDocLang ); + ULONG nFormat = pDocFormatter->GetStandardFormat( nType, eDocLang ); // maybe there is a special format including seconds or milliseconds if (nFound > 5) - nFormat = pFormatter->GetStandardFormat( fDays, nFormat, nType, eDocLang); + nFormat = pDocFormatter->GetStandardFormat( fDays, nFormat, nType, eDocLang); pDoc->PutCell( nCol, nRow, nTab, new ScValueCell(fDays), nFormat, FALSE ); @@ -1128,7 +1129,7 @@ static bool lcl_PutString( // Standard or date not determined -> SetString / EditCell if( rStr.Search( _LF ) == STRING_NOTFOUND ) - pDoc->SetString( nCol, nRow, nTab, rStr ); + pDoc->SetString( nCol, nRow, nTab, rStr, pFormatter, bDetectNumFormat ); else { bMultiLine = true; @@ -1138,7 +1139,7 @@ static bool lcl_PutString( } -String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext ) +String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext, bool& rbIsQuoted ) { xub_StrLen nLen = rLine.Len(); if (nNext > nLen) @@ -1152,7 +1153,11 @@ String lcl_GetFixed( const String& rLine, xub_StrLen nStart, xub_StrLen nNext ) while ( nSpace > nStart && pStr[nSpace-1] == ' ' ) --nSpace; - return rLine.Copy( nStart, nSpace-nStart ); + rbIsQuoted = (pStr[nStart] == sal_Unicode('"') && pStr[nSpace-1] == sal_Unicode('"')); + if (rbIsQuoted) + return rLine.Copy(nStart+1, nSpace-nStart-2); + else + return rLine.Copy(nStart, nSpace-nStart); } BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) @@ -1185,9 +1190,9 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) const BYTE* pColFormat = pExtOptions->GetColFormat(); long nSkipLines = pExtOptions->GetStartRow(); - LanguageType eLatin, eCjk, eCtl; - pDoc->GetLanguage( eLatin, eCjk, eCtl ); - LanguageType eDocLang = eLatin; //! which language for date formats? + LanguageType eDocLang = pExtOptions->GetLanguage(); + SvNumberFormatter aNumFormatter(pDoc->GetServiceManager(), eDocLang); + bool bDetectNumFormat = pExtOptions->IsDetectSpecialNumber(); // For date recognition ::utl::TransliterationWrapper aTransliteration( @@ -1229,6 +1234,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) // survives the toggle of bDetermineRange down at the end of the do{} loop. bool bRangeIsDetermined = bDetermineRange; + bool bQuotedAsText = pExtOptions && pExtOptions->IsQuotedAsText(); + ULONG nOriginalStreamPos = rStrm.Tell(); do @@ -1250,7 +1257,8 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) // SC_COL_SKIP. for ( i=0; i MAXCOL) bOverflow = TRUE; // display warning on import @@ -1258,11 +1266,15 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) { xub_StrLen nStart = pColStart[i]; xub_StrLen nNext = ( i+1 < nInfoCount ) ? pColStart[i+1] : nLineLen; - aCell = lcl_GetFixed( aLine, nStart, nNext ); - bMultiLine |= lcl_PutString( pDoc, nCol, nRow, - nTab, aCell, pColFormat[i], - aTransliteration, aCalendar, - pEnglishTransliteration, pEnglishCalendar); + bool bIsQuoted = false; + aCell = lcl_GetFixed( aLine, nStart, nNext, bIsQuoted ); + if (bIsQuoted && bQuotedAsText) + nFmt = SC_COL_TEXT; + + bMultiLine |= lcl_PutString( + pDoc, nCol, nRow, nTab, aCell, nFmt, + &aNumFormatter, bDetectNumFormat, aTransliteration, aCalendar, + pEnglishTransliteration, pEnglishCalendar); } ++nCol; } @@ -1298,13 +1310,13 @@ BOOL ScImportExport::ExtText2Doc( SvStream& rStrm ) bOverflow = TRUE; // display warning on import else if (!bDetermineRange) { - if (bIsQuoted && pExtOptions && pExtOptions->IsQuotedAsText()) + if (bIsQuoted && bQuotedAsText) nFmt = SC_COL_TEXT; - bMultiLine |= lcl_PutString( pDoc, nCol, nRow, - nTab, aCell, nFmt, aTransliteration, - aCalendar, pEnglishTransliteration, - pEnglishCalendar); + bMultiLine |= lcl_PutString( + pDoc, nCol, nRow, nTab, aCell, nFmt, + &aNumFormatter, bDetectNumFormat, aTransliteration, + aCalendar, pEnglishTransliteration, pEnglishCalendar); } ++nCol; } diff --git a/sc/source/ui/inc/asciiopt.hxx b/sc/source/ui/inc/asciiopt.hxx index 40c95f0f0702..54885eae2ccd 100644 --- a/sc/source/ui/inc/asciiopt.hxx +++ b/sc/source/ui/inc/asciiopt.hxx @@ -55,7 +55,7 @@ #include #include #include "csvtablebox.hxx" - +#include "i18npool/lang.h" // ============================================================================ @@ -66,8 +66,10 @@ private: String aFieldSeps; BOOL bMergeFieldSeps; bool bQuotedFieldAsText; + bool bDetectSpecialNumber; sal_Unicode cTextSep; CharSet eCharSet; + LanguageType eLang; BOOL bCharSetSystem; long nStartRow; USHORT nInfoCount; @@ -95,12 +97,14 @@ public: const String& GetFieldSeps() const { return aFieldSeps; } BOOL IsMergeSeps() const { return bMergeFieldSeps; } bool IsQuotedAsText() const { return bQuotedFieldAsText; } + bool IsDetectSpecialNumber() const { return bDetectSpecialNumber; } sal_Unicode GetTextSep() const { return cTextSep; } BOOL IsFixedLen() const { return bFixedLen; } USHORT GetInfoCount() const { return nInfoCount; } const xub_StrLen* GetColStart() const { return pColStart; } const BYTE* GetColFormat() const { return pColFormat; } long GetStartRow() const { return nStartRow; } + LanguageType GetLanguage() const { return eLang; } void SetCharSet( CharSet eNew ) { eCharSet = eNew; } void SetCharSetSystem( BOOL bSet ) { bCharSetSystem = bSet; } @@ -108,8 +112,10 @@ public: void SetFieldSeps( const String& rStr ) { aFieldSeps = rStr; } void SetMergeSeps( BOOL bSet ) { bMergeFieldSeps = bSet; } void SetQuotedAsText(bool bSet) { bQuotedFieldAsText = bSet; } + void SetDetectSpecialNumber(bool bSet) { bDetectSpecialNumber = bSet; } void SetTextSep( sal_Unicode c ) { cTextSep = c; } void SetStartRow( long nRow) { nStartRow= nRow; } + void SetLanguage(LanguageType e) { eLang = e; } void SetColInfo( USHORT nCount, const xub_StrLen* pStart, const BYTE* pFormat ); void SetColumnInfo( const ScCsvExpDataVec& rDataVec ); diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 33bc48b7122a..82963d2904af 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -35,6 +35,8 @@ #include "asciiopt.hxx" +#include "svx/langbox.hxx" + // ============================================================================ class ScImportAsciiDlg : public ModalDialog @@ -49,6 +51,8 @@ class ScImportAsciiDlg : public ModalDialog FixedLine aFlFieldOpt; FixedText aFtCharSet; SvxTextEncodingBox aLbCharSet; + FixedText aFtCustomLang; + SvxLanguageBox aLbCustomLang; FixedText aFtRow; NumericField aNfRow; @@ -64,7 +68,12 @@ class ScImportAsciiDlg : public ModalDialog CheckBox aCkbOther; Edit aEdOther; CheckBox aCkbAsOnce; + + FixedLine aFlOtherOpt; + CheckBox aCkbQuotedAsText; + CheckBox aCkbDetectNumber; + FixedText aFtTextSep; ComboBox aCbTextSep; -- cgit v1.2.3 From 0b44c19403edebdb3d1f9f24fcfa1bc6d256d58c Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 11:43:32 -0400 Subject: #i97416# initial porting of patches from ooo-build, to implement modified csv import option dialog. --- officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 560ca9518c9b..ff5a13c32fd2 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1044,6 +1044,22 @@ true + + + kyoshida + If true, Calc tries to detect special number format, such as date and scientific notation. + + + false + + + + kyoshida + Language to use for CSV import. This determines how the numbers are parsed. + + + 0 + muthusuba -- cgit v1.2.3 From 23d5998c325a7999f75448e70b315d12b639abc6 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 27 Jul 2009 14:57:34 -0400 Subject: fixed build breakages. sc module is now buildable. --- sc/inc/optutil.hxx | 7 ++++--- sc/inc/sc.hrc | 6 ++---- sc/source/core/tool/optutil.cxx | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sc/inc/optutil.hxx b/sc/inc/optutil.hxx index a00b3495d766..15cc8ba79bb7 100644 --- a/sc/inc/optutil.hxx +++ b/sc/inc/optutil.hxx @@ -33,6 +33,7 @@ #include #include +#include "scdllapi.h" class ScOptionsUtil @@ -44,13 +45,13 @@ public: // ConfigItem for classes that use items from several sub trees -class ScLinkConfigItem : public utl::ConfigItem +class SC_DLLPUBLIC ScLinkConfigItem : public utl::ConfigItem { Link aCommitLink; public: - ScLinkConfigItem( const rtl::OUString rSubTree ); - ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode ); + ScLinkConfigItem( const rtl::OUString& rSubTree ); + ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode ); void SetCommitLink( const Link& rLink ); virtual void Notify( const com::sun::star::uno::Sequence& aPropertyNames ); diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index ba3420f1d9c3..baf94c23748f 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1635,8 +1635,9 @@ #define RID_SCDLG_DOCPROTECTION (SC_DIALOGS_START + 149) #define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150) #define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151) +#define RID_SCDLG_LANG_CHOOSER (SC_DIALOGS_START + 152) -#define SC_DIALOGS_END (SC_DIALOGS_START + 152) +#define SC_DIALOGS_END (SC_DIALOGS_START + 153) #ifndef STD_MASKCOLOR #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } @@ -1650,9 +1651,6 @@ #define MID_3 3 #define MID_4 4 -// Language chooser for text import filters. -#define RID_SCDLG_LANG_CHOOSER (SC_OOO_BUILD_START + 12) - #endif diff --git a/sc/source/core/tool/optutil.cxx b/sc/source/core/tool/optutil.cxx index 3f3d2886dfa7..1a6ce33a3c6d 100644 --- a/sc/source/core/tool/optutil.cxx +++ b/sc/source/core/tool/optutil.cxx @@ -54,12 +54,12 @@ BOOL ScOptionsUtil::IsMetricSystem() //------------------------------------------------------------------ -ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree ) : +ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree ) : ConfigItem( rSubTree ) { } -ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString rSubTree, sal_Int16 nMode ) : +ScLinkConfigItem::ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode ) : ConfigItem( rSubTree, nMode ) { } -- cgit v1.2.3 -- cgit v1.2.3 From feeb99de89fc888b9397ddca882d121bdec2bef4 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 6 Aug 2009 14:58:06 -0400 Subject: Change the identity of the import option dialog. Change the identity of the import option dialog from lang chooser to text import options, since the dialog now contains more than just the language option. --- sc/inc/sc.hrc | 2 +- sc/inc/scabstdlg.hxx | 4 +- sc/source/ui/attrdlg/scdlgfact.cxx | 18 ++--- sc/source/ui/attrdlg/scdlgfact.hxx | 8 +-- sc/source/ui/dbgui/makefile.mk | 6 +- sc/source/ui/dbgui/textimportoptions.cxx | 120 +++++++++++++++++++++++++++++++ sc/source/ui/dbgui/textimportoptions.src | 112 +++++++++++++++++++++++++++++ sc/source/ui/inc/textimportoptions.hrc | 42 +++++++++++ sc/source/ui/inc/textimportoptions.hxx | 76 ++++++++++++++++++++ sc/source/ui/unoobj/filtuno.cxx | 4 +- sc/util/makefile.mk | 2 +- 11 files changed, 372 insertions(+), 22 deletions(-) create mode 100644 sc/source/ui/dbgui/textimportoptions.cxx create mode 100644 sc/source/ui/dbgui/textimportoptions.src create mode 100644 sc/source/ui/inc/textimportoptions.hrc create mode 100644 sc/source/ui/inc/textimportoptions.hxx diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index baf94c23748f..df07ed7a6d4c 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1635,7 +1635,7 @@ #define RID_SCDLG_DOCPROTECTION (SC_DIALOGS_START + 149) #define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150) #define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151) -#define RID_SCDLG_LANG_CHOOSER (SC_DIALOGS_START + 152) +#define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 152) #define SC_DIALOGS_END (SC_DIALOGS_START + 153) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 89c33bcae13f..9dc272715bd8 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -291,7 +291,7 @@ public: virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0; }; -class AbstractScLangChooserDlg : public VclAbstractDialog //add for ScLangChooserDlg +class AbstractScTextImportOptionsDlg : public VclAbstractDialog //add for ScLangChooserDlg { public: virtual LanguageType GetLanguageType() const = 0; @@ -308,7 +308,7 @@ public: SvStream* pInStream, int nId, sal_Unicode cSep = '\t') = 0; - virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ) = 0; + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0; virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 9690470ebfc8..f4aa89aaff1f 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -74,7 +74,7 @@ #include "validate.hxx" //add for ScValidationDlg #include "validate.hrc" //add for ScValidationDlg #include "sortdlg.hxx" //add for ScSortDlg -#include "langchooser.hxx" +#include "textimportoptions.hxx" #include "opredlin.hxx" //add for ScRedlineOptionsTabPage #include "tpcalc.hxx" //add for ScTpCalcOptions #include "tpprint.hxx" //add for ScTpPrintOptions @@ -116,7 +116,7 @@ IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); //add for ScNewScenarioDlg IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg -IMPL_ABSTDLG_BASE(AbstractScLangChooserDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl); IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg // AbstractTabDialog_Impl begin @@ -624,12 +624,12 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption // add for AbstractScImportOptionsDlg_Impl end //add for AbstractScLangChooserDlg_Impl begin -LanguageType AbstractScLangChooserDlg_Impl::GetLanguageType() const +LanguageType AbstractScTextImportOptionsDlg_Impl::GetLanguageType() const { return pDlg->getLanguageType(); } -bool AbstractScLangChooserDlg_Impl::IsDateConversionSet() const +bool AbstractScTextImportOptionsDlg_Impl::IsDateConversionSet() const { return pDlg->isDateConversionSet(); } @@ -658,19 +658,19 @@ AbstractScImportAsciiDlg * ScAbstractDialogFactory_Impl::CreateScImportAsciiDlg } // ScImportAsciiDlg end -AbstractScLangChooserDlg * ScAbstractDialogFactory_Impl::CreateScLangChooserDlg( Window* pParent, int nId ) +AbstractScTextImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScTextImportOptionsDlg( Window* pParent, int nId ) { - ScLangChooserDlg* pDlg = NULL; + ScTextImportOptionsDlg* pDlg = NULL; switch (nId) { - case RID_SCDLG_LANG_CHOOSER: - pDlg = new ScLangChooserDlg(pParent); + case RID_SCDLG_TEXT_IMPORT_OPTIONS: + pDlg = new ScTextImportOptionsDlg(pParent); break; default: ; } - return pDlg ? new AbstractScLangChooserDlg_Impl(pDlg) : NULL; + return pDlg ? new AbstractScTextImportOptionsDlg_Impl(pDlg) : NULL; } //add for ScAutoFormatDlg begin diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index dfdcbcced3e9..3b370f02d5df 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -64,7 +64,7 @@ class ScStringInputDlg; class ScImportOptionsDlg; class SfxTabDialog; class ScSortWarningDlg; -class ScLangChooserDlg; +class ScTextImportOptionsDlg; #define DECL_ABSTDLG_BASE(Class,DialogClass) \ DialogClass* pDlg; \ @@ -344,9 +344,9 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add virtual void GetImportOptions( ScImportOptions& rOptions ) const; }; -class AbstractScLangChooserDlg_Impl : public AbstractScLangChooserDlg +class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDlg { - DECL_ABSTDLG_BASE( AbstractScLangChooserDlg_Impl, ScLangChooserDlg) + DECL_ABSTDLG_BASE( AbstractScTextImportOptionsDlg_Impl, ScTextImportOptionsDlg) virtual LanguageType GetLanguageType() const; virtual bool IsDateConversionSet() const; }; @@ -392,7 +392,7 @@ public: SvStream* pInStream, int nId, sal_Unicode cSep = '\t'); - virtual AbstractScLangChooserDlg * CreateScLangChooserDlg( Window* pParent, int nId ); + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ); virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg ScAutoFormat* pAutoFormat, diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index 5bf847ef9a93..e5b6bfd0c74b 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -53,7 +53,7 @@ SLOFILES = \ $(SLO)$/pfiltdlg.obj \ $(SLO)$/dbnamdlg.obj \ $(SLO)$/expftext.obj \ - $(SLO)$/langchooser.obj \ + $(SLO)$/textimportoptions.obj \ $(SLO)$/subtdlg.obj \ $(SLO)$/tpsubt.obj \ $(SLO)$/fieldwnd.obj \ @@ -86,7 +86,7 @@ EXCEPTIONSFILES= \ SRS1NAME=$(TARGET) SRC1FILES = \ - langchooser.src \ + textimportoptions.src \ pivot.src \ pvfundlg.src \ dpgroupdlg.src \ @@ -117,7 +117,7 @@ LIB1OBJFILES = \ $(SLO)$/csvgrid.obj \ $(SLO)$/csvtablebox.obj \ $(SLO)$/asciiopt.obj \ - $(SLO)$/langchooser.obj + $(SLO)$/textimportoptions.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx new file mode 100644 index 000000000000..d1e0f0949f64 --- /dev/null +++ b/sc/source/ui/dbgui/textimportoptions.cxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +#undef SC_DLLIMPLEMENTATION + +//------------------------------------------------------------------------ + +#include "textimportoptions.hxx" +#include "textimportoptions.hrc" + +#include "scresid.hxx" +#include "vcl/window.hxx" +#include "vcl/msgbox.hxx" +#include "vcl/svapp.hxx" + +ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) : + ModalDialog(pParent, ScResId(RID_SCDLG_TEXT_IMPORT_OPTIONS)), + + maBtnOk(this, ScResId(BTN_OK)), + maBtnCancel(this, ScResId(BTN_CANCEL)), + maBtnHelp(this, ScResId(BTN_HELP)), + maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), + maRbAutomatic(this, ScResId(RB_AUTOMATIC)), + maRbCustom(this, ScResId(RB_CUSTOM)), + maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), + maFlOption(this, ScResId(FL_OPTION)), + maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) +{ + init(); +} + +ScTextImportOptionsDlg::~ScTextImportOptionsDlg() +{ +} + +short ScTextImportOptionsDlg::Execute() +{ + return ModalDialog::Execute(); +} + +LanguageType ScTextImportOptionsDlg::getLanguageType() const +{ + if (maRbAutomatic.IsChecked()) + return LANGUAGE_SYSTEM; + + return maLbCustomLang.GetSelectLanguage(); +} + +bool ScTextImportOptionsDlg::isDateConversionSet() const +{ + return maBtnConvertDate.IsChecked(); +} + +void ScTextImportOptionsDlg::init() +{ + Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl ); + maBtnOk.SetClickHdl(aLink); + aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl ); + maRbAutomatic.SetClickHdl(aLink); + maRbCustom.SetClickHdl(aLink); + + maRbAutomatic.Check(true); + + maLbCustomLang.SetLanguageList( + LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); + + LanguageType eLang = Application::GetSettings().GetLanguage(); + maLbCustomLang.SelectLanguage(eLang); + maLbCustomLang.Disable(); +} + +IMPL_LINK( ScTextImportOptionsDlg, OKHdl, OKButton*, EMPTYARG ) +{ + EndDialog(RET_OK); + return 0; +} + +IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn ) +{ + if (pBtn == &maRbAutomatic) + { + maLbCustomLang.Disable(); + } + else if (pBtn == &maRbCustom) + { + maLbCustomLang.Enable(); + } + return 0; +} + diff --git a/sc/source/ui/dbgui/textimportoptions.src b/sc/source/ui/dbgui/textimportoptions.src new file mode 100644 index 000000000000..fff3c4b40749 --- /dev/null +++ b/sc/source/ui/dbgui/textimportoptions.src @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "textimportoptions.hrc" + +ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS +{ + Text [ en-US ] = "Import Options" ; + Size = MAP_APPFONT ( 190 , 101 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + OutputSize = TRUE ; + + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 135, 6 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 135, 23 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 135, 43 ) ; + Size = MAP_APPFONT ( 50, 14 ) ; + }; + + FixedLine FL_CHOOSE_LANG + { + Pos = MAP_APPFONT( 6, 3 ) ; + Size = MAP_APPFONT( 125, 14 ) ; + + Text [ en-US ] = "Select the language to use for import" ; + }; + + RadioButton RB_AUTOMATIC + { + Pos = MAP_APPFONT( 12, 20 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Automatic" ; + }; + + RadioButton RB_CUSTOM + { + Pos = MAP_APPFONT( 12, 34 ) ; + Size = MAP_APPFONT( 50, 10 ) ; + TabStop = TRUE ; + + Text [ en-US ] = "Custom" ; + }; + + ListBox LB_CUSTOM_LANG + { + Pos = MAP_APPFONT( 20, 50 ) ; + Size = MAP_APPFONT( 100, 55 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + + FixedLine FL_OPTION + { + Pos = MAP_APPFONT( 6, 70 ); + Size = MAP_APPFONT( 125, 14 ); + + Text [ en-US ] = "Options" ; + }; + + CheckBox BTN_CONVERT_DATE + { + Pos = MAP_APPFONT( 12, 86 ); + Size = MAP_APPFONT( 125, 10 ); + TabStop = TRUE ; + + Text [ en-US ] = "Detect special numbers (such as dates)." ; + }; +}; + diff --git a/sc/source/ui/inc/textimportoptions.hrc b/sc/source/ui/inc/textimportoptions.hrc new file mode 100644 index 000000000000..93c554ef5c45 --- /dev/null +++ b/sc/source/ui/inc/textimportoptions.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: retypepassdlg.src,v $ + * $Revision: 1.1.2.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 + +#define FL_CHOOSE_LANG 4 +#define RB_AUTOMATIC 5 +#define RB_CUSTOM 6 +#define LB_CUSTOM_LANG 7 +#define FL_OPTION 8 +#define BTN_CONVERT_DATE 9 diff --git a/sc/source/ui/inc/textimportoptions.hxx b/sc/source/ui/inc/textimportoptions.hxx new file mode 100644 index 000000000000..bbb2bf6ebf09 --- /dev/null +++ b/sc/source/ui/inc/textimportoptions.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: langbox.hxx,v $ + * $Revision: 1.4.242.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_UI_IMPORTOPTIONS_HXX +#define SC_UI_IMPORTOPTIONS_HXX + +#include "vcl/dialog.hxx" +#include "vcl/button.hxx" +#include "vcl/fixed.hxx" +#include "i18npool/lang.h" +#include "svx/langbox.hxx" + +class ScTextImportOptionsDlg : public ModalDialog +{ +public: + ScTextImportOptionsDlg(Window* pParent); + virtual ~ScTextImportOptionsDlg(); + + virtual short Execute(); + + LanguageType getLanguageType() const; + bool isDateConversionSet() const; + +private: + void init(); + +private: + OKButton maBtnOk; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + FixedLine maFlChooseLang; + + RadioButton maRbAutomatic; + RadioButton maRbCustom; + + SvxLanguageBox maLbCustomLang; + + FixedLine maFlOption; + + CheckBox maBtnConvertDate; + + DECL_LINK( OKHdl, OKButton* ); + + DECL_LINK( RadioHdl, RadioButton* ); +}; + + +#endif diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 0fab38c8c1da..c8248b754708 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -188,8 +188,8 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) { // HTML import. - ::std::auto_ptr pDlg( - pFact->CreateScLangChooserDlg(NULL, RID_SCDLG_LANG_CHOOSER)); + ::std::auto_ptr pDlg( + pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS)); if (pDlg->Execute() == RET_OK) { diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index a7c981a11a95..144c60731970 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -277,7 +277,7 @@ LIB8OBJFILES = \ $(SLO)$/dapidata.obj \ $(SLO)$/crdlg.obj \ $(SLO)$/scuiasciiopt.obj \ - $(SLO)$/langchooser.obj \ + $(SLO)$/textimportoptions.obj \ $(SLO)$/scuiautofmt.obj \ $(SLO)$/dpgroupdlg.obj \ $(SLO)$/editfield.obj -- cgit v1.2.3 From dd257f983673e133cde535235d7abdfcb83fbed5 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 7 Aug 2009 14:57:02 -0400 Subject: * removed several files from version control because they are no longer present on the file system. * hg claims two files are modified in solenv, but taking a diff turns up nothing. Well, I'll commit them anyway. --- sc/source/ui/dbgui/langchooser.cxx | 120 ------------------------------------- sc/source/ui/dbgui/langchooser.src | 112 ---------------------------------- sc/source/ui/inc/langchooser.hrc | 42 ------------- sc/source/ui/inc/langchooser.hxx | 76 ----------------------- 4 files changed, 350 deletions(-) delete mode 100644 sc/source/ui/dbgui/langchooser.cxx delete mode 100644 sc/source/ui/dbgui/langchooser.src delete mode 100644 sc/source/ui/inc/langchooser.hrc delete mode 100644 sc/source/ui/inc/langchooser.hxx diff --git a/sc/source/ui/dbgui/langchooser.cxx b/sc/source/ui/dbgui/langchooser.cxx deleted file mode 100644 index 6640afc3bd3f..000000000000 --- a/sc/source/ui/dbgui/langchooser.cxx +++ /dev/null @@ -1,120 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: langbox.hxx,v $ - * $Revision: 1.4.242.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sc.hxx" - -#undef SC_DLLIMPLEMENTATION - -//------------------------------------------------------------------------ - -#include "langchooser.hxx" -#include "langchooser.hrc" - -#include "scresid.hxx" -#include "vcl/window.hxx" -#include "vcl/msgbox.hxx" -#include "vcl/svapp.hxx" - -ScLangChooserDlg::ScLangChooserDlg(Window* pParent) : - ModalDialog(pParent, ScResId(RID_SCDLG_LANG_CHOOSER)), - - maBtnOk(this, ScResId(BTN_OK)), - maBtnCancel(this, ScResId(BTN_CANCEL)), - maBtnHelp(this, ScResId(BTN_HELP)), - maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), - maRbAutomatic(this, ScResId(RB_AUTOMATIC)), - maRbCustom(this, ScResId(RB_CUSTOM)), - maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), - maFlOption(this, ScResId(FL_OPTION)), - maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) -{ - init(); -} - -ScLangChooserDlg::~ScLangChooserDlg() -{ -} - -short ScLangChooserDlg::Execute() -{ - return ModalDialog::Execute(); -} - -LanguageType ScLangChooserDlg::getLanguageType() const -{ - if (maRbAutomatic.IsChecked()) - return LANGUAGE_SYSTEM; - - return maLbCustomLang.GetSelectLanguage(); -} - -bool ScLangChooserDlg::isDateConversionSet() const -{ - return maBtnConvertDate.IsChecked(); -} - -void ScLangChooserDlg::init() -{ - Link aLink = LINK( this, ScLangChooserDlg, OKHdl ); - maBtnOk.SetClickHdl(aLink); - aLink = LINK( this, ScLangChooserDlg, RadioHdl ); - maRbAutomatic.SetClickHdl(aLink); - maRbCustom.SetClickHdl(aLink); - - maRbAutomatic.Check(true); - - maLbCustomLang.SetLanguageList( - LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); - - LanguageType eLang = Application::GetSettings().GetLanguage(); - maLbCustomLang.SelectLanguage(eLang); - maLbCustomLang.Disable(); -} - -IMPL_LINK( ScLangChooserDlg, OKHdl, OKButton*, EMPTYARG ) -{ - EndDialog(RET_OK); - return 0; -} - -IMPL_LINK( ScLangChooserDlg, RadioHdl, RadioButton*, pBtn ) -{ - if (pBtn == &maRbAutomatic) - { - maLbCustomLang.Disable(); - } - else if (pBtn == &maRbCustom) - { - maLbCustomLang.Enable(); - } - return 0; -} - diff --git a/sc/source/ui/dbgui/langchooser.src b/sc/source/ui/dbgui/langchooser.src deleted file mode 100644 index 313084299aba..000000000000 --- a/sc/source/ui/dbgui/langchooser.src +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: retypepassdlg.src,v $ - * $Revision: 1.1.2.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "langchooser.hrc" - -ModalDialog RID_SCDLG_LANG_CHOOSER -{ - Text [ en-US ] = "Select Language" ; - Size = MAP_APPFONT ( 190 , 101 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - OutputSize = TRUE ; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 135, 6 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - DefButton = TRUE ; - }; - - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 135, 23 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - }; - - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 135, 43 ) ; - Size = MAP_APPFONT ( 50, 14 ) ; - }; - - FixedLine FL_CHOOSE_LANG - { - Pos = MAP_APPFONT( 6, 3 ) ; - Size = MAP_APPFONT( 125, 14 ) ; - - Text [ en-US ] = "Select the language to use for import" ; - }; - - RadioButton RB_AUTOMATIC - { - Pos = MAP_APPFONT( 12, 20 ) ; - Size = MAP_APPFONT( 50, 10 ) ; - TabStop = TRUE ; - - Text [ en-US ] = "Automatic" ; - }; - - RadioButton RB_CUSTOM - { - Pos = MAP_APPFONT( 12, 34 ) ; - Size = MAP_APPFONT( 50, 10 ) ; - TabStop = TRUE ; - - Text [ en-US ] = "Custom" ; - }; - - ListBox LB_CUSTOM_LANG - { - Pos = MAP_APPFONT( 20, 50 ) ; - Size = MAP_APPFONT( 100, 55 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - Sort = TRUE ; - }; - - FixedLine FL_OPTION - { - Pos = MAP_APPFONT( 6, 70 ); - Size = MAP_APPFONT( 125, 14 ); - - Text [ en-US ] = "Options" ; - }; - - CheckBox BTN_CONVERT_DATE - { - Pos = MAP_APPFONT( 12, 86 ); - Size = MAP_APPFONT( 125, 10 ); - TabStop = TRUE ; - - Text [ en-US ] = "Detect special numbers (such as dates)." ; - }; -}; - diff --git a/sc/source/ui/inc/langchooser.hrc b/sc/source/ui/inc/langchooser.hrc deleted file mode 100644 index 93c554ef5c45..000000000000 --- a/sc/source/ui/inc/langchooser.hrc +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: retypepassdlg.src,v $ - * $Revision: 1.1.2.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#define BTN_OK 1 -#define BTN_CANCEL 2 -#define BTN_HELP 3 - -#define FL_CHOOSE_LANG 4 -#define RB_AUTOMATIC 5 -#define RB_CUSTOM 6 -#define LB_CUSTOM_LANG 7 -#define FL_OPTION 8 -#define BTN_CONVERT_DATE 9 diff --git a/sc/source/ui/inc/langchooser.hxx b/sc/source/ui/inc/langchooser.hxx deleted file mode 100644 index 4ff849fc2bc0..000000000000 --- a/sc/source/ui/inc/langchooser.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: langbox.hxx,v $ - * $Revision: 1.4.242.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SC_UI_LANGCHOOSER_HXX -#define SC_UI_LANGCHOOSER_HXX - -#include "vcl/dialog.hxx" -#include "vcl/button.hxx" -#include "vcl/fixed.hxx" -#include "i18npool/lang.h" -#include "svx/langbox.hxx" - -class ScLangChooserDlg : public ModalDialog -{ -public: - ScLangChooserDlg(Window* pParent); - virtual ~ScLangChooserDlg(); - - virtual short Execute(); - - LanguageType getLanguageType() const; - bool isDateConversionSet() const; - -private: - void init(); - -private: - OKButton maBtnOk; - CancelButton maBtnCancel; - HelpButton maBtnHelp; - - FixedLine maFlChooseLang; - - RadioButton maRbAutomatic; - RadioButton maRbCustom; - - SvxLanguageBox maLbCustomLang; - - FixedLine maFlOption; - - CheckBox maBtnConvertDate; - - DECL_LINK( OKHdl, OKButton* ); - - DECL_LINK( RadioHdl, RadioButton* ); -}; - - -#endif -- cgit v1.2.3 From a72cabcec67a5aa8b1ca175fe8a7494ab4327c68 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Tue, 27 Oct 2009 16:57:01 +0100 Subject: #i71568# #i108349# simplified C++ wrapper inline implementation. --- store/inc/store/store.hxx | 422 ++++++++++++++++++++++++++++++++---------- store/inc/store/store.inl | 454 ---------------------------------------------- 2 files changed, 322 insertions(+), 554 deletions(-) delete mode 100644 store/inc/store/store.inl diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx index 54f0d44024b8..b6301f41f8b3 100644 --- a/store/inc/store/store.hxx +++ b/store/inc/store/store.hxx @@ -31,9 +31,9 @@ #ifndef _STORE_STORE_HXX_ #define _STORE_STORE_HXX_ "$Revision: 1.5 $" -#include -#include -#include +#include "sal/types.h" +#include "rtl/ustring.hxx" +#include "store/store.h" namespace store { @@ -48,86 +48,154 @@ class OStoreStream public: /** Construction. */ - inline OStoreStream (void) SAL_THROW(()); + inline OStoreStream (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreStream (void) SAL_THROW(()); + inline ~OStoreStream (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()); + inline OStoreStream (OStoreStream const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreStream& operator= ( - const OStoreStream& rOther) SAL_THROW(()); - + inline OStoreStream & operator= (OStoreStream const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from Stream Handle. */ - inline OStoreStream (storeStreamHandle Handle) SAL_THROW(()); + inline explicit OStoreStream (storeStreamHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Stream Handle. */ - inline operator storeStreamHandle (void) const SAL_THROW(()); + inline operator storeStreamHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Stream Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the stream. @see store_openStream() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the stream. @see store_closeStream() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeStream (m_hImpl); + m_hImpl = 0; + } + } /** Read from the stream. @see store_readStream() */ inline storeError readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Write to the stream. @see store_writeStream() */ inline storeError writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone - ) SAL_THROW(()); + sal_uInt32 nOffset, + void const * pBuffer, + sal_uInt32 nBytes, + sal_uInt32 & rnDone) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone); + } /** Flush the stream. @see store_flushStream() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushStream (m_hImpl); + } /** Get the stream size. @see store_getStreamSize() */ - inline storeError getSize (sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getStreamSize (m_hImpl, &rnSize); + } /** Set the stream size. @see store_setStreamSize() */ - inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()); + inline storeError setSize (sal_uInt32 nSize) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_setStreamSize (m_hImpl, nSize); + } private: /** Representation. @@ -145,52 +213,91 @@ class OStoreDirectory public: /** Construction. */ - inline OStoreDirectory (void) SAL_THROW(()); + inline OStoreDirectory (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreDirectory (void) SAL_THROW(()); + inline ~OStoreDirectory (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()); + inline OStoreDirectory (OStoreDirectory const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreDirectory& operator= ( - const OStoreDirectory& rOther) SAL_THROW(()); - + inline OStoreDirectory & operator= (OStoreDirectory const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rOther.m_hImpl; + return *this; + } /** Construction from Directory Handle. */ - inline OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()); + inline explicit OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into Directory Handle. */ - inline operator storeDirectoryHandle (void) const SAL_THROW(()); + inline operator storeDirectoryHandle(void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid Directory Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the directory. @see store_openDirectory() */ inline storeError create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode - ) SAL_THROW(()); + storeFileHandle hFile, + rtl::OUString const & rPath, + rtl::OUString const & rName, + storeAccessMode eMode) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl); + } /** Close the directory. @see store_closeDirectory() */ - inline void close (void) SAL_THROW(()); - + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeDirectory (m_hImpl); + m_hImpl = 0; + } + } /** Directory iterator type. @see first() @@ -201,12 +308,24 @@ public: /** Find first directory entry. @see store_findFirst() */ - inline storeError first (iterator& it) SAL_THROW(()); + inline storeError first (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findFirst (m_hImpl, &it); + } /** Find next directory entry. @see store_findNext() */ - inline storeError next (iterator& it) SAL_THROW(()); + inline storeError next (iterator& it) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_findNext (m_hImpl, &it); + } /** Directory traversal helper. @see travel() @@ -228,7 +347,18 @@ public: @param rTraveller [in] the traversal callback. @return store_E_NoMoreFiles upon end of iteration. */ - inline storeError travel (traveller& rTraveller) const; + inline storeError travel (traveller & rTraveller) const + { + storeError eErrCode = store_E_InvalidHandle; + if (m_hImpl) + { + iterator it; + eErrCode = store_findFirst (m_hImpl, &it); + while ((eErrCode == store_E_None) && rTraveller.visit(it)) + eErrCode = store_findNext (m_hImpl, &it); + } + return eErrCode; + } private: /** Representation. @@ -246,126 +376,220 @@ class OStoreFile public: /** Construction. */ - inline OStoreFile (void) SAL_THROW(()); + inline OStoreFile (void) SAL_THROW(()) + : m_hImpl (0) + {} /** Destruction. */ - inline ~OStoreFile (void) SAL_THROW(()); + inline ~OStoreFile (void) SAL_THROW(()) + { + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + } /** Copy construction. */ - inline OStoreFile (const OStoreFile& rOther) SAL_THROW(()); + inline OStoreFile (OStoreFile const & rhs) SAL_THROW(()) + : m_hImpl (rhs.m_hImpl) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Assignment. */ - inline OStoreFile& operator= (const OStoreFile& rOther) SAL_THROW(()); - + inline OStoreFile & operator= (OStoreFile const & rhs) SAL_THROW(()) + { + if (rhs.m_hImpl) + (void) store_acquireHandle (rhs.m_hImpl); + if (m_hImpl) + (void) store_releaseHandle (m_hImpl); + m_hImpl = rhs.m_hImpl; + return *this; + } /** Construction from File Handle. */ - inline OStoreFile (storeFileHandle Handle) SAL_THROW(()); + inline explicit OStoreFile (storeFileHandle Handle) SAL_THROW(()) + : m_hImpl (Handle) + { + if (m_hImpl) + (void) store_acquireHandle (m_hImpl); + } /** Conversion into File Handle. */ - inline operator storeFileHandle (void) const SAL_THROW(()); + inline operator storeFileHandle (void) const SAL_THROW(()) + { + return m_hImpl; + } /** Check for a valid File Handle. @return sal_True if valid, sal_False otherwise. */ - inline sal_Bool isValid (void) const SAL_THROW(()); - + inline bool isValid (void) const SAL_THROW(()) + { + return (m_hImpl != 0); + } /** Open the file. @see store_openFile() */ inline storeError create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + rtl::OUString const & rFilename, + storeAccessMode eAccessMode, + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); + } /** Open the temporary file in memory. @see store_createMemoryFile() */ inline storeError createInMemory ( - sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE - ) SAL_THROW(()); + sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_releaseHandle (m_hImpl); + m_hImpl = 0; + } + return store_createMemoryFile (nPageSize, &m_hImpl); + } /** Close the file. @see store_closeFile() */ - inline void close (void) SAL_THROW(()); + inline void close (void) SAL_THROW(()) + { + if (m_hImpl) + { + (void) store_closeFile (m_hImpl); + m_hImpl = 0; + } + } /** Flush the file. @see store_flushFile() */ - inline storeError flush (void) const SAL_THROW(()); + inline storeError flush (void) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_flushFile (m_hImpl); + } /** Get the number of referers to the file. @see store_getFileRefererCount() */ - inline storeError getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()); + inline storeError getRefererCount (sal_uInt32 & rnRefCount) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_getFileRefererCount (m_hImpl, &rnRefCount); + } /** Get the file size. @see store_getFileSize() */ - inline storeError getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()); + inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + return store_getFileSize (m_hImpl, &rnSize); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2, + sal_uInt32 & rnAttrib) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); + } /** Set attributes of a file entry. @see store_attrib() */ inline storeError attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2 - ) SAL_THROW(()); + rtl::OUString const & rPath, + rtl::OUString const & rName, + sal_uInt32 nMask1, + sal_uInt32 nMask2) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); + } /** Insert a file entry as 'hard link' to another file entry. @see store_link() */ inline storeError link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_link ( + m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Insert a file entry as 'symbolic link' to another file entry. @see store_symlink() */ inline storeError symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_symlink (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Rename a file entry. @see store_rename() */ inline storeError rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName - ) SAL_THROW(()); + rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName, + rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_rename (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData); + } /** Remove a file entry. @see store_remove() */ inline storeError remove ( - const rtl::OUString &rPath, - const rtl::OUString &rName - ) SAL_THROW(()); + rtl::OUString const & rPath, rtl::OUString const & rName) SAL_THROW(()) + { + if (!m_hImpl) + return store_E_InvalidHandle; + + return store_remove (m_hImpl, rPath.pData, rName.pData); + } private: /** Representation. @@ -379,8 +603,6 @@ private: * *======================================================================*/ -#include - } // namespace store #endif /* !_STORE_STORE_HXX_ */ diff --git a/store/inc/store/store.inl b/store/inc/store/store.inl deleted file mode 100644 index 35aff6dde1e2..000000000000 --- a/store/inc/store/store.inl +++ /dev/null @@ -1,454 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: store.inl,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#define _STORE_STORE_INL_ "$Revision: 1.4 $" - -/*======================================================================== - * - * OStoreStream implementation. - * - *======================================================================*/ -inline OStoreStream::OStoreStream (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreStream::~OStoreStream (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreStream::OStoreStream ( - const OStoreStream& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream& OStoreStream::operator= ( - const OStoreStream& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreStream::OStoreStream ( - storeStreamHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreStream::operator storeStreamHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreStream::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreStream::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openStream ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreStream::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeStream (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreStream::readAt ( - sal_uInt32 nOffset, - void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_readStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::writeAt ( - sal_uInt32 nOffset, - const void *pBuffer, - sal_uInt32 nBytes, - sal_uInt32 &rnDone) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_writeStream ( - m_hImpl, nOffset, pBuffer, nBytes, &rnDone); -} - -inline storeError OStoreStream::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushStream (m_hImpl); -} - -inline storeError OStoreStream::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getStreamSize (m_hImpl, &rnSize); -} - -inline storeError OStoreStream::setSize ( - sal_uInt32 nSize) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_setStreamSize (m_hImpl, nSize); -} - -/*======================================================================== - * - * OStoreDirectory implementation. - * - *======================================================================*/ -inline OStoreDirectory::OStoreDirectory (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreDirectory::~OStoreDirectory (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreDirectory::OStoreDirectory ( - const OStoreDirectory& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory& OStoreDirectory::operator= ( - const OStoreDirectory& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreDirectory::OStoreDirectory ( - storeDirectoryHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreDirectory::operator storeDirectoryHandle(void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreDirectory::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreDirectory::create ( - storeFileHandle hFile, - const rtl::OUString &rPath, - const rtl::OUString &rName, - storeAccessMode eMode) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openDirectory ( - hFile, rPath.pData, rName.pData, eMode, &m_hImpl); -} - -inline void OStoreDirectory::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeDirectory (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreDirectory::first (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findFirst (m_hImpl, &it); -} - -inline storeError OStoreDirectory::next (iterator& it) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_findNext (m_hImpl, &it); -} - -inline storeError OStoreDirectory::travel (traveller& rTraveller) const -{ - storeError eErrCode = store_E_InvalidHandle; - if (m_hImpl) - { - iterator it; - eErrCode = store_findFirst (m_hImpl, &it); - while ((eErrCode == store_E_None) && rTraveller.visit(it)) - eErrCode = store_findNext (m_hImpl, &it); - } - return eErrCode; -} - -/*======================================================================== - * - * OStoreFile implementation. - * - *======================================================================*/ -inline OStoreFile::OStoreFile (void) SAL_THROW(()) - : m_hImpl (0) -{ -} - -inline OStoreFile::~OStoreFile (void) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); -} - -inline OStoreFile::OStoreFile ( - const OStoreFile& rOther) SAL_THROW(()) - : m_hImpl (rOther.m_hImpl) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile& OStoreFile::operator= ( - const OStoreFile& rOther) SAL_THROW(()) -{ - if (m_hImpl) - store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; - if (m_hImpl) - store_acquireHandle (m_hImpl); - return *this; -} - -inline OStoreFile::OStoreFile ( - storeFileHandle Handle) SAL_THROW(()) - : m_hImpl (Handle) -{ - if (m_hImpl) - store_acquireHandle (m_hImpl); -} - -inline OStoreFile::operator storeFileHandle (void) const SAL_THROW(()) -{ - return m_hImpl; -} - -inline sal_Bool OStoreFile::isValid (void) const SAL_THROW(()) -{ - return (!!m_hImpl); -} - -inline storeError OStoreFile::create ( - const rtl::OUString &rFilename, - storeAccessMode eAccessMode, - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl); -} - -inline storeError OStoreFile::createInMemory ( - sal_uInt16 nPageSize) SAL_THROW(()) -{ - if (m_hImpl) - { - store_releaseHandle (m_hImpl); - m_hImpl = 0; - } - return store_createMemoryFile (nPageSize, &m_hImpl); -} - -inline void OStoreFile::close (void) SAL_THROW(()) -{ - if (m_hImpl) - { - store_closeFile (m_hImpl); - m_hImpl = 0; - } -} - -inline storeError OStoreFile::flush (void) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_flushFile (m_hImpl); -} - -inline storeError OStoreFile::getRefererCount ( - sal_uInt32 &rnRefCount) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileRefererCount (m_hImpl, &rnRefCount); -} - -inline storeError OStoreFile::getSize ( - sal_uInt32 &rnSize) const SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_getFileSize (m_hImpl, &rnSize); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2, - sal_uInt32 &rnAttrib) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib); -} - -inline storeError OStoreFile::attrib ( - const rtl::OUString &rPath, - const rtl::OUString &rName, - sal_uInt32 nMask1, - sal_uInt32 nMask2) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_attrib ( - m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL); -} - -inline storeError OStoreFile::link ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_link ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::symlink ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_symlink ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::rename ( - const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName, - const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_rename ( - m_hImpl, - rSrcPath.pData, rSrcName.pData, - rDstPath.pData, rDstName.pData); -} - -inline storeError OStoreFile::remove ( - const rtl::OUString &rPath, const rtl::OUString &rName) SAL_THROW(()) -{ - if (!m_hImpl) - return store_E_InvalidHandle; - - return store_remove (m_hImpl, rPath.pData, rName.pData); -} - -- cgit v1.2.3 From aa4b05bffbcea6156c51f0c5ff936f87fc2f26a3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Thu, 29 Oct 2009 16:00:34 +0100 Subject: #i71568# #i108349# Remove unused range locking code. --- store/inc/store/store.hxx | 7 +-- store/source/lockbyte.cxx | 34 ------------ store/source/lockbyte.hxx | 30 ----------- store/source/storbios.cxx | 130 ++++------------------------------------------ store/source/storbios.hxx | 10 ---- store/source/stordata.cxx | 91 ++++---------------------------- store/source/stortree.cxx | 115 ++++------------------------------------ store/workben/t_base.cxx | 11 ---- 8 files changed, 33 insertions(+), 395 deletions(-) diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx index b6301f41f8b3..44540a44cb32 100644 --- a/store/inc/store/store.hxx +++ b/store/inc/store/store.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: store.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORE_HXX_ -#define _STORE_STORE_HXX_ "$Revision: 1.5 $" +#define _STORE_STORE_HXX_ #include "sal/types.h" #include "rtl/ustring.hxx" @@ -242,7 +239,7 @@ public: (void) store_acquireHandle (rhs.m_hImpl); if (m_hImpl) (void) store_releaseHandle (m_hImpl); - m_hImpl = rOther.m_hImpl; + m_hImpl = rhs.m_hImpl; return *this; } diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index a03628bfb740..551c7c737127 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -156,40 +156,6 @@ storeError ILockBytes::flush() return flush_Impl(); } -storeError ILockBytes::lockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::lockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return lockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - -storeError ILockBytes::unlockRange (sal_uInt32 nOffset, sal_uInt32 nBytes) -{ - OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::unlockRange(): invalid Offset"); - if (nOffset == STORE_PAGE_NULL) - return store_E_CantSeek; - - sal_uInt64 size = nOffset + nBytes; - if (size > SAL_MAX_UINT32) - return store_E_CantSeek; - -#ifdef STORE_FEATURE_LOCKING - return unlockRange_Impl (nOffset, nBytes); -#else - return store_E_None; // E_Unsupported -#endif /* STORE_FEATURE_LOCKING */ -} - /*======================================================================== * * FileLockBytes implementation. diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx index 20a8b0b77073..95f73f289b67 100644 --- a/store/source/lockbyte.hxx +++ b/store/source/lockbyte.hxx @@ -128,26 +128,6 @@ public: */ storeError flush(); - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError lockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - - /** - @param nOffset [in] - @param nBytes [in] - @return store_E_None upon success - store_E_LockingViolation - */ - storeError unlockRange ( - sal_uInt32 nOffset, - sal_uInt32 nBytes); - private: /** Implementation (abstract). */ @@ -180,16 +160,6 @@ private: sal_uInt32 nSize) = 0; virtual storeError flush_Impl() = 0; - -#ifdef STORE_FEATURE_LOCKING - virtual storeError lockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; - - virtual storeError unlockRange_Impl ( - sal_uInt32 nOffset, - sal_uInt32 nBytes) = 0; -#endif /* STORE_FEATURE_LOCKING */ }; /*======================================================================== diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index d1f15dcda247..62852fa3e0cd 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -697,22 +697,8 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper) */ storeError OStorePageBIOS::repair (SuperPage *&rpSuper) { - // Acquire Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Verify SuperBlock page (with repair). - eErrCode = verify (rpSuper); - if (eErrCode != store_E_None) - { - // Failure. - releaseLock (0, SuperPage::theSize); - return eErrCode; - } - - // ReleaseLock. - return releaseLock (0, SuperPage::theSize); + return verify (rpSuper); } /* @@ -729,29 +715,16 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) return store_E_InvalidParameter; nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - // Acquire Lock. - storeError eErrCode = acquireLock (0, nPageSize); - if (eErrCode != store_E_None) - return eErrCode; - // Allocate SuperBlock page. delete m_pSuper, m_pSuper = 0; if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0) - { - // Cleanup and fail. - releaseLock (0, nPageSize); return store_E_OutOfMemory; - } m_pSuper->guard(); // Create initial page (w/ SuperBlock). - eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); + storeError eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); if (eErrCode != store_E_None) - { - // Cleanup and fail. - releaseLock (0, nPageSize); return eErrCode; - } #ifdef STORE_FEATURE_COMMIT // Commit. @@ -763,9 +736,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) // Adjust modified state. m_bModified = (eErrCode != store_E_None); - - // Release Lock and finish. - return releaseLock (0, nPageSize); + return eErrCode; } /* @@ -859,36 +830,6 @@ storeError OStorePageBIOS::initialize ( return eErrCode; } -/* - * acquireLock. - * Low Level: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) -{ - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; - - // Acquire Lock. - return m_xLockBytes->lockRange (nAddr, nSize); -} - -/* - * releaseLock. - * Low Level: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize) -{ - // Check precond. - if (!m_xLockBytes.is()) - return store_E_InvalidAccess; - - // Release Lock. - return m_xLockBytes->unlockRange (nAddr, nSize); -} - /* * read. * Low Level: Precond: initialized, exclusive access. @@ -1034,18 +975,10 @@ storeError OStorePageBIOS::allocate ( if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); + storeError eErrCode = verify (m_pSuper); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Check allocation. if (eAlloc != ALLOCATE_EOF) @@ -1061,10 +994,7 @@ storeError OStorePageBIOS::allocate ( // Load PageHead. eErrCode = peek (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Verify FreeList head. OSL_PRECOND( @@ -1079,9 +1009,6 @@ storeError OStorePageBIOS::allocate ( // Save SuperBlock page. eErrCode = m_pSuper->save (*this); - // Release SuperBlock Lock. - releaseLock (0, SuperPage::theSize); - // Recovery: Allocate from EOF. if (eErrCode == store_E_None) return allocate (rPage, ALLOCATE_EOF); @@ -1096,12 +1023,9 @@ storeError OStorePageBIOS::allocate ( // Save page at PageHead location. eErrCode = saveObjectAt_Impl (rPage, aPageHead.location()); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. m_pSuper->m_aSuperTwo.unusedRemove (aListHead); m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; @@ -1109,9 +1033,7 @@ storeError OStorePageBIOS::allocate ( OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } } @@ -1119,10 +1041,7 @@ storeError OStorePageBIOS::allocate ( sal_uInt32 nPhysLen = STORE_PAGE_NULL; eErrCode = m_xLockBytes->getSize (nPhysLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Obtain logical EOF. OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr); @@ -1141,10 +1060,7 @@ storeError OStorePageBIOS::allocate ( // Mark SuperBlock modified. eErrCode = m_pSuper->modified (*this); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } } // Resize. @@ -1153,21 +1069,15 @@ storeError OStorePageBIOS::allocate ( eErrCode = m_xLockBytes->setSize (nPhysLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } } // Save page at logical EOF. eErrCode = saveObjectAt_Impl (rPage, nLogLen); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. nLogLen += store::ntohs(aDescr.m_nSize); aDescr.m_nAddr = store::htonl(nLogLen); @@ -1178,9 +1088,7 @@ storeError OStorePageBIOS::allocate ( OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::allocate(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } /* @@ -1198,18 +1106,10 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) if (!m_bWriteable) return store_E_AccessViolation; - // Acquire SuperBlock Lock. - storeError eErrCode = acquireLock (0, SuperPage::theSize); - if (eErrCode != store_E_None) - return eErrCode; - // Load SuperBlock and require good health. - eErrCode = verify (m_pSuper); + storeError eErrCode = verify (m_pSuper); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Load PageHead. OStorePageData aPageHead(OStorePageData::theSize); @@ -1217,10 +1117,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) eErrCode = peek (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } // Invalidate cache. (void) m_xCache->removePageAt (nAddr); @@ -1234,12 +1131,9 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) // Save PageHead. eErrCode = poke (aPageHead); if (eErrCode != store_E_None) - { - releaseLock (0, SuperPage::theSize); return eErrCode; - } - // Save SuperBlock page. + // Save SuperBlock page and finish. m_pSuper->m_aSuperTwo.unusedInsert (aListHead); m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; @@ -1247,9 +1141,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) OSL_POSTCOND( eErrCode == store_E_None, "OStorePageBIOS::free(): SuperBlock save failed"); - - // Release SuperBlock Lock and finish. - return releaseLock (0, SuperPage::theSize); + return eErrCode; } /* diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index d9a0f982bd3c..d9d91255742b 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -83,16 +83,6 @@ public: return m_xAllocator; } - /** acquireLock. - */ - storeError acquireLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - - /** releaseLock. - */ - storeError releaseLock ( - sal_uInt32 nAddr, sal_uInt32 nSize); - /** read. */ storeError read ( diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 29350f8ebfdd..dd0a8f18211f 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -436,17 +436,8 @@ storeError OStoreIndirectionPageObject::truncate ( if (!(nSingle < nLimit)) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nSingle; i--) { // Obtain data page location. @@ -457,10 +448,7 @@ storeError OStoreIndirectionPageObject::truncate ( OStorePageData aPageHead; eErrCode = rBIOS.free (aPageHead, nAddr); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to data page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -473,19 +461,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -504,26 +483,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nDouble + 1; i--) { // Truncate single indirect page to zero direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to single indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -533,10 +500,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last single indirect page to 'nSingle' direct pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nDouble]), nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if (nSingle == 0) @@ -551,19 +515,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /* @@ -583,26 +538,14 @@ storeError OStoreIndirectionPageObject::truncate ( if (!((nTriple < nLimit) && (nDouble < nLimit) && (nSingle < nLimit))) return store_E_InvalidAccess; - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Truncate. + storeError eErrCode = store_E_None; for (sal_uInt16 i = nLimit; i > nTriple + 1; i--) { // Truncate double indirect page to zero single indirect pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, 0, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Clear pointer to double indirect page. rPage.m_pData[i - 1] = STORE_PAGE_NULL; @@ -612,10 +555,7 @@ storeError OStoreIndirectionPageObject::truncate ( // Truncate last double indirect page to 'nDouble', 'nSingle' pages. eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nTriple]), nDouble, nSingle, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check for complete truncation. if ((nDouble + nSingle) == 0) @@ -630,19 +570,10 @@ storeError OStoreIndirectionPageObject::truncate ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -1132,8 +1063,8 @@ storeError OStoreDirectoryPageObject::truncate ( if (nAddr == STORE_PAGE_NULL) continue; // Free data page. - OStoreDataPageData aData; - eErrCode = rBIOS.free (aData, nAddr); + OStorePageData aPageHead; + eErrCode = rBIOS.free (aPageHead, nAddr); if (eErrCode != store_E_None) break; diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 614b995aba72..3f4f4b21c68b 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -205,25 +205,10 @@ storeError OStoreBTreeNodeObject::split ( if (!rxPageL->querySplit()) return store_E_None; - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - - // [Begin PageL Lock (NYI)] - // Construct right page. PageHolderObject< page > xPageR; if (!xPageR.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Split right page off left page. xPageR->split (*rxPageL); @@ -231,12 +216,9 @@ storeError OStoreBTreeNodeObject::split ( // Allocate right page. self aNodeR (xPageR.get()); - eErrCode = rBIOS.allocate (aNodeR); + storeError eErrCode = rBIOS.allocate (aNodeR); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Truncate left page. rxPageL->truncate (rxPageL->capacityCount() / 2); @@ -245,35 +227,14 @@ storeError OStoreBTreeNodeObject::split ( self aNodeL (rxPageL.get()); eErrCode = rBIOS.saveObjectAt (aNodeL, aNodeL.location()); if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } - - // [End PageL Lock (NYI)] // Insert right page. OStorePageLink aLink (xPageR->location()); xPage->insert (nIndexL + 1, T(xPageR->m_pData[0].m_aKey, aLink)); - // Save this page. - eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } - - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Save this page and leave. + return rBIOS.saveObjectAt (*this, location()); } /* @@ -287,43 +248,25 @@ storeError OStoreBTreeNodeObject::remove ( PageHolderObject< page > xImpl (m_xPage); page & rPage = (*xImpl); - // Save PageDescriptor. - OStorePageDescriptor aDescr (rPage.m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Check depth. + storeError eErrCode = store_E_None; if (rPage.depth()) { // Check link entry. T const aEntryL (rPage.m_pData[nIndexL]); if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_InvalidAccess; - } // Load link node. self aNodeL; eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Recurse: remove from link node. eErrCode = aNodeL.remove (0, rEntryL, rBIOS); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Check resulting link node usage. PageHolderObject< page > xPageL (aNodeL.get()); @@ -333,10 +276,7 @@ storeError OStoreBTreeNodeObject::remove ( OStorePageData aPageHead; eErrCode = rBIOS.free (aPageHead, xPageL->location()); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return eErrCode; - } // Remove index. rPage.remove (nIndexL); @@ -373,10 +313,7 @@ storeError OStoreBTreeNodeObject::remove ( { // Check leaf entry. if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL)) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_NotExists; - } // Save leaf entry. rEntryL = rPage.m_pData[nIndexL]; @@ -391,19 +328,10 @@ storeError OStoreBTreeNodeObject::remove ( { // Save this page. eErrCode = rBIOS.saveObjectAt (*this, location()); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } } - // Release Lock and Leave. - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + // Done. + return eErrCode; } /*======================================================================== @@ -457,33 +385,17 @@ storeError OStoreBTreeRootObject::change ( PageHolderObject< page > xPage (m_xPage); (void) testInvariant("OStoreBTreeRootObject::change(): enter"); - // Save PageDescriptor. - OStorePageDescriptor aDescr (xPage->m_aDescr); - aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr); - aDescr.m_nSize = store::ntohs(aDescr.m_nSize); - // Save root location. sal_uInt32 const nRootAddr = xPage->location(); - // Acquire Lock. - storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize); - if (eErrCode != store_E_None) - return eErrCode; - // Construct new root. if (!rxPageL.construct (rBIOS.allocator())) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Save this as prev root. - eErrCode = rBIOS.allocate (*this); + storeError eErrCode = rBIOS.allocate (*this); if (eErrCode != store_E_None) - { - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); return store_E_OutOfMemory; - } // Setup new root. rxPageL->depth (xPage->depth() + 1); @@ -500,22 +412,13 @@ storeError OStoreBTreeRootObject::change ( // Save this as new root. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - if (eErrCode != store_E_None) - { - // Must not happen. - OSL_TRACE("OStoreBTreeRootObject::change(): save() failed"); - - // Release Lock and Leave. - rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); - return eErrCode; - } // Flush for robustness. (void) rBIOS.flush(); - // Done. Release Lock and Leave. + // Done. (void) testInvariant("OStoreBTreeRootObject::change(): leave"); - return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize); + return eErrCode; } /* diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx index 593736e4d57b..02d283c7e31e 100644 --- a/store/workben/t_base.cxx +++ b/store/workben/t_base.cxx @@ -365,18 +365,7 @@ int SAL_CALL main (int argc, char **argv) rtl_zeroMemory (pBuffer, sizeof (pBuffer)); rtl_copyMemory (pBuffer, argv[0], rtl_str_getLength(argv[0]) + 1); - eErrCode = xBIOS->acquireLock (TEST_PAGESIZE, sizeof(pBuffer)); - if (eErrCode != store_E_None) - return eErrCode; - eErrCode = xBIOS->write (TEST_PAGESIZE, pBuffer, sizeof (pBuffer)); - if (eErrCode != store_E_None) - { - xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); - return eErrCode; - } - - eErrCode = xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer)); if (eErrCode != store_E_None) return eErrCode; -- cgit v1.2.3 From d886d389f1531aadb4e81186ca5ceb3e8cb7c4ad Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Mon, 2 Nov 2009 19:09:43 +0100 Subject: #i71568# #i108349# Remove unused StateBlock code. --- store/source/storbios.cxx | 480 ++++++++++------------------------------------ store/source/storbios.hxx | 56 ++---- store/workben/makefile.mk | 6 +- 3 files changed, 119 insertions(+), 423 deletions(-) diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 62852fa3e0cd..499584b02cd3 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -1,35 +1,27 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile: storbios.cxx,v $ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision: 1.1.2.3 $ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author: mhu $ $Date: 2008/10/31 18:28:18 $ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. * ************************************************************************/ @@ -91,36 +83,36 @@ struct OStoreSuperBlock m_aUnused (0) {} - OStoreSuperBlock (const OStoreSuperBlock& rOther) - : m_aGuard (rOther.m_aGuard), - m_aDescr (rOther.m_aDescr), - m_nMarked (rOther.m_nMarked), - m_aMarked (rOther.m_aMarked), - m_nUnused (rOther.m_nUnused), - m_aUnused (rOther.m_aUnused) + OStoreSuperBlock (const OStoreSuperBlock & rhs) + : m_aGuard (rhs.m_aGuard), + m_aDescr (rhs.m_aDescr), + m_nMarked (rhs.m_nMarked), + m_aMarked (rhs.m_aMarked), + m_nUnused (rhs.m_nUnused), + m_aUnused (rhs.m_aUnused) {} - OStoreSuperBlock& operator= (const OStoreSuperBlock& rOther) + OStoreSuperBlock& operator= (const OStoreSuperBlock & rhs) { - m_aGuard = rOther.m_aGuard; - m_aDescr = rOther.m_aDescr; - m_nMarked = rOther.m_nMarked; - m_aMarked = rOther.m_aMarked; - m_nUnused = rOther.m_nUnused; - m_aUnused = rOther.m_aUnused; + m_aGuard = rhs.m_aGuard; + m_aDescr = rhs.m_aDescr; + m_nMarked = rhs.m_nMarked; + m_aMarked = rhs.m_aMarked; + m_nUnused = rhs.m_nUnused; + m_aUnused = rhs.m_aUnused; return *this; } /** Comparison. */ - sal_Bool operator== (const OStoreSuperBlock& rOther) const + sal_Bool operator== (const OStoreSuperBlock & rhs) const { - return ((m_aGuard == rOther.m_aGuard ) && - (m_aDescr == rOther.m_aDescr ) && - (m_nMarked == rOther.m_nMarked) && - (m_aMarked == rOther.m_aMarked) && - (m_nUnused == rOther.m_nUnused) && - (m_aUnused == rOther.m_aUnused) ); + return ((m_aGuard == rhs.m_aGuard ) && + (m_aDescr == rhs.m_aDescr ) && + (m_nMarked == rhs.m_nMarked) && + (m_aMarked == rhs.m_aMarked) && + (m_nUnused == rhs.m_nUnused) && + (m_aUnused == rhs.m_aUnused) ); } /** unused(Count|Head|Insert|Remove|Reset). @@ -179,74 +171,6 @@ struct OStoreSuperBlock } }; -/*======================================================================== - * - * OStoreStateBlock. - * - *======================================================================*/ -struct OStoreStateBlock -{ - enum StateBits - { - STATE_CLEAN = 0, - STATE_CLOSE_WAIT = 1, - STATE_FLUSH_WAIT = 2 - }; - - /** Representation. - */ - sal_uInt32 m_nState; - - /** theSize. - */ - static const size_t theSize = sizeof(sal_uInt32); - - /** Construction. - */ - OStoreStateBlock() - : m_nState (store::htonl(STATE_CLEAN)) - {} - - /** Operation. - */ - bool closePending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_CLOSE_WAIT) == STATE_CLOSE_WAIT); - } - void closed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_CLOSE_WAIT; - m_nState = store::htonl(nState); - } - - bool flushPending (void) const - { - sal_uInt32 nState = store::ntohl(m_nState); - return ((nState & STATE_FLUSH_WAIT) == STATE_FLUSH_WAIT); - } - void flushed (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~STATE_FLUSH_WAIT; - m_nState = store::htonl(nState); - } - - void modified (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState |= (STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } - void clean (void) - { - sal_uInt32 nState = store::ntohl(m_nState); - nState &= ~(STATE_CLOSE_WAIT | STATE_FLUSH_WAIT); - m_nState = store::htonl(nState); - } -}; - /*======================================================================== * * OStoreSuperBlockPage interface. @@ -258,17 +182,15 @@ namespace store struct OStoreSuperBlockPage { typedef OStoreSuperBlock SuperBlock; - typedef OStoreStateBlock StateBlock; /** Representation. */ SuperBlock m_aSuperOne; SuperBlock m_aSuperTwo; - StateBlock m_aState; /** theSize. */ - static const size_t theSize = 2 * SuperBlock::theSize + StateBlock::theSize; + static const size_t theSize = 2 * SuperBlock::theSize; static const sal_uInt16 thePageSize = theSize; STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize); @@ -296,8 +218,7 @@ struct OStoreSuperBlockPage */ explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize) : m_aSuperOne(nPageSize), - m_aSuperTwo(nPageSize), - m_aState() + m_aSuperTwo(nPageSize) {} /** guard (external representation). @@ -319,21 +240,6 @@ struct OStoreSuperBlockPage return rBIOS.write (0, this, theSize); } - /** close. - */ - storeError close ( - OStorePageBIOS &rBIOS); - - /** flush. - */ - storeError flush ( - OStorePageBIOS &rBIOS); - - /** modified. - */ - storeError modified ( - OStorePageBIOS &rBIOS); - /** verify (with repair). */ storeError verify ( @@ -347,89 +253,44 @@ struct OStoreSuperBlockPage * OStoreSuperBlockPage implementation. * *======================================================================*/ -/* - * close. - */ -storeError OStoreSuperBlockPage::close (OStorePageBIOS &rBIOS) +#if 0 /* NEW */ +SuperBlockPage::unusedHead(PageData & rPageHead) // alloc page, step 1 { - storeError eErrCode = store_E_None; - if (m_aState.closePending()) - { - // Mark as modified. - m_aState.modified(); - - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); - - // Mark as clean. - aState.clean(); + L aListHead (m_aSuperTwo.unusedHead()); + if (aListHead.location() == STORE_PAGE_NULL) + return store_E_NotExists; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - - // Mark as clean. - m_aState.clean(); - } - return eErrCode; + rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); } - -/* - * flush. - */ -storeError OStoreSuperBlockPage::flush (OStorePageBIOS &rBIOS) +SuperBlockPage::unusedPop(sal_uInt32 nAddr) // alloc page, step 2 { - storeError eErrCode = store_E_None; - if (m_aState.flushPending()) - { - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); - - // Mark as flushed. - aState.flushed(); +} +storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) +{ + PageData aPageHead (PageData::theSize); + eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } + eErrCode = aPageHead.verify (nAddr); + if (eErrCode != store_E_None) + return eErrCode; - // Mark as flushed. - m_aState.flushed(); - } - return eErrCode; -} + aPageHead.m_aUnused = m_aSuperTwo.unusedHead(); + aPageHead.guard (nAddr); -/* - * modified. - */ -storeError OStoreSuperBlockPage::modified (OStorePageBIOS &rBIOS) -{ - storeError eErrCode = store_E_None; - if (!m_aState.flushPending()) - { - // Mark as modified. - m_aState.modified(); + eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; - // Check access mode. - if (rBIOS.isWriteable()) - { - // Save StateBlock. - StateBlock aState (m_aState); + OStorePageLink aListHead (nAddr); + m_aSuperTwo.unusedInsert(aListHead); + m_aSuperOne = m_aSuperTwo; + guard(); - // Write behind SuperBlock. - sal_uInt32 nAddr = 2 * SuperBlock::theSize; - eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize); - } - } - return eErrCode; + return rBIOS.write (0, this, theSize); } +#endif /* NEW */ /* * verify (with repair). @@ -644,8 +505,7 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace) OStorePageBIOS::OStorePageBIOS (void) : m_xLockBytes (NULL), m_pSuper (NULL), - m_bModified (sal_False), - m_bWriteable (sal_False) + m_bWriteable (false) { } @@ -678,29 +538,12 @@ storeError OStorePageBIOS::verify (SuperPage *&rpSuper) delete rpSuper, rpSuper = 0; return eErrCode; } - - // Check SuperBlock state. - if (rpSuper->m_aState.closePending()) - OSL_TRACE("OStorePageBIOS::verify(): close pending.\n"); - - if (rpSuper->m_aState.flushPending()) - OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n"); } // Verify SuperBlock page (with repair). return rpSuper->verify (*this); } -/* - * repair (SuperBlock). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::repair (SuperPage *&rpSuper) -{ - // Verify SuperBlock page (with repair). - return verify (rpSuper); -} - /* * create (SuperBlock). * Internal: Precond: initialized, exclusive access. @@ -722,21 +565,7 @@ storeError OStorePageBIOS::create (sal_uInt16 nPageSize) m_pSuper->guard(); // Create initial page (w/ SuperBlock). - storeError eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize); - if (eErrCode != store_E_None) - return eErrCode; - -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::create(): flush failed"); -#endif /* STORE_FEATURE_COMMIT */ - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - return eErrCode; + return write (0, m_pSuper, nPageSize); } /* @@ -764,19 +593,13 @@ storeError OStorePageBIOS::initialize ( // Initialize. m_xLockBytes = pLockBytes; - m_bModified = sal_False; m_bWriteable = (!(eAccessMode == store_AccessReadOnly)); // Check access mode. - if (eAccessMode == store_AccessReadOnly) - { - // Verify SuperBlock page. - eErrCode = verify (m_pSuper); - } - else if (eAccessMode != store_AccessCreate) + if (eAccessMode != store_AccessCreate) { // Verify (w/ repair) SuperBlock page. - eErrCode = repair (m_pSuper); + eErrCode = verify (m_pSuper); } else { @@ -785,13 +608,6 @@ storeError OStorePageBIOS::initialize ( if (eErrCode != store_E_None) return eErrCode; -#ifdef STORE_FEATURE_COMMIT - // Commit. - eErrCode = m_xLockBytes->flush(); - if (eErrCode != store_E_None) - return eErrCode; -#endif /* STORE_FEATURE_COMMIT */ - // Mark as not existing. eErrCode = store_E_NotExists; } @@ -813,9 +629,6 @@ storeError OStorePageBIOS::initialize ( } if (eErrCode == store_E_None) { - // Obtain modified state. - m_bModified = m_pSuper->m_aState.flushPending(); - // Obtain page size. rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize); @@ -841,7 +654,7 @@ storeError OStorePageBIOS::read ( if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Read Page. + // Read Data. return m_xLockBytes->readAt (nAddr, pData, nSize); } @@ -858,18 +671,6 @@ storeError OStorePageBIOS::write ( if (!m_bWriteable) return store_E_AccessViolation; - // Check modified state. - if (!m_bModified) - { - // Mark as modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - storeError eErrCode = m_pSuper->modified (*this); - if (eErrCode != store_E_None) - return eErrCode; - } - // Write Data. return m_xLockBytes->writeAt (nAddr, pData, nSize); } @@ -989,10 +790,9 @@ storeError OStorePageBIOS::allocate ( { // Allocate from FreeList. OStorePageData aPageHead (OStorePageData::theSize); - aPageHead.location (aListHead.location()); // Load PageHead. - eErrCode = peek (aPageHead); + eErrCode = peek (aPageHead, aListHead.location()); if (eErrCode != store_E_None) return eErrCode; @@ -1037,58 +837,14 @@ storeError OStorePageBIOS::allocate ( } } - // Allocate from logical EOF. Determine physical EOF. - sal_uInt32 nPhysLen = STORE_PAGE_NULL; - eErrCode = m_xLockBytes->getSize (nPhysLen); + // Allocate from EOF. Determine current size. + sal_uInt32 nSize = STORE_PAGE_NULL; + eErrCode = m_xLockBytes->getSize (nSize); if (eErrCode != store_E_None) return eErrCode; - // Obtain logical EOF. - OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr); - sal_uInt32 nLogLen = store::ntohl(aDescr.m_nAddr); - if (nLogLen == 0) - nLogLen = nPhysLen; /* backward compatibility */ - - if (!(nLogLen < nPhysLen)) - { - // Check modified state. - if (!m_bModified) - { - // Mark modified. - m_bModified = sal_True; - - // Mark SuperBlock modified. - eErrCode = m_pSuper->modified (*this); - if (eErrCode != store_E_None) - return eErrCode; - } - - // Resize. - sal_uInt32 nAlign = SAL_MIN (nPhysLen, STORE_MAXIMUM_PAGESIZE); - nPhysLen = ((nPhysLen + nAlign) / nAlign) * nAlign; - - eErrCode = m_xLockBytes->setSize (nPhysLen); - if (eErrCode != store_E_None) - return eErrCode; - } - - // Save page at logical EOF. - eErrCode = saveObjectAt_Impl (rPage, nLogLen); - if (eErrCode != store_E_None) - return eErrCode; - - // Save SuperBlock page and finish. - nLogLen += store::ntohs(aDescr.m_nSize); - aDescr.m_nAddr = store::htonl(nLogLen); - - m_pSuper->m_aSuperTwo.m_aDescr = aDescr; - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - return eErrCode; + // Save page at current EOF. + return saveObjectAt_Impl (rPage, nSize); } /* @@ -1113,9 +869,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) // Load PageHead. OStorePageData aPageHead(OStorePageData::theSize); - aPageHead.location (nAddr); - - eErrCode = peek (aPageHead); + eErrCode = peek (aPageHead, nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1129,7 +883,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; // Save PageHead. - eErrCode = poke (aPageHead); + eErrCode = poke (aPageHead, nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1253,37 +1007,17 @@ storeError OStorePageBIOS::close (void) #endif /* NEW */ } - // Check SuperBlock page. - storeError eErrCode = store_E_None; - if (m_pSuper) - { - // Release SuperBlock page. - eErrCode = m_pSuper->close (*this); - delete m_pSuper, m_pSuper = 0; - } + // Release SuperBlock page. + delete m_pSuper, m_pSuper = 0; // Release PageCache. m_xCache.clear(); - // Check LockBytes. - if (m_xLockBytes.is()) - { -#ifdef STORE_FEATURE_COMMIT - // Commit. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } -#endif /* STORE_FEATURE_COMMIT */ - - // Release LockBytes. - m_xLockBytes.clear(); - } + // Release LockBytes. + m_xLockBytes.clear(); // Done. - return eErrCode; + return store_E_None; } /* @@ -1299,27 +1033,8 @@ storeError OStorePageBIOS::flush (void) if (!m_xLockBytes.is()) return store_E_InvalidAccess; - // Check mode and state. - storeError eErrCode = store_E_None; - if (!(m_bWriteable && m_bModified)) - return eErrCode; - - // Flush SuperBlock page. - eErrCode = m_pSuper->flush (*this); - - // Flush LockBytes. - storeError result = m_xLockBytes->flush(); - if (eErrCode == store_E_None) - { - // Previous result(s) okay. Propagate next result. - eErrCode = result; - } - - // Adjust modified state. - m_bModified = (eErrCode != store_E_None); - - // Done. - return eErrCode; + // Flush LockBytes and finish. + return m_xLockBytes->flush(); } /* @@ -1372,7 +1087,8 @@ storeError OStorePageBIOS::scanBegin ( // Setup Context descriptor. rCtx.m_aDescr = m_pSuper->m_aSuperOne.m_aDescr; - rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // @@@ ntoh @@@ + rCtx.m_aDescr.m_nSize = store::ntohs(rCtx.m_aDescr.m_nSize); + rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // Setup Context size. eErrCode = size (rCtx.m_nSize); @@ -1404,11 +1120,11 @@ storeError OStorePageBIOS::scanNext ( while (rCtx.isValid()) { // Assign next location. - aPageHead.location (rCtx.m_aDescr.m_nAddr); + sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr; rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize; // Load PageHead. - storeError eErrCode = peek (aPageHead); + storeError eErrCode = peek (aPageHead, nAddr); if (eErrCode != store_E_None) continue; @@ -1421,7 +1137,7 @@ storeError OStorePageBIOS::scanNext ( continue; // Load page. - eErrCode = loadObjectAt_Impl (rPage, aPageHead.location()); + eErrCode = loadObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) continue; @@ -1437,26 +1153,26 @@ storeError OStorePageBIOS::scanNext ( * peek (PageHead). * Internal: Precond: initialized, readable, exclusive access. */ -storeError OStorePageBIOS::peek (OStorePageData &rData) +storeError OStorePageBIOS::peek (OStorePageData &rData, sal_uInt32 nAddr) { // Read PageHead. - storeError eErrCode = read (rData.location(), &rData, OStorePageData::theSize); + storeError eErrCode = read (nAddr, &rData, OStorePageData::theSize); if (eErrCode != store_E_None) return eErrCode; // Verify PageHead. - return rData.verify(); + return rData.verify (nAddr); } /* * poke (PageHead). * Internal: Precond: initialized, writeable, exclusive access. */ -storeError OStorePageBIOS::poke (OStorePageData &rData) +storeError OStorePageBIOS::poke (OStorePageData &rData, sal_uInt32 nAddr) { // Guard PageHead. - rData.guard(); + rData.guard (nAddr); // Write PageHead. - return write (rData.location(), &rData, OStorePageData::theSize); + return write (nAddr, &rData, OStorePageData::theSize); } diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index d9d91255742b..f6e74ee3e19d 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -1,40 +1,32 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile: storbios.hxx,v $ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision: 1.1.2.3 $ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author: mhu $ $Date: 2008/10/31 18:28:18 $ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. * ************************************************************************/ #ifndef _STORE_STORBIOS_HXX_ -#define _STORE_STORBIOS_HXX_ "$Revision: 1.1.2.3 $" +#define _STORE_STORBIOS_HXX_ #include "sal/types.h" #include "rtl/ref.hxx" @@ -93,10 +85,6 @@ public: storeError write ( sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize); - /** isModified. - */ - inline bool isModified (void) const; - /** isWriteable. */ inline bool isWriteable (void) const; @@ -197,7 +185,6 @@ private: typedef OStoreSuperBlockPage SuperPage; SuperPage *m_pSuper; - bool m_bModified; bool m_bWriteable; rtl::Reference< PageData::Allocator > m_xAllocator; @@ -235,14 +222,13 @@ private: /** SuperBlock verification and repair. */ storeError verify (SuperPage *&rpSuper); - storeError repair (SuperPage *&rpSuper); /** Page Maintenance. */ storeError peek ( - OStorePageData &rData); + OStorePageData &rData, sal_uInt32 nAddr); storeError poke ( - OStorePageData &rData); + OStorePageData &rData, sal_uInt32 nAddr); storeError loadObjectAt_Impl ( OStorePageObject & rPage, sal_uInt32 nAddr); @@ -259,10 +245,6 @@ inline OStorePageBIOS::operator osl::Mutex& (void) const { return (osl::Mutex&)m_aMutex; } -inline bool OStorePageBIOS::isModified (void) const -{ - return m_bModified; -} inline bool OStorePageBIOS::isWriteable (void) const { return m_bWriteable; diff --git a/store/workben/makefile.mk b/store/workben/makefile.mk index 4b58d26409a0..60f1bb9b2ffe 100644 --- a/store/workben/makefile.mk +++ b/store/workben/makefile.mk @@ -6,10 +6,6 @@ # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -80,6 +76,7 @@ APP1OBJS= $(OBJ)$/t_file.obj APP1STDLIBS= $(STOREDBGLIB) APP1STDLIBS+= $(SALLIB) APP1DEPN= $(STOREDBGLIB) +APP1RPATH= UREBIN APP2TARGET= t_page APP2OBJS= $(OBJ)$/t_page.obj @@ -92,6 +89,7 @@ APP3OBJS= $(OBJ)$/t_base.obj APP3STDLIBS= $(STOREDBGLIB) APP3STDLIBS+= $(SALLIB) APP3DEPN= $(STOREDBGLIB) +APP3RPATH= UREBIN APP4TARGET= t_store APP4OBJS= $(OBJ)$/t_store.obj -- cgit v1.2.3 From 5243a9ef4e1178f0e03c9fcafb2a4405db4b4da3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Tue, 10 Nov 2009 15:55:03 +0100 Subject: #i71568# #i108349# Remove unnecessary flush(), more cleanup. --- store/source/storbios.cxx | 87 ++++++++++++++++++++++++++++++++--------------- store/source/storpage.cxx | 5 --- store/source/stortree.cxx | 7 +--- 3 files changed, 60 insertions(+), 39 deletions(-) diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 499584b02cd3..1882c5ab072c 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -231,19 +231,16 @@ struct OStoreSuperBlockPage /** save. */ - storeError save (OStorePageBIOS &rBIOS) + storeError save (OStorePageBIOS & rBIOS) { - // Guard. - guard(); - - // Write. + m_aSuperOne.guard(); + m_aSuperTwo = m_aSuperOne; return rBIOS.write (0, this, theSize); } /** verify (with repair). */ - storeError verify ( - OStorePageBIOS &rBIOS); + storeError verify (OStorePageBIOS & rBIOS); }; } // namespace store @@ -254,17 +251,55 @@ struct OStoreSuperBlockPage * *======================================================================*/ #if 0 /* NEW */ -SuperBlockPage::unusedHead(PageData & rPageHead) // alloc page, step 1 +/** + * alloc page, step 1: get freelist head. + */ +storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHead) { - L aListHead (m_aSuperTwo.unusedHead()); - if (aListHead.location() == STORE_PAGE_NULL) - return store_E_NotExists; + // Check FreeList. + OStorePageLink const aListHead (m_aSuperOne.unusedHead()); + if (aListHead.location() == 0) // @see SuperBlock::ctor() + { + rPageHead.location (STORE_PAGE_NULL); + return store_E_None; + } + + // Load PageHead. + eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + + eErrCode = rPageHead.verify (aListHead.location()); - rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + // Verify page is unused. + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_POSTCOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedHead(): page not free"); + if (nAddr == STORE_PAGE_NULL) + { + // Page in use. + rPageHead.location (STORE_PAGE_NULL); + + // Recovery: Reset FreeList. + m_aSuperOne.unusedReset(); + return save (rBIOS); + } + return store_E_None; } -SuperBlockPage::unusedPop(sal_uInt32 nAddr) // alloc page, step 2 + +/** + * alloc page, step 2: pop freelist head. + */ +SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) { + sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); + OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free"); + if (nAddr == STORE_PAGE_NULL) + return store_E_CantSeek; + + // Pop from FreeList. + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedRemove (aListHead); + return save (rBIOS); } + storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) { PageData aPageHead (PageData::theSize); @@ -276,19 +311,16 @@ storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 if (eErrCode != store_E_None) return eErrCode; - aPageHead.m_aUnused = m_aSuperTwo.unusedHead(); + aPageHead.m_aUnused = m_aSuperOne.unusedHead(); aPageHead.guard (nAddr); eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) return eErrCode; - OStorePageLink aListHead (nAddr); - m_aSuperTwo.unusedInsert(aListHead); - m_aSuperOne = m_aSuperTwo; - guard(); - - return rBIOS.write (0, this, theSize); + OStorePageLink const aListHead (nAddr); + m_aSuperOne.unusedInsert(aListHead); + return save (rBIOS); } #endif /* NEW */ @@ -785,7 +817,7 @@ storeError OStorePageBIOS::allocate ( if (eAlloc != ALLOCATE_EOF) { // Check FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); + OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); if (aListHead.location()) { // Allocate from FreeList. @@ -803,8 +835,7 @@ storeError OStorePageBIOS::allocate ( if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL) { // Recovery: Reset FreeList. - m_pSuper->m_aSuperTwo.unusedReset(); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedReset(); // Save SuperBlock page. eErrCode = m_pSuper->save (*this); @@ -826,8 +857,7 @@ storeError OStorePageBIOS::allocate ( return eErrCode; // Save SuperBlock page and finish. - m_pSuper->m_aSuperTwo.unusedRemove (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedRemove (aListHead); eErrCode = m_pSuper->save (*this); OSL_POSTCOND( @@ -877,7 +907,9 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) (void) m_xCache->removePageAt (nAddr); // Push onto FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead()); + // return m_pSuper->unusedPush (*this, nAddr); // @@@ NEW @@@ + + OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr; aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; @@ -888,8 +920,7 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) return eErrCode; // Save SuperBlock page and finish. - m_pSuper->m_aSuperTwo.unusedInsert (aListHead); - m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo; + m_pSuper->m_aSuperOne.unusedInsert (aListHead); eErrCode = m_pSuper->save (*this); OSL_POSTCOND( diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index b112d5bb8fdd..126057457c15 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -120,11 +120,6 @@ storeError OStorePageManager::initialize ( // Save RootNode. eErrCode = base::saveObjectAt (m_aRoot, rnPageSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Flush for robustness. - (void) base::flush(); } // Done. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 3f4f4b21c68b..26f06b887b75 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -410,13 +410,8 @@ storeError OStoreBTreeRootObject::change ( tmp.swap (m_xPage); } - // Save this as new root. + // Save this as new root and finish. eErrCode = rBIOS.saveObjectAt (*this, nRootAddr); - - // Flush for robustness. - (void) rBIOS.flush(); - - // Done. (void) testInvariant("OStoreBTreeRootObject::change(): leave"); return eErrCode; } -- cgit v1.2.3 From 00075d74eef445722ff1b269ef5205e29f559af3 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Fri, 13 Nov 2009 16:03:20 +0100 Subject: #i71568# #i108349# Simplified block (page) allocation. --- store/source/storbase.hxx | 17 -- store/source/storbios.cxx | 387 ++++++++++++++++++---------------------------- store/source/storbios.hxx | 25 ++- store/source/stordata.cxx | 15 +- store/source/storpage.cxx | 3 +- store/source/stortree.cxx | 5 +- 6 files changed, 170 insertions(+), 282 deletions(-) diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx index 04be2860f691..3331763acf61 100644 --- a/store/source/storbase.hxx +++ b/store/source/storbase.hxx @@ -556,13 +556,6 @@ struct PageData /** guard (external representation). */ - void guard() - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - m_aGuard.m_nCRC32 = store::htonl(nCRC32); - } void guard (sal_uInt32 nAddr) { sal_uInt32 nCRC32 = 0; @@ -574,16 +567,6 @@ struct PageData /** verify (external representation). */ - storeError verify() const - { - sal_uInt32 nCRC32 = 0; - nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32)); - nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G)); - if (m_aGuard.m_nCRC32 != store::htonl(nCRC32)) - return store_E_InvalidChecksum; - else - return store_E_None; - } storeError verify (sal_uInt32 nAddr) const { sal_uInt32 nCRC32 = 0; diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 1882c5ab072c..9e01c0489d94 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -173,13 +173,13 @@ struct OStoreSuperBlock /*======================================================================== * - * OStoreSuperBlockPage interface. + * SuperBlockPage interface. * *======================================================================*/ namespace store { -struct OStoreSuperBlockPage +struct SuperBlockPage { typedef OStoreSuperBlock SuperBlock; @@ -216,28 +216,34 @@ struct OStoreSuperBlockPage /** Construction. */ - explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize) + explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize) : m_aSuperOne(nPageSize), m_aSuperTwo(nPageSize) {} - /** guard (external representation). - */ - void guard() - { - m_aSuperOne.guard(); - m_aSuperTwo.guard(); - } - /** save. */ - storeError save (OStorePageBIOS & rBIOS) + storeError save (OStorePageBIOS & rBIOS, sal_uInt32 nSize = theSize) { m_aSuperOne.guard(); m_aSuperTwo = m_aSuperOne; - return rBIOS.write (0, this, theSize); + return rBIOS.write (0, this, nSize); } + /** Page allocation. + */ + storeError unusedHead ( + OStorePageBIOS & rBIOS, + PageData & rPageHead); + + storeError unusedPop ( + OStorePageBIOS & rBIOS, + PageData const & rPageHead); + + storeError unusedPush ( + OStorePageBIOS & rBIOS, + sal_uInt32 nAddr); + /** verify (with repair). */ storeError verify (OStorePageBIOS & rBIOS); @@ -247,27 +253,35 @@ struct OStoreSuperBlockPage /*======================================================================== * - * OStoreSuperBlockPage implementation. + * SuperBlockPage implementation. * *======================================================================*/ -#if 0 /* NEW */ -/** - * alloc page, step 1: get freelist head. +/* + * unusedHead(): get freelist head (alloc page, step 1). */ -storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHead) +storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageHead) { - // Check FreeList. + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; + + // Check freelist head. OStorePageLink const aListHead (m_aSuperOne.unusedHead()); - if (aListHead.location() == 0) // @see SuperBlock::ctor() + if (aListHead.location() == 0) { + // Freelist empty, see SuperBlock::ctor(). rPageHead.location (STORE_PAGE_NULL); return store_E_None; } // Load PageHead. eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize); + if (eErrCode != store_E_None) + return eErrCode; eErrCode = rPageHead.verify (aListHead.location()); + if (eErrCode != store_E_None) + return eErrCode; // Verify page is unused. sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); @@ -277,17 +291,17 @@ storeError SuperBlockPage::unusedHead(OStorePageBIOS & rBIOS, PageData & rPageHe // Page in use. rPageHead.location (STORE_PAGE_NULL); - // Recovery: Reset FreeList. + // Recovery: Reset freelist to empty. m_aSuperOne.unusedReset(); - return save (rBIOS); + eErrCode = save (rBIOS); } - return store_E_None; + return eErrCode; } -/** - * alloc page, step 2: pop freelist head. +/* + * unusedPop(): pop freelist head (alloc page, step 2). */ -SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) +storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) { sal_uInt32 const nAddr = rPageHead.m_aUnused.location(); OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free"); @@ -300,9 +314,16 @@ SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead) return save (rBIOS); } -storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) +/* + * unusedPush(): push new freelist head. + */ +storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr) { - PageData aPageHead (PageData::theSize); + storeError eErrCode = verify (rBIOS); + if (eErrCode != store_E_None) + return eErrCode; + + PageData aPageHead; eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) return eErrCode; @@ -322,12 +343,11 @@ storeError OStoreSuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 m_aSuperOne.unusedInsert(aListHead); return save (rBIOS); } -#endif /* NEW */ /* * verify (with repair). */ -storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS) +storeError SuperBlockPage::verify (OStorePageBIOS & rBIOS) { // Verify 1st copy. storeError eErrCode = m_aSuperOne.verify(); @@ -546,58 +566,7 @@ OStorePageBIOS::OStorePageBIOS (void) */ OStorePageBIOS::~OStorePageBIOS (void) { - OStorePageBIOS::close(); -} - -/* - * verify (SuperBlock with repair). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::verify (SuperPage *&rpSuper) -{ - // Check SuperBlock page allocation. - if (rpSuper == 0) - { - // Allocate. - if ((rpSuper = new SuperPage()) == 0) - return store_E_OutOfMemory; - - // Load (w/o verification). - storeError eErrCode = read (0, rpSuper, SuperPage::theSize); - if (eErrCode != store_E_None) - { - // Cleanup and fail. - delete rpSuper, rpSuper = 0; - return eErrCode; - } - } - - // Verify SuperBlock page (with repair). - return rpSuper->verify (*this); -} - -/* - * create (SuperBlock). - * Internal: Precond: initialized, exclusive access. - */ -storeError OStorePageBIOS::create (sal_uInt16 nPageSize) -{ - // Check (internal) precond. - OSL_PRECOND(m_xLockBytes.is(), "store::PageBIOS::create(): contract violation"); - - // Check PageSize. - if ((STORE_MINIMUM_PAGESIZE > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE)) - return store_E_InvalidParameter; - nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); - - // Allocate SuperBlock page. - delete m_pSuper, m_pSuper = 0; - if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0) - return store_E_OutOfMemory; - m_pSuper->guard(); - - // Create initial page (w/ SuperBlock). - return write (0, m_pSuper, nPageSize); + cleanup_Impl(); } /* @@ -612,26 +581,48 @@ storeError OStorePageBIOS::initialize ( // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); - // Check arguments. - storeError eErrCode = store_E_InvalidParameter; - if (!pLockBytes) - return eErrCode; + // Initialize. + storeError eErrCode = initialize_Impl (pLockBytes, eAccessMode, rnPageSize); + if (eErrCode != store_E_None) + { + // Cleanup. + cleanup_Impl(); + } + return eErrCode; +} +/* + * initialize_Impl. + * Internal: Precond: exclusive access. + */ +storeError OStorePageBIOS::initialize_Impl ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize) +{ // Cleanup. -#if 0 /* OLD */ - __STORE_DELETEZ (m_pAcl); /* @@@ */ -#endif /* OLD */ - delete m_pSuper, m_pSuper = 0; + cleanup_Impl(); // Initialize. m_xLockBytes = pLockBytes; - m_bWriteable = (!(eAccessMode == store_AccessReadOnly)); + if (!m_xLockBytes.is()) + return store_E_InvalidParameter; + m_bWriteable = (eAccessMode != store_AccessReadOnly); // Check access mode. + storeError eErrCode = store_E_None; if (eAccessMode != store_AccessCreate) { - // Verify (w/ repair) SuperBlock page. - eErrCode = verify (m_pSuper); + // Load SuperBlock page. + if ((m_pSuper = new SuperBlockPage()) == 0) + return store_E_OutOfMemory; + + eErrCode = read (0, m_pSuper, SuperBlockPage::theSize); + if (eErrCode == store_E_None) + { + // Verify SuperBlock page (with repair). + eErrCode = m_pSuper->verify (*this); + } } else { @@ -656,8 +647,15 @@ storeError OStorePageBIOS::initialize ( if (eAccessMode == store_AccessReadWrite) return store_E_NotExists; - // Create SuperBlock page. - eErrCode = create (rnPageSize); + // Check PageSize. + if ((STORE_MINIMUM_PAGESIZE > rnPageSize) || (rnPageSize > STORE_MAXIMUM_PAGESIZE)) + return store_E_InvalidParameter; + rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1)); + + // Create initial page (w/ SuperBlock). + if ((m_pSuper = new(rnPageSize) SuperBlockPage(rnPageSize)) == 0) + return store_E_OutOfMemory; + eErrCode = m_pSuper->save (*this, rnPageSize); } if (eErrCode == store_E_None) { @@ -675,6 +673,38 @@ storeError OStorePageBIOS::initialize ( return eErrCode; } +/* + * cleanup_Impl. + * Internal: Precond: exclusive access. + */ +void OStorePageBIOS::cleanup_Impl() +{ + // Check referer count. + if (m_ace_head.m_used > 0) + { + // Report remaining referer count. + OSL_TRACE("store::PageBIOS::cleanup_Impl(): referer count: %d\n", m_ace_head.m_used); + for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) + { + m_ace_head.m_used -= ace->m_used; + AceCache::get().destroy (ace); + } + OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::cleanup_Impl(): logic error"); + } + + // Release SuperBlock page. + delete m_pSuper, m_pSuper = 0; + + // Release PageCache. + m_xCache.clear(); + + // Release PageAllocator. + m_xAllocator.clear(); + + // Release LockBytes. + m_xLockBytes.clear(); +} + /* * read. * Low Level: Precond: initialized, exclusive access. @@ -808,62 +838,26 @@ storeError OStorePageBIOS::allocate ( if (!m_bWriteable) return store_E_AccessViolation; - // Load SuperBlock and require good health. - storeError eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - return eErrCode; - - // Check allocation. + // Check allocation type. + storeError eErrCode = store_E_None; if (eAlloc != ALLOCATE_EOF) { - // Check FreeList. - OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); - if (aListHead.location()) - { - // Allocate from FreeList. - OStorePageData aPageHead (OStorePageData::theSize); - - // Load PageHead. - eErrCode = peek (aPageHead, aListHead.location()); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify FreeList head. - OSL_PRECOND( - aPageHead.m_aUnused.m_nAddr != STORE_PAGE_NULL, - "OStorePageBIOS::allocate(): page not free"); - if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL) - { - // Recovery: Reset FreeList. - m_pSuper->m_aSuperOne.unusedReset(); - - // Save SuperBlock page. - eErrCode = m_pSuper->save (*this); - - // Recovery: Allocate from EOF. - if (eErrCode == store_E_None) - return allocate (rPage, ALLOCATE_EOF); - else - return store_E_Unknown; - } - - // Pop from FreeList. - aListHead = aPageHead.m_aUnused.location(); - rPage.get()->m_aUnused = STORE_PAGE_NULL; + // Try freelist head. + PageData aPageHead; + eErrCode = m_pSuper->unusedHead (*this, aPageHead); + if (eErrCode != store_E_None) + return eErrCode; - // Save page at PageHead location. - eErrCode = saveObjectAt_Impl (rPage, aPageHead.location()); + sal_uInt32 const nAddr = aPageHead.location(); + if (nAddr != STORE_PAGE_NULL) + { + // Save page. + eErrCode = saveObjectAt_Impl (rPage, nAddr); if (eErrCode != store_E_None) return eErrCode; - // Save SuperBlock page and finish. - m_pSuper->m_aSuperOne.unusedRemove (aListHead); - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::allocate(): SuperBlock save failed"); - return eErrCode; + // Pop freelist head and finish. + return m_pSuper->unusedPop (*this, aPageHead); } } @@ -881,7 +875,7 @@ storeError OStorePageBIOS::allocate ( * free. * Precond: initialized, writeable. */ -storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) +storeError OStorePageBIOS::free (sal_uInt32 nAddr) { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); @@ -892,41 +886,11 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr) if (!m_bWriteable) return store_E_AccessViolation; - // Load SuperBlock and require good health. - storeError eErrCode = verify (m_pSuper); - if (eErrCode != store_E_None) - return eErrCode; - - // Load PageHead. - OStorePageData aPageHead(OStorePageData::theSize); - eErrCode = peek (aPageHead, nAddr); - if (eErrCode != store_E_None) - return eErrCode; - // Invalidate cache. (void) m_xCache->removePageAt (nAddr); - // Push onto FreeList. - // return m_pSuper->unusedPush (*this, nAddr); // @@@ NEW @@@ - - OStorePageLink aListHead (m_pSuper->m_aSuperOne.unusedHead()); - - aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr; - aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr; - - // Save PageHead. - eErrCode = poke (aPageHead, nAddr); - if (eErrCode != store_E_None) - return eErrCode; - - // Save SuperBlock page and finish. - m_pSuper->m_aSuperOne.unusedInsert (aListHead); - - eErrCode = m_pSuper->save (*this); - OSL_POSTCOND( - eErrCode == store_E_None, - "OStorePageBIOS::free(): SuperBlock save failed"); - return eErrCode; + // Push onto freelist. + return m_pSuper->unusedPush (*this, nAddr); } /* @@ -1018,34 +982,13 @@ storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt * close. * Precond: none. */ -storeError OStorePageBIOS::close (void) +storeError OStorePageBIOS::close() { // Acquire exclusive access. osl::MutexGuard aGuard (m_aMutex); - // Check referer count. - if (m_ace_head.m_used > 0) - { - // Report remaining referer count. - OSL_TRACE("store::PageBIOS::close(): referer count: %d\n", m_ace_head.m_used); -#if 1 /* NEW */ - for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next) - { - m_ace_head.m_used -= ace->m_used; - AceCache::get().destroy (ace); - } - OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::close(): logic error"); -#endif /* NEW */ - } - - // Release SuperBlock page. - delete m_pSuper, m_pSuper = 0; - - // Release PageCache. - m_xCache.clear(); - - // Release LockBytes. - m_xLockBytes.clear(); + // Cleanup. + cleanup_Impl(); // Done. return store_E_None; @@ -1108,7 +1051,7 @@ storeError OStorePageBIOS::scanBegin ( return store_E_InvalidAccess; // Check SuperBlock page. - storeError eErrCode = verify (m_pSuper); + storeError eErrCode = m_pSuper->verify (*this); if (eErrCode != store_E_None) { // Damaged. Determine page size (NYI). @@ -1145,7 +1088,7 @@ storeError OStorePageBIOS::scanNext ( return store_E_InvalidAccess; // Setup PageHead. - OStorePageData aPageHead (OStorePageData::theSize); + PageData aPageHead; // Check context. while (rCtx.isValid()) @@ -1154,11 +1097,15 @@ storeError OStorePageBIOS::scanNext ( sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr; rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize; - // Load PageHead. - storeError eErrCode = peek (aPageHead, nAddr); + // Read PageHead. + storeError eErrCode = read (nAddr, &aPageHead, PageData::theSize); if (eErrCode != store_E_None) continue; + // Verify PageHead. + eErrCode = aPageHead.verify (nAddr); + continue; + // Check PageHead Magic number. if (aPageHead.m_aGuard.m_nMagic != rCtx.m_nMagic) continue; @@ -1179,31 +1126,3 @@ storeError OStorePageBIOS::scanNext ( // Done. return store_E_CantSeek; } - -/* - * peek (PageHead). - * Internal: Precond: initialized, readable, exclusive access. - */ -storeError OStorePageBIOS::peek (OStorePageData &rData, sal_uInt32 nAddr) -{ - // Read PageHead. - storeError eErrCode = read (nAddr, &rData, OStorePageData::theSize); - if (eErrCode != store_E_None) - return eErrCode; - - // Verify PageHead. - return rData.verify (nAddr); -} - -/* - * poke (PageHead). - * Internal: Precond: initialized, writeable, exclusive access. - */ -storeError OStorePageBIOS::poke (OStorePageData &rData, sal_uInt32 nAddr) -{ - // Guard PageHead. - rData.guard (nAddr); - - // Write PageHead. - return write (nAddr, &rData, OStorePageData::theSize); -} diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx index f6e74ee3e19d..ef95d2f8376e 100644 --- a/store/source/storbios.hxx +++ b/store/source/storbios.hxx @@ -46,7 +46,7 @@ namespace store { -struct OStoreSuperBlockPage; +struct SuperBlockPage; class OStorePageBIOS : public store::OStoreObject { @@ -115,8 +115,7 @@ public: storeError allocate ( OStorePageObject& rPage, Allocation eAllocation = ALLOCATE_FIRST); - storeError free ( - OStorePageData & /* rData */, sal_uInt32 nAddr); + storeError free (sal_uInt32 nAddr); /** Page I/O. */ @@ -182,8 +181,7 @@ private: rtl::Reference m_xLockBytes; osl::Mutex m_aMutex; - typedef OStoreSuperBlockPage SuperPage; - SuperPage *m_pSuper; + SuperBlockPage * m_pSuper; bool m_bWriteable; @@ -215,21 +213,16 @@ private: class AceCache; - /** create (SuperBlock). - */ - storeError create (sal_uInt16 nPageSize); - - /** SuperBlock verification and repair. + /** Initialization. */ - storeError verify (SuperPage *&rpSuper); + storeError initialize_Impl ( + ILockBytes * pLockBytes, + storeAccessMode eAccessMode, + sal_uInt16 & rnPageSize); + void cleanup_Impl(); /** Page Maintenance. */ - storeError peek ( - OStorePageData &rData, sal_uInt32 nAddr); - storeError poke ( - OStorePageData &rData, sal_uInt32 nAddr); - storeError loadObjectAt_Impl ( OStorePageObject & rPage, sal_uInt32 nAddr); storeError saveObjectAt_Impl ( diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index dd0a8f18211f..91d789a2cb0d 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -98,8 +98,7 @@ static storeError store_truncate_Impl ( if (nSingle == 0) { // Free single indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -138,8 +137,7 @@ static storeError store_truncate_Impl ( if ((nDouble + nSingle) == 0) { // Free double indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -174,8 +172,7 @@ static storeError store_truncate_Impl ( if ((nTriple + nDouble + nSingle) == 0) { // Free triple indirect page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; } @@ -445,8 +442,7 @@ storeError OStoreIndirectionPageObject::truncate ( if (nAddr != STORE_PAGE_NULL) { // Free data page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) return eErrCode; @@ -1063,8 +1059,7 @@ storeError OStoreDirectoryPageObject::truncate ( if (nAddr == STORE_PAGE_NULL) continue; // Free data page. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, nAddr); + eErrCode = rBIOS.free (nAddr); if (eErrCode != store_E_None) break; diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx index 126057457c15..992931828080 100644 --- a/store/source/storpage.cxx +++ b/store/source/storpage.cxx @@ -855,8 +855,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey) eErrCode = base::releasePage (aDescr, store_AccessReadWrite); // Release and free directory page. - OStorePageData aPageHead; - eErrCode = base::free (aPageHead, aPage.location()); + eErrCode = base::free (aPage.location()); } // Remove entry. diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx index 26f06b887b75..d96216654732 100644 --- a/store/source/stortree.cxx +++ b/store/source/stortree.cxx @@ -273,8 +273,7 @@ storeError OStoreBTreeNodeObject::remove ( if (xPageL->usageCount() == 0) { // Free empty link node. - OStorePageData aPageHead; - eErrCode = rBIOS.free (aPageHead, xPageL->location()); + eErrCode = rBIOS.free (xPageL->location()); if (eErrCode != store_E_None) return eErrCode; @@ -298,7 +297,7 @@ storeError OStoreBTreeNodeObject::remove ( { rPageL.merge (rPageR); - eErrCode = rBIOS.free (aPageHead, rPageR.location()); + eErrCode = rBIOS.free (rPageR.location()); } } } -- cgit v1.2.3 From a750da5d7f3c9a21ee05442b317622df4a45b1e4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Nov 2009 12:18:12 +0100 Subject: [CWS autorecovery] a very early step towards #i65597#: some refactoring, removal of unused code, and consolidation Basically, in the current phase this is just to make it easier to understand the current code. --- sfx2/inc/frmload.hxx | 91 +++--- sfx2/inc/sfx2/frame.hxx | 2 +- sfx2/inc/sfx2/objsh.hxx | 2 +- sfx2/source/doc/objcont.cxx | 69 ++--- sfx2/source/view/frame.cxx | 4 +- sfx2/source/view/frmload.cxx | 645 ++++++++++++++++++++++--------------------- sfx2/source/view/topfrm.cxx | 86 +++--- sfx2/source/view/viewfrm.cxx | 14 +- sfx2/source/view/viewprn.cxx | 4 + 9 files changed, 440 insertions(+), 477 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index d3df697cecfa..5053f6a2a8f8 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -31,71 +31,40 @@ #ifndef _SFX_FRMLOAD_HXX #define _SFX_FRMLOAD_HXX +/** === begin UNO includes === **/ #include -#include -#include #include #include #include -#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include #include #include #include - -#include -#include #include #include #include +#include -class SfxObjectFactory; +class SfxFilter; class SfxFilterMatcher; -class LoadEnvironment_Impl; -class SfxMedium; - -namespace com -{ - namespace sun - { - namespace star - { - namespace uno - { - class Any; - } - namespace lang - { - class XMultiServiceFactory; - } - namespace frame - { - class XFrame; - } - namespace beans - { - struct PropertyValue; - } - } - } -} +class SfxFrame; #include -#define REFERENCE ::com::sun::star::uno::Reference -#define SEQUENCE ::com::sun::star::uno::Sequence -#define RUNTIME_EXCEPTION ::com::sun::star::uno::RuntimeException - class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > { - REFERENCE < ::com::sun::star::frame::XFrame > xFrame; - REFERENCE < ::com::sun::star::frame::XLoadEventListener > xListener; - String aFilterName; - SfxMedium* pMedium; - - DECL_LINK( LoadDone_Impl, void* ); + ::comphelper::ComponentContext m_aContext; public: - SfxFrameLoader_Impl( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); + SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); virtual ~SfxFrameLoader_Impl(); SFX_DECL_XSERVICEINFO @@ -103,8 +72,34 @@ public: //---------------------------------------------------------------------------------- // XSynchronousFrameLoader //---------------------------------------------------------------------------------- - virtual sal_Bool SAL_CALL load( const SEQUENCE< ::com::sun::star::beans::PropertyValue >& lDescriptor, const REFERENCE< ::com::sun::star::frame::XFrame >& xFrame ) throw( RUNTIME_EXCEPTION ); - virtual void SAL_CALL cancel() throw( RUNTIME_EXCEPTION ); + virtual sal_Bool SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); + +private: + const SfxFilter* impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const; + ::rtl::OUString impl_askForFilter_nothrow( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler, + const ::rtl::OUString& _rDocumentURL + ) const; + + const SfxFilter* impl_detectFilterForURL( + const ::rtl::OUString& _rURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, + const SfxFilterMatcher& rMatcher + ) const; + + sal_Bool impl_createNewDocWithSlotParam( + const sal_uInt16 _nSlotID, + SfxFrame* _pFrame + ); + + sal_Bool impl_createNewDoc( + const SfxItemSet& _rSet, + SfxFrame* _pFrame, + const ::rtl::OUString& _rFactoryURL + ); + + void impl_ensureValidFrame_throw( const SfxFrame* _pFrame ); }; #endif diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 2443fcb345a9..18e1cba1e3a3 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -224,7 +224,7 @@ public: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool DoClose_Impl(); - SAL_DLLPRIVATE void SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > GetInterceptor_Impl(); diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 7e3813584de9..9b7665671200 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -789,7 +789,7 @@ public: SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); //REMOVE FASTBOOL SaveWindows_Impl( SvStorage &rStor ) const; - SAL_DLLPRIVATE SfxViewFrame* LoadWindows_Impl( SfxTopFrame *pPrefered = 0 ); + SAL_DLLPRIVATE SfxViewFrame* LoadWindows_Impl( SfxTopFrame& rPrefered ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index f9c675372307..998d2f89b510 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -50,8 +50,9 @@ #include #include #include -#include #include +#include +#include #include #include #include @@ -254,10 +255,10 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig //==================================================================== -SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) +SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame& rPreferedFrame ) { - DBG_ASSERT( pPreferedFrame, "Call without preferred Frame is not supported anymore!" ); - if ( pImp->bLoadingWindows || !pPreferedFrame ) + + if ( pImp->bLoadingWindows ) return NULL; DBG_ASSERT( GetMedium(), "A Medium should exist here!"); @@ -266,9 +267,9 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) // get correct mode SFX_APP(); - SfxViewFrame *pPrefered = pPreferedFrame ? pPreferedFrame->GetCurrentViewFrame() : 0; + SfxViewFrame* pPreferedViewFrame = rPreferedFrame.GetCurrentViewFrame(); SvtSaveOptions aOpt; - BOOL bLoadDocWins = aOpt.IsSaveDocWins() && !pPrefered; + BOOL bLoadDocWins = aOpt.IsSaveDocWins() && !pPreferedViewFrame; // try to get viewdata information for XML format REFERENCE < XVIEWDATASUPPLIER > xViewDataSupplier( GetModel(), ::com::sun::star::uno::UNO_QUERY ); @@ -292,11 +293,10 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) sal_Int32 nView = 0; // get saved information for all views + SfxTopFrame* pCurrentTargetFrame = &rPreferedFrame; while ( TRUE ) { USHORT nViewId = 0; - FASTBOOL bMaximized=FALSE; - String aPosSize; String aUserData; // used in the binary format SEQUENCE < PROPERTYVALUE > aSeq; // used in the XML format @@ -312,18 +312,12 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) ::com::sun::star::uno::Any aAny = xViewData->getByIndex( nView++ ); if ( aAny >>= aSeq ) { - for ( sal_Int32 n=0; n>= aId; - String aTmp( aId ); - aTmp.Erase( 0, 4 ); // format is like in "view3" - nViewId = (USHORT) aTmp.ToInt32(); - break; - } + sViewId = sViewId.copy( 4 ); // format is like in "view3" + nViewId = USHORT( sViewId.toInt32() ); } } @@ -332,26 +326,12 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) if ( !bLoadDocWins && !bActive ) break; - // check for minimized/maximized/size - if ( aPosSize.EqualsAscii( "max" ) ) - bMaximized = TRUE; - else if ( aPosSize.EqualsAscii( "min" ) ) - { - bMaximized = TRUE; - bActive = FALSE; - } - else - bMaximized = FALSE; - - Point aPt; - Size aSz; - pSet->ClearItem( SID_USER_DATA ); SfxViewFrame *pFrame = 0; - if ( pPrefered ) + if ( pPreferedViewFrame ) { // use the frame from the arguments, but don't set a window size - pFrame = pPrefered; + pFrame = pPreferedViewFrame; if ( pFrame->GetViewShell() || !pFrame->GetObjectShell() ) { pSet->ClearItem( SID_VIEW_POS_SIZE ); @@ -363,7 +343,7 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) rBind.ENTERREGISTRATIONS(); // set document into frame - pPreferedFrame->InsertDocument( this ); + pCurrentTargetFrame->InsertDocument( this ); // restart controller updating rBind.LEAVEREGISTRATIONS(); @@ -380,17 +360,16 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) { // open in the background pSet->Put( SfxUInt16Item( SID_VIEW_ZOOM_MODE, 0 ) ); - if ( !bMaximized ) - pSet->Put( SfxRectangleItem( SID_VIEW_POS_SIZE, Rectangle( aPt, aSz ) ) ); + pSet->Put( SfxRectangleItem( SID_VIEW_POS_SIZE, Rectangle() ) ); } pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( pPreferedFrame ) + if ( pCurrentTargetFrame ) { // Frame "ubergeben, allerdings ist der noch leer - pPreferedFrame->InsertDocument( this ); - pFrame = pPreferedFrame->GetCurrentViewFrame(); + pCurrentTargetFrame->InsertDocument( this ); + pFrame = pCurrentTargetFrame->GetCurrentViewFrame(); } else { @@ -416,25 +395,25 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) } // perhaps there are more windows to load - pPreferedFrame = NULL; + pCurrentTargetFrame = NULL; if ( bActive ) pActiveFrame = pFrame; - if( pPrefered || !bLoadDocWins ) + if( pPreferedViewFrame || !bLoadDocWins ) // load only active window break; } if ( pActiveFrame ) { - if ( !pPrefered ) + if ( !pPreferedViewFrame ) // activate frame pActiveFrame->MakeActive_Impl( TRUE ); } pImp->bLoadingWindows = FALSE; - return pPrefered && bLoaded ? pPrefered : pActiveFrame; + return pPreferedViewFrame && bLoaded ? pPreferedViewFrame : pActiveFrame; } //==================================================================== diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 42e9a1d04cb6..4aa23dbe1dc5 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -683,7 +683,7 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { // Beim InsertDocument wird der Descriptor des Frames aktualisiert // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres - // Restaurieren der ::com::sun::star::sdbcx::View n"otig sind, sind damit festgehalten. + // Restaurieren der View n"otig sind, sind damit festgehalten. // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) // die neueste Information hinzugef"ugt. Alles zusammen wird dann in der // Browse-History gesichert. Beim Aktivieren eines solchen FramePickEntry @@ -1265,7 +1265,7 @@ sal_Bool SfxFrame::HasComponent() const return pImp->xFrame; } -void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) +void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) { pImp->xFrame = rFrame; com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index b91e1e6b4998..27355dd6026c 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -34,44 +34,27 @@ #include "frmload.hxx" #include + #include -#include #include -#include #include #include -#include -#include -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include -#endif -#include -#include #include -#include -#include -#include -#include #include -#include -#ifndef _TOOLKIT_UNOHLP_HXX #include -#endif #include #include #include #include -#include +#include #include #include -#include -#include -#include -#include +#include #include #include +#include #include #include @@ -95,7 +78,32 @@ namespace css = ::com::sun::star; #include "brokenpackageint.hxx" #include "objshimp.hxx" -SfxFrameLoader_Impl::SfxFrameLoader_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& /*xFactory*/ ) +// do not remove the markers below +/** === begin UNO using === **/ +using ::com::sun::star::uno::Reference; +using ::com::sun::star::task::XInteractionHandler; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::container::XContainerQuery; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::document::XTypeDetection; +using ::com::sun::star::util::XCloseable; +using ::com::sun::star::frame::XLoadable; +/** === end UNO using === **/ + +SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< css::lang::XMultiServiceFactory >& _rxFactory ) + :m_aContext( _rxFactory ) { } @@ -103,54 +111,46 @@ SfxFrameLoader_Impl::~SfxFrameLoader_Impl() { } -const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& sURL , - const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const SfxFilterMatcher& rMatcher) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUString& sURL, + const Sequence< PropertyValue >& rArgs, const SfxFilterMatcher& rMatcher ) const { - static ::rtl::OUString SERVICENAME_TYPEDETECTION = ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection"); - ::rtl::OUString sFilter; try { - if (!sURL.getLength()) + if ( !sURL.getLength() ) return 0; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - if (!xSMGR.is()) - return 0; + Reference< XTypeDetection > xDetect( + m_aContext.createComponent( "com.sun.star.document.TypeDetection" ), + UNO_QUERY_THROW); + + ::comphelper::NamedValueCollection aNewArgs; + aNewArgs.put( "URL", sURL ); - css::uno::Reference< css::document::XTypeDetection > xDetect( - xSMGR->createInstance(SERVICENAME_TYPEDETECTION), - css::uno::UNO_QUERY_THROW); - - ::comphelper::MediaDescriptor lOrgArgs(rArgs); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(), - css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::task::XStatusIndicator > xProgress = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), - css::uno::Reference< css::task::XStatusIndicator >()); - - ::comphelper::SequenceAsHashMap lNewArgs; - lNewArgs[::comphelper::MediaDescriptor::PROP_URL()] <<= sURL; - if (xInteraction.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteraction; - if (xProgress.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress; - - css::uno::Sequence< css::beans::PropertyValue > lDescr = lNewArgs.getAsConstPropertyValueList(); - ::rtl::OUString sType = xDetect->queryTypeByDescriptor(lDescr, sal_True); - if (sType.getLength()) + ::comphelper::NamedValueCollection aOrgArgs( rArgs ); + if ( aOrgArgs.has( "InteractionHandler" ) ) + aNewArgs.put( "InteractionHandler", aOrgArgs.get( "InteractionHandler" ) ); + if ( aOrgArgs.has( "StatusIndicator" ) ) + aNewArgs.put( "StatusIndicator", aOrgArgs.get( "StatusIndicator" ) ); + + ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aNewArgs.getPropertyValues(), sal_True ); + if ( sType.getLength() ) { - const SfxFilter* pFilter = rMatcher.GetFilter4EA(sType); - if (pFilter) + const SfxFilter* pFilter = rMatcher.GetFilter4EA( sType ); + if ( pFilter ) sFilter = pFilter->GetName(); } } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { sFilter = ::rtl::OUString(); } + catch ( const RuntimeException& ) + { + throw; + } + catch( const css::uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + sFilter = ::rtl::OUString(); + } const SfxFilter* pFilter = 0; if (sFilter.getLength()) @@ -158,37 +158,144 @@ const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& return pFilter; } -sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const css::uno::Reference< css::frame::XFrame >& rFrame ) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const +{ + const SfxFilter* pFilter = NULL; + try + { + ::comphelper::NamedValueCollection aQuery; + aQuery.put( "DocumentService", _rServiceName ); + + const Reference< XContainerQuery > xQuery( + m_aContext.createComponent( "com.sun.star.document.FilterFactory" ), + UNO_QUERY_THROW ); + + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const SfxFilterFlags nMust = SFX_FILTER_IMPORT; + const SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; + + Reference < XEnumeration > xEnum( xQuery->createSubSetEnumerationByProperties( + aQuery.getNamedValues() ), UNO_SET_THROW ); + while ( xEnum->hasMoreElements() ) + { + ::comphelper::NamedValueCollection aType( xEnum->nextElement() ); + ::rtl::OUString sFilterName = aType.getOrDefault( "Name", ::rtl::OUString() ); + if ( !sFilterName.getLength() ) + continue; + + const SfxFilter* pFilter = rMatcher.GetFilter4FilterName( sFilterName ); + if ( !pFilter ) + continue; + + SfxFilterFlags nFlags = pFilter->GetFilterFlags(); + if ( ( ( nFlags & nMust ) == nMust ) + && ( ( nFlags & nDont ) == 0 ) + ) + { + return pFilter; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; +} + +// -------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SfxFrameLoader_Impl::impl_askForFilter_nothrow( const Reference< XInteractionHandler >& _rxHandler, + const ::rtl::OUString& _rDocumentURL ) const +{ + ENSURE_OR_THROW( _rxHandler.is(), "invalid interaction handler" ); + + ::rtl::OUString sFilterName; + try + { + ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( _rDocumentURL ); + Reference< XInteractionRequest > xRequest ( pRequest ); + _rxHandler->handle( xRequest ); + if( !pRequest->isAbort() ) + sFilterName = pRequest->getFilter(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sFilterName; +} + +// -------------------------------------------------------------------------------------------------------------------- +namespace +{ + sal_Bool lcl_getDispatchResult( const SfxPoolItem* _pResult ) + { + if ( !_pResult ) + return sal_False; + + // default must be set to true, because some return values + // cant be checked, but nonetheless indicate "success"! + sal_Bool bSuccess = sal_True; + + // On the other side some special slots return a boolean state, + // which can be set to FALSE. + SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); + if ( pItem ) + bSuccess = pItem->GetValue(); + + return bSuccess; + } +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const sal_uInt16 _nSlotID, SfxFrame* _pFrame ) +{ + SfxApplication* pApp = SFX_APP(); + + SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); + aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, _pFrame ) ); + + return lcl_getDispatchResult( pApp->ExecuteSlot( aRequest ) ); +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const SfxItemSet& _rSet, SfxFrame* _pFrame, const ::rtl::OUString& _rFactoryURL ) +{ + SfxApplication* pApp = SFX_APP(); + + SfxRequest aRequest( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, _rSet ); + aRequest.AppendItem( SfxFrameItem( SID_DOCFRAME, _pFrame ) ); + aRequest.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, _rFactoryURL ) ); + + SFX_ITEMSET_ARG( &_rSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); + if ( pDocumentTitleItem ) + aRequest.AppendItem( *pDocumentTitleItem ); + + return lcl_getDispatchResult( pApp->NewDocDirectExec_ImplOld( aRequest ) ); +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyValue >& rArgs, + const Reference< css::frame::XFrame >& _rTargetFrame ) throw( css::uno::RuntimeException ) { - static ::rtl::OUString PROP_URL = ::rtl::OUString::createFromAscii("URL" ); - static ::rtl::OUString PROP_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); - static ::rtl::OUString PROP_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" ); - static ::rtl::OUString PROP_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" ); - static ::rtl::OUString PROP_MODEL = ::rtl::OUString::createFromAscii("Model" ); - static ::rtl::OUString PROP_DOCUMENTSERVICE = ::rtl::OUString::createFromAscii("DocumentService" ); - static ::rtl::OUString PROP_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" ); - static ::rtl::OUString PROP_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" ); - static ::rtl::OUString PROP_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler"); - - sal_Bool bLoadState = sal_False; + ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); // this methods assumes that the filter is detected before, usually by calling the detect() method below ::vos::OGuard aGuard( Application::GetSolarMutex() ); RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); - if ( !rFrame.is() ) - return sal_False; - - ::comphelper::SequenceAsHashMap lDescriptor(rArgs); - String rURL = lDescriptor.getUnpackedValueOrDefault(PROP_URL , ::rtl::OUString() ); - String aTypeName = lDescriptor.getUnpackedValueOrDefault(PROP_TYPENAME , ::rtl::OUString() ); - aFilterName = lDescriptor.getUnpackedValueOrDefault(PROP_FILTERNAME , ::rtl::OUString() ); - String aServiceName = lDescriptor.getUnpackedValueOrDefault(PROP_DOCUMENTSERVICE , ::rtl::OUString() ); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lDescriptor.getUnpackedValueOrDefault(PROP_INTERACTIONHANDLER, css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::frame::XModel > xModel = lDescriptor.getUnpackedValueOrDefault(PROP_MODEL , css::uno::Reference< css::frame::XModel >() ); + ::comphelper::NamedValueCollection aDescriptor( rArgs ); + const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const ::rtl::OUString sTypeName = aDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); + ::rtl::OUString sFilterName = aDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + const Reference< XInteractionHandler > + xInteraction = aDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); const SfxFilter* pFilter = NULL; const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); @@ -201,134 +308,91 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean { // get filter by its name directly ... - if( aFilterName.Len() ) - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); + if ( sFilterName.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sFilterName ); // or search the preferred filter for the detected type ... - if( !pFilter && aTypeName.Len() ) - pFilter = rMatcher.GetFilter4EA(aTypeName); + if ( !pFilter && sTypeName.getLength() ) + pFilter = rMatcher.GetFilter4EA( sTypeName ); // or use given document service for detection too! - if (!pFilter && aServiceName.Len()) - { - ::comphelper::SequenceAsHashMap lQuery; - - if (aServiceName.Len()) - lQuery[::rtl::OUString::createFromAscii("DocumentService")] <<= ::rtl::OUString(aServiceName); - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > xQuery ( xServiceManager->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), ::com::sun::star::uno::UNO_QUERY ); - - SfxFilterFlags nMust = SFX_FILTER_IMPORT; - SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; - - ::com::sun::star::uno::Reference < com::sun::star::container::XEnumeration > xEnum = xQuery->createSubSetEnumerationByProperties(lQuery.getAsConstNamedValueList()); - while ( xEnum->hasMoreElements() ) - { - ::comphelper::SequenceAsHashMap aType( xEnum->nextElement() ); - aFilterName = aType.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("Name"), ::rtl::OUString()); - if (!aFilterName.Len()) - continue; - pFilter = rMatcher.GetFilter4FilterName(aFilterName); - if (!pFilter) - continue; - SfxFilterFlags nFlags = pFilter->GetFilterFlags(); - if ( - ((nFlags & nMust) == nMust) && - (!(nFlags & nDont )) - ) - { - break; - } - pFilter = 0; //! in case we reach end of enumeration we must have a valid value ... - } - } + if ( !pFilter && sServiceName.getLength() ) + pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); // or use interaction to ask user for right filter. - if ( !pFilter && xInteraction.is() && rURL.Len() ) + if ( !pFilter && xInteraction.is() && sURL.getLength() ) { - ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( rURL ); - css::uno::Reference< css::task::XInteractionRequest > xRequest ( pRequest ); - xInteraction->handle( xRequest ); - if( !pRequest->isAbort() ) - { - aFilterName = pRequest->getFilter(); - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); - } + ::rtl::OUString sSelectedFilter = impl_askForFilter_nothrow( xInteraction, sURL ); + if ( sSelectedFilter.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sSelectedFilter ); } if( !pFilter ) return sal_False; - aTypeName = pFilter->GetTypeName(); // use filter names without prefix - aFilterName = pFilter->GetFilterName(); + sFilterName = pFilter->GetFilterName(); // If detected filter indicates using of an own template format - // add property "AsTemplate" to descriptor. But supress this step + // add property "AsTemplate" to descriptor. But suppress this step // if such property already exists. - if( pFilter->IsOwnTemplateFormat()) + if ( pFilter->IsOwnTemplateFormat() && !aDescriptor.has( "AsTemplate" ) ) { - ::comphelper::SequenceAsHashMap::iterator pIt = lDescriptor.find(PROP_ASTEMPLATE); - if (pIt == lDescriptor.end()) - lDescriptor[PROP_ASTEMPLATE] <<= sal_True; + aDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); } } - xFrame = rFrame; - // Achtung: beim Abraeumen der Objekte kann die SfxApp destruiert werden, vorher noch Deinitialize_Impl rufen SfxApplication* pApp = SFX_APP(); - // Attention! Because lDescriptor is a copy of rArgs - // and was might by changed (e.g. for AsTemplate) - // move all changes there back! + // attention: Don't use rArgs, but instead aDescriptor, which is rArgs plus some + // changes SfxAllItemSet aSet( pApp->GetPool() ); - TransformParameters( SID_OPENDOC, lDescriptor.getAsConstPropertyValueList(), aSet ); + TransformParameters( SID_OPENDOC, aDescriptor.getPropertyValues(), aSet ); SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); if ( !pRefererItem ) aSet.Put( SfxStringItem( SID_REFERER, String() ) ); - SfxFrame* pFrame=0; - for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) + SfxFrame* pTargetFrame = NULL; + for ( pTargetFrame = SfxFrame::GetFirst(); pTargetFrame; pTargetFrame = SfxFrame::GetNext( *pTargetFrame ) ) { - if ( pFrame->GetFrameInterface() == xFrame ) + if ( pTargetFrame->GetFrameInterface() == _rTargetFrame ) break; } BOOL bFrameCreated = FALSE; - if ( !pFrame ) + if ( !pTargetFrame ) { - pFrame = SfxTopFrame::Create( rFrame ); + pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); bFrameCreated = TRUE; } if ( xModel.is() ) { // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) + if ( _rTargetFrame->getController().is() ) { // remove old component // if a frame was created already, it can't be an SfxComponent! - pFrame->GetFrameInterface()->setComponent( 0, 0 ); + _rTargetFrame->setComponent( NULL, NULL ); if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); + pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); } - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); + aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { if ( xModel == pDoc->GetModel() ) { - pFrame->SetItemSet_Impl( &aSet ); - ::comphelper::SequenceAsHashMap lUpdateDescr( lDescriptor ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); + pTargetFrame->SetItemSet_Impl( &aSet ); - xModel->attachResource( rURL, lUpdateDescr.getAsConstPropertyValueList() ); - return pFrame->InsertDocument( pDoc ); + aDescriptor.remove( "Model" ); + aDescriptor.remove( "URL" ); + + xModel->attachResource( sURL, aDescriptor.getPropertyValues() ); + return pTargetFrame->InsertDocument( pDoc ); } } @@ -337,14 +401,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean } // check for the URL pattern of our factory URLs - SfxFrameWeak wFrame = pFrame; + SfxFrameWeak wFrame = pTargetFrame; String aPrefix = String::CreateFromAscii( "private:factory/" ); - String aFact( rURL ); + String aFact( sURL ); if ( aPrefix.Len() == aFact.Match( aPrefix ) ) { - if ( !aServiceName.Len() ) - aServiceName = SfxObjectShell::GetServiceNameFromFactory( rURL ); - // it's a factory URL aFact.Erase( 0, aPrefix.Len() ); @@ -360,41 +421,16 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean aFact.Erase( nPos, aFact.Len() ); } - WildCard aSearchedFac( aFact.EraseAllChars('4').ToUpperAscii() ); - SFX_ITEMSET_ARG( &aSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - INetURLObject aObj( rURL ); - if ( aParam.Len() ) { - sal_uInt16 nSlotId = (sal_uInt16) aParam.ToInt32(); - SfxRequest aReq( nSlotId, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); - aReq.AppendItem( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - const SfxPoolItem* pRet = pApp->ExecuteSlot( aReq ); - if ( pRet ) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; - - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) + sal_Bool bSuccess = impl_createNewDocWithSlotParam( (sal_uInt16)aParam.ToInt32(), pTargetFrame ); + if ( !bSuccess && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); + wFrame->SetFrameInterface_Impl( NULL ); wFrame->DoClose(); } - xFrame.clear(); - xListener.clear(); - return bLoadState; + return bSuccess; } String sTemplateURL; @@ -407,7 +443,10 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean } else { - sTemplateURL = SfxObjectFactory::GetStandardTemplate( aServiceName ); + if ( sServiceName.getLength() ) + sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); + else + sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); } BOOL bUseTemplate = (sTemplateURL.Len()>0); @@ -420,7 +459,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean if (pTemplateFilter) { pFilter = pTemplateFilter; - aFilterName = pTemplateFilter->GetName(); + sFilterName = pTemplateFilter->GetName(); // standard template set -> load it "AsTemplate" aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) ); aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); @@ -437,174 +476,144 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::bean if ( !bUseTemplate ) { // execute "NewDocument" request - /* Attention! - #107913# - Pointers can't be used to check if two objects are equals! - E.g. the memory manager can reuse freed memory ... - and then the holded copy of a pointer will point to another - (and different!) object - may using the same type then before. - In such case we compare one object with itself ... - */ - SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) ); - - if ( pDocumentTitleItem ) - aReq.AppendItem( *pDocumentTitleItem ); - - const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq); - if (pRet) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; - - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) + sal_Bool bSuccess = impl_createNewDoc( aSet, pTargetFrame, aFact );; + if ( !bSuccess && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); + wFrame->SetFrameInterface_Impl( NULL ); wFrame->DoClose(); } - - xFrame.clear(); - xListener.clear(); - return bLoadState; + return bSuccess; } } else { // load the desired file - aSet.Put( SfxStringItem ( SID_FILE_NAME, rURL ) ); + aSet.Put( SfxStringItem ( SID_FILE_NAME, sURL ) ); } - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrame) ) ); - aSet.Put( SfxStringItem( SID_FILTER_NAME, aFilterName ) ); - - // !TODO: replace by direct construction of model (needs view factory) - DBG_ASSERT( pFilter, "No filter set!" ); + DBG_ASSERT( pFilter, "SfxFrameLoader_Impl::load: could not determine a filter!" ); if ( !pFilter ) return sal_False; + // !TODO: replace by direct construction of model (needs view factory) sal_Bool bDisaster = sal_False; SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName() ); - if ( pDoc ) + if ( !pDoc ) + return sal_False; + + aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + aSet.Put( SfxUnoAnyItem( SID_FILLFRAME, makeAny( _rTargetFrame ) ) ); + aSet.Put( SfxStringItem( SID_FILTER_NAME, sFilterName ) ); + + sal_Bool bLoadSuccess = sal_False; + try { - css::uno::Reference< css::frame::XLoadable > xLoadable = css::uno::Reference< css::frame::XLoadable >( pDoc->GetModel(), css::uno::UNO_QUERY ); - css::uno::Sequence < css::beans::PropertyValue > aLoadArgs; + Reference< XLoadable > xLoadable( pDoc->GetModel(), UNO_QUERY ); + Sequence< PropertyValue > aLoadArgs; TransformItems( SID_OPENDOC, aSet, aLoadArgs ); - try - { - xLoadable->load( aLoadArgs ); - - SfxMedium* pDocMedium = pDoc->GetMedium(); - BOOL bHidden = FALSE; - SFX_ITEMSET_ARG( pDocMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - if ( pHidItem ) - bHidden = pHidItem->GetValue(); - - // !TODO: will be done by Framework! - pDocMedium->SetUpdatePickList( !bHidden ); - - /* - #121119# - We dont know why pFrame can be corrupt here. - But if it was deleted it shouldnt exists inside our global list. - May be we can use the damaged pointer to detect if it was removed from - this global list. - */ - SfxFrame* pTmp=0; - for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) - { - if ( pFrame == pTmp ) - break; - } - if ( pTmp == pFrame ) - { - // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) - { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - // pFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); - } - - wFrame = pFrame; - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - if( pFrame->InsertDocument( pDoc ) ) - { - pFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = pDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - bLoadState = sal_True; - } - else - bDisaster = sal_True; - } - else - { - DBG_ERROR("#121119# You found the reason for a stacktrace! Frame destroyed while loading document."); - bLoadState = sal_False; - } + xLoadable->load( aLoadArgs ); + + SfxMedium* pDocMedium = pDoc->GetMedium(); + BOOL bHidden = FALSE; + SFX_ITEMSET_ARG( pDocMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); + if ( pHidItem ) + bHidden = pHidItem->GetValue(); + + // !TODO: will be done by Framework! + pDocMedium->SetUpdatePickList( !bHidden ); + + impl_ensureValidFrame_throw( pTargetFrame ); + + // !TODO: replace by ViewFactory + if ( pTargetFrame->GetFrameInterface()->getController().is() ) + { + // remove old component + // if a frame was created already, it can't be an SfxComponent! + //pTargetFrame->GetFrameInterface()->setComponent( 0, 0 ); + if ( !bFrameCreated ) + pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); } - catch ( css::uno::Exception& ) + + wFrame = pTargetFrame; + aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + pTargetFrame->SetItemSet_Impl( &aSet ); + if ( pTargetFrame->InsertDocument( pDoc ) ) { + pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); + String aURL = pDoc->GetMedium()->GetName(); + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); + bLoadSuccess = sal_True; + } + else bDisaster = sal_True; + } + catch ( css::uno::Exception& ) + { + bDisaster = sal_True; + } + + if ( bDisaster ) + { + if ( wFrame && !wFrame->GetCurrentDocument() ) + { + // document loading was not successful; close SfxFrame (but not XFrame!) + wFrame->SetFrameInterface_Impl( NULL ); + wFrame->DoClose(); } - if ( bDisaster ) + Reference< XCloseable > xCloseable( pDoc->GetModel(), UNO_QUERY ); + if ( xCloseable.is() ) { - if ( wFrame && !wFrame->GetCurrentDocument() ) + try { - // document loading was not successful; close SfxFrame (but not XFrame!) - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - aSet.ClearItem( SID_DOCFRAME ); + xCloseable->close( sal_True ); } - - css::uno::Reference< css::util::XCloseable > xCloseable( xLoadable, css::uno::UNO_QUERY ); - if ( xCloseable.is() ) + catch ( css::uno::Exception& ) { - try { - xCloseable->close( sal_True ); - } catch ( css::uno::Exception& ) - {} + DBG_UNHANDLED_EXCEPTION(); } } } - xFrame.clear(); - xListener.clear(); - return bLoadState; + return bLoadSuccess; +} + +void SfxFrameLoader_Impl::impl_ensureValidFrame_throw( const SfxFrame* _pFrame ) +{ + /* + #121119# + We dont know why pTargetFrame can be corrupt here. + But if it was deleted it shouldnt exists inside our global list. + May be we can use the damaged pointer to detect if it was removed from + this global list. + */ + SfxFrame* pTmp = NULL; + for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) + { + if ( _pFrame == pTmp ) + // all fine, frame still alive + return; + } + + DBG_ERROR( "#121119# You found the reason for a stacktrace! Frame destroyed while loading document." ); + throw RuntimeException( ::rtl::OUString(), *this ); } -void SfxFrameLoader_Impl::cancel() throw( RUNTIME_EXCEPTION ) +void SfxFrameLoader_Impl::cancel() throw( RuntimeException ) { } SFX_IMPL_SINGLEFACTORY( SfxFrameLoader_Impl ) /* XServiceInfo */ -UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( UNORUNTIMEEXCEPTION ) +UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( RuntimeException ) { return impl_getStaticImplementationName(); } \ /* XServiceInfo */ -sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION ) +sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( RuntimeException ) { UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames(); const UNOOUSTRING* pArray = seqServiceNames.getConstArray(); @@ -619,7 +628,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServ } /* XServiceInfo */ -UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION ) +UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( RuntimeException ) { return impl_getStaticSupportedServiceNames(); } diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 01c48f8f2be0..1b6b7dd2f6b1 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -800,34 +800,14 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) pSet = pDoc->GetMedium()->GetItemSet(); SetItemSet_Impl(0); - // Position und Gr"o\se - SFX_ITEMSET_ARG( - pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - // View-Id - SFX_ITEMSET_ARG( - pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); - // Zoom - SFX_ITEMSET_ARG( - pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); - // Hidden - SFX_ITEMSET_ARG( - pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - // ViewDaten - SFX_ITEMSET_ARG( - pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); - // ViewOnly - SFX_ITEMSET_ARG( - pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False); - // InPlace (Hack) - SFX_ITEMSET_ARG( - pSet, pPluginItem, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); - - // Plugin (external InPlace) - SFX_ITEMSET_ARG( - pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False); - // Jump (GotoBookmark) - SFX_ITEMSET_ARG( - pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False); + SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size + SFX_ITEMSET_ARG( pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID + SFX_ITEMSET_ARG( pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom + SFX_ITEMSET_ARG( pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden + SFX_ITEMSET_ARG( pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data + SFX_ITEMSET_ARG( pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only + SFX_ITEMSET_ARG( pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) + SFX_ITEMSET_ARG( pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) if ( pEditItem && pEditItem->GetValue() ) SetMenuBarOn_Impl( FALSE ); @@ -838,36 +818,34 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if( !pImp->bHidden ) pDoc->OwnerLock( sal_True ); - // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation - // aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits - // aus LoadWindows_Impl aufgerufen wurde! - if ( !pJumpItem && !pPluginMode && pDoc && !pAreaItem && !pViewIdItem && !pModeItem && - pDoc->LoadWindows_Impl( this ) ) - { - if ( GetCurrentDocument() != pDoc ) - // something went wrong during insertion - return sal_False; - pDoc->OwnerLock( sal_False ); - return sal_True; - } - if ( pDoc ) { + // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation + // aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits + // aus LoadWindows_Impl aufgerufen wurde! + if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + { + if ( pDoc->LoadWindows_Impl( *this ) ) + { + if ( GetCurrentDocument() != pDoc ) + // something went wrong during insertion + return sal_False; + pDoc->OwnerLock( sal_False ); + return sal_True; + } + } + UpdateHistory( pDoc ); UpdateDescriptor( pDoc ); } SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - sal_Bool bBrowsing = sal_True; SfxViewFrame *pFrame = GetCurrentViewFrame(); if ( pFrame ) { sal_Bool bChildActivated = sal_False; if ( pFrame->GetActiveChildFrame_Impl() && pFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) { -// ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > xFrames( GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); -// if ( xFrames.is() ) -// xFrames->setActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () ); pFrame->SetActiveChildFrame_Impl(0); SfxViewFrame::SetViewFrame( pFrame ); bChildActivated = sal_True; @@ -888,15 +866,14 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) // 1: internal embedded object // 2: external embedded object // 3: OLE server - if ( pPluginItem && pPluginItem->GetValue() != 2 ) + if ( pPluginMode && pPluginMode->GetValue() != 2 ) SetInPlace_Impl( TRUE ); - bBrowsing = sal_False; pFrame = new SfxTopViewFrame( this, pDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); if ( !pFrame->GetViewShell() ) return sal_False; - if ( pPluginItem && pPluginItem->GetValue() == 1 ) + if ( pPluginMode && pPluginMode->GetValue() == 1 ) { pFrame->ForceOuterResize_Impl( FALSE ); pFrame->GetBindings().HidePopups(TRUE); @@ -912,9 +889,8 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) } String aMark; - SFX_ITEMSET_ARG( pSet, pMarkItem, SfxStringItem, SID_JUMPMARK, FALSE ); - if ( pMarkItem ) - aMark = pMarkItem->GetValue(); + if ( pJumpItem ) + aMark = pJumpItem->GetValue(); if ( pDoc->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) { @@ -966,7 +942,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if ( !pImp->bHidden ) { - if ( pDoc->IsHelpDocument() || (pPluginItem && pPluginItem->GetValue() == 2) ) + if ( pDoc->IsHelpDocument() || (pPluginMode && pPluginMode->GetValue() == 2) ) pFrame->GetDispatcher()->HideUI( TRUE ); else pFrame->GetDispatcher()->HideUI( FALSE ); @@ -981,7 +957,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) pFrame->GetDispatcher()->Update_Impl(); pFrame->Show(); GetWindow().Show(); - if ( !IsInPlace() || (pPluginItem && pPluginItem->GetValue() == 3) ) + if ( !IsInPlace() || (pPluginMode && pPluginMode->GetValue() == 3) ) pFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); pDoc->OwnerLock( sal_False ); @@ -993,13 +969,13 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) pFrame->UnlockAdjustPosSizePixel(); // force resize for OLE server to fix layout problems of writer and math // see i53651 - if ( pPluginItem && pPluginItem->GetValue() == 3 ) + if ( pPluginMode && pPluginMode->GetValue() == 3 ) pFrame->Resize(TRUE); } } else { - DBG_ASSERT( !IsInPlace() && !pPluginMode && !pPluginItem, "Special modes not compatible with hidden mode!" ); + DBG_ASSERT( !IsInPlace() && !pPluginMode, "Special modes not compatible with hidden mode!" ); GetWindow().Show(); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 592926bca1ce..d2c8ffdf76e0 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1012,7 +1012,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) } else if ( GetViewShell() ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq ); if ( pRet ) bOK = ((SfxBoolItem*)pRet)->GetValue(); @@ -1034,7 +1034,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) SfxUndoManager *pShUndoMgr = pSh->GetUndoManager(); if ( !pShUndoMgr ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View SfxWhichIter aIter( rSet ); SfxViewShell *pViewSh = GetViewShell(); if( !pViewSh ) return; @@ -1133,7 +1133,7 @@ void SfxViewFrame::SetObjectShell_Impl GetDocNumber_Impl(); } - // ::com::sun::star::sdbcx::View erzeugen + // View erzeugen if ( bDefaultView ) SetRestoreView_Impl( sal_False ); @@ -2235,7 +2235,7 @@ SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) LockAdjustPosSizePixel(); - // passende ::com::sun::star::sdbcx::View-Factory suchen + // passende View-Factory suchen SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); sal_uInt16 nNewNo = nViewId ? USHRT_MAX : 0; for ( sal_uInt16 nNo = 0; @@ -2371,16 +2371,16 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( sal_uInt16 nViewId, /* > 0 - Registrierungs-Id der ::com::sun::star::sdbcx::View, auf die umge- + Registrierungs-Id der View, auf die umge- schaltet werden soll, bzw. die erstmalig erzeugt werden soll. == 0 - Es soll die Default-::com::sun::star::sdbcx::View verwendet werden. */ + Es soll die Default-View verwendet werden. */ sal_Bool bIsIndex /* sal_True 'nViewId' ist keine Registrations-Id sondern - ein ::com::sun::star::sdbcx::Index in die f"ur die in diesem + ein Index in die f"ur die in diesem dargestellte . */ ) diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index c944264dd20c..eb6836c00deb 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -440,6 +440,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) return; } + int provokeCrash = 0; + int dummy = 1 / provokeCrash; + (void)dummy; + const USHORT nId = rReq.GetSlot(); switch( nId ) { -- cgit v1.2.3 From 4acaac1b07aaa9173b74e68ebc849b7f49ec3e05 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Nov 2009 15:17:30 +0100 Subject: [CWS autorecovery] removed some unused SfxFrame methods --- sfx2/inc/sfx2/frame.hxx | 46 +--- sfx2/inc/sfx2/objsh.hxx | 1 - sfx2/inc/sfx2/topfrm.hxx | 3 +- sfx2/inc/sfx2/viewfrm.hxx | 3 - sfx2/source/appl/app.cxx | 6 - sfx2/source/appl/appopen.cxx | 4 +- sfx2/source/doc/objcont.cxx | 65 +---- sfx2/source/view/frame.cxx | 558 ++---------------------------------------- sfx2/source/view/frmload.cxx | 13 +- sfx2/source/view/impframe.hxx | 2 - sfx2/source/view/topfrm.cxx | 65 ++--- sfx2/source/view/viewfrm.cxx | 35 +-- 12 files changed, 73 insertions(+), 728 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 18e1cba1e3a3..8475907a522d 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -103,7 +103,6 @@ DECLARE_LIST( TargetList, String* ) #define SFXFRAME_PLUGIN 0x0008 #define SFXFRAME_HASTITLE 0x0010 #define SFXFRAME_SERVER 0x0020 // Is es ein Frame, der in einem Container steckt ? -#define SFXFRAME_FRAMESET 0x0040 #define BROWSE_NORMAL 0 #define BROWSE_FORWARD 1 @@ -143,11 +142,6 @@ private: SfxFrame_Impl* pImp; SfxUnoFrame* pUnoImp; - SAL_DLLPRIVATE void UpdateUndoHistory_Impl( - SfxObjectShell *pDocSh, const String* pNew, const String *pTitle = 0 ); - SAL_DLLPRIVATE void UpdateCurrentHistory_Impl( - SfxObjectShell *pDocSh, const String* pNew ); - protected: virtual sal_Bool Close() = 0; virtual ~SfxFrame(); @@ -155,7 +149,6 @@ protected: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetCurrentDocument_Impl( SfxObjectShell* ); SAL_DLLPRIVATE void InsertChildFrame_Impl( SfxFrame*, sal_uInt16 nPos = 0 ); - SAL_DLLPRIVATE void RemoveChildFrame_Impl( sal_uInt16 nPos ); SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); SAL_DLLPRIVATE void SetIsTop_Impl( sal_Bool bIsTop = sal_True ); //#endif @@ -170,19 +163,17 @@ public: sal_Bool DoClose(); sal_uInt16 GetChildFrameCount() const; SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; - void SetFrameName( const String& rName ); const String& GetFrameName() const { return aName; } SfxFrame* GetParentFrame() const { return pParentFrame; } - String GetContent() const; static SfxFrame* GetFirst(); static SfxFrame* GetNext( SfxFrame& ); - virtual sal_Bool InsertDocument( SfxObjectShell *pDoc ); + static SfxViewFrame* + InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTargetFrame, const USHORT nViewId = 0, const bool bHidden = false ); const SfxPoolItem* LoadDocumentSynchron( SfxItemSet& aSet ); - void DocumentInserted( SfxObjectShell* pDoc ); SfxBroadcaster& GetBroadcaster() const; SfxObjectShell* GetCurrentDocument() const; @@ -190,18 +181,10 @@ public: SfxFrame* GetTopFrame() const; sal_Bool IsParent( SfxFrame* ) const; - SfxFrame* findFrame( const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags); - SfxFrame* SearchFrame( const String&, SfxMedium* pMedium = 0 ); sal_uInt32 GetFrameType() const; void GetTargetList( TargetList& ) const; - void ClearHistory(); SAL_DLLPRIVATE SfxFrame* GetContainingDocFrame_Impl( SfxFrame* pSelf ); sal_Bool IsTop() const; - sal_Bool CloseChildFrames(); - void UpdatePickEntries(); - void UpdatePickEntries( const ::com::sun::star::uno::Any& rValue ); - void UpdateHistory( const ::rtl::OUString& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::rtl::OUString& rTitle ); - void UpdateHistory(SfxObjectShell*, const String*pNew = 0 ); void UpdateDescriptor( SfxObjectShell *pDoc ); void Resize(); sal_Bool HasComponent() const; @@ -215,50 +198,27 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > GetController() const; - static sal_Bool LoadSfxComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &, - const ::rtl::OUString&, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&, - const SfxObjectFactory* ); - sal_Bool IsInPlace() const; //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE sal_Bool DoClose_Impl(); SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); - SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > - GetInterceptor_Impl(); - SAL_DLLPRIVATE void Clear_Impl(); SAL_DLLPRIVATE sal_uInt16 LoadComponent_Impl( const ::rtl::OUString& rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameLoader > & rLoader, SfxItemSet* pSet=0, sal_Bool bDontClose=sal_False ); - SAL_DLLPRIVATE void LoadFinished_Impl(); DECL_DLLPRIVATE_STATIC_LINK( SfxFrame, BindingHasNewPart_Impl, void* ); SAL_DLLPRIVATE SfxCancelManager* GetCancelManager() const; SAL_DLLPRIVATE void GetViewData_Impl(); - SAL_DLLPRIVATE sal_Bool CheckContentForLoad_Impl(); - SAL_DLLPRIVATE sal_Bool ExecuteHistoryMenu_Impl( sal_uInt16 nWnich, const Rectangle& rRect, sal_uInt16 nFlags=0 ); SAL_DLLPRIVATE void ActivatePickEntry_Impl( SfxFramePickEntry_Impl*, sal_uInt16 nMode, SfxFrameDescriptor *pD = NULL ); - SAL_DLLPRIVATE void CopyHistory_Impl( SfxFrame *pFrame ) const; - SAL_DLLPRIVATE SfxFrame* SearchChildrenForName_Impl( const String&, sal_Bool bDeep = sal_True ) const; SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); - SAL_DLLPRIVATE void Activate_Impl( sal_Bool bBeamerOn ); - SAL_DLLPRIVATE void Deactivate_Impl(); SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False ); SAL_DLLPRIVATE sal_Bool DocIsModified_Impl(); SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); - SAL_DLLPRIVATE SfxFrame* SearchFrame_Impl( sal_uInt16, sal_Bool bDeep=sal_False ); - SAL_DLLPRIVATE SfxFrame* SearchFrame_Impl( const String&, sal_Bool bDeep=sal_False ); - SAL_DLLPRIVATE void SetFrameId_Impl( sal_uInt16 ); - SAL_DLLPRIVATE sal_uInt16 GetFrameId_Impl() const; - SAL_DLLPRIVATE void SetFrameIdName_Impl( const String& ); SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; SAL_DLLPRIVATE void SetIsClosing_Impl(); - SAL_DLLPRIVATE sal_Bool BrowseInFrame( int nDelta ); SAL_DLLPRIVATE sal_Bool Browse( sal_Bool bForward, sal_uInt16 nDelta = 1, sal_Bool bNewFrame=sal_False ); - SAL_DLLPRIVATE sal_Bool CanBrowseForward() const; - SAL_DLLPRIVATE sal_Bool CanBrowseBackward() const; // Methoden f"ur den Zugriff auf das aktuelle Set SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* ); @@ -290,8 +250,6 @@ public: SAL_DLLPRIVATE const SvBorder& GetBorder_Impl() const; SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void ReFill_Impl( const SfxFrameSetDescriptor* pSet ); - SAL_DLLPRIVATE void LockFocus_Impl( sal_Bool bLock ); - SAL_DLLPRIVATE sal_Bool IsFocusLocked_Impl() const; SAL_DLLPRIVATE void CloseDocument_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); // sal_Bool IsPlugin_Impl() const; diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 9b7665671200..c6b2b163f5f6 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -788,7 +788,6 @@ public: SAL_DLLPRIVATE sal_uInt16& GetAktViewNo() { return nViewNo; } SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); -//REMOVE FASTBOOL SaveWindows_Impl( SvStorage &rStor ) const; SAL_DLLPRIVATE SfxViewFrame* LoadWindows_Impl( SfxTopFrame& rPrefered ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index 657312f3a6b7..af1f3c488904 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -66,17 +66,16 @@ public: virtual Window& GetWindow() const; virtual BOOL Close(); - virtual BOOL InsertDocument( SfxObjectShell *pDoc ); String GetWindowData(); void SetPresentationMode( BOOL bSet ); SystemWindow* GetSystemWindow() const; //#if 0 // _SOLAR__PRIVATE + SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell *pDoc, USHORT nViewId=0 ); SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void CheckMenuCloser_Impl( MenuBar* pMenubar ); //#endif diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 08ea57d12e3a..dc0180a19a85 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -165,7 +165,6 @@ public: SfxViewFrame( const SfxViewFrame &, SfxBindings &, SfxFrame *pFrame); - static SfxViewFrame* SearchViewFrame( SfxViewFrame*, const String& ); static void SetViewFrame( SfxViewFrame* ); static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, @@ -247,8 +246,6 @@ public: { return GetFrame()->GetFrameType(); } SfxFrame* GetTopFrame() const { return GetFrame()->GetTopFrame(); } - SfxFrame* SearchFrame( const String& rName, SfxMedium* pMedium = 0) - { return GetFrame()->SearchFrame( rName, pMedium ); } void GetTargetList( TargetList& rList ) const { GetFrame()->GetTargetList( rList ); } void CancelTransfers() diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 53ea87703ac6..98c2bd0f55d7 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -495,12 +495,6 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) // BOOL bDocWinActivate = pOldContainerFrame && pNewContainerFrame && // pOldContainerFrame->GetTopViewFrame() == pNewContainerFrame->GetTopViewFrame(); BOOL bTaskActivate = pOldContainerFrame != pNewContainerFrame; - if ( pAppData_Impl->pViewFrame ) - { - if ( bTaskActivate ) - // prepare UI for deacivation - pAppData_Impl->pViewFrame->GetFrame()->Deactivate_Impl(); - } if ( pOldContainerFrame ) { diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index c6cb16f8f3f6..e21f8407171e 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -711,7 +711,9 @@ const SfxPoolItem* SfxApplication::NewDocDirectExec_ImplOld( SfxRequest& rReq ) if ( pFrame->GetCurrentDocument() != xDoc ) { - if ( pFrame->InsertDocument( xDoc ) ) + SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pFrame ); + OSL_ENSURE( pTopFrame, "An SfxFrame which is no SfxTopFrame?!" ); + if ( pTopFrame && pTopFrame->InsertDocument_Impl( *xDoc ) ) rReq.SetReturnValue( SfxFrameItem( 0, pFrame ) ); else xDoc->DoClose(); diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 998d2f89b510..a946cc690318 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -192,67 +192,6 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig return pFile; } -//REMOVE FASTBOOL SfxObjectShell::SaveWindows_Impl( SvStorage &rStor ) const -//REMOVE { -//REMOVE SvStorageStreamRef xStream = rStor.OpenStream( DEFINE_CONST_UNICODE( SFX_WINDOWS_STREAM ), -//REMOVE STREAM_TRUNC | STREAM_STD_READWRITE); -//REMOVE if ( !xStream ) -//REMOVE return FALSE; -//REMOVE -//REMOVE xStream->SetBufferSize(1024); -//REMOVE xStream->SetVersion( rStor.GetVersion() ); -//REMOVE -//REMOVE // "uber alle Fenster iterieren (aber aktives Window zuletzt) -//REMOVE SfxViewFrame *pActFrame = SfxViewFrame::Current(); -//REMOVE if ( !pActFrame || pActFrame->GetObjectShell() != this ) -//REMOVE pActFrame = SfxViewFrame::GetFirst(this); -//REMOVE -//REMOVE String aActWinData; -//REMOVE for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame) ); pFrame; -//REMOVE pFrame = SfxViewFrame::GetNext(*pFrame, this, TYPE(SfxTopViewFrame) ) ) -//REMOVE { -//REMOVE // Bei Dokumenten, die Outplace aktiv sind, kann beim Speichern auch schon die View weg sein! -//REMOVE if ( pFrame->GetViewShell() ) -//REMOVE { -//REMOVE SfxTopFrame* pTop = (SfxTopFrame*) pFrame->GetFrame(); -//REMOVE pTop->GetTopWindow_Impl(); -//REMOVE -//REMOVE char cToken = ','; -//REMOVE const BOOL bActWin = pActFrame == pFrame; -//REMOVE String aUserData; -//REMOVE pFrame->GetViewShell()->WriteUserData(aUserData); -//REMOVE -//REMOVE // assemble ini-data -//REMOVE String aWinData; -//REMOVE aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); -//REMOVE aWinData += cToken; -//REMOVE /* -//REMOVE if ( !pWin || pWin->IsMaximized() ) -//REMOVE aWinData += SFX_WINSIZE_MAX; -//REMOVE else if ( pWin->IsMinimized() ) -//REMOVE aWinData += SFX_WINSIZE_MIN; -//REMOVE else -//REMOVE */ -//REMOVE aWinData += cToken; -//REMOVE aWinData += aUserData; -//REMOVE -//REMOVE // aktives kennzeichnen -//REMOVE aWinData += cToken; -//REMOVE aWinData += bActWin ? '1' : '0'; -//REMOVE -//REMOVE // je nachdem merken oder abspeichern -//REMOVE if ( bActWin ) -//REMOVE aActWinData = aWinData; -//REMOVE else -//REMOVE xStream->WriteByteString( aWinData ); -//REMOVE } -//REMOVE } -//REMOVE -//REMOVE // aktives Window hinterher -//REMOVE xStream->WriteByteString( aActWinData ); -//REMOVE return !xStream->GetError(); -//REMOVE } - //==================================================================== SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame& rPreferedFrame ) @@ -343,7 +282,7 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame& rPreferedFrame ) rBind.ENTERREGISTRATIONS(); // set document into frame - pCurrentTargetFrame->InsertDocument( this ); + pCurrentTargetFrame->InsertDocument_Impl( *this ); // restart controller updating rBind.LEAVEREGISTRATIONS(); @@ -368,7 +307,7 @@ SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame& rPreferedFrame ) if ( pCurrentTargetFrame ) { // Frame "ubergeben, allerdings ist der noch leer - pCurrentTargetFrame->InsertDocument( this ); + pCurrentTargetFrame->InsertDocument_Impl( *this ); pFrame = pCurrentTargetFrame->GetCurrentViewFrame(); } else diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 4aa23dbe1dc5..ff8dca80b1e0 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -217,53 +217,6 @@ sal_Bool SfxFrame::DoClose_Impl() return bRet; } -void SfxFrame::Clear_Impl() -{ - CancelTransfers(); - - // Bei FrameSets verhindern, da\s das Closen der Childs zu st"andigen - // ReCalcs im SplitWindow f"uhrt; SetUpdateMode am FrameWindow wirkt - // leider nicht auf dem MAC - Window *pWin = NULL; - SfxViewShell *pViewSh; - if ( pImp->pCurrentViewFrame && - 0 != ( pViewSh = pImp->pCurrentViewFrame->GetViewShell() ) ) - { - pWin = pViewSh->GetWindow(); - if ( pWin ) - pWin->Hide(); - } - - sal_Bool bRet = sal_True; - SfxBindings* pBindings = NULL; - if ( pImp->pCurrentViewFrame ) - { - pBindings = &pImp->pCurrentViewFrame->GetBindings(); - pImp->bClosing = sal_True; - bRet = pImp->pCurrentViewFrame->Close(); - pImp->bClosing = sal_False; - } - - if ( bRet ) - { - // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden - if ( pImp->pWorkWin ) - { - pImp->pWorkWin->DeleteControllers_Impl(); - DELETEZ( pImp->pWorkWin ); - } - - if ( pImp->bOwnsBindings ) - delete pBindings; - } - else - { - if ( pWin ) - pWin->Show(); - } -} - - sal_Bool SfxFrame::DocIsModified_Impl() { if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetObjectShell() && @@ -344,61 +297,13 @@ void SfxFrame::InsertChildFrame_Impl( SfxFrame* pFrame, sal_uInt16 nPos ) pFrame->pParentFrame = this; } -void SfxFrame::RemoveChildFrame_Impl( sal_uInt16 nPos ) -{ - DBG_ASSERT( pChildArr, "Unbekannter Frame!"); - pChildArr->Remove( nPos ); -}; - void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) { DBG_ASSERT( pChildArr, "Unbekannter Frame!"); sal_uInt16 nPos = pChildArr->GetPos(pFrame); - RemoveChildFrame_Impl( nPos ); + pChildArr->Remove( nPos ); }; -sal_Bool SfxFrame::CloseChildFrames() -{ - sal_Bool bRet = sal_True; - if ( pChildArr ) - { - // Childs closen - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - // pFrame removed sich selbst - bRet = pFrame->DoClose(); - if ( !bRet ) - break; - } - } - - return bRet; -} - -SfxFrame* SfxFrame::SearchChildrenForName_Impl( const String& rName, sal_Bool bDeep ) const -{ - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - if ( rName.CompareIgnoreCaseToAscii( pFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pFrame; - if( bDeep ) - { - pFrame = pFrame->SearchChildrenForName_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - SfxFrame* SfxFrame::GetTopFrame() const { SfxFrame *pParent = (SfxFrame*) this; @@ -407,95 +312,6 @@ SfxFrame* SfxFrame::GetTopFrame() const return pParent; } -SfxFrame* SfxFrame::SearchFrame( const String& rName, SfxMedium* /*pMedium*/ ) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aFrameName( rName ); - aFrameName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - if( !aFrameName.Len() || aFrameName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - { - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL) - { - // Eigener Name, kein Name oder Selbstbezug - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pParentFrame ? pParentFrame : this; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - else - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aFrameName ); - } - - if ( !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aFrameName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aFrameName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == - COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aFrameName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; -} - sal_Bool SfxFrame::IsClosing_Impl() const { return pImp->bClosing; @@ -506,19 +322,31 @@ void SfxFrame::SetIsClosing_Impl() pImp->bClosing = TRUE; } -void SfxFrame::DocumentInserted( SfxObjectShell* /*pDoc*/ ) -{ -} - sal_uInt16 SfxFrame::GetChildFrameCount() const { return pChildArr ? pChildArr->Count() : 0; } -sal_Bool SfxFrame::InsertDocument( SfxObjectShell* pDoc ) +SfxViewFrame* SfxFrame::InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTargetFrame, const USHORT nViewId, const bool bHidden ) { - DocumentInserted( pDoc ); - return sal_True; + SfxViewFrame* pViewFrame = NULL; + + if ( rpTargetFrame ) + { + SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( rpTargetFrame ); + OSL_ENSURE( pTopFrame, "SfxFrame::InsertDocument: an SfxFrame which is no SfxTopFrame?!" ); + if ( bHidden ) + rDoc.PutItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); + pTopFrame->InsertDocument_Impl( rDoc ); + pViewFrame = rpTargetFrame->GetCurrentViewFrame(); + } + else + { + pViewFrame = SfxViewFrame::CreateViewFrame( rDoc, nViewId, bHidden ); + if( pViewFrame ) + rpTargetFrame = pViewFrame->GetFrame(); + } + return pViewFrame; } void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) @@ -592,56 +420,15 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) pImp->nType = n; } -void SfxFrame::CopyHistory_Impl( SfxFrame* /*pFrame*/ ) const -{ -} - - -void SfxFrame::ClearHistory() -{ -} - -sal_Bool SfxFrame::ExecuteHistoryMenu_Impl( sal_uInt16 /*nWhich*/, const Rectangle& /*rRect*/, sal_uInt16 /*nFlags*/ ) -{ - return sal_True; -} - sal_Bool SfxFrame::Browse( sal_Bool /*bForward*/, sal_uInt16 /*nSteps*/, sal_Bool /*bNewFrame*/ ) { return FALSE; } -void SfxFrame::UpdatePickEntries() -{ -} - -void SfxFrame::UpdatePickEntries( const ::com::sun::star::uno::Any& /*rValue*/ ) -{ -} - -void SfxFrame::UpdateUndoHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/, const String* /*pTitle*/ ) -{ -} - -void SfxFrame::UpdateCurrentHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const ::rtl::OUString& /*rTitle*/ ) -{ -} - void SfxFrame::GetViewData_Impl() { // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die - // festen Daten werden nur einmal ( nach InsertDocument in UpdateDescriptor ) + // festen Daten werden nur einmal ( nach InsertDocument_Impl in UpdateDescriptor ) // geholt, um Zeit zu sparen. SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) @@ -681,7 +468,7 @@ void SfxFrame::GetViewData_Impl() void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { - // Beim InsertDocument wird der Descriptor des Frames aktualisiert + // Beim InsertDocument_Impl wird der Descriptor des Frames aktualisiert // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres // Restaurieren der View n"otig sind, sind damit festgehalten. // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) @@ -735,20 +522,6 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) //------------------------------------------------------------------------- -sal_Bool SfxFrame::CanBrowseBackward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - -sal_Bool SfxFrame::CanBrowseForward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD ) { DBG_ASSERT( pD, "Kein Descriptor!" ); @@ -811,147 +584,11 @@ void SfxFrame::GetTargetList( TargetList& rList ) const //------------------------------------------------------------------------- -void SfxFrame::SetFrameId_Impl( sal_uInt16 nId ) -{ - pImp->nFrameId = nId; - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->UpdateTitle(); -} - -sal_uInt16 SfxFrame::GetFrameId_Impl() const -{ - return pImp->nFrameId; -} - -void SfxFrame::SetFrameIdName_Impl( const String& rName ) -{ - pImp->aFrameIdName = rName; -} - -//------------------------------------------------------------------------- - -SfxFrame* SfxFrame::SearchFrame_Impl( sal_uInt16 nId, sal_Bool bDeep ) -{ - if ( pImp->nFrameId == nId ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; npImp->nFrameId == nId ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( nId, sal_True ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -SfxFrame* SfxFrame::SearchFrame_Impl( const String& rName, sal_Bool bDeep ) -{ - if ( pImp->aFrameIdName == rName ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; npImp->aFrameIdName == rName ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -//------------------------------------------------------------------------- - -//------------------------------------------------------------------------- - -void SfxFrame::Activate_Impl( sal_Bool bBeamerOn ) - -/* [Description] - - Internal Activate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if ( GetParentFrame() ) - GetParentFrame()->Activate_Impl( bBeamerOn ); -} - SfxBroadcaster& SfxFrame::GetBroadcaster() const { return *pImp; } -//------------------------------------------------------------------------- - -void SfxFrame::Deactivate_Impl() - -/* [Description] - - Internal Deactivate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if( GetParentFrame() ) - GetParentFrame()->Deactivate_Impl(); -} - -String SfxFrame::GetContent() const -{ - SfxObjectShell *pObj = GetCurrentDocument(); - if ( !pObj || !pObj->GetMedium() ) - return String(); - else - return pObj->GetMedium()->GetName(); -} - -sal_Bool SfxFrame::CheckContentForLoad_Impl() -{ - if ( GetCurrentDocument() ) - { - SfxMedium* pMedium = GetCurrentDocument()->GetMedium(); -#ifdef DEBUG - SfxItemSet* pSet; - pSet = pMedium->GetItemSet(); -#endif - SfxItemSet* pNew = GetDescriptor()->GetArgs(); - - // Falls URLs nicht uebereinstimmen - if ( INetURLObject( GetDescriptor()->GetActualURL() ) != INetURLObject( pMedium->GetOrigURL() ) ) - return sal_True; - - // Falls die Filter nicht uebereinstimmen - SFX_ITEMSET_ARG( pNew, pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False ); - if( pMedium->GetOrigFilter() && pFilterItem && pFilterItem->GetValue() != pMedium->GetOrigFilter()->GetFilterName() ) - return sal_True; - - return sal_False; - } - - return (GetDescriptor()->GetActualURL().GetMainURL( INetURLObject::NO_DECODE ).getLength() != 0); -} - sal_Bool SfxFrame::IsParent( SfxFrame *pFrame ) const { SfxFrame *pParent = pParentFrame; @@ -1083,11 +720,6 @@ sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*n return sal_True; } -sal_Bool SfxFrame::BrowseInFrame( int /*nDelta*/ ) -{ - return sal_False; -} - SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur ) : pFrame( &rFrame ) , bRecursive( bRecur ) @@ -1132,116 +764,6 @@ SfxFrame* SfxFrameIterator::NextSibling_Impl( SfxFrame& rPrev ) return pRet; } -void SfxFrame::SetFrameName( const String& rName ) -{ - if ( pImp->pDescr ) - pImp->pDescr->SetName( rName ); - aName = rName; - if ( pImp->pCurrentViewFrame ) - pImp->pCurrentViewFrame->UpdateTitle(); - if ( GetFrameInterface().is() ) - GetFrameInterface()->setName( rName ); -} - -void SfxFrame::LoadFinished_Impl() -{ -} - -SfxFrame* SfxFrame::findFrame(const ::rtl::OUString& aTargetframename, sal_Int32 nSearchFlags) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aTargetName( aTargetframename ); - aTargetName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - - if ( !aTargetName.Len() && GetParentFrame() && GetParentFrame()->GetCurrentViewFrame()->GetViewShell()->IsImplementedAsFrameset_Impl() ) - return GetParentFrame(); - - if( !aTargetName.Len() || aTargetName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - return pFrame; - - if ( aTargetName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - - if ( aTargetName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pFrame->GetParentFrame(); - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - - if ( ( nSearchFlags & FRAME_SEARCH_SELF ) && aTargetName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL ) - { - // Eigener Name - return pFrame; - } - - if ( nSearchFlags & FRAME_SEARCH_CHILDREN ) - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aTargetName ); - } - - if ( ( nSearchFlags & FRAME_SEARCH_CHILDREN ) && !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aTargetName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aTargetName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aTargetName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; -} - sal_Bool SfxFrame::IsTop() const { return GetFrameInterface().is() ? GetFrameInterface()->isTop() : sal_False; @@ -1431,47 +953,11 @@ void SfxFrame::GrabFocusOnComponent_Impl() pWindow->GrabFocus(); } -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > SfxFrame::GetInterceptor_Impl() -{ -//(mba)/compview: hier fehlt der Zugriff auf den Interceptor !!!!! - return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > (); -} - void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) { pImp->bReleasingComponent = bSet; } -sal_Bool SfxFrame::LoadSfxComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & /*aFrame*/, - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const SfxObjectFactory* /*pFact*/ ) -{ - // get Implementation of xComponents ... - DBG_ERROR( "Should not be called anymore!" ); - return sal_False; -} - -void SfxFrame::LockFocus_Impl( sal_Bool bLock ) -{ - if ( pChildArr && pChildArr->Count() ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; npImp->bFocusLocked = bLock; - pFrame->LockFocus_Impl( bLock ); - } - } -} - -sal_Bool SfxFrame::IsFocusLocked_Impl() const -{ - return pImp->bFocusLocked; -} - sal_Bool SfxFrame::IsInPlace() const { return pImp->bInPlace; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 27355dd6026c..62830b47d0f5 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -386,13 +386,19 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV { if ( xModel == pDoc->GetModel() ) { + SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pTargetFrame ); + OSL_ENSURE( pTopFrame, "SfxFrameLoader_Impl::load: An SfxFrame which is no SfxTopFrame?!" ); + if ( !pTopFrame ) + return sal_False; + pTargetFrame->SetItemSet_Impl( &aSet ); aDescriptor.remove( "Model" ); aDescriptor.remove( "URL" ); xModel->attachResource( sURL, aDescriptor.getPropertyValues() ); - return pTargetFrame->InsertDocument( pDoc ); + + return pTopFrame->InsertDocument_Impl( *pDoc ); } } @@ -538,7 +544,10 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV wFrame = pTargetFrame; aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); pTargetFrame->SetItemSet_Impl( &aSet ); - if ( pTargetFrame->InsertDocument( pDoc ) ) + + SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pTargetFrame ); + OSL_ENSURE( pTopFrame, "SfxFrameLoader_Impl::load: An SfxFrame which is no SfxTopFrame?!" ); + if ( pTopFrame && pTopFrame->InsertDocument_Impl( *pDoc ) ) { pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); String aURL = pDoc->GetMedium()->GetName(); diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 21215fa6e730..f8233c0c64fe 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -73,7 +73,6 @@ friend class SfxFrame; sal_Bool bInCancelTransfers : 1; sal_Bool bOwnsBindings : 1; sal_Bool bReleasingComponent : 1; - sal_Bool bFocusLocked : 1; sal_Bool bInPlace : 1; SfxCancelManager* pCancelMgr; SfxCancellable* pLoadCancellable; @@ -97,7 +96,6 @@ friend class SfxFrame; bInCancelTransfers( sal_False ), bOwnsBindings( sal_False ), bReleasingComponent( sal_False ), - bFocusLocked( sal_False ), bInPlace( sal_False ), pCancelMgr( 0 ), pLoadCancellable( 0 ), diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 1b6b7dd2f6b1..5957abb67b27 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -568,7 +568,7 @@ SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHi { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument( pDoc ); + pFrame->InsertDocument_Impl( *pDoc ); if ( pWindow && !bHidden ) pWindow->Show(); } @@ -599,7 +599,7 @@ SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument( pDoc ); + pFrame->InsertDocument_Impl( *pDoc ); } return pFrame; @@ -781,14 +781,10 @@ String SfxTopFrame::GetWindowData() return aWinData; } -sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) +sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) /* [Beschreibung] */ { - // Spezielle Bedingungen testen: nicht im ModalMode! - if ( !SfxFrame::InsertDocument( pDoc ) ) - return sal_False; - SfxObjectShell *pOld = GetCurrentDocument(); // Position und Groesse testen @@ -797,7 +793,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) // an einer Task aufgerufen hat! ) const SfxItemSet* pSet = GetItemSet_Impl(); if ( !pSet ) - pSet = pDoc->GetMedium()->GetItemSet(); + pSet = rDoc.GetMedium()->GetItemSet(); SetItemSet_Impl(0); SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size @@ -816,30 +812,25 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) pImp->bHidden = pHidItem->GetValue(); if( !pImp->bHidden ) - pDoc->OwnerLock( sal_True ); + rDoc.OwnerLock( sal_True ); - if ( pDoc ) + // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation + // aus den Dokument geladen werden, z.B. weil InsertDocument_Impl seinerseits + // aus LoadWindows_Impl aufgerufen wurde! + if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation - // aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits - // aus LoadWindows_Impl aufgerufen wurde! - if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + if ( rDoc.LoadWindows_Impl( *this ) ) { - if ( pDoc->LoadWindows_Impl( *this ) ) - { - if ( GetCurrentDocument() != pDoc ) - // something went wrong during insertion - return sal_False; - pDoc->OwnerLock( sal_False ); - return sal_True; - } + if ( GetCurrentDocument() != &rDoc ) + // something went wrong during insertion + return sal_False; + rDoc.OwnerLock( sal_False ); + return sal_True; } - - UpdateHistory( pDoc ); - UpdateDescriptor( pDoc ); } - SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); + UpdateDescriptor( &rDoc ); + SfxViewFrame *pFrame = GetCurrentViewFrame(); if ( pFrame ) { @@ -858,8 +849,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if ( pViewIdItem ) pFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); - if ( pDoc ) - pFrame->SetObjectShell_Impl( *pDoc ); + pFrame->SetObjectShell_Impl( rDoc ); } else { @@ -869,7 +859,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if ( pPluginMode && pPluginMode->GetValue() != 2 ) SetInPlace_Impl( TRUE ); - pFrame = new SfxTopViewFrame( this, pDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); + pFrame = new SfxTopViewFrame( this, &rDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); if ( !pFrame->GetViewShell() ) return sal_False; @@ -892,7 +882,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if ( pJumpItem ) aMark = pJumpItem->GetValue(); - if ( pDoc->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) + if ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) { if ( pViewDataItem ) pFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); @@ -902,7 +892,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) else { // Daten setzen, die in FinishedLoading ausgewertet werden - MarkData_Impl*& rpMark = pDoc->Get_Impl()->pMarkData; + MarkData_Impl*& rpMark = rDoc.Get_Impl()->pMarkData; if (!rpMark) rpMark = new MarkData_Impl; rpMark->pFrame = GetCurrentViewFrame(); @@ -942,7 +932,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) if ( !pImp->bHidden ) { - if ( pDoc->IsHelpDocument() || (pPluginMode && pPluginMode->GetValue() == 2) ) + if ( rDoc.IsHelpDocument() || (pPluginMode && pPluginMode->GetValue() == 2) ) pFrame->GetDispatcher()->HideUI( TRUE ); else pFrame->GetDispatcher()->HideUI( FALSE ); @@ -959,7 +949,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) GetWindow().Show(); if ( !IsInPlace() || (pPluginMode && pPluginMode->GetValue() == 3) ) pFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); - pDoc->OwnerLock( sal_False ); + rDoc.OwnerLock( sal_False ); // Dont show container window! Its done by framework or directly // by SfxTopFrame::Create() or SfxViewFrame::ExecView_Impl() ... @@ -995,7 +985,7 @@ sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) GetCurrentViewFrame()->Resize(TRUE); } - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), pDoc ) ); + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); return sal_True; } @@ -1539,11 +1529,8 @@ void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) { - if ( !GetFrame()->CanBrowseForward() ) - rItemSet.DisableItem( SID_BROWSE_FORWARD ); - - if ( !GetFrame()->CanBrowseBackward() ) - rItemSet.DisableItem( SID_BROWSE_BACKWARD ); + rItemSet.DisableItem( SID_BROWSE_FORWARD ); + rItemSet.DisableItem( SID_BROWSE_BACKWARD ); // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen SfxObjectShell *pDocSh = GetObjectShell(); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d2c8ffdf76e0..abdec58b8ef7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -855,8 +855,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) pCurrView->SetRestoreView_Impl( bRestoreView ); //if( pView != this || !xNewObj.Is() ) { - SfxFrame *pFrame = pCurrView->GetFrame(); - pFrame->InsertDocument(xNewObj.Is() ? xNewObj : xOldObj ); + SfxTopFrame* pFrame = dynamic_cast< SfxTopFrame* >( pCurrView->GetFrame() ); + OSL_ENSURE( pFrame, "An SfxFrame which is no SfxTopFrame?!" ); + if ( pFrame ) + pFrame->InsertDocument_Impl( *xNewObj ); } } @@ -1110,8 +1112,6 @@ void SfxViewFrame::SetObjectShell_Impl if ( xObjSh.Is() && xObjSh->IsPreview() ) SetQuietMode_Impl( sal_True ); - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - // Modulshell einf"ugen SfxModule* pModule = xObjSh->GetModule(); if( pModule ) @@ -1623,7 +1623,6 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) //------------------------------------------------------------------------ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { - pImp->pFrame->DocumentInserted( pObjSh ); pImp->bInCtor = sal_True; pImp->pParentViewFrame = 0; pImp->bResizeInToOut = sal_True; @@ -1654,7 +1653,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) if ( xObjSh.Is() && xObjSh->IsPreview() ) SetQuietMode_Impl( sal_True ); - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); if ( pObjSh ) { pDispatcher->Push( *SFX_APP() ); @@ -2281,27 +2279,6 @@ SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) return pViewShell; } -//------------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::SearchViewFrame( SfxViewFrame *pViewFrame, - const String& rName ) -{ - if ( !pViewFrame ) - pViewFrame = SfxViewFrame::Current(); - if ( !pViewFrame ) - return NULL; - SfxFrame *pFrame = pViewFrame->GetFrame()->SearchFrame( rName ); - if ( !pFrame ) - return NULL; - - // Der Frame ist selbst ein ViewFrame oder enth"alt einen -/* - pViewFrame = PTR_CAST( SfxViewFrame, pFrame ); - if ( !pViewFrame && pFrame->GetChildFrameCount() ) - pViewFrame = PTR_CAST( SfxViewFrame, pFrame->GetChildFrame(0) ); -*/ - return pFrame->GetCurrentViewFrame(); -} - //------------------------------------------------------------------------- void SfxViewFrame::SetQuietMode_Impl( sal_Bool bOn ) @@ -2736,9 +2713,9 @@ void SfxViewFrame::ExecView_Impl { Reference < XFrame > xFrame; pFrameItem->GetValue() >>= xFrame; - SfxFrame* pFrame = SfxTopFrame::Create( xFrame ); + SfxTopFrame* pFrame = SfxTopFrame::Create( xFrame ); pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument( GetObjectShell() ); + pFrame->InsertDocument_Impl( *GetObjectShell() ); if ( !bHidden ) xFrame->getContainerWindow()->setVisible( sal_True ); } -- cgit v1.2.3 From af4e6b24573b5dd00e6beac7544becf559b8f498 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Nov 2009 15:30:25 +0100 Subject: [CWS autorecovery] introduced status SfxFrame::InsertDocument which encapsulates a usage pattern comprised of the old InsertDocument/CreateViewFrame pair --- sw/source/ui/app/apphdl.cxx | 9 ++------- sw/source/ui/app/applab.cxx | 21 ++++++--------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 7fe0d349e8a7..840b765b9a72 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -965,13 +965,8 @@ void NewXForms( SfxRequest& rReq ) { const SfxPoolItem* pFrameItem = NULL; pArgs->GetItemState( SID_DOCFRAME, FALSE, &pFrameItem ); - if( pFrameItem != NULL ) - { - SfxFrame* pFrame = - static_cast( pFrameItem )->GetFrame(); - DBG_ASSERT( pFrame != NULL, "no frame?" ); - pFrame->InsertDocument( xDocSh ); - } + SfxFrame* pFrame = pFrameItem ? dynamic_cast< const SfxFrameItem& >( *pFrameItem ).GetFrame() : NULL; + SfxFrame::InsertDocument( *xDocSh, pFrame ); } // set return value diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index d09e522599d7..7e04e982d039 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -243,19 +243,10 @@ static sal_uInt16 nBCTitleNo = 0; if(pArgs) pArgs->GetItemState(SID_DOCFRAME, FALSE, &pFrameItem); - SfxViewFrame* pFrame = 0; - if( pFrameItem ) - { - SfxFrame* pFr = ((const SfxFrameItem*)pFrameItem)->GetFrame(); - xDocSh->PutItem(SfxBoolItem(SID_HIDDEN, TRUE)); - pFr->InsertDocument(xDocSh); - pFrame = pFr->GetCurrentViewFrame(); - } - else - { - pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); - } - SwView *pNewView = (SwView*) pFrame->GetViewShell(); + SfxFrame* pFrame = pFrameItem ? dynamic_cast< const SfxFrameItem& >( *pFrameItem ).GetFrame() : NULL; + SfxViewFrame* pViewFrame = SfxFrame::InsertDocument( *xDocSh, pFrame, 0, true ); + + SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. // Dokumenttitel setzen @@ -272,7 +263,7 @@ static sal_uInt16 nBCTitleNo = 0; } xDocSh->SetTitle( aTmp ); - pFrame->GetFrame()->Appear(); + pViewFrame->GetFrame()->Appear(); // Shell ermitteln SwWrtShell *pSh = pNewView->GetWrtShellPtr(); @@ -474,7 +465,7 @@ static sal_uInt16 nBCTitleNo = 0; if( rItem.bSynchron ) { - SfxDispatcher* pDisp = pFrame->GetDispatcher(); + SfxDispatcher* pDisp = pViewFrame->GetDispatcher(); ASSERT(pDisp, "Heute kein Dispatcher am Frame?"); pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON); } -- cgit v1.2.3 From ac9a1cd44c34c7692b5c0ffb36f21d42420e80a7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Nov 2009 15:30:25 +0100 Subject: [CWS autorecovery] introduced status SfxFrame::InsertDocument which encapsulates a usage pattern comprised of the old InsertDocument/CreateViewFrame pair --- sd/source/ui/app/sdmod1.cxx | 50 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 4144b4afb774..8f27f8cadf59 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -305,13 +305,8 @@ void SdModule::OutlineToImpress (SfxRequest& rRequest) } SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - if ( pFrmItem ) - { - SfxFrame* pFrame = pFrmItem->GetFrame(); - pFrame->InsertDocument( pDocSh ); - } - else - SfxViewFrame::CreateViewFrame(*pDocSh, ::sd::OUTLINE_FACTORY_ID); + SfxFrame* pFrame = pFrmItem ? pFrmItem->GetFrame() : NULL; + SfxFrame::InsertDocument( *pDocSh, pFrame, ::sd::OUTLINE_FACTORY_ID ); ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); @@ -555,17 +550,8 @@ SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, SfxFrame* p } else if( pDocShell ) { - if ( pTargetFrame ) - { - pFrame = pTargetFrame; - pFrame->InsertDocument( pDocShell ); - } - else - { - SfxViewFrame* pViewFrame = SfxViewFrame::CreateViewFrame( *pDocShell ); - if( pViewFrame ) - pFrame = pViewFrame->GetFrame(); - } + pFrame = pTargetFrame; + SfxFrame::InsertDocument( *pDocShell, pFrame ); } return pFrame; @@ -694,19 +680,8 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxObjectShell* pShell = xShell; if( pShell ) { - if ( pTargetFrame ) - { - pFrame = pTargetFrame; - pFrame->InsertDocument( pShell ); - pViewFrame = pFrame->GetCurrentViewFrame(); - } - else - { - pViewFrame = SfxViewFrame::CreateViewFrame( *pShell ); - if( pViewFrame ) - pFrame = pViewFrame->GetFrame(); - } - + pFrame = pTargetFrame; + pViewFrame = SfxFrame::InsertDocument( *pShell, pFrame ); DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); if(bNewDocDirect && !bStartWithTemplate) @@ -810,17 +785,8 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTarge pDoc->StopWorkStartupDelay(); } - if ( pTargetFrame ) - { - pFrame = pTargetFrame; - pFrame->InsertDocument( pNewDocSh ); - } - else - { - SfxViewFrame* pViewFrame = SfxViewFrame::CreateViewFrame( *pNewDocSh ); - if( pViewFrame ) - pFrame = pViewFrame->GetFrame(); - } + pFrame = pTargetFrame; + SfxFrame::InsertDocument( *pNewDocSh, pFrame ); } return pFrame; -- cgit v1.2.3 From b2fbc111be780077874598dea2e66375d07c018b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 20 Nov 2009 15:37:27 +0100 Subject: #i10000# --- sfx2/source/view/frmload.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 62830b47d0f5..8b0ac1fa237a 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -134,7 +134,8 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt if ( aOrgArgs.has( "StatusIndicator" ) ) aNewArgs.put( "StatusIndicator", aOrgArgs.get( "StatusIndicator" ) ); - ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aNewArgs.getPropertyValues(), sal_True ); + Sequence< PropertyValue > aQueryArgs( aNewArgs.getPropertyValues() ); + ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aQueryArgs, sal_True ); if ( sType.getLength() ) { const SfxFilter* pFilter = rMatcher.GetFilter4EA( sType ); @@ -161,7 +162,6 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt // -------------------------------------------------------------------------------------------------------------------- const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const { - const SfxFilter* pFilter = NULL; try { ::comphelper::NamedValueCollection aQuery; -- cgit v1.2.3 From 0e40f8c467fcf5bd83eee451dcf7d2a7de1889c6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 22 Nov 2009 22:17:18 +0100 Subject: [CWS autorecovery] removed the unused "Save Window State with Document" option This happened in further preparation for issue #i65597#, where the current phase aims at changing the SFX-Document-Loader to be completely UNO-based, by introducing a UNO-ViewFactory in SFX. --- svtools/inc/svtools/saveopt.hxx | 4 --- svtools/source/config/saveopt.cxx | 60 ++++++--------------------------------- 2 files changed, 9 insertions(+), 55 deletions(-) diff --git a/svtools/inc/svtools/saveopt.hxx b/svtools/inc/svtools/saveopt.hxx index 2966e2f24aba..f4718fa9166a 100644 --- a/svtools/inc/svtools/saveopt.hxx +++ b/svtools/inc/svtools/saveopt.hxx @@ -49,7 +49,6 @@ public: E_AUTOSAVEPROMPT, E_DOCINFSAVE, E_SAVEWORKINGSET, - E_SAVEDOCWINS, E_SAVEDOCVIEW, E_SAVERELINET, E_SAVERELFSYS, @@ -96,9 +95,6 @@ public: void SetSaveWorkingSet( sal_Bool b ); sal_Bool IsSaveWorkingSet() const; - void SetSaveDocWins( sal_Bool b ); - sal_Bool IsSaveDocWins() const; - void SetSaveDocView( sal_Bool b ); sal_Bool IsSaveDocView() const; diff --git a/svtools/source/config/saveopt.cxx b/svtools/source/config/saveopt.cxx index 2b18d1bf4767..1b0e07069d5c 100644 --- a/svtools/source/config/saveopt.cxx +++ b/svtools/source/config/saveopt.cxx @@ -76,7 +76,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bAutoSavePrompt, bDocInfSave, bSaveWorkingSet, - bSaveDocWins, bSaveDocView, bSaveRelINet, bSaveRelFSys, @@ -92,7 +91,6 @@ class SvtSaveOptions_Impl : public utl::ConfigItem bROAutoSavePrompt, bRODocInfSave, bROSaveWorkingSet, - bROSaveDocWins, bROSaveDocView, bROSaveRelINet, bROSaveRelFSys, @@ -118,7 +116,6 @@ public: BOOL IsAutoSavePrompt() const { return bAutoSavePrompt; } BOOL IsDocInfoSave() const { return bDocInfSave; } BOOL IsSaveWorkingSet() const { return bSaveWorkingSet; } - BOOL IsSaveDocWins() const { return bSaveDocWins; } BOOL IsSaveDocView() const { return bSaveDocView; } BOOL IsSaveRelINet() const { return bSaveRelINet; } BOOL IsSaveRelFSys() const { return bSaveRelFSys; } @@ -136,7 +133,6 @@ public: void SetAutoSavePrompt( BOOL b ); void SetDocInfoSave( BOOL b ); void SetSaveWorkingSet( BOOL b ); - void SetSaveDocWins( BOOL b ); void SetSaveDocView( BOOL b ); void SetSaveRelINet( BOOL b ); void SetSaveRelFSys( BOOL b ); @@ -214,15 +210,6 @@ void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b ) } } -void SvtSaveOptions_Impl::SetSaveDocWins( BOOL b ) -{ - if (!bROSaveDocWins && bSaveDocWins!=b) - { - bSaveDocWins = b; - SetModified(); - } -} - void SvtSaveOptions_Impl::SetSaveDocView( BOOL b ) { if (!bROSaveDocView && bSaveDocView!=b) @@ -321,9 +308,6 @@ sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) cons case SvtSaveOptions::E_SAVEWORKINGSET : bReadOnly = bROSaveWorkingSet; break; - case SvtSaveOptions::E_SAVEDOCWINS : - bReadOnly = bROSaveDocWins; - break; case SvtSaveOptions::E_SAVEDOCVIEW : bReadOnly = bROSaveDocView; break; @@ -359,16 +343,15 @@ sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) cons #define AUTOSAVE 4 #define PROMPT 5 #define EDITPROPERTY 6 -#define SAVEDOCWINS 7 -#define SAVEVIEWINFO 8 -#define UNPACKED 9 -#define PRETTYPRINTING 10 -#define WARNALIENFORMAT 11 -#define LOADDOCPRINTER 12 -#define FILESYSTEM 13 -#define INTERNET 14 -#define SAVEWORKINGSET 15 -#define ODFDEFAULTVERSION 16 +#define SAVEVIEWINFO 7 +#define UNPACKED 8 +#define PRETTYPRINTING 9 +#define WARNALIENFORMAT 10 +#define LOADDOCPRINTER 11 +#define FILESYSTEM 12 +#define INTERNET 13 +#define SAVEWORKINGSET 14 +#define ODFDEFAULTVERSION 15 Sequence< OUString > GetPropertyNames() { @@ -381,7 +364,6 @@ Sequence< OUString > GetPropertyNames() "Document/AutoSave", "Document/AutoSavePrompt", "Document/EditProperty", - "Document/DocumentWindows", "Document/ViewInfo", "Document/Unpacked", "Document/PrettyPrinting", @@ -413,7 +395,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bAutoSavePrompt( sal_False ) , bDocInfSave( sal_False ) , bSaveWorkingSet( sal_False ) - , bSaveDocWins( sal_False ) , bSaveDocView( sal_False ) , bSaveRelINet( sal_False ) , bSaveRelFSys( sal_False ) @@ -428,7 +409,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() , bROAutoSavePrompt( CFG_READONLY_DEFAULT ) , bRODocInfSave( CFG_READONLY_DEFAULT ) , bROSaveWorkingSet( CFG_READONLY_DEFAULT ) - , bROSaveDocWins( CFG_READONLY_DEFAULT ) , bROSaveDocView( CFG_READONLY_DEFAULT ) , bROSaveRelINet( CFG_READONLY_DEFAULT ) , bROSaveRelFSys( CFG_READONLY_DEFAULT ) @@ -518,10 +498,6 @@ SvtSaveOptions_Impl::SvtSaveOptions_Impl() bSaveWorkingSet = bTemp; bROSaveWorkingSet = pROStates[nProp]; break; - case SAVEDOCWINS : - bSaveDocWins = bTemp; - bROSaveDocWins = pROStates[nProp]; - break; case SAVEVIEWINFO : bSaveDocView = bTemp; bROSaveDocView = pROStates[nProp]; @@ -667,14 +643,6 @@ void SvtSaveOptions_Impl::Commit() ++nRealCount; } break; - case SAVEDOCWINS : - if (!bROSaveDocWins) - { - pValues[nRealCount] <<= bSaveDocWins; - pNames[nRealCount] = pOrgNames[i]; - ++nRealCount; - } - break; case SAVEVIEWINFO : if (!bROSaveDocView) { @@ -940,16 +908,6 @@ sal_Bool SvtSaveOptions::IsSaveWorkingSet() const return pImp->pSaveOpt->IsSaveWorkingSet(); } -void SvtSaveOptions::SetSaveDocWins( sal_Bool b ) -{ - pImp->pSaveOpt->SetSaveDocWins( b ); -} - -sal_Bool SvtSaveOptions::IsSaveDocWins() const -{ - return pImp->pSaveOpt->IsSaveDocWins(); -} - void SvtSaveOptions::SetSaveDocView( sal_Bool b ) { pImp->pSaveOpt->SetSaveDocView( b ); -- cgit v1.2.3 From 70259f71b73997f8cf16a73ae1677ffa985717d0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 22 Nov 2009 22:17:18 +0100 Subject: [CWS autorecovery] removed the unused "Save Window State with Document" option This happened in further preparation for issue #i65597#, where the current phase aims at changing the SFX-Document-Loader to be completely UNO-based, by introducing a UNO-ViewFactory in SFX. --- .../schema/org/openoffice/Office/Common.xcs | 11 -- sfx2/inc/sfx2/objsh.hxx | 2 +- sfx2/inc/sfx2/sfxsids.hrc | 4 +- sfx2/source/appl/appcfg.cxx | 15 -- sfx2/source/doc/objcont.cxx | 187 +++++++-------------- sfx2/source/view/topfrm.cxx | 6 +- sfx2/source/view/viewfrm.cxx | 2 +- 7 files changed, 68 insertions(+), 159 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 246b1bcdb974..bca79f4e30ba 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2223,17 +2223,6 @@ Dymamic border coloring means that when the mouse is hovered over a control, and true - - - - - - MBA - Specifies whether all currently open windows of a document should be saved. If true the view properties for all open document views of that document are saved. - - - false - diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index c6b2b163f5f6..0ebfd74c55a9 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -788,7 +788,7 @@ public: SAL_DLLPRIVATE sal_uInt16& GetAktViewNo() { return nViewNo; } SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); - SAL_DLLPRIVATE SfxViewFrame* LoadWindows_Impl( SfxTopFrame& rPrefered ); + SAL_DLLPRIVATE bool LoadView_Impl( SfxTopFrame& rPrefered ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index c15c09a09384..615bb8494bb8 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -873,7 +873,7 @@ #define SID_HELP_PI (SID_SFX_START + 962) #define SID_BASIC_ENABLED (SID_SFX_START + 964) #define SID_EXPORT_DIALOG (SID_SFX_START + 965) -#define SID_IMPORT_DIALOG (SID_SFX_START + 966) +#define SID_IMPORT_DIALOG (SID_SFX_START + 966) #define SID_BASICBREAK (SID_SFX_START +1521) @@ -1015,7 +1015,7 @@ #define SID_ATTR_AUTOSAVEMINUTE (SID_OPTIONS_START + 5) #define SID_ATTR_WORKINGSET (SID_OPTIONS_START + 13) #define SID_ATTR_UNDO_COUNT (SID_OPTIONS_START + 16) -#define SID_ATTR_SAVEDOCWINS (SID_OPTIONS_START + 17) + // unused #define SID_ATTR_SAVEDOCVIEW (SID_OPTIONS_START + 18) // GeneralTabPage diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index af31659ec24c..f19bd0972c21 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -272,14 +272,6 @@ BOOL SfxApplication::GetOptions( SfxItemSet& rSet ) bRet = FALSE; } break; - case SID_ATTR_SAVEDOCWINS : - { - bRet = TRUE; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCWINS)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCWINS ), aSaveOptions.IsSaveDocWins()))) - bRet = FALSE; - } - break; case SID_ATTR_SAVEDOCVIEW : { bRet = TRUE; @@ -631,13 +623,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue()); } - // offene Fenster speichern - if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCWINS), TRUE, &pItem)) - { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); - aSaveOptions.SetSaveDocWins(((const SfxBoolItem *)pItem)->GetValue()); - } - // Fenster-Einstellung speichern if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), TRUE, &pItem)) { diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index a946cc690318..a7561b7dec37 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -89,12 +89,11 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; //==================================================================== -#define SFX_WINDOWS_STREAM "SfxWindows" -#define SFX_PREVIEW_STREAM "SfxPreview" - //==================================================================== static @@ -194,165 +193,101 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig //==================================================================== -SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame& rPreferedFrame ) +bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rPreferedFrame ) { - if ( pImp->bLoadingWindows ) - return NULL; + return false; DBG_ASSERT( GetMedium(), "A Medium should exist here!"); - if( !GetMedium() ) - return 0; + if ( !GetMedium() ) + return false; // get correct mode SFX_APP(); SfxViewFrame* pPreferedViewFrame = rPreferedFrame.GetCurrentViewFrame(); - SvtSaveOptions aOpt; - BOOL bLoadDocWins = aOpt.IsSaveDocWins() && !pPreferedViewFrame; - - // try to get viewdata information for XML format - REFERENCE < XVIEWDATASUPPLIER > xViewDataSupplier( GetModel(), ::com::sun::star::uno::UNO_QUERY ); - REFERENCE < XINDEXACCESS > xViewData; + // obtain view data + Reference< XViewDataSupplier > xViewDataSupplier( GetModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; if ( xViewDataSupplier.is() ) - { xViewData = xViewDataSupplier->getViewData(); - if ( !xViewData.is() ) - return NULL; - } - else - return NULL; - SfxViewFrame *pActiveFrame = 0; - String aWinData; - SfxItemSet *pSet = GetMedium()->GetItemSet(); + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + return false; + + SfxItemSet* pSet = GetMedium()->GetItemSet(); pImp->bLoadingWindows = TRUE; - BOOL bLoaded = FALSE; - sal_Int32 nView = 0; // get saved information for all views - SfxTopFrame* pCurrentTargetFrame = &rPreferedFrame; - while ( TRUE ) + // get viewdata and look for the stored ViewId + USHORT nViewId = 0; + SEQUENCE < PROPERTYVALUE > aUserData; + if ( xViewData->getByIndex( 0 ) >>= aUserData ) { - USHORT nViewId = 0; - String aUserData; // used in the binary format - SEQUENCE < PROPERTYVALUE > aSeq; // used in the XML format - - // XML format - // active view is the first view in the container - FASTBOOL bActive = ( nView == 0 ); - - if ( nView == xViewData->getCount() ) - // finished - break; - - // get viewdata and look for the stored ViewId - ::com::sun::star::uno::Any aAny = xViewData->getByIndex( nView++ ); - if ( aAny >>= aSeq ) + ::comphelper::NamedValueCollection aNamedUserData( aUserData ); + ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( sViewId.getLength() ) { - ::comphelper::NamedValueCollection aNamedUserData( aSeq ); - ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( sViewId.getLength() ) - { - sViewId = sViewId.copy( 4 ); // format is like in "view3" - nViewId = USHORT( sViewId.toInt32() ); - } + sViewId = sViewId.copy( 4 ); // format is like in "view3" + nViewId = USHORT( sViewId.toInt32() ); } + } - // load only active view, but current item is not the active one ? - // in XML format the active view is the first one - if ( !bLoadDocWins && !bActive ) - break; - - pSet->ClearItem( SID_USER_DATA ); - SfxViewFrame *pFrame = 0; - if ( pPreferedViewFrame ) + pSet->ClearItem( SID_USER_DATA ); + SfxViewFrame* pTargetFrame = pPreferedViewFrame; + if ( pTargetFrame ) + { + // use the frame from the arguments, but don't set a window size + if ( pTargetFrame->GetViewShell() || !pTargetFrame->GetObjectShell() ) { - // use the frame from the arguments, but don't set a window size - pFrame = pPreferedViewFrame; - if ( pFrame->GetViewShell() || !pFrame->GetObjectShell() ) - { - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + pSet->ClearItem( SID_VIEW_POS_SIZE ); + pSet->ClearItem( SID_WIN_POSSIZE ); + pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - // avoid flickering controllers - SfxBindings &rBind = pFrame->GetBindings(); - rBind.ENTERREGISTRATIONS(); + // avoid flickering controllers + SfxBindings &rBind = pTargetFrame->GetBindings(); + rBind.ENTERREGISTRATIONS(); - // set document into frame - pCurrentTargetFrame->InsertDocument_Impl( *this ); + // set document into frame + rPreferedFrame.InsertDocument_Impl( *this ); - // restart controller updating - rBind.LEAVEREGISTRATIONS(); - } - else - { - // create new view - pFrame->CreateView_Impl( nViewId ); - } + // restart controller updating + rBind.LEAVEREGISTRATIONS(); } else { - if ( bLoadDocWins ) - { - // open in the background - pSet->Put( SfxUInt16Item( SID_VIEW_ZOOM_MODE, 0 ) ); - pSet->Put( SfxRectangleItem( SID_VIEW_POS_SIZE, Rectangle() ) ); - } - - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - if ( pCurrentTargetFrame ) - { - // Frame "ubergeben, allerdings ist der noch leer - pCurrentTargetFrame->InsertDocument_Impl( *this ); - pFrame = pCurrentTargetFrame->GetCurrentViewFrame(); - } - else - { - pFrame = SfxTopFrame::Create( this, nViewId, FALSE, pSet )->GetCurrentViewFrame(); - } - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - } - - bLoaded = TRUE; - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pFrame && pFrame->GetViewShell() ) - { - if ( aUserData.Len() ) - pFrame->GetViewShell()->ReadUserData( aUserData, !bLoadDocWins ); - else if ( aSeq.getLength() ) - pFrame->GetViewShell()->ReadUserDataSequence( aSeq, !bLoadDocWins ); + // create new view + pTargetFrame->CreateView_Impl( nViewId ); } + } + else + { + pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - // perhaps there are more windows to load - pCurrentTargetFrame = NULL; - - if ( bActive ) - pActiveFrame = pFrame; + // Frame "ubergeben, allerdings ist der noch leer + rPreferedFrame.InsertDocument_Impl( *this ); + pTargetFrame = rPreferedFrame.GetCurrentViewFrame(); - if( pPreferedViewFrame || !bLoadDocWins ) - // load only active window - break; + // only temporary data, don't hold it in the itemset + pSet->ClearItem( SID_VIEW_POS_SIZE ); + pSet->ClearItem( SID_WIN_POSSIZE ); + pSet->ClearItem( SID_VIEW_ZOOM_MODE ); } - if ( pActiveFrame ) + // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE + // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet + if ( pTargetFrame && pTargetFrame->GetViewShell() && aUserData.getLength() ) { - if ( !pPreferedViewFrame ) - // activate frame - pActiveFrame->MakeActive_Impl( TRUE ); + pTargetFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); } + if ( pTargetFrame && !pPreferedViewFrame ) + // activate frame + pTargetFrame->MakeActive_Impl( TRUE ); + pImp->bLoadingWindows = FALSE; - return pPreferedViewFrame && bLoaded ? pPreferedViewFrame : pActiveFrame; + return true; } //==================================================================== diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 5957abb67b27..b43ccae4aa2b 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -789,7 +789,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // Position und Groesse testen // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch - // LoadWindows_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() + // LoadView_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() // an einer Task aufgerufen hat! ) const SfxItemSet* pSet = GetItemSet_Impl(); if ( !pSet ) @@ -816,10 +816,10 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation // aus den Dokument geladen werden, z.B. weil InsertDocument_Impl seinerseits - // aus LoadWindows_Impl aufgerufen wurde! + // aus LoadView_Impl aufgerufen wurde! if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - if ( rDoc.LoadWindows_Impl( *this ) ) + if ( rDoc.LoadView_Impl( *this ) ) { if ( GetCurrentDocument() != &rDoc ) // something went wrong during insertion diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index abdec58b8ef7..2427b54a8c9a 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2224,7 +2224,7 @@ SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) /* [Beschreibung] Erzeugt eine SfxViewShell f"ur diesen SfxViewFrame. Wird auch aus - + gerufen. */ -- cgit v1.2.3 From 31f10b977919d80de6f23cd754b56558e10e671c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:17:00 +0100 Subject: [CWS autorecovery] during #i65597#: removed some unused SFX_HINT_* --- svtools/inc/svtools/smplhint.hxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/svtools/inc/svtools/smplhint.hxx b/svtools/inc/svtools/smplhint.hxx index 9858fefd86f0..4e1f4601f78a 100644 --- a/svtools/inc/svtools/smplhint.hxx +++ b/svtools/inc/svtools/smplhint.hxx @@ -43,13 +43,13 @@ #define SFX_HINT_DEINITIALIZING 0x00000040 #define SFX_HINT_MODECHANGED 0x00000080 #define SFX_HINT_CANCELLABLE 0x00000100 -#define SFX_HINT_DATAAVAILABLE 0x00000200 -#define SFX_HINT_SAVECOMPLETED 0x00000400 -#define SFX_HINT_RELEASEREF 0x00000800 + // unused, formerly SFX_HINT_DATAAVAILABLE + // unused, formerly SFX_HINT_SAVECOMPLETED + // unused, formerly SFX_HINT_RELEASEREF #define SFX_HINT_COLORS_CHANGED 0x00001000 #define SFX_HINT_CTL_SETTINGS_CHANGED 0x00002000 #define SFX_HINT_ACCESSIBILITY_CHANGED 0x00004000 -#define SFX_HINT_VIEWCREATED 0x00008000 + // unused, formerly SFX_HINT_VIEWCREATED #define SFX_HINT_USER00 0x00010000 #define SFX_HINT_USER01 0x00020000 #define SFX_HINT_USER02 0x00040000 -- cgit v1.2.3 From 6f1f154f9a48300285bbac3c191142db32bfc2f0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:20:13 +0100 Subject: [CWS autorecovery] #i65597# further refactored the loader code, cutting dead branches Sadly, there's still one use case which calls InsertDocument_Impl on a frame which already contains an SfxViewFrame: reloading the document (explicitly via SID_RELOAD, or implicitly via SID_EDITDOC). If this weren't the case, the code would look even simpler. On the medium run, the reload code should also be migrated to a ViewFactory usage. --- sfx2/inc/sfx2/topfrm.hxx | 1 + sfx2/source/doc/objcont.cxx | 62 +++++++---------- sfx2/source/doc/objxtor.cxx | 2 - sfx2/source/inc/objshimp.hxx | 2 - sfx2/source/view/frmload.cxx | 71 +++++-------------- sfx2/source/view/topfrm.cxx | 162 ++++++++++++++++++++----------------------- sfx2/source/view/viewfrm.cxx | 4 -- 7 files changed, 118 insertions(+), 186 deletions(-) diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index af1f3c488904..0e072a8ac87d 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -78,6 +78,7 @@ public: SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void CheckMenuCloser_Impl( MenuBar* pMenubar ); + SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; //#endif }; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index a7561b7dec37..99253fbce806 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -193,19 +193,12 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig //==================================================================== -bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rPreferedFrame ) +bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rTargetFrame ) { - if ( pImp->bLoadingWindows ) - return false; - DBG_ASSERT( GetMedium(), "A Medium should exist here!"); if ( !GetMedium() ) return false; - // get correct mode - SFX_APP(); - SfxViewFrame* pPreferedViewFrame = rPreferedFrame.GetCurrentViewFrame(); - // obtain view data Reference< XViewDataSupplier > xViewDataSupplier( GetModel(), UNO_QUERY ); Reference< XIndexAccess > xViewData; @@ -215,12 +208,7 @@ bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rPreferedFrame ) if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) return false; - SfxItemSet* pSet = GetMedium()->GetItemSet(); - - pImp->bLoadingWindows = TRUE; - - // get saved information for all views - // get viewdata and look for the stored ViewId + // obtain the ViewID from the view data USHORT nViewId = 0; SEQUENCE < PROPERTYVALUE > aUserData; if ( xViewData->getByIndex( 0 ) >>= aUserData ) @@ -234,23 +222,29 @@ bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rPreferedFrame ) } } + SfxItemSet* pSet = GetMedium()->GetItemSet(); pSet->ClearItem( SID_USER_DATA ); - SfxViewFrame* pTargetFrame = pPreferedViewFrame; - if ( pTargetFrame ) + pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + + if ( rTargetFrame.GetCurrentViewFrame() ) { + // TODO: the only client of this case is the Reload-implementation for SFX-based documents. This should be + // migrated to use UNO mechanisms, too. In this case, we can simplify the code here. + // use the frame from the arguments, but don't set a window size - if ( pTargetFrame->GetViewShell() || !pTargetFrame->GetObjectShell() ) + SfxViewFrame* pViewFrame = rTargetFrame.GetCurrentViewFrame(); + if ( pViewFrame->GetViewShell() || !pViewFrame->GetObjectShell() ) { pSet->ClearItem( SID_VIEW_POS_SIZE ); pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + pSet->ClearItem( SID_VIEW_ZOOM_MODE ); // avoid flickering controllers - SfxBindings &rBind = pTargetFrame->GetBindings(); + SfxBindings &rBind = pViewFrame->GetBindings(); rBind.ENTERREGISTRATIONS(); // set document into frame - rPreferedFrame.InsertDocument_Impl( *this ); + rTargetFrame.InsertDocument_Impl( *this ); // restart controller updating rBind.LEAVEREGISTRATIONS(); @@ -258,35 +252,31 @@ bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rPreferedFrame ) else { // create new view - pTargetFrame->CreateView_Impl( nViewId ); + pViewFrame->CreateView_Impl( nViewId ); } } else { - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - // Frame "ubergeben, allerdings ist der noch leer - rPreferedFrame.InsertDocument_Impl( *this ); - pTargetFrame = rPreferedFrame.GetCurrentViewFrame(); - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); + rTargetFrame.InsertDocument_Impl( *this ); } + SfxViewFrame* pViewFrame = rTargetFrame.GetCurrentViewFrame(); + + // only temporary data, don't hold it in the itemset + pSet->ClearItem( SID_VIEW_POS_SIZE ); + pSet->ClearItem( SID_WIN_POSSIZE ); + pSet->ClearItem( SID_VIEW_ZOOM_MODE ); // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pTargetFrame && pTargetFrame->GetViewShell() && aUserData.getLength() ) + if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) { - pTargetFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); + pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); } - if ( pTargetFrame && !pPreferedViewFrame ) + if ( pViewFrame ) // activate frame - pTargetFrame->MakeActive_Impl( TRUE ); + pViewFrame->MakeActive_Impl( TRUE ); - pImp->bLoadingWindows = FALSE; return true; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 950ecf9ea239..22b239a3c5da 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -219,9 +219,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bForbidCaching( sal_False ) ,bForbidReload( sal_False ) ,bSupportsEventMacros( sal_True ) - ,bLoadingWindows( sal_False ) ,bBasicInitialized( sal_False ) -// ,bHidden( sal_False ) ,bIsPrintJobCancelable( sal_True ) ,bOwnsStorage( sal_True ) ,bNoBaseURL( sal_False ) diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 77162423cabe..9e5bc0cc8ce1 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -103,9 +103,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bForbidCaching : 1, bForbidReload : 1, bSupportsEventMacros: 1, - bLoadingWindows: 1, bBasicInitialized :1, - //bHidden :1, // indicates a hidden view shell bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! bOwnsStorage:1, bNoBaseURL:1, diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 62830b47d0f5..8b4a035cb176 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -354,43 +354,15 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( !pRefererItem ) aSet.Put( SfxStringItem( SID_REFERER, String() ) ); - SfxFrame* pTargetFrame = NULL; - for ( pTargetFrame = SfxFrame::GetFirst(); pTargetFrame; pTargetFrame = SfxFrame::GetNext( *pTargetFrame ) ) - { - if ( pTargetFrame->GetFrameInterface() == _rTargetFrame ) - break; - } - - BOOL bFrameCreated = FALSE; - if ( !pTargetFrame ) - { - pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); - bFrameCreated = TRUE; - } - + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); if ( xModel.is() ) { - // !TODO: replace by ViewFactory - if ( _rTargetFrame->getController().is() ) - { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - _rTargetFrame->setComponent( NULL, NULL ); - if ( !bFrameCreated ) - pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); - } - aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { if ( xModel == pDoc->GetModel() ) { - SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pTargetFrame ); - OSL_ENSURE( pTopFrame, "SfxFrameLoader_Impl::load: An SfxFrame which is no SfxTopFrame?!" ); - if ( !pTopFrame ) - return sal_False; - pTargetFrame->SetItemSet_Impl( &aSet ); aDescriptor.remove( "Model" ); @@ -398,7 +370,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV xModel->attachResource( sURL, aDescriptor.getPropertyValues() ); - return pTopFrame->InsertDocument_Impl( *pDoc ); + // TODO: replace by ViewFactory + return pTargetFrame->InsertDocument_Impl( *pDoc ); } } @@ -430,7 +403,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( aParam.Len() ) { sal_Bool bSuccess = impl_createNewDocWithSlotParam( (sal_uInt16)aParam.ToInt32(), pTargetFrame ); - if ( !bSuccess && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) + if ( !bSuccess && wFrame && !wFrame->GetCurrentDocument() ) { wFrame->SetFrameInterface_Impl( NULL ); wFrame->DoClose(); @@ -482,8 +455,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( !bUseTemplate ) { // execute "NewDocument" request - sal_Bool bSuccess = impl_createNewDoc( aSet, pTargetFrame, aFact );; - if ( !bSuccess && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) + sal_Bool bSuccess = impl_createNewDoc( aSet, pTargetFrame, aFact ); + if ( !bSuccess && wFrame && !wFrame->GetCurrentDocument() ) { wFrame->SetFrameInterface_Impl( NULL ); wFrame->DoClose(); @@ -529,25 +502,20 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV // !TODO: will be done by Framework! pDocMedium->SetUpdatePickList( !bHidden ); + /* + #121119# + We dont know why _pFrame can be corrupt here. + But if it was deleted it shouldnt exists inside our global list. + May be we can use the damaged pointer to detect if it was removed from + this global list. + */ impl_ensureValidFrame_throw( pTargetFrame ); - // !TODO: replace by ViewFactory - if ( pTargetFrame->GetFrameInterface()->getController().is() ) - { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - //pTargetFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); - } - - wFrame = pTargetFrame; aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); - pTargetFrame->SetItemSet_Impl( &aSet ); - SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pTargetFrame ); - OSL_ENSURE( pTopFrame, "SfxFrameLoader_Impl::load: An SfxFrame which is no SfxTopFrame?!" ); - if ( pTopFrame && pTopFrame->InsertDocument_Impl( *pDoc ) ) + // !TODO: replace by ViewFactory + pTargetFrame->SetItemSet_Impl( &aSet ); + if ( pTargetFrame->InsertDocument_Impl( *pDoc ) ) { pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); String aURL = pDoc->GetMedium()->GetName(); @@ -590,13 +558,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV void SfxFrameLoader_Impl::impl_ensureValidFrame_throw( const SfxFrame* _pFrame ) { - /* - #121119# - We dont know why pTargetFrame can be corrupt here. - But if it was deleted it shouldnt exists inside our global list. - May be we can use the damaged pointer to detect if it was removed from - this global list. - */ SfxFrame* pTmp = NULL; for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index b43ccae4aa2b..287c0783052f 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -781,21 +781,48 @@ String SfxTopFrame::GetWindowData() return aWinData; } +void SfxTopFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const +{ + Window *pWin = pImp->pWindow; + + // Groesse setzen + const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() ); + Point aPos( rWinArea.TopLeft() ); + Size aSz( rWinArea.GetSize() ); + if ( aSz.Width() && aSz.Height() ) + { + aPos.X() = Min(aPos.X(), + long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); + aPos.Y() = Min(aPos.Y(), + long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); + if ( aPos.X() + aSz.Width() < + aAppWindow.Width() + aSz.Width() / 2 && + aPos.Y() + aSz.Height() < + aAppWindow.Height() + aSz.Height() / 2 ) + { + pWin->SetPosPixel( aPos ); + pWin->SetOutputSizePixel( aSz ); + } + } +} + sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) /* [Beschreibung] */ { - SfxObjectShell *pOld = GetCurrentDocument(); + const SfxObjectShell* pOldDocument = GetCurrentDocument(); + OSL_PRECOND( pOldDocument == NULL, + "SfxTopFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - // Position und Groesse testen - // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch - // LoadView_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() - // an einer Task aufgerufen hat! ) const SfxItemSet* pSet = GetItemSet_Impl(); if ( !pSet ) pSet = rDoc.GetMedium()->GetItemSet(); SetItemSet_Impl(0); + // Position und Groesse testen + // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch + // LoadView_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() + // an einer Task aufgerufen hat! ) SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size SFX_ITEMSET_ARG( pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID SFX_ITEMSET_ARG( pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom @@ -814,6 +841,8 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if( !pImp->bHidden ) rDoc.OwnerLock( sal_True ); + const USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; + // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation // aus den Dokument geladen werden, z.B. weil InsertDocument_Impl seinerseits // aus LoadView_Impl aufgerufen wurde! @@ -831,42 +860,39 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) UpdateDescriptor( &rDoc ); - SfxViewFrame *pFrame = GetCurrentViewFrame(); - if ( pFrame ) + SfxViewFrame* pViewFrame = GetCurrentViewFrame(); + if ( pViewFrame ) { - sal_Bool bChildActivated = sal_False; - if ( pFrame->GetActiveChildFrame_Impl() && pFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) + // TODO: the only client of this case is the Reload-implementation for SFX-based documents. This should be + // migrated to use UNO mechanisms, too. In this case, we can simplify the code here. + if ( pViewFrame->GetActiveChildFrame_Impl() && pViewFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) { - pFrame->SetActiveChildFrame_Impl(0); - SfxViewFrame::SetViewFrame( pFrame ); - bChildActivated = sal_True; + pViewFrame->SetActiveChildFrame_Impl(0); + SfxViewFrame::SetViewFrame( pViewFrame ); } - if ( pFrame->GetObjectShell() ) + if ( pViewFrame->GetObjectShell() ) { - pFrame->ReleaseObjectShell_Impl( sal_False ); + pViewFrame->ReleaseObjectShell_Impl( sal_False ); } if ( pViewIdItem ) - pFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); - pFrame->SetObjectShell_Impl( rDoc ); + pViewFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); + pViewFrame->SetObjectShell_Impl( rDoc ); } else { - // 1: internal embedded object - // 2: external embedded object - // 3: OLE server if ( pPluginMode && pPluginMode->GetValue() != 2 ) SetInPlace_Impl( TRUE ); - pFrame = new SfxTopViewFrame( this, &rDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); - if ( !pFrame->GetViewShell() ) + pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); + if ( !pViewFrame->GetViewShell() ) return sal_False; if ( pPluginMode && pPluginMode->GetValue() == 1 ) { - pFrame->ForceOuterResize_Impl( FALSE ); - pFrame->GetBindings().HidePopups(TRUE); + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups(TRUE); // MBA: layoutmanager of inplace frame starts locked and invisible GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); @@ -878,77 +904,39 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) } } - String aMark; - if ( pJumpItem ) - aMark = pJumpItem->GetValue(); - - if ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) - { - if ( pViewDataItem ) - pFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); - else if( aMark.Len() ) - GetCurrentViewFrame()->GetViewShell()->JumpToMark( aMark ); - } - else - { - // Daten setzen, die in FinishedLoading ausgewertet werden - MarkData_Impl*& rpMark = rDoc.Get_Impl()->pMarkData; - if (!rpMark) - rpMark = new MarkData_Impl; - rpMark->pFrame = GetCurrentViewFrame(); - if ( pViewDataItem ) - rpMark->aUserData = pViewDataItem->GetValue(); - else - rpMark->aMark = aMark; - } + OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, + "SfxTopFrame::InsertDocument_Impl: so this code wasn't dead?" ); + // Before CWS autorecovery, there was code which postponed setting the ViewData/Mark to a later time + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since loads this method + // here is never called before the load process finished. + if ( pViewDataItem ) + pViewFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); + else if( pJumpItem ) + pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); // Position und Groesse setzen - //sal_uInt16 nWinMode = pModeItem ? pModeItem->GetValue() : 1; - if ( pAreaItem && !pOld ) - { - Window *pWin = pImp->pWindow; - - // Groesse setzen - const Rectangle aWinRect( pAreaItem->GetValue() ); - const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() ); - Point aPos( aWinRect.TopLeft() ); - Size aSz(aWinRect.GetSize()); - if ( aSz.Width() && aSz.Height() ) - { - aPos.X() = Min(aPos.X(), - long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); - aPos.Y() = Min(aPos.Y(), - long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); - if ( aPos.X() + aSz.Width() < - aAppWindow.Width() + aSz.Width() / 2 && - aPos.Y() + aSz.Height() < - aAppWindow.Height() + aSz.Height() / 2 ) - { - pWin->SetPosPixel( aPos ); - pWin->SetOutputSizePixel( aSz ); - } - } - } + if ( pAreaItem && !pOldDocument ) + PositionWindow_Impl( pAreaItem->GetValue() ); if ( !pImp->bHidden ) { if ( rDoc.IsHelpDocument() || (pPluginMode && pPluginMode->GetValue() == 2) ) - pFrame->GetDispatcher()->HideUI( TRUE ); + pViewFrame->GetDispatcher()->HideUI( TRUE ); else - pFrame->GetDispatcher()->HideUI( FALSE ); + pViewFrame->GetDispatcher()->HideUI( FALSE ); if ( IsInPlace() ) - pFrame->LockAdjustPosSizePixel(); + pViewFrame->LockAdjustPosSizePixel(); if ( pPluginMode && pPluginMode->GetValue() == 3) GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); if ( !IsInPlace() ) - pFrame->GetDispatcher()->Update_Impl(); - pFrame->Show(); + pViewFrame->GetDispatcher()->Update_Impl(); + pViewFrame->Show(); GetWindow().Show(); if ( !IsInPlace() || (pPluginMode && pPluginMode->GetValue() == 3) ) - pFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); + pViewFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); rDoc.OwnerLock( sal_False ); // Dont show container window! Its done by framework or directly @@ -956,11 +944,11 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if ( IsInPlace() ) { - pFrame->UnlockAdjustPosSizePixel(); + pViewFrame->UnlockAdjustPosSizePixel(); // force resize for OLE server to fix layout problems of writer and math // see i53651 if ( pPluginMode && pPluginMode->GetValue() == 3 ) - pFrame->Resize(TRUE); + pViewFrame->Resize(TRUE); } } else @@ -970,19 +958,19 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) } // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! - pFrame->UpdateTitle(); + pViewFrame->UpdateTitle(); if ( !IsInPlace() ) { - if ( pFrame->GetViewShell()->UseObjectSize() ) + if ( pViewFrame->GetViewShell()->UseObjectSize() ) { - GetCurrentViewFrame()->UnlockAdjustPosSizePixel(); - GetCurrentViewFrame()->Resize(TRUE); - GetCurrentViewFrame()->ForceInnerResize_Impl( FALSE ); - GetCurrentViewFrame()->Resize(TRUE); + pViewFrame->UnlockAdjustPosSizePixel(); + pViewFrame->Resize(TRUE); + pViewFrame->ForceInnerResize_Impl( FALSE ); + pViewFrame->Resize(TRUE); } else - GetCurrentViewFrame()->Resize(TRUE); + pViewFrame->Resize(TRUE); } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 2427b54a8c9a..160b594f38af 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2269,10 +2269,6 @@ SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) GetDispatcher()->Push( *pViewShell->GetSubShell() ); pViewShell->PushSubShells_Impl(); -#if defined SFX_HINT_VIEWCREATED - GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_VIEWCREATED ) ); -#endif - GetBindings().LEAVEREGISTRATIONS(); DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); -- cgit v1.2.3 From f82ce508322002e0af815fdbfa1d102b48b2d1c0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:28:55 +0100 Subject: [CWS autorecovery] removed the dead code for loading in a separate thread Part of the code relied in the SfxCancellable, which is going to be removed. Also, this feature wasn't used anymore for a long time now, if we want to have it, again, we should better re-implement it. --- dbaccess/source/ui/browser/brwctrlr.cxx | 324 +++----------------------------- dbaccess/source/ui/browser/unodatbr.cxx | 4 - dbaccess/source/ui/inc/brwctrlr.hxx | 69 ------- 3 files changed, 30 insertions(+), 367 deletions(-) diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index ddfb583f65c9..187ac9640286 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -493,7 +493,6 @@ SbaXDataBrowserController::SbaXDataBrowserController(const Reference< ::com::sun ,m_sStateSaveRecord(ModuleRes(RID_STR_SAVE_CURRENT_RECORD)) ,m_sStateUndoRecord(ModuleRes(RID_STR_UNDO_MODIFY_RECORD)) ,m_sModuleIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataSourceBrowser" ) ) ) - ,m_pLoadThread(NULL) ,m_pFormControllerImpl(NULL) ,m_nPendingLoadFinished(0) ,m_nFormActionNestingLevel(0) @@ -1155,45 +1154,6 @@ void SbaXDataBrowserController::elementReplaced(const ::com::sun::star::containe sal_Bool SbaXDataBrowserController::suspend(sal_Bool /*bSuspend*/) throw( RuntimeException ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaui", "Ocke.Janssen@sun.com", "SbaXDataBrowserController::suspend" ); - // have a pending open operation ? - if (PendingLoad()) - { - ::vos::OGuard aGuard(Application::GetSolarMutex()); - if (m_nPendingLoadFinished != 0) - { // clean up directly. Otherwise there may be a pending asynchronous call - // to OnOpenFinishedMainThread, which won't be executed before we leave - // this method. Sounds like a classic infinite loop. - Application::RemoveUserEvent(m_nPendingLoadFinished); - LINK(this, SbaXDataBrowserController, OnOpenFinishedMainThread).Call(NULL); - } - else - { // set m_bClosingKillOpen to ensure that the our termination handler reacts according - // it's context - m_bClosingKillOpen = sal_True; - - // normally we would now just wait for termination of the load thread, but there is a small problem : - // In the current thread the global solar mutex is locked (that's for sure). If the loading of the - // form tries to acquire (blocking) the solar mutex, too, and we loop waiting for the other thread - // we have a classic deadlock. And bet your ass that ANYBODY in the foreign thread tries to lock - // the solar mutex. Almost all the UNO-capsules around normal C++ classes use the solar mutex for - // "thread safety" (which doesn't deserve that name anymore ;), e.g. the XNumberFormatter-implementation - // does. - // So we have to do a fake : we tell the loading thread that we aren't interested in the results anymore - // and the thread deletes itself (and the data source) as soon as it is done. As it holds the last - // references to the form (and thus, indirectly, to the grid) they will be cleared as soon as the thread dies. - // So all is fine. Except the small flaw that the form is still loading in the background while the - // window that should display it is already dead. - // If we could release the solar mutex in this thread and block it 'til the loader is finished we could - // solve it in a less dirty way, but uinfortunatelly we don't know how often this thread acquired the mutex. - // With high effort we could reach this with releasing the mutex until a third thread - which has to be - // created - can acquire it.Then we block, the third thread releases the mutex (and dies) and the loader - // thread would be able to finish. But that sounds difficult and fault-prone, so I think it's not worth it ... - ((LoadFormThread*)m_pLoadThread)->SetTerminationHdl(Link()); - // and of course we tell the thread to stop .... - ((LoadFormThread*)m_pLoadThread)->StopIt(); - } - - } DBG_ASSERT(m_nPendingLoadFinished == 0, "SbaXDataBrowserController::suspend : there shouldn't be a pending load !"); m_aAsyncGetCellFocus.CancelCall(); @@ -1219,42 +1179,30 @@ void SbaXDataBrowserController::disposing() // the base class SbaXDataBrowserController_Base::OGenericUnoController::disposing(); - if (!PendingLoad()) + // the data source + Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); + if (xFormSet.is()) { - // don't do the removeXxxListener calls if there is a pending load, this may lead to a deadlock : - // as in this thread the SolarMutex is locked (that's for sure) and removeXxxListener locks - // the form's mutex. But in the loading thread both mutexes are acquired in reverse order. - // That's no problem that we don't remove ourself here, as the load thread is responsible for the form - // at the moment. So if the loading is finished, the form will be disposed (by the load thread), and - // we get the "disposing" event where we can do the removeXxxListener calls. - // The alternative for this handling would be that the form has two mutexes : one for handling it's - // listeners and properties and so on, on for it's pure cursor actions - - // the data source - Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); - if (xFormSet.is()) - { - xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE, static_cast(this)); - xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast(this)); - } + xFormSet->removePropertyChangeListener(PROPERTY_ISNEW, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ISMODIFIED, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ROWCOUNT, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ACTIVECOMMAND, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_ORDER, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_FILTER, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_HAVING_CLAUSE, static_cast(this)); + xFormSet->removePropertyChangeListener(PROPERTY_APPLYFILTER, static_cast(this)); + } - Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); - if (xFormError.is()) - xFormError->removeSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); + Reference< ::com::sun::star::sdb::XSQLErrorBroadcaster > xFormError(getRowSet(), UNO_QUERY); + if (xFormError.is()) + xFormError->removeSQLErrorListener((::com::sun::star::sdb::XSQLErrorListener*)this); - if (m_xLoadable.is()) - m_xLoadable->removeLoadListener(this); + if (m_xLoadable.is()) + m_xLoadable->removeLoadListener(this); - Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); - if (xFormParameter.is()) - xFormParameter->removeParameterListener((::com::sun::star::form::XDatabaseParameterListener*)this); - } + Reference< ::com::sun::star::form::XDatabaseParameterBroadcaster > xFormParameter(getRowSet(), UNO_QUERY); + if (xFormParameter.is()) + xFormParameter->removeParameterListener((::com::sun::star::form::XDatabaseParameterListener*)this); removeModelListeners(getControlModel()); @@ -1276,23 +1224,18 @@ void SbaXDataBrowserController::disposing() if(m_aInvalidateClipboard.IsActive()) m_aInvalidateClipboard.Stop(); - // dispose the data source - // if there is a pending load we decided to give the responsibility for the data source to the open thread - // (see ::suspend) - if (!PendingLoad()) + // dispose the row set + try { - try - { - ::comphelper::disposeComponent(m_xRowSet); + ::comphelper::disposeComponent(m_xRowSet); - m_xRowSet = NULL; - m_xColumnsSupplier = NULL; - m_xLoadable = NULL; - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception thrown by dispose"); - } + m_xRowSet = NULL; + m_xColumnsSupplier = NULL; + m_xLoadable = NULL; + } + catch(Exception&) + { + OSL_ENSURE(0,"Exception thrown by dispose"); } try { @@ -1507,9 +1450,6 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const aReturn.bEnabled = m_xParser->getFilter().getLength() || m_xParser->getHavingClause().getLength() || m_xParser->getOrder().getLength(); return aReturn; } - // no chance while loading the form - if (PendingLoad()) - return aReturn; // no chance without valid models if (isValid() && !isValidCursor()) return aReturn; @@ -2510,45 +2450,6 @@ IMPL_LINK(SbaXDataBrowserController, OnCanceledNotFound, FmFoundRecordInformatio return 0L; } -//------------------------------------------------------------------------------ -IMPL_LINK(SbaXDataBrowserController, OnOpenFinishedMainThread, void*, EMPTYARG) -{ - ::vos::OGuard aGuard(Application::GetSolarMutex()); - if (!m_nPendingLoadFinished) - // it's possible that the direct call of this link from within suspend caused this method to be executed - // in another thread while we were waiting for the mutex in this thread - return 0; - m_nPendingLoadFinished = 0; - - if ( static_cast< LoadFormThread* >( m_pLoadThread )->WasCanceled() ) - setLoadingCancelled(); - - delete m_pLoadThread; - m_pLoadThread = NULL; - - LoadFinished(sal_False); - - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(SbaXDataBrowserController, OnOpenFinished, void*, EMPTYARG) -{ - ::osl::MutexGuard aCheckGuard(m_aAsyncLoadSafety); - - if (m_bClosingKillOpen) - { - delete m_pLoadThread; - m_pLoadThread = NULL; - } - else - // all cleaning has to run in the main thread, not here (this is called synchronously from the LoadThread) - // so we use an user event - m_nPendingLoadFinished = Application::PostUserEvent(LINK(this, SbaXDataBrowserController, OnOpenFinishedMainThread)); - - return 0L; -} - //------------------------------------------------------------------------------ IMPL_LINK(SbaXDataBrowserController, OnAsyncGetCellFocus, void*, EMPTYARG) { @@ -2905,171 +2806,6 @@ bool LoadFormHelper::WaitUntilReallyLoaded(bool _bOnlyIfLoaded) return true; } -//================================================================== -// LoadFormThread - a thread for asynchronously loading a form -//================================================================== -//------------------------------------------------------------------------------ -void LoadFormThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - m_bCanceled = sal_False; - aResetGuard.clear(); - - LoadFormHelper* pHelper = new LoadFormHelper(m_xRowSet); - pHelper->acquire(); - - // start it - bool bErrorOccured = false; - Reference< XLoadable > xLoadable(m_xRowSet, UNO_QUERY); - try - { - Reference< XRowSet > xMove(m_xRowSet, UNO_QUERY); - DBG_ASSERT(xLoadable.is() && xMove.is(), "LoadFormThread::run : invalid cursor !"); - xLoadable->load(); - // go to the first record if the load was successfull. - Reference< XColumnsSupplier > xColumnsSupplier(m_xRowSet, UNO_QUERY); - Reference< ::com::sun::star::container::XNameAccess > xCols = xColumnsSupplier.is() ? xColumnsSupplier->getColumns() : Reference< ::com::sun::star::container::XNameAccess > (); - if (xCols.is() && xCols->hasElements()) - xMove->first(); - else - bErrorOccured = true; - } - catch(Exception&) - { - bErrorOccured = true; - } - - // check if we were canceled - ::osl::ClearableMutexGuard aTestGuard(m_aAccessSafety); - bool bReallyCanceled = m_bCanceled ? true : false;; - aTestGuard.clear(); - - bReallyCanceled |= bErrorOccured; - - // the load on the form is "slightly asyncronous" (which isn't covered by it's specification, anyway), so wait - // some time .... - // (though me thinks that the load of the new api is synchronous, so we won't need this LoadFormHelper anymore ...) - if (!bReallyCanceled) - pHelper->WaitUntilReallyLoaded(true); - - pHelper->cancel(); - pHelper->release(); - - // yes, we were, but eventually the cancel request didn't reach the data source in time - if (bReallyCanceled && xLoadable.is() && xLoadable->isLoaded()) - xLoadable->unload(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to take care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void LoadFormThread::onTerminated() -{ - ::osl::ClearableMutexGuard aGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - { - // within the call of our termination handler we may be deleted, so do anything which is a member - // access before the call ... - // FS - #69801# - 02.12.99 - Link aHandler(m_aTerminationHandler); - aGuard.clear(); - aHandler.Call(this); - } - else - { - // we are fully responsible for the data source and for ourself, so dispose the former ... - try - { - ::comphelper::disposeComponent(m_xRowSet); - - m_xRowSet = NULL; - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception thrown by dispose"); - } - // ... and delete the latter - aGuard.clear(); // like above - releasing the mutex is a member access ... - delete this; - } -} - -//------------------------------------------------------------------------------ -void LoadFormThread::StopIt() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - m_bCanceled = sal_True; - aResetGuard.clear(); - - Reference< XColumnsSupplier > xColumnsSupplier(m_xRowSet, UNO_QUERY); - if (!xColumnsSupplier.is()) - { - DBG_ERROR("LoadFormThread::StopIt : invalid data source !"); - return; - } - Reference< ::com::sun::star::container::XNameAccess > xCols(xColumnsSupplier->getColumns(), UNO_QUERY); - if (!xCols.is() || !xCols->hasElements()) - // the cursor isn't alive, don't need to cancel - return; - - Reference< ::com::sun::star::util::XCancellable > xCancel(m_xRowSet, UNO_QUERY); - if (xCancel.is()) - { - try { xCancel->cancel(); } catch(SQLException&) {} - // with this the cursor returns from it's load call, this terminates our run, this get's our termination handler to - // be called - // (the try-catch is just in case the cancel wasn't neccessary anymore) - } -} - -//------------------------------------------------------------------------------ -LoadFormThread::ThreadStopper::ThreadStopper(LoadFormThread* pOwner, const String& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void LoadFormThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void LoadFormThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, LoadFormThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(LoadFormThread::ThreadStopper, OnDeleteInMainThread, LoadFormThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} // ----------------------------------------------------------------------------- sal_Int16 SbaXDataBrowserController::getCurrentColumnPosition() { diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index aad25f1cd7ab..eecb974ba959 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1659,10 +1659,6 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const if (isValid() && !isValidCursor() && nId != ID_BROWSER_CLOSE) return aReturn; - // no chance while loading the form - if (PendingLoad()) - return aReturn; - switch (nId) { case ID_BROWSER_INSERTCOLUMNS: diff --git a/dbaccess/source/ui/inc/brwctrlr.hxx b/dbaccess/source/ui/inc/brwctrlr.hxx index 1e796fbed624..128b20178e8a 100644 --- a/dbaccess/source/ui/inc/brwctrlr.hxx +++ b/dbaccess/source/ui/inc/brwctrlr.hxx @@ -56,7 +56,6 @@ #include #include #include -#include #include #include @@ -122,7 +121,6 @@ namespace dbaui ::rtl::OUString m_sModuleIdentifier; // members for asynchronous load operations - ::vos::OThread* m_pLoadThread; // the thread wherein the form is loaded FormControllerImpl* m_pFormControllerImpl; // implementing the XFormController ULONG m_nPendingLoadFinished; // the event used to tell ourself that the load is finished @@ -319,9 +317,6 @@ namespace dbaui // a PropertySet corresponding to the cursor field a column is bound to // if nViewPos is (sal_uInt16)-1 (the default) then the field for the current column will be retrieved - sal_Bool PendingLoad() const { return m_pLoadThread != NULL; } - // is there an asyncronous load operation in progress ? - void enterFormAction(); void leaveFormAction(); @@ -362,74 +357,10 @@ namespace dbaui DECL_LINK(OnFoundData, FmFoundRecordInformation*); DECL_LINK(OnCanceledNotFound, FmFoundRecordInformation*); - // callbacks for the completed loading process - DECL_LINK(OnOpenFinished, void*); - DECL_LINK(OnOpenFinishedMainThread, void*); - // OnOpenFinsihed is called in a foreign thread (the one which does the loading) so it simply posts the - // OnOpenFinishedMainThread-link (which will be called in the main thread, then) as user event. - // (the alternative would be to lock the SolarMutex in OnOpenFinished to avoid problems with the needed updates, - // but playing with this mutex seems very hazardous to me ....) DECL_LINK(OnAsyncGetCellFocus, void*); DECL_LINK( OnAsyncDisplayError, void* ); }; - - //================================================================== - // LoadFormThread - a thread for asynchronously loading a form - //================================================================== - class LoadFormThread : public ::vos::OThread - { - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; // the data source to be loaded - - Link m_aTerminationHandler; // the handler to be called upon termination - sal_Bool m_bCanceled; // StopIt has been called ? - String m_sStopperCaption; // the caption for the ThreadStopper - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - LoadFormThread* m_pOwner; - - public: - ThreadStopper(LoadFormThread* pOwner, const String& rTitle); - virtual ~ThreadStopper() { } - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a LoadFormThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have to make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class LoadFormThread::ThreadStopper; - - public: - LoadFormThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > & _xRowSet, const String& _rStopperCaption) : m_xRowSet(_xRowSet), m_sStopperCaption(_rStopperCaption) { } - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - void SetTerminationHdl(const Link& aTermHdl) { m_aTerminationHandler = aTermHdl; } - // the handler will be called synchronously (the parameter is a pointer to the thread) - // if no termination handler is set, the thread disposes the data source and deletes - // itself upon termination - - // cancels the process. to be called from another thread (of course ;) - void StopIt(); - - // ask if the load canceled - sal_Bool WasCanceled() const { return m_bCanceled; } - }; } #endif // _SBA_BWRCTRLR_HXX -- cgit v1.2.3 From 61addfefa431d7c5fd8a445c08bd5b1bf122161b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:32:25 +0100 Subject: [CWS autorecovery] removed the dead code for moving to the last record in a separate thread Part of the code relied in the SfxCancellable, which is going to be removed. Also, this feature wasn't used anymore for a long time now, if we want to have it, again, we should better re-implement it. --- svx/source/form/fmshell.cxx | 12 +- svx/source/form/fmshimp.cxx | 472 ------------------------------------------- svx/source/form/fmstring.src | 4 - svx/source/inc/fmresids.hrc | 2 +- svx/source/inc/fmshimp.hxx | 167 --------------- 5 files changed, 3 insertions(+), 654 deletions(-) diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index ccdfb2b1af39..aba2702c4ddf 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -301,9 +301,6 @@ sal_uInt16 FmFormShell::PrepareClose(sal_Bool bUI, sal_Bool bForBrowsing) m_pFormView && m_pFormView->GetActualOutDev() && m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW) { - if (GetImpl()->HasAnyPendingCursorAction()) - GetImpl()->CancelAnyPendingCursorAction(); - SdrPageView* pCurPageView = m_pFormView->GetSdrPageView(); // sal_uInt16 nPos = pCurPageView ? pCurPageView->GetWinList().Find((OutputDevice*)m_pFormView->GetActualOutDev()) : SDRPAGEVIEWWIN_NOTFOUND; @@ -1126,8 +1123,8 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && (SID_FM_RECORD_TOTAL != nWhich) + || ( /*GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) + && */(SID_FM_RECORD_TOTAL != nWhich) ) ) rSet.DisableItem(nWhich); @@ -1415,11 +1412,6 @@ void FmFormShell::SetDesignMode( sal_Bool _bDesignMode ) if ( _bDesignMode == m_bDesignMode ) return; - // if we are moving our data source cursor currently .... - if ( GetImpl()->HasAnyPendingCursorAction() ) - // ... cancel this - GetImpl()->CancelAnyPendingCursorAction(); - FmFormModel* pModel = GetFormModel(); if (pModel) // fuer die Zeit des Uebergangs das Undo-Environment ausschalten, das sichert, dass man dort auch nicht-transiente diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index e4d656a06f28..06bd3cd128f4 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -408,11 +408,6 @@ sal_Bool FmXBoundFormFieldIterator::ShouldHandleElement(const Reference< XInterf return aVal.hasValue(); } -//============================================================================== - -DECL_CURSOR_ACTION_THREAD(FmMoveToLastThread) -IMPL_CURSOR_ACTION_THREAD(FmMoveToLastThread, SVX_RES(RID_STR_MOVING_CURSOR), last()); - //------------------------------------------------------------------------------ sal_Bool isControlList(const SdrMarkList& rMarkList) { @@ -834,8 +829,6 @@ void FmXFormShell::disposing() { ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); - if (HasAnyPendingCursorAction()) - CancelAnyPendingCursorAction(); aGuard.clear(); DBG_ASSERT(!m_nInvalidationEvent, "FmXFormShell::~FmXFormShell : still have an invalidation event !"); @@ -1828,10 +1821,6 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont if (xController != m_xActiveController) { - // if there is a async cursor action running we have to restore the locking state of the controls of the old controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - restoreControlLocks(); - ::osl::ClearableMutexGuard aGuard(m_aAsyncSafety); // switch all nav dispatchers belonging to the form of the current nav controller to 'non active' Reference< XResultSet> xNavigationForm; @@ -1911,10 +1900,6 @@ void FmXFormShell::setActiveController( const Reference< XFormController>& xCont if (m_xNavigationController.is()) xNavigationForm = Reference< XResultSet>(m_xNavigationController->getModel(), UNO_QUERY); - // if there is a async cursor action running we have to lock the controls of the new controller - if (HasPendingCursorAction(Reference< XResultSet>(m_xActiveForm, UNO_QUERY))) - setControlLocks(); - m_bInActivate = sal_False; m_pShell->UIFeatureChanged(); @@ -3150,312 +3135,6 @@ void FmXFormShell::clearFilter() } } -//------------------------------------------------------------------------------ -void FmXFormShell::setControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::setControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - DBG_ASSERT( m_aControlLocks.empty(), "FmXFormShell::setControlLocks: locking state array isn't empty (called me twice ?)!" ); - - Sequence< Reference< XControl> > aControls = xControls->getControls(); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, remember the old locking state, set the lock - for (sal_Int32 i=0; i xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; jgetCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } - } - continue; - } - - m_aControlLocks.push_back( xCtrl->getLock() ); - xCtrl->setLock(sal_True); - } -} - -//------------------------------------------------------------------------------ -void FmXFormShell::restoreControlLocks() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::restoreControlLocks" ); - if ( impl_checkDisposed() ) - return; - - Reference< XTabController> xCtrler(getActiveController(), UNO_QUERY); - if (!xCtrler.is()) - return; - - Reference< XControlContainer> xControls(xCtrler->getContainer(), UNO_QUERY); - if (!xControls.is()) - return; - - Sequence< Reference< XControl> > aControls(xControls->getControls()); - const Reference< XControl>* pControls = aControls.getConstArray(); - - // iterate through all bound controls, restore the old locking state - size_t nBoundControl = 0; - for (sal_Int32 i=0; i xCtrl(pControls[i], UNO_QUERY); - if (!xCtrl.is()) - { - // it may be a container of controls - Reference< XIndexAccess> xContainer(pControls[i], UNO_QUERY); - if (xContainer.is()) - { // no recursion. we only know top level control containers (e.g. grid controls) - for (sal_Int16 j=0; jgetCount(); ++j) - { - xContainer->getByIndex(j) >>= xCtrl; - if (!xCtrl.is()) - continue; - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - } - continue; - } - - DBG_ASSERT( nBoundControl < m_aControlLocks.size(), "FmXFormShell::restoreControlLocks: m_aControlLocks is invalid!" ); - // a violation of this condition would mean a) setControlLocks hasn't been called or b) the ControlContainer - // has changed since the last call to setControlLocks. - // a) clearly is a fault of the programmer and b) shouldn't be possible (as we are in alive mode) - xCtrl->setLock( m_aControlLocks[ nBoundControl ] ); - ++nBoundControl; - } - ::std::vector< sal_Bool > aEmpty; - m_aControlLocks.swap( aEmpty ); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XFormController>& _xController, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - DBG_ASSERT(_xController.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - DoAsyncCursorAction(Reference< XResultSet>(_xController->getModel(), UNO_QUERY), _eWhat); -} - -//------------------------------------------------------------------------------ -void FmXFormShell::DoAsyncCursorAction(const Reference< XResultSet>& _xForm, CURSOR_ACTION _eWhat) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::DoAsyncCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - DBG_ASSERT(_xForm.is(), "FmXFormShell::DoAsyncCursorAction : invalid argument !"); - - // build the access path for the form - if (HasPendingCursorAction(_xForm)) - { - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : invalid call !"); - return; - } - - CursorActionDescription& rDesc = m_aCursorActions[ _xForm ]; - // [] will create a new one if non-existent - DBG_ASSERT(rDesc.pThread == NULL, "FmXFormShell::DoAsyncCursorAction : the cursor action thread for this form is still alive !"); - - Reference< XResultSet > xCursor( getInternalForm( _xForm ), UNO_QUERY ); - switch (_eWhat) - { - case CA_MOVE_TO_LAST : - rDesc.pThread = new FmMoveToLastThread( xCursor ); - break; - case CA_MOVE_ABSOLUTE: - DBG_ERROR("FmXFormShell::DoAsyncCursorAction : CA_MOVE_ABSOLUTE not supported yet !"); - return; - } - rDesc.pThread->SetTerminationHdl(LINK(this, FmXFormShell, OnCursorActionDone)); - rDesc.pThread->EnableSelfDelete(sal_False); - - rDesc.bCanceling = sal_False; - - // set the control locks before starting the thread - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - if (getInternalForm(_xForm) == m_xActiveForm) - setControlLocks(); - - // go ... - rDesc.pThread->create(); - - // set a priority slightly below normal - rDesc.pThread->setPriority(::vos::OThread::TPriority_BelowNormal); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XResultSet>& _xForm) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!_xForm.is()) - return sal_False; - - // TODO: if we ever re-implement the asynchronous cursor actions, then this will happen - // in the controller, and not in the form. In such a case, we here probably need to check - // whether the controller for the form has this "pending cursor action" - - return sal_False; -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasPendingCursorAction(const Reference< XFormController>& xController) const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasPendingCursorAction" ); - if ( impl_checkDisposed() ) - return sal_False; - - if (!xController.is()) - return sal_False; - - return HasPendingCursorAction(Reference< XResultSet>(xController->getModel(), UNO_QUERY)); -} - -//------------------------------------------------------------------------------ -sal_Bool FmXFormShell::HasAnyPendingCursorAction() const -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::HasAnyPendingCursorAction" ); - ::osl::MutexGuard aGuard( const_cast< FmXFormShell* >( this )->m_aAsyncSafety ); - - for ( CursorActions::const_iterator aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter ) - { - if (((*aIter).second.pThread != NULL) || ((*aIter).second.nFinishedEvent != 0)) - return sal_True; - } - return sal_False; -} - -//------------------------------------------------------------------------------ -void FmXFormShell::CancelAnyPendingCursorAction() -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmXFormShell::CancelAnyPendingCursorAction" ); - if ( impl_checkDisposed() ) - return; - - ::osl::ResettableMutexGuard aGuard( m_aAsyncSafety ); - - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if (!(*aIter).second.nFinishedEvent && (*aIter).second.pThread) - { // the thread is really running - (*aIter).second.bCanceling = sal_True; - - aGuard.clear(); - (*aIter).second.pThread->StopItWait(); - // StopItWait returns after the termination handler (our OnCursorActionDone) has been called - aGuard.reset(); - } - } - - // all threads are finished (means canceled), now do the cleanup - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread) - { - LINK(this, FmXFormShell, OnCursorActionDoneMainThread).Call((*aIter).second.pThread); - DBG_ASSERT((*aIter).second.pThread == NULL, "FmXFormShell::CancelAnyPendingCursorAction : strange behaviour of OnCursorActionDoneMainThread !"); - } - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDone, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter; - for (aIter = m_aCursorActions.begin(); aIter != m_aCursorActions.end(); ++aIter) - { - if ((*aIter).second.pThread == pThread) - break; - } - - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDone : could not ::std::find the thread !"); - DBG_ASSERT((*aIter).second.nFinishedEvent == 0, "FmXFormShell::OnCursorActionDone : another 'ActionDone' for this thread is pending !"); - // as we allow only one async action at a time (per form) this shouldn't happen - - if (!(*aIter).second.bCanceling) - (*aIter).second.nFinishedEvent = Application::PostUserEvent(LINK(this, FmXFormShell, OnCursorActionDoneMainThread), pThread); - // if bCanceling is sal_True an other thread's execution is in CancelAnyPendingCursorAction - return 0L; -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmXFormShell, OnCursorActionDoneMainThread, FmCursorActionThread*, pThread) -{ - if ( impl_checkDisposed() ) - return 0L; - - ::osl::MutexGuard aGuard(m_aAsyncSafety); - - // search the pos of the thread within m_aCursorActions - CursorActions::iterator aIter = m_aCursorActions.find( pThread->getDataSource() ); - DBG_ASSERT(aIter != m_aCursorActions.end(), "FmXFormShell::OnCursorActionDoneMainThread : could not ::std::find the thread data !"); - DBG_ASSERT((*aIter).second.pThread == pThread, "FmXFormShell::OnCursorActionDoneMainThread : invalid thread data !"); - - // remember some thread parameters - Reference< XResultSet> xForm(pThread->getDataSource(), UNO_QUERY); - - // throw away the thread - delete (*aIter).second.pThread; - (*aIter).second.pThread = NULL; - (*aIter).second.nFinishedEvent = 0; - (*aIter).second.bCanceling = sal_False; - // as we allow exactly one thread per form we may remove this ones data from m_aCursorActions - m_aCursorActions.erase(aIter); - - DBG_ASSERT(getInternalForm(m_xActiveForm) == m_xActiveForm, "FmXFormShell::DoAsyncCursorAction : the active form should always be a internal one !"); - DBG_ASSERT(getInternalForm(xForm) == xForm, "FmXFormShell::DoAsyncCursorAction : the thread's form should always be a internal one !"); - // if one of the two asserts above fails the upcoming comparison is senseless - if (xForm == m_xActiveForm) - { - // the active controller belongs to the form where the action is finished - // -> re-enable the controls if they are not locked because of another running thread - if (!HasPendingCursorAction(xForm)) - restoreControlLocks(); - } - - m_pShell->GetViewShell()->GetViewFrame()->GetBindings().Invalidate(DatabaseSlotMap); - // it may not be neccessary but me thinks it's faster without the check if we really have to do this - - return 0L; -} - //------------------------------------------------------------------------------ void FmXFormShell::CreateExternalView() { @@ -4419,155 +4098,4 @@ void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState } } -//================================================================== - -FmCursorActionThread::FmCursorActionThread(const Reference< XResultSet>& _xDataSource, const UniString& _rStopperCaption) - :m_xDataSource(_xDataSource) - ,m_sStopperCaption(_rStopperCaption) - ,m_bCanceled(sal_False) - ,m_bDeleteMyself(sal_False) - ,m_bDisposeCursor(sal_False) - ,m_bTerminated(sal_False) - ,m_bRunFailed(sal_False) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmCursorActionThread::FmCursorActionThread" ); - DBG_ASSERT(m_xDataSource.is() && Reference< XCancellable>(m_xDataSource, UNO_QUERY).is(), - "FmCursorActionThread::FmCursorActionThread : invalid cursor !"); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::run() -{ - // On instantiation of a SfxCancellable the application is notified and 'switches on' the red stop button. - // Unfortunally this is conditioned with the acquirement of the solar mutex, and the application tries - // only once and ignores the notification if it fails. - // To prevent that we get the solar mutex and _block_ 'til we got it. - // As we are in the 'top level execution' of this thread (with a rather small stack and no other mutexes locked) - // we shouldn't experience problems with deadlocks ... - ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex()); - ThreadStopper* pStopper = new ThreadStopper(this, m_sStopperCaption); - aSolarGuard.clear(); - - // we're not canceled yet - ::osl::ClearableMutexGuard aInitGuard(m_aAccessSafety); - m_bCanceled = sal_False; - m_bRunFailed = sal_False; - aInitGuard.clear(); - - // start it - try - { - RunImpl(); - } - catch(SQLException e) - { - ::osl::MutexGuard aErrorGuard(m_aAccessSafety); - m_bRunFailed = sal_True; - m_aRunException = e; - } - catch(Exception&) - { - DBG_ERROR("FmCursorActionThread::run : catched a non-database exception !"); - } - - - sal_Bool bReallyCanceled; - ::osl::ClearableMutexGuard aEvalGuard(m_aAccessSafety); - bReallyCanceled = m_bCanceled; - aEvalGuard.clear(); - - pStopper->OwnerTerminated(); - // this will cause the stopper to delete itself (in the main thread) so we don't have to care of the - // solar mutex -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::onTerminated() -{ - ::osl::ClearableMutexGuard aResetGuard(m_aAccessSafety); - if (m_aTerminationHandler.IsSet()) - m_aTerminationHandler.Call(this); - - if (IsCursorDisposeEnabled()) - { - Reference< ::com::sun::star::lang::XComponent> xDataSourceComponent(m_xDataSource, UNO_QUERY); - if (xDataSourceComponent.is()) - xDataSourceComponent->dispose(); - } - - aResetGuard.clear(); - // with this StopItWait has a chance to do it's Terminated() - - ::osl::MutexGuard aGuard(m_aFinalExitControl); - // Terminated() in StopItWait still returns sal_False - m_bTerminated = sal_True; - // Terminated() now returns sal_True, but StopItWait can't exit until this method exits (because of the guarded m_aFinalExitControl) - - if (IsSelfDeleteEnabled()) - delete this; -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopIt() -{ - ::osl::MutexGuard aGuard(m_aAccessSafety); - m_bCanceled = sal_True; - - Reference< XCancellable> xCancel(m_xDataSource, UNO_QUERY); - DBG_ASSERT(xCancel.is(), "FmCursorActionThread::StopIt : invalid cursor !"); - xCancel->cancel(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::StopItWait() -{ - StopIt(); - - while (!Terminated()) - ; - - // OnTerminated has been called, but we can't simply exit : Suppose the caller want's to delete the thread object - // immediately after returning from StopItWait. With the following guard we ensure that we exit this method - // only after onTerminated has exited. - ::osl::ClearableMutexGuard aGuard(m_aFinalExitControl); - - // now onTerminated has exited, so we can leave, too -} - -//------------------------------------------------------------------------------ -FmCursorActionThread::ThreadStopper::ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle) - :SfxCancellable(SFX_APP()->GetCancelManager(), rTitle) - ,m_pOwner(pOwner) -{ -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::Cancel() -{ - if (!m_pOwner) // the owner is already terminated and we're waiting for the OnDeleteInMainThread event - return; - - ::osl::MutexGuard aGuard(m_pOwner->m_aAccessSafety); - if (IsCancelled()) - // we already did pass this to our owner - return; - - SfxCancellable::Cancel(); - m_pOwner->StopIt(); -} - -//------------------------------------------------------------------------------ -void FmCursorActionThread::ThreadStopper::OwnerTerminated() -{ - m_pOwner = NULL; - Application::PostUserEvent(LINK(this, FmCursorActionThread::ThreadStopper, OnDeleteInMainThread), this); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(FmCursorActionThread::ThreadStopper, OnDeleteInMainThread, FmCursorActionThread::ThreadStopper*, pThis) -{ - delete pThis; - return 0L; -} - //============================================================================== diff --git a/svx/source/form/fmstring.src b/svx/source/form/fmstring.src index 8b42ccadc6a6..02beaf2397be 100644 --- a/svx/source/form/fmstring.src +++ b/svx/source/form/fmstring.src @@ -217,10 +217,6 @@ String RID_STR_PROPTITLE_FORMATTED { Text [ en-US ] = "Formatted Field"; }; -String RID_STR_MOVING_CURSOR -{ - Text [ en-US ] = "align data source"; -}; String RID_STR_PROPTITLE_LISTBOX { Text [ en-US ] = "List Box"; diff --git a/svx/source/inc/fmresids.hrc b/svx/source/inc/fmresids.hrc index 95a478fc5aee..37b936ef0ee2 100644 --- a/svx/source/inc/fmresids.hrc +++ b/svx/source/inc/fmresids.hrc @@ -196,7 +196,7 @@ #define RID_STR_FILTER_FILTER_OR (RID_FORMS_START + 80) #define RID_STR_PROPTITLE_FORMATTED (RID_FORMS_START + 81) #define RID_STR_SYNTAXERROR (RID_FORMS_START + 82) -#define RID_STR_MOVING_CURSOR (RID_FORMS_START + 83) + // FREE #define RID_STR_NOCONTROLS_FOR_EXTERNALDISPLAY (RID_FORMS_START + 84) #define RID_STR_SEARCH_ANYWHERE (RID_FORMS_START + 85) #define RID_STR_SEARCH_BEGINNING (RID_FORMS_START + 86) diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 85644ea5daba..4932f3b8f850 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -71,7 +71,6 @@ #include "fmsrccfg.hxx" #include #include -#include #include #include #include @@ -122,21 +121,6 @@ protected: virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const; }; -//======================================================================== -// I would prefer this to be a struct local to FmXFormShell but unfortunately local structs/classes -// are somewhat difficult with some of our compilers -class FmCursorActionThread; -struct SAL_DLLPRIVATE CursorActionDescription -{ - FmCursorActionThread* pThread; - ULONG nFinishedEvent; - // we want to do the cleanup of the thread in the main thread so we post an event to ourself - sal_Bool bCanceling; - // this thread is being canceled - - CursorActionDescription() : pThread(NULL), nFinishedEvent(0), bCanceling(sal_False) { } -}; - class FmFormPage; //======================================================================== struct SAL_DLLPRIVATE FmLoadAction @@ -205,18 +189,6 @@ class SAL_DLLPRIVATE FmXFormShell :public FmXFormShell_BASE // we explicitly switch off the propbrw before leaving the design mode // this flag tells us if we have to switch it on again when reentering - typedef ::std::map< - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >, - CursorActionDescription, - ::comphelper::OInterfaceCompare< ::com::sun::star::sdbc::XResultSet > - > CursorActions; - CursorActions m_aCursorActions; - // all actions on async cursors - - ::std::vector< sal_Bool > - m_aControlLocks; - // while doing a async cursor action we have to lock all controls of the active controller. - // m_aControlLocks remembers the previous lock states to be restored afterwards. ::osl::Mutex m_aAsyncSafety; // secure the access to our thread related members ::osl::Mutex m_aInvalidationSafety; @@ -563,20 +535,7 @@ private: // --------------------------------------------------- // asyncronous cursor actions/navigation slot handling - void setControlLocks(); // lock all controls of the active controller - void restoreControlLocks(); // restore the lock state of all controls of the active controller - public: - enum CURSOR_ACTION { CA_MOVE_TO_LAST, CA_MOVE_ABSOLUTE }; - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController, CURSOR_ACTION _eWhat); - void DoAsyncCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm, CURSOR_ACTION _eWhat); - - sal_Bool HasAnyPendingCursorAction() const; - void CancelAnyPendingCursorAction(); - - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController>& _xController) const; - sal_Bool HasPendingCursorAction(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const; - /** execute the given form slot

Warning. Only a small set of slots implemented currently.

@param _nSlot @@ -589,9 +548,6 @@ public: bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL ); protected: - DECL_LINK(OnCursorActionDone, FmCursorActionThread*); - DECL_LINK(OnCursorActionDoneMainThread, FmCursorActionThread*); - DECL_LINK( OnLoadForms, FmFormPage* ); }; @@ -646,127 +602,4 @@ public: SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState); }; -//================================================================== -// FmCursorActionThread -//================================================================== - -class SAL_DLLPRIVATE FmCursorActionThread : public ::vos::OThread -{ - Link m_aTerminationHandler; // the handler to be called upon termination - ::com::sun::star::sdbc::SQLException m_aRunException; // the database exception thrown by RunImpl - ::osl::Mutex m_aAccessSafety; // for securing the multi-thread access - ::osl::Mutex m_aFinalExitControl; // see StopItWait - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDataSource; // the cursor which we work with - -private: - - UniString m_sStopperCaption; // the caption for the ThreadStopper - sal_Bool m_bCanceled:1; // StopIt has been called ? - sal_Bool m_bDeleteMyself:1; // delete the thread upon termination (defaults to sal_False) ? - sal_Bool m_bDisposeCursor:1; // dispose the cursor upon termination (defaults to sal_False) ? - sal_Bool m_bTerminated:1; // onTerminated already called ? - sal_Bool m_bRunFailed:1; // a database execption occured in RunImpl ? - - // a ThreadStopper will be instantiated so that the open can be canceled via the UI - class ThreadStopper : protected SfxCancellable - { - FmCursorActionThread* m_pOwner; - - virtual ~ThreadStopper() { } - - public: - ThreadStopper(FmCursorActionThread* pOwner, const UniString& rTitle); - - virtual void Cancel(); - - virtual void OwnerTerminated(); - // Normally the Owner (a FmCursorActionThread) would delete the stopper when terminated. - // Unfortunally the application doesn't remove the 'red light' when a SfxCancellable is deleted - // if it (the app) can't acquire the solar mutex. The deletion is IGNORED then. So we have make - // sure that a) the stopper is deleted from inside the main thread (where the solar mutex is locked) - // and b) that in the time between the termination of the thread and the deletion of the stopper - // the latter doesn't access the former. - // The OwnerTerminated cares for both aspects. - // SO DON'T DELETE THE STOPPER EXPLICITLY ! - - protected: - // HACK HACK HACK HACK HACK : this should be private, but MSVC doesn't accept the LINK-macro then .... - DECL_LINK(OnDeleteInMainThread, ThreadStopper*); - }; - friend class FmCursorActionThread::ThreadStopper; - - -public: - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getDataSource() const { return m_xDataSource; } - -private: - sal_Bool Terminated() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bTerminated; } - -public: - FmCursorActionThread(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource, const UniString& _rStopperCaption); - virtual ~FmCursorActionThread() {} - - // control of self-deletion - sal_Bool IsSelfDeleteEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDeleteMyself; } - void EnableSelfDelete(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDeleteMyself = bEnable; } - - // control of cursor-dipose - sal_Bool IsCursorDisposeEnabled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bDisposeCursor; } - void EnableCursorDispose(sal_Bool bEnable) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_bDisposeCursor = bEnable; } - - // error-access - sal_Bool RunFailed() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bRunFailed; } - ::com::sun::star::sdbc::SQLException GetRunException() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_aRunException; } - - /// the excution (within the method "run") was canceled ? - sal_Bool WasCanceled() { ::osl::MutexGuard aGuard(m_aAccessSafety); return m_bCanceled; } - - /// the handler will be called synchronously (the parameter is a pointer to the thread) - void SetTerminationHdl(const Link& aTermHdl) { ::osl::MutexGuard aGuard(m_aAccessSafety); m_aTerminationHandler = aTermHdl; } - - /// cancels the process. returns to the caller immediately. to be called from another thread (of course ;) - void StopIt(); - - /// cancels the process. does not return to the caller until the thread is terminated. - void StopItWait(); - -protected: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - /// called from within run. run itself handles (de)initialisation of the cancel handling. - virtual void RunImpl() = 0; -}; - -//------------------------------------------------------------------------------ - -#define DECL_CURSOR_ACTION_THREAD(classname) \ - \ -class SAL_DLLPRIVATE classname : public FmCursorActionThread \ -{ \ -public: \ - classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource); \ -protected: \ - virtual void RunImpl(); \ -}; \ - - -//------------------------------------------------------------------------------ - -#define IMPL_CURSOR_ACTION_THREAD(classname, caption, action) \ - \ -classname::classname(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDataSource) \ - :FmCursorActionThread(_xDataSource, caption) \ -{ \ -} \ - \ -void classname::RunImpl() \ -{ \ - m_xDataSource->action; \ -} \ - - - #endif // _SVX_FMSHIMP_HXX -- cgit v1.2.3 From f2d25eab84b2ddf644ca1ec53e3ae492766c75f2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:38:46 +0100 Subject: [CWS autorecovery] removed SfxCancellable/SfxCancelManager, and (part of) its transitive closure No real-life use cases for this exist anymore, since nowadays document loading happens synchronously all the time. --- svtools/inc/svtools/cancel.hxx | 145 -------------------------- svtools/source/control/inettbc.cxx | 1 - svtools/source/notify/cancel.cxx | 204 ------------------------------------- svtools/source/notify/makefile.mk | 1 - 4 files changed, 351 deletions(-) delete mode 100644 svtools/inc/svtools/cancel.hxx delete mode 100644 svtools/source/notify/cancel.cxx diff --git a/svtools/inc/svtools/cancel.hxx b/svtools/inc/svtools/cancel.hxx deleted file mode 100644 index 5929fc4db47a..000000000000 --- a/svtools/inc/svtools/cancel.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: cancel.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFXCANCEL_HXX -#define _SFXCANCEL_HXX - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -class SfxCancellable; - -#ifdef _SFX_CANCEL_CXX -#include - -SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 ) - -#else - -typedef SvPtrarr SfxCancellables_Impl; - -#endif - -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxCancelManager: public SfxBroadcaster -, public SvWeakBase - -/* [Beschreibung] - - An Instanzen dieser Klasse k"onnen nebenl"aufige Prozesse angemeldet - werden, um vom Benutzer abbrechbar zu sein. Werden abbrechbare - Prozesse (Instanzen von ) an- oder abgemeldet, wird - dies durch einen mit dem Flag SFX_HINT_CANCELLABLE - gebroadcastet. - - SfxCancelManager k"onnen hierarchisch angeordnet werden, so k"onnen - z.B. Dokument-lokale Prozesse getrennt gecancelt werden. - - [Beispiel] - - SfxCancelManager *pMgr = new SfxCancelManager; - StartListening( pMgr ); - pMailSystem->SetCancelManager( pMgr ) -*/ - -{ - SfxCancelManager* _pParent; - SfxCancellables_Impl _aJobs; - -public: - SfxCancelManager( SfxCancelManager *pParent = 0 ); - ~SfxCancelManager(); - - BOOL CanCancel() const; - void Cancel( BOOL bDeep ); - SfxCancelManager* GetParent() const { return _pParent; } - - void InsertCancellable( SfxCancellable *pJob ); - void RemoveCancellable( SfxCancellable *pJob ); - USHORT GetCancellableCount() const - { return _aJobs.Count(); } - SfxCancellable* GetCancellable( USHORT nPos ) const - { return (SfxCancellable*) _aJobs[nPos]; } -}; - -SV_DECL_WEAK( SfxCancelManager ) -//------------------------------------------------------------------------- - -class SVL_DLLPUBLIC SfxCancellable - -/* [Beschreibung] - - Instanzen dieser Klasse werden immer an einem Cancel-Manager angemeldet, - der dadurch dem Benutzer signalisieren kann, ob abbrechbare Prozesse - vorhanden sind und der die SfxCancellable-Instanzen auf 'abgebrochen' - setzen kann. - - Die im Ctor "ubergebene -Instanz mu\s die Instanz - dieser Klasse "uberleben! - - [Beispiel] - - { - SfxCancellable aCancel( pCancelMgr ); - while ( !aCancel && GetData() ) - Reschedule(); - } - -*/ - -{ - SfxCancelManager* _pMgr; - BOOL _bCancelled; - String _aTitle; - -public: - SfxCancellable( SfxCancelManager *pMgr, - const String &rTitle ) - : _pMgr( pMgr ), - _bCancelled( FALSE ), - _aTitle( rTitle ) - { pMgr->InsertCancellable( this ); } - - virtual ~SfxCancellable(); - - void SetManager( SfxCancelManager *pMgr ); - SfxCancelManager* GetManager() const { return _pMgr; } - - virtual void Cancel(); - BOOL IsCancelled() const { return _bCancelled; } - operator BOOL() const { return _bCancelled; } - const String& GetTitle() const { return _aTitle; } -}; - -#endif - diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 4a01a03ad759..0e43e387103f 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -69,7 +69,6 @@ #include #include #include -#include #include #include "urihelper.hxx" #include diff --git a/svtools/source/notify/cancel.cxx b/svtools/source/notify/cancel.cxx deleted file mode 100644 index 32a76a7df9c1..000000000000 --- a/svtools/source/notify/cancel.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: cancel.cxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#define _SFX_CANCEL_CXX -#include - -#include -#include - -#include -#include -#include - -namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; } - -//========================================================================= - -SfxCancelManager::SfxCancelManager( SfxCancelManager *pParent ) -: _pParent( pParent ) -{ -} - -//------------------------------------------------------------------------- - -SfxCancelManager::~SfxCancelManager() -{ - DBG_ASSERT( _pParent || !_aJobs.Count(), "deleting SfxCancelManager in use" ); - for ( USHORT n = _aJobs.Count(); n--; ) - _aJobs.GetObject(n)->SetManager( _pParent ); -} - -//------------------------------------------------------------------------- - -BOOL SfxCancelManager::CanCancel() const - -/* [Beschreibung] - - Liefert TRUE wenn an diesem CancelManager oder an einem Parent - ein Job l"auft. -*/ - -{ - ::vos::OGuard aGuard( lclMutex::get() ); - return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() ); -} - -//------------------------------------------------------------------------- - -void SfxCancelManager::Cancel( BOOL bDeep ) - -/* [Beschreibung] - - Diese Methode markiert alle angemeldeten -Instanzen - als suspendiert. -*/ - -{ - ::vos::OGuard aGuard( lclMutex::get() ); - SfxCancelManagerWeak xWeak( this ); - for ( USHORT n = _aJobs.Count(); n-- && xWeak.Is(); ) - if ( n < _aJobs.Count() ) - _aJobs.GetObject(n)->Cancel(); - if ( xWeak.Is() && _pParent ) - _pParent->Cancel( bDeep ); -} - -//------------------------------------------------------------------------- - -void SfxCancelManager::InsertCancellable( SfxCancellable *pJob ) - -/* [Beschreibung] - - Diese interne Methode tr"agt 'pJob' in die Liste der unterbrechbaren - Jobs ein und Broadcastet dies. Jeder darf nur - maximal einmal angemeldet sein, dies geschiet in seinem Ctor. -*/ - -{ -#ifdef GPF_ON_EMPTY_TITLE - if ( !pJob->GetTitle() ) - { - DBG_ERROR( "SfxCancellable: empty titles not allowed (Vermummungsverbot)" ) - *(int*)0 = 0; - } -#endif - - ::vos::OClearableGuard aGuard( lclMutex::get() ); - _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() ); - - aGuard.clear(); - Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); -} - -//------------------------------------------------------------------------- - - -void SfxCancelManager::RemoveCancellable( SfxCancellable *pJob ) - -/* [Beschreibung] - - Diese interne Methode tr"agt 'pJob' aus die Liste der unterbrechbaren - Jobs aus und Broadcastet dies. Dieser Aufruf mu\s paarig nach einem - erfolgen und wird im Dtor des - ausgel"ost. -*/ - -{ - ::vos::OClearableGuard aGuard( lclMutex::get() ); - const SfxCancellable *pTmp = pJob; - USHORT nPos = _aJobs.GetPos( pTmp ); - if ( nPos != 0xFFFF ) - { - _aJobs.Remove( nPos , 1 ); - aGuard.clear(); - Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) ); - Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) ); - } -} - -//------------------------------------------------------------------------- - -SfxCancellable::~SfxCancellable() -{ - SfxCancelManager* pMgr = _pMgr; - if ( pMgr ) - pMgr->RemoveCancellable( this ); -} - -//------------------------------------------------------------------------- - -void SfxCancellable::Cancel() - -/* [Description] - - This virtual function is called when the user hits the cancel-button. - If you overload it, you can stop your activities. Please always call - 'SfxCancellable::Cancel()'. -*/ - -{ -#ifdef GFP_ON_NO_CANCEL - if ( _bCancelled < 5 ) - ++_bCancelled; - else - { - delete this; - } -#else - _bCancelled = TRUE; -#endif -} - -//------------------------------------------------------------------------- - -void SfxCancellable::SetManager( SfxCancelManager *pMgr ) -{ - SfxCancelManager* pTmp = _pMgr; - if ( pTmp ) - pTmp->RemoveCancellable( this ); - _pMgr = pMgr; - if ( pMgr ) - pMgr->InsertCancellable( this ); -} - -//------------------------------------------------------------------------- - -TYPEINIT1(SfxCancelHint, SfxHint); - -SfxCancelHint::SfxCancelHint( SfxCancellable* pJob, USHORT _nAction ) -{ - pCancellable = pJob; - nAction = _nAction; -} - - diff --git a/svtools/source/notify/makefile.mk b/svtools/source/notify/makefile.mk index 8e4c4b211258..6790d58dddbd 100644 --- a/svtools/source/notify/makefile.mk +++ b/svtools/source/notify/makefile.mk @@ -46,7 +46,6 @@ SLOFILES = \ $(SLO)$/hint.obj \ $(SLO)$/lstner.obj \ $(SLO)$/isethint.obj \ - $(SLO)$/cancel.obj \ $(SLO)$/brdcst.obj \ $(SLO)$/listener.obj \ $(SLO)$/listenerbase.obj \ -- cgit v1.2.3 From 1e30a9a1368eab0b8a56efdcf677bb3c8e27c768 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:38:46 +0100 Subject: [CWS autorecovery] removed SfxCancellable/SfxCancelManager, and (part of) its transitive closure No real-life use cases for this exist anymore, since nowadays document loading happens synchronously all the time. --- sfx2/inc/inettbc.hxx | 13 ----- sfx2/inc/sfx2/app.hxx | 2 - sfx2/inc/sfx2/docfile.hxx | 14 ----- sfx2/inc/sfx2/frame.hxx | 3 -- sfx2/inc/sfx2/viewfrm.hxx | 2 - sfx2/source/appl/appdata.cxx | 2 - sfx2/source/appl/appmisc.cxx | 7 --- sfx2/source/appl/appquit.cxx | 3 -- sfx2/source/appl/appreg.cxx | 1 - sfx2/source/appl/appserv.cxx | 1 - sfx2/source/bastyp/progress.cxx | 34 +++--------- sfx2/source/doc/docfile.cxx | 114 +--------------------------------------- sfx2/source/doc/objmisc.cxx | 2 - sfx2/source/inc/appdata.hxx | 2 - sfx2/source/inet/inettbc.cxx | 100 ----------------------------------- sfx2/source/view/frame.cxx | 12 ----- sfx2/source/view/impframe.cxx | 58 -------------------- sfx2/source/view/impframe.hxx | 11 +--- sfx2/source/view/makefile.mk | 1 - sfx2/source/view/topfrm.cxx | 18 ++----- sfx2/source/view/viewfrm.cxx | 15 ------ svx/inc/linkmgr.hxx | 2 - svx/inc/pch/precompiled_svx.hxx | 1 - svx/source/svxlink/fileobj.cxx | 8 --- svx/source/svxlink/fileobj.hxx | 1 - svx/source/svxlink/linkmgr.cxx | 10 ---- 26 files changed, 12 insertions(+), 425 deletions(-) delete mode 100644 sfx2/source/view/impframe.cxx diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index cbc9e12dad70..6e5b907d4237 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -77,19 +77,6 @@ public: virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); }; -class SfxCancelToolBoxControl_Impl : public SfxToolBoxControl -{ -public: - - SFX_DECL_TOOLBOX_CONTROL(); - - SfxCancelToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ); - - virtual SfxPopupWindowType GetPopupWindowType() const; - virtual SfxPopupWindow* CreatePopupWindow(); - virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ); -}; - #endif #endif diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index 99deee0c97a3..b770d47e49b5 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -61,7 +61,6 @@ class AppSettings; struct SfxChildWinContextFactory; class SfxAppData_Impl; class SfxBindings; -class SfxCancelManager; class SfxChildWinFactArr_Impl; class SfxChildWindow; class SfxDispatcher; @@ -222,7 +221,6 @@ public: // members SfxFilterMatcher& GetFilterMatcher(); - SfxCancelManager* GetCancelManager() const; SfxMacroConfig* GetMacroConfig() const; SfxProgress* GetProgress() const; const String& GetLastSaveDirectory() const; diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index e8ae3f5d1d85..53712002dbe7 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -51,7 +51,6 @@ #include #include -#include #include #include @@ -67,16 +66,6 @@ class SfxItemSet; class DateTime; class SvStringsDtor; class SvEaMgr; -class SfxPoolCancelManager_Impl; - -#define SFX_TFPRIO_SYNCHRON 0 -#define SFX_TFPRIO_DOC 10 -#define SFX_TFPRIO_VISIBLE_LOWRES_GRAPHIC 20 -#define SFX_TFPRIO_VISIBLE_HIGHRES_GRAPHIC 21 -#define SFX_TFPRIO_PLUGINS 40 -#define SFX_TFPRIO_INVISIBLE_LOWRES_GRAPHIC 50 -#define SFX_TFPRIO_INVISIBLE_HIGHRES_GRAPHIC 51 -#define SFX_TFPRIO_DOWNLOADS 60 #define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) @@ -160,7 +149,6 @@ public: void SetLoadTargetFrame(SfxFrame* pFrame ); SfxFrame* GetLoadTargetFrame() const; - void CancelTransfers(); void SetReferer( const String& rRefer ); const String& GetReferer( ) const; @@ -276,8 +264,6 @@ public: SAL_DLLPRIVATE sal_Bool TransferVersionList_Impl( SfxMedium& rMedium ); SAL_DLLPRIVATE sal_Bool SaveVersionList_Impl( sal_Bool bUseXML ); SAL_DLLPRIVATE sal_Bool RemoveVersion_Impl( const ::rtl::OUString& rVersion ); - SAL_DLLPRIVATE SfxPoolCancelManager_Impl* GetCancelManager_Impl() const; - SAL_DLLPRIVATE void SetCancelManager_Impl( SfxPoolCancelManager_Impl* pMgr ); SAL_DLLPRIVATE void SetExpired_Impl( const DateTime& rDateTime ); SAL_DLLPRIVATE SvKeyValueIterator* GetHeaderAttributes_Impl(); diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 8475907a522d..3d783c80fb6b 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -86,7 +86,6 @@ class SfxMedium; class SfxFrameHistory_Impl; class SfxDispatcher; class SfxMedium; -class SfxCancellable; class Rectangle; class SfxRequest; class SfxUnoControllerItem; @@ -125,7 +124,6 @@ DECLARE_LIST( TargetList, String* ) //========================================================================== class SfxFrameArr_Impl; -class SfxCancelManager; struct SfxFramePickEntry_Impl; class SfxUnoFrame; class SFX2_DLLPUBLIC SfxFrame @@ -209,7 +207,6 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameLoader > & rLoader, SfxItemSet* pSet=0, sal_Bool bDontClose=sal_False ); DECL_DLLPRIVATE_STATIC_LINK( SfxFrame, BindingHasNewPart_Impl, void* ); - SAL_DLLPRIVATE SfxCancelManager* GetCancelManager() const; SAL_DLLPRIVATE void GetViewData_Impl(); SAL_DLLPRIVATE void ActivatePickEntry_Impl( SfxFramePickEntry_Impl*, sal_uInt16 nMode, SfxFrameDescriptor *pD = NULL ); SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index dc0180a19a85..d12e5ca7eabf 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -51,7 +51,6 @@ class SfxProgress; class SvData; class SfxViewShell; class SvPseudoObject; -class SfxCancelManager; class SystemWindow; class Fraction; class Point; @@ -250,7 +249,6 @@ public: { GetFrame()->GetTargetList( rList ); } void CancelTransfers() { GetFrame()->CancelTransfers(); } - SfxCancelManager* GetCancelManager() const; void SetModalMode( BOOL ); BOOL IsInModalMode() const; diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index 23de7317c379..e6a1674d5452 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -101,7 +101,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : pTopFrames( new SfxFrameArr_Impl ), pInitLinkList(0), pMatcher( 0 ), - pCancelMgr( 0 ), pLabelResMgr( 0 ), pAppDispatch(NULL), pTemplates( 0 ), @@ -152,7 +151,6 @@ SfxAppData_Impl::~SfxAppData_Impl() { DeInitDDE(); delete pTopFrames; - delete pCancelMgr; delete pSecureURLs; delete pBasicManager; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 08a61b1f0ce6..e9e0cb386ed8 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -329,13 +329,6 @@ ISfxTemplateCommon* SfxApplication::GetCurrentTemplateCommon( SfxBindings& rBind return 0; } -SfxCancelManager* SfxApplication::GetCancelManager() const -{ - if ( !pAppData_Impl->pCancelMgr ) - pAppData_Impl->pCancelMgr = new SfxCancelManager; - return pAppData_Impl->pCancelMgr; -} - SfxResourceManager& SfxApplication::GetResourceManager() const { return *pAppData_Impl->pResMgr; } BOOL SfxApplication::IsDowning() const { return pAppData_Impl->bDowning; } SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->pAppDispat; } diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index 16ae1fe236a9..20836918cbc6 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -119,9 +119,6 @@ BOOL SfxApplication::QueryExit_Impl() } } */ - // alles canceln was zu canceln ist - GetCancelManager()->Cancel(TRUE); - /* SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst(); if ( bQuit ) diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 9e688f885e3c..aa5205f739c4 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -76,7 +76,6 @@ void SfxApplication::Registrations_Impl() // Controller SfxToolBoxControl::RegisterControl(SID_REPEAT); SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL); - SfxCancelToolBoxControl_Impl::RegisterControl(SID_BROWSE_STOP); SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT ); SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU ); }; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 184ecb9f1a5c..24498c19516f 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -71,7 +71,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 121b8604e02d..97e30932ba25 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -80,7 +80,7 @@ void AddNumber_Impl( String& aNumber, sal_uInt32 nArg ) } } -struct SfxProgress_Impl : public SfxCancellable +struct SfxProgress_Impl { Reference < XStatusIndicator > xStatusInd; String aText, aStateText; @@ -144,11 +144,9 @@ void SfxProgress_Impl::Enable_Impl( BOOL bEnable ) // ----------------------------------------------------------------------- -SfxProgress_Impl::SfxProgress_Impl( const String &rTitle ) - : SfxCancellable( SFX_APP()->GetCancelManager(), rTitle ), - pActiveProgress( 0 ) +SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) + : pActiveProgress( 0 ) { - SFX_APP()->GetCancelManager()->RemoveCancellable(this); } // ----------------------------------------------------------------------- @@ -186,21 +184,6 @@ SfxProgress::SfxProgress pImp->bRunning = TRUE; pImp->bAllowRescheduling = Application::IsInExecute();; - if ( pObjSh ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pObjSh ) ) - { - pFrame->GetCancelManager()->InsertCancellable( pImp ); -/* - SfxBindings& rBindings = pFrame->GetBindings(); - rBindings.Invalidate( SID_BROWSE_STOP ); - if ( !rBindings.IsInRegistrations() ) - rBindings.Update( SID_BROWSE_STOP ); - rBindings.Invalidate( SID_BROWSE_STOP ); - */ - } - } - pImp->xObjSh = pObjSh; pImp->aText = rText; pImp->nMax = nRange; @@ -242,12 +225,7 @@ SfxProgress::~SfxProgress() if( pImp->bIsStatusText == TRUE ) GetpApp()->HideStatusText( ); SfxObjectShell* pDoc = pImp->xObjSh; - if ( pDoc ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDoc ) ) - pFrame->GetCancelManager()->RemoveCancellable( pImp );//Invalidate( SID_BROWSE_STOP ); - } - else + if ( !pDoc ) SFX_APP()->Invalidate( SID_BROWSE_STOP ); delete pImp; } @@ -390,8 +368,8 @@ BOOL SfxProgress::SetState { // wurde via Stop-Button angehalten? - if ( pImp->IsCancelled() ) - return FALSE; +// if ( pImp->IsCancelled() ) +// return FALSE; if( pImp->pActiveProgress ) return TRUE; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 32ae33ec3c8b..c4078dba3118 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -260,79 +260,6 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc m_xInter->handle( xRequest ); } -//---------------------------------------------------------------- -class SfxPoolCancelManager_Impl : public SfxCancelManager , - public SfxCancellable , - public SfxListener , - public SvRefBase -{ - SfxCancelManagerWeak wParent; - - ~SfxPoolCancelManager_Impl(); -public: - SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - using SfxCancelManager::Cancel; - virtual void Cancel(); -}; - -//---------------------------------------------------------------- -SV_DECL_IMPL_REF( SfxPoolCancelManager_Impl ) - - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ) - : SfxCancelManager( pParent ), - SfxCancellable( pParent ? pParent : this, rName ), - wParent( pParent ) -{ - if( pParent ) - { - StartListening( *this ); - SetManager( 0 ); - } -} - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::~SfxPoolCancelManager_Impl() -{ - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - // nicht an Parent uebernehmen! - SfxCancellable* pCbl = GetCancellable( nPos ); - if ( pCbl ) - pCbl->SetManager( 0 ); - } -} - - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/ ) -{ - if( !GetCancellableCount() ) SetManager( 0 ); - else if( !GetManager() ) - { - if( !wParent.Is() ) wParent = SFX_APP()->GetCancelManager(); - SetManager( wParent ); - } -} - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Cancel() -{ - SfxPoolCancelManager_ImplRef xThis = this; - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - SfxCancellable* pCbl = GetCancellable( nPos ); - // Wenn wir nicht im Button stehen - if( pCbl && pCbl != this ) - pCbl->Cancel(); - if( GetCancellableCount() < nPos ) - nPos = GetCancellableCount(); - } -} - //---------------------------------------------------------------- class SfxMedium_Impl : public SvCompatWeakBase { @@ -341,7 +268,6 @@ public: sal_Bool bUpdatePickList : 1; sal_Bool bIsTemp : 1; sal_Bool bForceSynchron : 1; - sal_Bool bDontCreateCancellable : 1; sal_Bool bDownloadDone : 1; sal_Bool bDontCallDoneLinkOnSharingError : 1; sal_Bool bIsStorage: 1; @@ -357,7 +283,6 @@ public: uno::Reference < embed::XStorage > xStorage; - SfxPoolCancelManager_ImplRef xCancelManager; SfxMedium* pAntiImpl; long nFileVersion; @@ -398,8 +323,6 @@ public: uno::Reference< logging::XSimpleLogRing > m_xLogRing; - SfxPoolCancelManager_Impl* GetCancelManager(); - SfxMedium_Impl( SfxMedium* pAntiImplP ); ~SfxMedium_Impl(); }; @@ -415,29 +338,12 @@ void SfxMedium::Cancel_Impl() SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } -SfxPoolCancelManager_Impl* SfxMedium_Impl::GetCancelManager() -{ - if( !xCancelManager.Is() ) - { - if( !bDontCreateCancellable ) - xCancelManager = new SfxPoolCancelManager_Impl( - wLoadTargetFrame ? wLoadTargetFrame->GetCancelManager() : - SFX_APP()->GetCancelManager(), - pAntiImpl->GetURLObject().GetURLNoPass() ); - else - xCancelManager = new SfxPoolCancelManager_Impl( - 0, pAntiImpl->GetURLObject().GetURLNoPass() ); - } - return xCancelManager; -} - //------------------------------------------------------------------ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) : SvCompatWeakBase( pAntiImplP ), bUpdatePickList(sal_True), bIsTemp( sal_False ), bForceSynchron( sal_False ), - bDontCreateCancellable( sal_False ), bDownloadDone( sal_True ), bDontCallDoneLinkOnSharingError( sal_False ), bIsStorage( sal_False ), @@ -2374,25 +2280,7 @@ void SfxMedium::GetMedium_Impl() } } -//------------------------------------------------------------------ -SfxPoolCancelManager_Impl* SfxMedium::GetCancelManager_Impl() const -{ - return pImp->GetCancelManager(); -} - -//------------------------------------------------------------------ -void SfxMedium::SetCancelManager_Impl( SfxPoolCancelManager_Impl* pMgr ) -{ - pImp->xCancelManager = pMgr; -} - //---------------------------------------------------------------- -void SfxMedium::CancelTransfers() -{ - if( pImp->xCancelManager.Is() ) - pImp->xCancelManager->Cancel(); -} - sal_Bool SfxMedium::IsRemote() { return bRemote; @@ -3199,7 +3087,7 @@ sal_Bool SfxMedium::IsDownloadDone_Impl() void SfxMedium::SetDontCreateCancellable( ) { - pImp->bDontCreateCancellable = sal_True; + OSL_ENSURE( false, "SfxMedium::SetDontCreateCancellable: dead code!" ); } ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SfxMedium::GetInputStream() diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5e3ace93372a..fe0c222c2c92 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1161,7 +1161,6 @@ void SfxObjectShell::RegisterTransfer( SfxMedium& rMedium ) laden, muessen an der zugehoerigen SfxObjectShell angemeldet werden. So kann dokumentweise abgebrochen werden. */ { - rMedium.SetCancelManager_Impl( GetMedium()->GetCancelManager_Impl() ); rMedium.SetReferer( GetMedium()->GetName() ); } @@ -1565,7 +1564,6 @@ void SfxObjectShell::CancelTransfers() Hier koennen Transfers gecanceled werden, die nicht mit RegisterTransfer registiert wurden */ { - GetMedium()->CancelTransfers(); if( ( pImp->nLoadedFlags & SFX_LOADED_ALL ) != SFX_LOADED_ALL ) { AbortImport(); diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index bd782b76a5ae..696d95501205 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -55,7 +55,6 @@ class SfxFilterMatcher; class SvUShorts; class ISfxTemplateCommon; class SfxFilterMatcher; -class SfxCancelManager; class SfxStatusDispatcher; class SfxDdeTriggerTopic_Impl; class SfxMiscCfg; @@ -112,7 +111,6 @@ public: // application members SfxFilterMatcher* pMatcher; - SfxCancelManager* pCancelMgr; ResMgr* pLabelResMgr; SfxStatusDispatcher* pAppDispatch; SfxDocumentTemplates* pTemplates; diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index d6ce65c96b6d..e9cf246b9919 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -305,102 +304,3 @@ void SfxURLToolBoxControl_Impl::StateChanged } } -//*************************************************************************** -// SfxCancelToolBoxControl_Impl -//*************************************************************************** - -SFX_IMPL_TOOLBOX_CONTROL(SfxCancelToolBoxControl_Impl,SfxBoolItem) - -//*************************************************************************** - -SfxCancelToolBoxControl_Impl::SfxCancelToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ) : - SfxToolBoxControl( nSlotId, nId, rBox ) -{ -} - -//*************************************************************************** - -SfxPopupWindowType SfxCancelToolBoxControl_Impl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONTIMEOUT; -} - -//*************************************************************************** - -SfxPopupWindow* SfxCancelToolBoxControl_Impl::CreatePopupWindow() -{ - PopupMenu aMenu; - BOOL bExecute = FALSE, bSeparator = FALSE; - USHORT nIndex = 1; - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n=0; nGetCancellableCount(); ++n ) - { - if ( !n && bSeparator ) - { - aMenu.InsertSeparator(); - bSeparator = FALSE; - } - String aItemText = pCancelMgr->GetCancellable(n)->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - aMenu.InsertItem( nIndex++, aItemText ); - bExecute = TRUE; - bSeparator = TRUE; - } - } - - ToolBox& rToolBox = GetToolBox(); - USHORT nId = bExecute ? aMenu.Execute( &rToolBox, rToolBox.GetPointerPosPixel() ) : 0; - GetToolBox().EndSelection(); -// ClearCache(); -// UpdateSlot(); - if ( nId ) - { - String aSearchText = aMenu.GetItemText(nId); - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n = 0; n < pCancelMgr->GetCancellableCount(); ++n ) - { - SfxCancellable *pCancel = pCancelMgr->GetCancellable(n); - String aItemText = pCancel->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - - if ( aItemText == aSearchText ) - { - pCancel->Cancel(); - return 0; - } - } - } - - } - - return 0; -} - -//*************************************************************************** - -void SfxCancelToolBoxControl_Impl::StateChanged -( - USHORT nSID, - SfxItemState eState, - const SfxPoolItem* pState -) -{ - SfxVoidItem aVoidItem( nSID ); - //SfxToolBoxControl::StateChanged( nSID, eState, pState ? &aVoidItem : 0 ); - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index ff8dca80b1e0..04d75a40fda6 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -122,18 +122,6 @@ SvCompatWeakHdl* SfxFrame::GetHdl() return pImp->GetHdl(); } -SfxCancelManager* SfxFrame::GetCancelManager() const -{ - SfxFrame *pFrame = GetTopFrame(); - SfxCancelManager*& rpMgr = pFrame->pImp->pCancelMgr; - if ( !rpMgr ) - { - rpMgr = new SfxCancelManager( SFX_APP()->GetCancelManager() ); - pFrame->pImp->StartListening( *rpMgr ); - } - return rpMgr; -} - //-------------------------------------------------------------------- SfxFrame::~SfxFrame() diff --git a/sfx2/source/view/impframe.cxx b/sfx2/source/view/impframe.cxx deleted file mode 100644 index d13beadee9f0..000000000000 --- a/sfx2/source/view/impframe.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: impframe.cxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#ifndef GCC -#endif - -#include "impframe.hxx" - -#include - -#include -#include -#include - -void SfxFrame_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) -{ - SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint && pHint->GetId() == SFX_HINT_CANCELLABLE && pCurrentViewFrame ) - { - // vom Cancel-Manager - SfxBindings &rBind = pCurrentViewFrame->GetBindings(); - rBind.Invalidate( SID_BROWSE_STOP ); - if ( !rBind.IsInRegistrations() ) - rBind.Update( SID_BROWSE_STOP ); - rBind.Invalidate( SID_BROWSE_STOP ); - } -} - diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index f8233c0c64fe..f5bcc27733b0 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -31,8 +31,6 @@ #ifndef _SFX_IMPFRAME_HXX #define _SFX_IMPFRAME_HXX -#include - #include #include // SvBorder @@ -54,7 +52,7 @@ class SfxObjectShell; #define FRAME_SEARCH_CREATE 0x00000008 #endif -class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase, public SfxListener +class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase { friend class SfxFrame; @@ -74,8 +72,6 @@ friend class SfxFrame; sal_Bool bOwnsBindings : 1; sal_Bool bReleasingComponent : 1; sal_Bool bInPlace : 1; - SfxCancelManager* pCancelMgr; - SfxCancellable* pLoadCancellable; SfxFrame* pFrame; const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; @@ -97,15 +93,12 @@ friend class SfxFrame; bOwnsBindings( sal_False ), bReleasingComponent( sal_False ), bInPlace( sal_False ), - pCancelMgr( 0 ), - pLoadCancellable( 0 ), pFrame( pAntiImplP ), pSet( 0 ), pWorkWin( 0 ) {} - virtual ~SfxFrame_Impl() { delete pCancelMgr; delete pLoadCancellable; } - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual ~SfxFrame_Impl() { } }; #endif diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk index 98d34215e097..3ab9d5d7e242 100644 --- a/sfx2/source/view/makefile.mk +++ b/sfx2/source/view/makefile.mk @@ -59,7 +59,6 @@ SLOFILES = \ $(SLO)$/viewfac.obj \ $(SLO)$/orgmgr.obj \ $(SLO)$/viewfrm.obj \ - $(SLO)$/impframe.obj \ $(SLO)$/topfrm.obj \ $(SLO)$/sfxbasecontroller.obj \ $(SLO)$/userinputinterception.obj diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 5957abb67b27..5508c4a825bf 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -1493,21 +1493,9 @@ void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) break; } case SID_BROWSE_STOP: - { - if ( GetCancelManager() ) - GetCancelManager()->Cancel( TRUE ); - - // cancel jobs in hidden tasks - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxFrame *pFrame = rArr[ nPos ]; - if ( !pFrame->GetCurrentViewFrame() ) - pFrame->GetCancelManager()->Cancel( TRUE ); - } - + OSL_ENSURE( false, "SID_BROWSE_STOP is dead!" ); break; - } + case SID_FOCUSURLBOX: { SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); @@ -1539,7 +1527,7 @@ void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) rItemSet.DisableItem( SID_CREATELINK ); - pImp->pStopButtonTimer->SetButtonState( GetCancelManager()->CanCancel() ); + pImp->pStopButtonTimer->SetButtonState( FALSE ); if ( !pImp->pStopButtonTimer->GetButtonState() ) rItemSet.DisableItem( SID_BROWSE_STOP ); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index abdec58b8ef7..238b2f1100f4 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -172,7 +172,6 @@ struct SfxViewFrame_Impl String aActualURL; String aActualPresentationURL; SfxFrame* pFrame; - SfxCancelManager* pCancelMgr; svtools::AsynchronLink* pReloader; //SfxInPlaceFrame* pIPFrame; Window* pWindow; @@ -205,7 +204,6 @@ struct SfxViewFrame_Impl ~SfxViewFrame_Impl() { delete pReloader; - delete pCancelMgr; } }; @@ -1641,7 +1639,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) pImp->bEnabled = sal_True; pImp->nDocViewNo = 0; pImp->aMargin = Size( -1, -1 ); - pImp->pCancelMgr = 0; pImp->pWindow = 0; SetPool( &SFX_APP()->GetPool() ); @@ -2960,18 +2957,6 @@ SfxViewFrame* SfxViewFrame::GetTopViewFrame() const //------------------------------------------------------------------------- -SfxCancelManager *SfxViewFrame::GetCancelManager() const - -/*

Description

- - Returns a pointer to the of the top-view-frame of - this view-frame. -*/ - -{ - return GetTopViewFrame()->GetFrame()->GetCancelManager(); -} - void SfxViewFrame::SetWindow_Impl( Window *pWin ) { pImp->pWindow = pWin; diff --git a/svx/inc/linkmgr.hxx b/svx/inc/linkmgr.hxx index b65c91ce7ebd..24a3fff479bb 100644 --- a/svx/inc/linkmgr.hxx +++ b/svx/inc/linkmgr.hxx @@ -79,8 +79,6 @@ public: // (ist zur Zeit nur fuer die FileLinks interressant!) void CancelTransfers(); - static void SetTransferPriority( sfx2::SvBaseLink& rLink, USHORT nPrio ); - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 8e9bc4d17930..4fe38e521830 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -757,7 +757,6 @@ #include "svtools/apearcfg.hxx" #include "svtools/brdcst.hxx" #include "svtools/cacheoptions.hxx" -#include "svtools/cancel.hxx" #include "svtools/cjkoptions.hxx" #include "svtools/cmdoptions.hxx" #include "svtools/cntwall.hxx" diff --git a/svx/source/svxlink/fileobj.cxx b/svx/source/svxlink/fileobj.cxx index d159c7f78abe..2ccc8754dffc 100644 --- a/svx/source/svxlink/fileobj.cxx +++ b/svx/source/svxlink/fileobj.cxx @@ -692,9 +692,6 @@ BOOL SvFileObject::IsDataComplete() const void SvFileObject::CancelTransfers() { - if( xMed.Is() ) - xMed->CancelTransfers(); - // und aus dem Cache austragen, wenn man mitten im Laden ist if( !bDataReady ) { @@ -706,11 +703,6 @@ void SvFileObject::CancelTransfers() } -void SvFileObject::SetTransferPriority( USHORT ) -{ -} - - void SvFileObject::SendStateChg_Impl( LinkState nState ) { if( !bStateChangeCalled && HasDataLinks() ) diff --git a/svx/source/svxlink/fileobj.hxx b/svx/source/svxlink/fileobj.hxx index 78dbe84dfdc3..44644b1cef0a 100644 --- a/svx/source/svxlink/fileobj.hxx +++ b/svx/source/svxlink/fileobj.hxx @@ -91,7 +91,6 @@ public: virtual BOOL IsDataComplete() const; void CancelTransfers(); - void SetTransferPriority( USHORT nPrio ); }; diff --git a/svx/source/svxlink/linkmgr.cxx b/svx/source/svxlink/linkmgr.cxx index 4f66ba983c06..229632587ba4 100644 --- a/svx/source/svxlink/linkmgr.cxx +++ b/svx/source/svxlink/linkmgr.cxx @@ -181,16 +181,6 @@ void SvxLinkManager::CancelTransfers() pFileObj->CancelTransfers(); } -void SvxLinkManager::SetTransferPriority( sfx2::SvBaseLink& /*rLink*/, USHORT /*nPrio*/ ) -{ -// SvFileObject* pFileObj = -// (SvFileObject*)SvFileObject::ClassFactory()-> -// CastAndAddRef( rLink.GetObj() ); -// OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & rLink.GetObjType()) ? -// (SvFileObject*)rLink.GetObj() : 0; -} - - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. -- cgit v1.2.3 From afb4cbbcae4e553eae99303024a72784a336a399 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:38:46 +0100 Subject: [CWS autorecovery] removed SfxCancellable/SfxCancelManager, and (part of) its transitive closure No real-life use cases for this exist anymore, since nowadays document loading happens synchronously all the time. --- sw/inc/ndgrf.hxx | 4 ---- sw/source/core/graphic/ndgrf.cxx | 9 --------- sw/source/filter/html/htmlgrin.cxx | 1 - 3 files changed, 14 deletions(-) diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 45ecea30a9c0..b21bf78037d7 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -211,10 +211,6 @@ public: BOOL GetFileFilterNms( String* pFileNm, String* pFilterNm ) const; void ReleaseLink(); - // Prioritaet beim Laden der Grafik setzen. Geht nur, wenn der Link - // ein FileObject gesetzt hat - void SetTransferPriority( USHORT nPrio ); - // Skalieren einer Image-Map: Die Image-Map wird um den Faktor // zwischen Grafik-Groesse und Rahmen-Groesse vergroessert/verkleinert void ScaleImageMap(); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 55fbb54bd718..a359f4b5c7c9 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -674,15 +674,6 @@ void SwGrfNode::SetTwipSize( const Size& rSz ) } } - // Prioritaet beim Laden der Grafik setzen. Geht nur, wenn der Link - // ein FileObject gesetzt hat -void SwGrfNode::SetTransferPriority( USHORT nPrio ) -{ - if( refLink.Is() && refLink->GetObj() ) - SvxLinkManager::SetTransferPriority( *refLink, nPrio ); -} - - void SwGrfNode::ScaleImageMap() { if( !nGrfSize.Width() || !nGrfSize.Height() ) diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index d18a2b762aa0..5d84c49d9e86 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -809,7 +809,6 @@ IMAGE_SETEVENT: // gleich (synchron) angepasst wird (war bug #40983#) if( bRequestGrfNow ) { - pGrfNd->SetTransferPriority( SFX_TFPRIO_VISIBLE_LOWRES_GRAPHIC ); pGrfNd->SwapIn(); } -- cgit v1.2.3 From 9b35a905d89b9f07aff5ad6908a48eb9132e0ddc Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 14:38:46 +0100 Subject: [CWS autorecovery] removed SfxCancellable/SfxCancelManager, and (part of) its transitive closure No real-life use cases for this exist anymore, since nowadays document loading happens synchronously all the time. --- sc/source/core/inc/core_pch.hxx | 1 - sc/source/ui/inc/ui_pch.hxx | 1 - 2 files changed, 2 deletions(-) diff --git a/sc/source/core/inc/core_pch.hxx b/sc/source/core/inc/core_pch.hxx index d756d1a91246..2e910328f54a 100644 --- a/sc/source/core/inc/core_pch.hxx +++ b/sc/source/core/inc/core_pch.hxx @@ -161,7 +161,6 @@ #include #include #include -#include #include #include #include diff --git a/sc/source/ui/inc/ui_pch.hxx b/sc/source/ui/inc/ui_pch.hxx index 335f7e917505..73b9a0e2fccd 100644 --- a/sc/source/ui/inc/ui_pch.hxx +++ b/sc/source/ui/inc/ui_pch.hxx @@ -174,7 +174,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From e02702c1d120c7e93826ed537e3bf66763a2b31f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 17:11:58 +0100 Subject: [CWS autorecovery] SFX_HINT_CANCELLABLE is not used anymore --- svtools/inc/svtools/smplhint.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/inc/svtools/smplhint.hxx b/svtools/inc/svtools/smplhint.hxx index 4e1f4601f78a..886eae0774ac 100644 --- a/svtools/inc/svtools/smplhint.hxx +++ b/svtools/inc/svtools/smplhint.hxx @@ -42,7 +42,7 @@ #define SFX_HINT_UPDATEDONE 0x00000020 #define SFX_HINT_DEINITIALIZING 0x00000040 #define SFX_HINT_MODECHANGED 0x00000080 -#define SFX_HINT_CANCELLABLE 0x00000100 + // unused, formerly SFX_HINT_CANCELLABLE // unused, formerly SFX_HINT_DATAAVAILABLE // unused, formerly SFX_HINT_SAVECOMPLETED // unused, formerly SFX_HINT_RELEASEREF -- cgit v1.2.3 From 88cb329eca47476bee17baa4eff507697dd9d95a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 20:48:33 +0100 Subject: [CWS autorecovery] while we are at it .... SID_BROWSE_STOP is dead, for a long time now ... --- sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/sdi/frmslots.sdi | 6 ---- sfx2/sdi/sfx.sdi | 78 +++++++++++++--------------------------- sfx2/source/appl/app.src | 5 --- sfx2/source/bastyp/progress.cxx | 3 -- sfx2/source/control/dispatch.cxx | 2 +- sfx2/source/view/topfrm.cxx | 48 ------------------------- 7 files changed, 27 insertions(+), 117 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 615bb8494bb8..f886077919d8 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -305,7 +305,7 @@ // browse-ids #define SID_BROWSE_FORWARD (SID_SFX_START + 1300) #define SID_BROWSE_BACKWARD (SID_SFX_START + 1301) -#define SID_BROWSE_STOP (SID_SFX_START + 1302) + // FREE, formerly SID_BROWSE_STOP #define SID_BROWSE_HOME (SID_SFX_START + 1303) #define SID_AUTOBROWSE (SID_SFX_START + 1304) #define SID_AUTOMAIL (SID_SFX_START + 1305) diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 35f410db44af..f1431a325773 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -435,12 +435,6 @@ interface TopWindow : BrowseWindow ExecMethod = INetExecute_Impl ; StateMethod = INetState_Impl ; ] - SID_BROWSE_STOP // ole(no) api() - [ - ExecMethod = INetExecute_Impl ; - StateMethod = INetState_Impl ; - ] - } //========================================================================= diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 26f55ccdd178..bf4561fe0d4c 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -901,34 +901,6 @@ SfxUInt32Item BuildVersion SID_BUILD_VERSION GroupId = GID_INTERN; ] -//-------------------------------------------------------------------------- -SfxVoidItem Stop SID_BROWSE_STOP -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* status: */ - SlotType = SfxBoolItem - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_NAVIGATOR; -] - //-------------------------------------------------------------------------- SfxStringItem Caption SID_CAPTION @@ -5897,31 +5869,31 @@ SfxVoidItem ExportDialog SID_EXPORT_DIALOG ] //-------------------------------------------------------------------------- -SfxVoidItem ImportDialog SID_IMPORT_DIALOG -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOCUMENT; -] - -//-------------------------------------------------------------------------- +SfxVoidItem ImportDialog SID_IMPORT_DIALOG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = TRUE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_DOCUMENT; +] + +//-------------------------------------------------------------------------- SfxVoidItem SaveConfiguration SID_SAVECONFIG (SfxStringItem FileName SID_CFGFILE) [ diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index 463788d2d6d0..ef43af6b7926 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -654,11 +654,6 @@ ToolBox RID_ENVTOOLBOX Identifier = SID_OPENURL ; }; ToolBoxItem - { - Identifier = SID_BROWSE_STOP ; - Hide = TRUE; - }; - ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; }; diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 97e30932ba25..182a96e47959 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -224,9 +224,6 @@ SfxProgress::~SfxProgress() if( pImp->bIsStatusText == TRUE ) GetpApp()->HideStatusText( ); - SfxObjectShell* pDoc = pImp->xObjSh; - if ( !pDoc ) - SFX_APP()->Invalidate( SID_BROWSE_STOP ); delete pImp; } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index f57ca40e8519..e4a292857e49 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -2324,7 +2324,7 @@ sal_Bool SfxDispatcher::_FindServer { SFX_STACK(SfxDispatcher::_FindServer); - // Dispatcher gelockt? (SID_BROWSE_STOP und SID_HELP_PI trotzdem durchlassen) + // Dispatcher gelockt? (SID_HELP_PI trotzdem durchlassen) SfxApplication *pSfxApp = SFX_APP(); if ( IsLocked(nSlot) ) { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index b73e187e8fd0..3ca1c1989e97 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -307,42 +307,6 @@ void SfxTopWindow_Impl::DoResize() pFrame->Resize(); } -class StopButtonTimer_Impl : public Timer -{ - BOOL bState; - SfxViewFrame* pFrame; -protected: - virtual void Timeout(); -public: - StopButtonTimer_Impl( SfxViewFrame*); - void SetButtonState( BOOL bStateP ); - BOOL GetButtonState() const { return bState; } -}; - -StopButtonTimer_Impl::StopButtonTimer_Impl( SfxViewFrame*p) - : bState( FALSE ) - , pFrame( p ) -{ - SetTimeout( 200 ); -} - -void StopButtonTimer_Impl::SetButtonState( BOOL bStateP ) -{ - if( bStateP ) - { - bState = TRUE; - Stop(); - } - else if( bState ) - Start(); -} - -void StopButtonTimer_Impl::Timeout() -{ - bState = FALSE; - pFrame->GetBindings().Invalidate( SID_BROWSE_STOP ); -} - class SfxTopViewWin_Impl : public Window { friend class SfxInternalFrame; @@ -391,12 +355,10 @@ public: sal_Bool bActive; Window* pWindow; String aFactoryName; - StopButtonTimer_Impl* pStopButtonTimer; SfxTopViewFrame_Impl() : bActive( sal_False ) , pWindow( 0 ) - , pStopButtonTimer( 0 ) {} }; @@ -1148,7 +1110,6 @@ SfxTopViewFrame::SfxTopViewFrame pCloser = 0; pImp = new SfxTopViewFrame_Impl; - pImp->pStopButtonTimer = new StopButtonTimer_Impl(this); //(mba)/task if ( !pFrame->GetTask() ) { @@ -1230,7 +1191,6 @@ SfxTopViewFrame::~SfxTopViewFrame() KillDispatcher_Impl(); delete pImp->pWindow; - delete pImp->pStopButtonTimer; delete pImp; } @@ -1480,10 +1440,6 @@ void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) */ break; } - case SID_BROWSE_STOP: - OSL_ENSURE( false, "SID_BROWSE_STOP is dead!" ); - break; - case SID_FOCUSURLBOX: { SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); @@ -1514,10 +1470,6 @@ void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) rItemSet.DisableItem( SID_CREATELINK ); - - pImp->pStopButtonTimer->SetButtonState( FALSE ); - if ( !pImp->pStopButtonTimer->GetButtonState() ) - rItemSet.DisableItem( SID_BROWSE_STOP ); } void SfxTopViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) -- cgit v1.2.3 From f686c4209086312d92ee16c78c7b4e1ee120327e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 20:48:33 +0100 Subject: [CWS autorecovery] while we are at it .... SID_BROWSE_STOP is dead, for a long time now ... --- sw/source/ui/docvw/docvw.hrc | 2 +- sw/source/ui/docvw/docvw.src | 6 ------ sw/source/ui/docvw/romenu.cxx | 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc index afb599e64c6c..95581adbe5fa 100644 --- a/sw/source/ui/docvw/docvw.hrc +++ b/sw/source/ui/docvw/docvw.hrc @@ -37,7 +37,7 @@ #define MN_READONLY_OPENURL (RC_DOCVW_BEGIN + 2) #define MN_READONLY_OPENURLNEW (RC_DOCVW_BEGIN + 3) #define MN_READONLY_EDITDOC (RC_DOCVW_BEGIN + 4) -#define MN_READONLY_BROWSE_STOP (RC_DOCVW_BEGIN + 5) + // FREE, formerly known as MN_READONLY_BROWSE_STOP #define MN_READONLY_BROWSE_BACKWARD (RC_DOCVW_BEGIN + 6) #define MN_READONLY_BROWSE_FORWARD (RC_DOCVW_BEGIN + 7) #define MN_READONLY_SELECTION_MODE (RC_DOCVW_BEGIN + 8) diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src index 0220d9d9eddf..93b51e6de83b 100644 --- a/sw/source/ui/docvw/docvw.src +++ b/sw/source/ui/docvw/docvw.src @@ -80,12 +80,6 @@ Menu MN_READONLY_POPUP }; SEPARATOR MenuItem - { - Identifier = MN_READONLY_BROWSE_STOP ; - HelpID = SID_BROWSE_STOP ; - Text [ en-US ] = "~Stop" ; - }; - MenuItem { Identifier = MN_READONLY_BROWSE_BACKWARD ; HelpID = SID_BROWSE_BACKWARD ; diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 50776ef80f11..598cf064c7b3 100644 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -226,7 +226,6 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) : Check( MN_READONLY_EDITDOC, SID_EDITDOC, rDis ); Check( MN_READONLY_SELECTION_MODE, FN_READONLY_SELECTION_MODE, rDis ); Check( MN_READONLY_SOURCEVIEW, SID_SOURCEVIEW, rDis ); - Check( MN_READONLY_BROWSE_STOP, SID_BROWSE_STOP, rDis ); Check( MN_READONLY_BROWSE_BACKWARD, SID_BROWSE_BACKWARD,rDis ); Check( MN_READONLY_BROWSE_FORWARD, SID_BROWSE_FORWARD, rDis ); #ifdef WNT @@ -318,7 +317,6 @@ void SwReadOnlyPopup::Execute( Window* pWin, USHORT nId ) rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD); break; - case MN_READONLY_BROWSE_STOP: nExecId = SID_BROWSE_STOP; break; case MN_READONLY_BROWSE_BACKWARD: nExecId = SID_BROWSE_BACKWARD;break; case MN_READONLY_BROWSE_FORWARD: nExecId = SID_BROWSE_FORWARD; break; case MN_READONLY_SOURCEVIEW: nExecId = SID_SOURCEVIEW; break; -- cgit v1.2.3 From 59d8e4aaa91240076d5c1d185436a6bb7a237b31 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 20:48:33 +0100 Subject: [CWS autorecovery] while we are at it .... SID_BROWSE_STOP is dead, for a long time now ... --- default_images/res/commandimagelist/lc_stop.png | Bin 885 -> 0 bytes default_images/res/commandimagelist/lch_stop.png | Bin 144 -> 0 bytes default_images/res/commandimagelist/sc_stop.png | Bin 592 -> 0 bytes default_images/res/commandimagelist/sch_stop.png | Bin 123 -> 0 bytes .../industrial/res/commandimagelist/lc_stop.png | Bin 1302 -> 0 bytes .../industrial/res/commandimagelist/sc_stop.png | Bin 590 -> 0 bytes 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 default_images/res/commandimagelist/lc_stop.png delete mode 100644 default_images/res/commandimagelist/lch_stop.png delete mode 100644 default_images/res/commandimagelist/sc_stop.png delete mode 100644 default_images/res/commandimagelist/sch_stop.png delete mode 100644 ooo_custom_images/industrial/res/commandimagelist/lc_stop.png delete mode 100644 ooo_custom_images/industrial/res/commandimagelist/sc_stop.png diff --git a/default_images/res/commandimagelist/lc_stop.png b/default_images/res/commandimagelist/lc_stop.png deleted file mode 100644 index 17ad62f4c359..000000000000 Binary files a/default_images/res/commandimagelist/lc_stop.png and /dev/null differ diff --git a/default_images/res/commandimagelist/lch_stop.png b/default_images/res/commandimagelist/lch_stop.png deleted file mode 100644 index 6b9eb665828c..000000000000 Binary files a/default_images/res/commandimagelist/lch_stop.png and /dev/null differ diff --git a/default_images/res/commandimagelist/sc_stop.png b/default_images/res/commandimagelist/sc_stop.png deleted file mode 100644 index 699d99a3fb48..000000000000 Binary files a/default_images/res/commandimagelist/sc_stop.png and /dev/null differ diff --git a/default_images/res/commandimagelist/sch_stop.png b/default_images/res/commandimagelist/sch_stop.png deleted file mode 100644 index 16c76c8fb180..000000000000 Binary files a/default_images/res/commandimagelist/sch_stop.png and /dev/null differ diff --git a/ooo_custom_images/industrial/res/commandimagelist/lc_stop.png b/ooo_custom_images/industrial/res/commandimagelist/lc_stop.png deleted file mode 100644 index 4594ddaa4926..000000000000 Binary files a/ooo_custom_images/industrial/res/commandimagelist/lc_stop.png and /dev/null differ diff --git a/ooo_custom_images/industrial/res/commandimagelist/sc_stop.png b/ooo_custom_images/industrial/res/commandimagelist/sc_stop.png deleted file mode 100644 index ceeb384e349b..000000000000 Binary files a/ooo_custom_images/industrial/res/commandimagelist/sc_stop.png and /dev/null differ -- cgit v1.2.3 From 3a98b758e51d9dd66574ecbb7efe508a5f3ee253 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 20:56:41 +0100 Subject: [CWS autorecovery] SfxFrame::Browse is dead, too --- sfx2/inc/sfx2/frame.hxx | 1 - sfx2/source/view/frame.cxx | 5 ----- sfx2/source/view/topfrm.cxx | 7 +------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 3d783c80fb6b..c33626a5f648 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -215,7 +215,6 @@ public: SAL_DLLPRIVATE void SetCurrentViewFrame_Impl( SfxViewFrame* ); SAL_DLLPRIVATE sal_Bool IsClosing_Impl() const; SAL_DLLPRIVATE void SetIsClosing_Impl(); - SAL_DLLPRIVATE sal_Bool Browse( sal_Bool bForward, sal_uInt16 nDelta = 1, sal_Bool bNewFrame=sal_False ); // Methoden f"ur den Zugriff auf das aktuelle Set SAL_DLLPRIVATE void SetDescriptor( SfxFrameDescriptor* ); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 04d75a40fda6..a72822ec7c53 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -408,11 +408,6 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) pImp->nType = n; } -sal_Bool SfxFrame::Browse( sal_Bool /*bForward*/, sal_uInt16 /*nSteps*/, sal_Bool /*bNewFrame*/ ) -{ - return FALSE; -} - void SfxFrame::GetViewData_Impl() { // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index b73e187e8fd0..eaed659e6beb 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -1467,13 +1467,8 @@ void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) { case SID_BROWSE_FORWARD: case SID_BROWSE_BACKWARD: - { - // Anzeige der n"achsten oder vorherigen Seite aus der History - SFX_REQUEST_ARG( rRequest, pSteps, SfxUInt16Item, nSlotId, sal_False ); - GetFrame()->Browse( nSlotId == SID_BROWSE_FORWARD, pSteps ? pSteps->GetValue() : 1, - (rRequest.GetModifier() & KEY_MOD1) != 0 ); + OSL_ENSURE( false, "SfxTopViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); break; - } case SID_CREATELINK: { /*! (pb) we need new implementation to create a link -- cgit v1.2.3 From 05aee339c8c9a3bfe0e6ecb94bb9e58748e5fa1b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 21:43:54 +0100 Subject: [CWS autorecovery] #i65597# when reloading an SFX document, do this via UNO, not via internal methods. In particular, do not re-use existing SfxTopFrames. This implies slightly more flickering, but this should be bearable nowadays. The advantage is more simplified code. Also, on the medium run, when UNO view factories are implemented for SFX documents, the old approach would not have worked, anyway. --- sfx2/source/doc/objcont.cxx | 37 +++------------ sfx2/source/view/topfrm.cxx | 56 ++++++++--------------- sfx2/source/view/viewfrm.cxx | 105 +++++++++++++++++++------------------------ 3 files changed, 71 insertions(+), 127 deletions(-) diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 99253fbce806..3ea51f6b54e9 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -226,39 +226,12 @@ bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rTargetFrame ) pSet->ClearItem( SID_USER_DATA ); pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( rTargetFrame.GetCurrentViewFrame() ) - { - // TODO: the only client of this case is the Reload-implementation for SFX-based documents. This should be - // migrated to use UNO mechanisms, too. In this case, we can simplify the code here. - - // use the frame from the arguments, but don't set a window size - SfxViewFrame* pViewFrame = rTargetFrame.GetCurrentViewFrame(); - if ( pViewFrame->GetViewShell() || !pViewFrame->GetObjectShell() ) - { - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - - // avoid flickering controllers - SfxBindings &rBind = pViewFrame->GetBindings(); - rBind.ENTERREGISTRATIONS(); + OSL_ENSURE( rTargetFrame.GetCurrentViewFrame() == NULL, + "SfxObjectShell::LoadView_Impl: no support (anymore) for loading into a non-empty frame!" ); + // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays + // done in higher layers, namely in the framework. - // set document into frame - rTargetFrame.InsertDocument_Impl( *this ); - - // restart controller updating - rBind.LEAVEREGISTRATIONS(); - } - else - { - // create new view - pViewFrame->CreateView_Impl( nViewId ); - } - } - else - { - rTargetFrame.InsertDocument_Impl( *this ); - } + rTargetFrame.InsertDocument_Impl( *this ); SfxViewFrame* pViewFrame = rTargetFrame.GetCurrentViewFrame(); // only temporary data, don't hold it in the itemset diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 0f434a115fd8..740698d34e7c 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -822,48 +822,30 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) UpdateDescriptor( &rDoc ); - SfxViewFrame* pViewFrame = GetCurrentViewFrame(); - if ( pViewFrame ) - { - // TODO: the only client of this case is the Reload-implementation for SFX-based documents. This should be - // migrated to use UNO mechanisms, too. In this case, we can simplify the code here. - if ( pViewFrame->GetActiveChildFrame_Impl() && pViewFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) - { - pViewFrame->SetActiveChildFrame_Impl(0); - SfxViewFrame::SetViewFrame( pViewFrame ); - } + if ( pPluginMode && pPluginMode->GetValue() != 2 ) + SetInPlace_Impl( TRUE ); - if ( pViewFrame->GetObjectShell() ) - { - pViewFrame->ReleaseObjectShell_Impl( sal_False ); - } + OSL_ENSURE( GetCurrentViewFrame() == NULL, + "SfxTopFrame::InsertDocument_Impl: no support (anymore) for loading a document into a non-empty frame!" ); + // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays + // done in higher layers, namely in the framework. - if ( pViewIdItem ) - pViewFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); - pViewFrame->SetObjectShell_Impl( rDoc ); - } - else - { - if ( pPluginMode && pPluginMode->GetValue() != 2 ) - SetInPlace_Impl( TRUE ); - - pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); - if ( !pViewFrame->GetViewShell() ) - return sal_False; + SfxViewFrame* pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); + if ( !pViewFrame->GetViewShell() ) + return sal_False; - if ( pPluginMode && pPluginMode->GetValue() == 1 ) - { - pViewFrame->ForceOuterResize_Impl( FALSE ); - pViewFrame->GetBindings().HidePopups(TRUE); + if ( pPluginMode && pPluginMode->GetValue() == 1 ) + { + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups(TRUE); - // MBA: layoutmanager of inplace frame starts locked and invisible - GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - GetWorkWindow_Impl()->Lock_Impl( TRUE ); + // MBA: layoutmanager of inplace frame starts locked and invisible + GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + GetWorkWindow_Impl()->Lock_Impl( TRUE ); - GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } + GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index bbdfa40a78a0..081adde3a42f 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include @@ -56,6 +57,7 @@ #endif #include #include +#include #include #include #include @@ -66,6 +68,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +82,7 @@ #include #include #include +#include #include #include @@ -245,6 +249,7 @@ SfxObjectShell* SfxViewFrame::GetImportingObjectShell_Impl() const } +//-------------------------------------------------------------------- class SfxViewNotificatedFrameList_Impl : public SfxListener, public SfxViewFrameArr_Impl { @@ -632,25 +637,22 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // bestehende SfxMDIFrames f"ur dieses Doc leeren // eigenes Format oder R/O jetzt editierbar "offnen? - SfxViewNotificatedFrameList_Impl aFrames; SfxObjectShellLock xNewObj; - sal_Bool bRestoreView = ( pURLItem == NULL ); TypeId aOldType = xOldObj->Type(); - SfxViewFrame *pView = GetFirst(xOldObj); - while(pView) + // collect the views of the document + // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should + // be UNOized, too + typedef ::std::pair< Reference< XFrame >, USHORT > ViewDescriptor; + ::std::list< ViewDescriptor > aViewFrames; + SfxViewFrame *pView = GetFirst( xOldObj ); + while ( pView ) { - if( bHandsOff ) - pView->GetDispatcher()->LockUI_Impl(sal_True); - aFrames.InsertViewFrame( pView ); - pView->GetBindings().ENTERREGISTRATIONS(); - - // RestoreView nur wenn keine neue Datei geladen - // (Client-Pull-Reloading) - pView = /*bHandsOff ? (SfxTopViewFrame*) GetFirst( - xOldObj, TYPE(SfxTopViewFrame) ) :*/ - (SfxTopViewFrame*)GetNext( *pView, xOldObj, - TYPE( SfxTopViewFrame ) ); + Reference< XFrame > xFrame( pView->GetFrame()->GetFrameInterface() ); + OSL_ENSURE( xFrame.is(), "SfxViewFrame::ExecReload_Impl: no XFrame?!" ); + aViewFrames.push_back( ViewDescriptor( xFrame, pView->GetCurViewId() ) ); + + pView = (SfxTopViewFrame*)GetNext( *pView, xOldObj, TYPE( SfxTopViewFrame ) ); } DELETEZ( xOldObj->Get_Impl()->pReloadTimer ); @@ -759,12 +761,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD ); + uno::Sequence < beans::PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs ); try { - uno::Sequence < beans::PropertyValue > aProps; - TransformItems( SID_OPENDOC, *pNewSet, aProps ); uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY ); - xLoad->load( aProps ); + xLoad->load( aLoadArgs ); } catch ( uno::Exception& ) { @@ -816,56 +818,48 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { if ( xNewObj->IsDocShared() ) { - // the file is shared but the closing can chang the sharing control file + // the file is shared but the closing can change the sharing control file xOldObj->DoNotCleanShareControlFile(); } + // the Reload and Silent items were only temporary, remove them xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD ); xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT ); + TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs ); + UpdateDocument_Impl(); } - SfxViewFrame* pThis = (SfxViewFrame*)this; - sal_Bool bDeleted = aFrames.C40_GETPOS( SfxViewFrame, pThis ) == USHRT_MAX; - - if( !bDeleted ) + if ( xNewObj.Is() ) { - GetBindings().Invalidate( SID_RELOAD ); - pImp->bReloading = sal_False; - } - - // neues Doc in die bestehenden SfxMDIFrames einsetzen; wenn - // das Reload geklappt hat, mu\s in diesem Frame kein Dokument - // eingesetzt werden, weil das schon vom LoadEnvironment - // gemacht wurde - if ( xNewObj.Is() && xNewObj->Type() != aOldType ) - // RestoreView nur, wenn gleicher Dokumenttyp - bRestoreView = sal_False; + try + { + ::comphelper::NamedValueCollection aTransformLoadArgs( aLoadArgs ); + Reference< XModel > xDocument( xNewObj->GetModel(), UNO_SET_THROW ); + aTransformLoadArgs.put( "Model", xDocument ); - const sal_uInt16 nCount = aFrames.Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) - { - SfxViewFrame *pCurrView = aFrames.GetObject( i ); - if ( xNewObj.Is() ) + while ( !aViewFrames.empty() ) + { + aTransformLoadArgs.put( "ViewId", aViewFrames.front().second ); + Reference< XComponentLoader > xLoader( aViewFrames.front().first, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( xDocument->getURL(), ::rtl::OUString::createFromAscii( "_self" ), 0, + aTransformLoadArgs.getPropertyValues() ); + aViewFrames.pop_front(); + } + } + catch( const Exception& ) { - //if( /*!bHandsOff &&*/ this != pView ) - pCurrView->ReleaseObjectShell_Impl( bRestoreView ); - pCurrView->SetRestoreView_Impl( bRestoreView ); - //if( pView != this || !xNewObj.Is() ) + // close the remaining frames + // Don't catch exceptions herein, if this fails, then we're left in an indetermined state, and + // crashing is better than trying to proceed + while ( !aViewFrames.empty() ) { - SfxTopFrame* pFrame = dynamic_cast< SfxTopFrame* >( pCurrView->GetFrame() ); - OSL_ENSURE( pFrame, "An SfxFrame which is no SfxTopFrame?!" ); - if ( pFrame ) - pFrame->InsertDocument_Impl( *xNewObj ); + Reference< util::XCloseable > xClose( aViewFrames.front().first, UNO_QUERY_THROW ); + xClose->close( sal_True ); + aViewFrames.pop_front(); } } - pCurrView->GetBindings().LEAVEREGISTRATIONS(); - pCurrView->GetDispatcher()->LockUI_Impl( sal_False ); - } - - if ( xNewObj.Is() ) - { // Propagate document closure. SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); } @@ -873,11 +867,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // als erledigt recorden rReq.Done( sal_True ); rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True)); - if( !bDeleted ) - { - Notify( *GetObjectShell(), SfxSimpleHint( - SFX_HINT_TITLECHANGED )); - } return; } else -- cgit v1.2.3 From 8a09f55aaede159defcb32f2ea2ae02ea3d5c4a0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 21:43:54 +0100 Subject: [CWS autorecovery] #i65597# when reloading an SFX document, do this via UNO, not via internal methods. In particular, do not re-use existing SfxTopFrames. This implies slightly more flickering, but this should be bearable nowadays. The advantage is more simplified code. Also, on the medium run, when UNO view factories are implemented for SFX documents, the old approach would not have worked, anyway. --- sd/source/ui/view/drviews3.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 87374cce8c04..d6e25701fc96 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -101,9 +101,12 @@ #include #include #include +#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController; namespace sd { @@ -378,17 +381,15 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) try { + Reference< XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface(), UNO_SET_THROW ); + // Save the current configuration of panes and views. Reference xControllerManager ( GetViewShellBase().GetController(), UNO_QUERY_THROW); Reference xConfigurationController ( - xControllerManager->getConfigurationController()); - if ( ! xConfigurationController.is()) - throw RuntimeException(); + xControllerManager->getConfigurationController(), UNO_QUERY_THROW ); Reference xConfiguration ( - xConfigurationController->getRequestedConfiguration()); - if ( ! xConfiguration.is()) - throw RuntimeException(); + xConfigurationController->getRequestedConfiguration(), UNO_SET_THROW ); SfxChildWindow* pWindow = pFrame->GetChildWindow(nId); if(pWindow) @@ -401,14 +402,12 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) // Normale Weiterleitung an ViewFrame zur Ausfuehrung GetViewFrame()->ExecuteSlot(rReq); - // From here on we must cope with this object already being + // From here on we must cope with this object and the frame already being // deleted. Do not call any methods or use data members. - ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pFrame); - OSL_ASSERT(pBase!=NULL); + Reference xController( xFrame->getController(), UNO_SET_THROW ); // Restore the configuration. - xControllerManager = Reference( - pBase->GetController(), UNO_QUERY_THROW); + xControllerManager = Reference( xController, UNO_QUERY_THROW); xConfigurationController = Reference( xControllerManager->getConfigurationController()); if ( ! xConfigurationController.is()) -- cgit v1.2.3 From f79d2dca63518d29b41287431f24b523f71156d8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 21:59:14 +0100 Subject: #i10000# --- sfx2/source/view/viewfrm.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 081adde3a42f..5bc708ac558d 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -638,7 +638,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // bestehende SfxMDIFrames f"ur dieses Doc leeren // eigenes Format oder R/O jetzt editierbar "offnen? SfxObjectShellLock xNewObj; - TypeId aOldType = xOldObj->Type(); // collect the views of the document // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should -- cgit v1.2.3 From 63fe7c4dc33d5398b2e66f89ed6680d9c8e0aba0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 23 Nov 2009 21:59:14 +0100 Subject: #i10000# --- solenv/bin/build.pl | 3 --- 1 file changed, 3 deletions(-) mode change 100644 => 100755 solenv/bin/build.pl diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl old mode 100644 new mode 100755 index 40c310929eaa..e45d9edea770 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -753,9 +753,6 @@ sub BuildAll { }; modules_classify(keys %global_deps_hash); store_weights(\%global_deps_hash); - if (keys %active_modules && ($build_from || $incompatible)) { - print_error("There are active module in $source_config_file. Please remove these modules to proceed.\n"); - }; prepare_build_from(\%global_deps_hash) if ($build_from); prepare_incompatible_build(\%global_deps_hash) if ($incompatible); if ($build_all_cont || $build_since) { -- cgit v1.2.3 From 4d61332a3cb172cdfe29f64efb325f6ef20c573c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 24 Nov 2009 09:45:17 +0100 Subject: [CWS autorecovery] removed (now) unused methods in Sfx(Top)Frame --- sfx2/inc/sfx2/topfrm.hxx | 1 - sfx2/inc/sfx2/viewfrm.hxx | 13 --- sfx2/source/appl/app.cxx | 3 - sfx2/source/view/topfrm.cxx | 43 --------- sfx2/source/view/viewfrm.cxx | 216 +------------------------------------------ 5 files changed, 1 insertion(+), 275 deletions(-) diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index 0e072a8ac87d..d64c5d6de9a4 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -77,7 +77,6 @@ public: SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; - SAL_DLLPRIVATE void CheckMenuCloser_Impl( MenuBar* pMenubar ); SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; //#endif }; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d12e5ca7eabf..f39bc555aeb5 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -265,18 +265,11 @@ public: void ChildWindowState(SfxItemSet&); //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE SfxMacro* GetRecordingMacro_Impl(); SAL_DLLPRIVATE void SetFrame_Impl( SfxFrame* ); SAL_DLLPRIVATE void SetDowning_Impl(); SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE BOOL IsDowning_Impl() const; - SAL_DLLPRIVATE void SetSetViewFrameAllowed_Impl( BOOL bSet ); - SAL_DLLPRIVATE BOOL IsSetViewFrameAllowed_Impl() const; - SAL_DLLPRIVATE void SetImportingObjectShell_Impl( SfxObjectShell* pSH ); - SAL_DLLPRIVATE SfxObjectShell* GetImportingObjectShell_Impl( ) const; SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh ); - SAL_DLLPRIVATE void SetObjectShell_Impl( SfxObjectShell& rObjSh , - FASTBOOL bDefaultView = FALSE ); SAL_DLLPRIVATE void ReleaseObjectShell_Impl( BOOL bStoreView = FALSE ); SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet ); @@ -285,10 +278,8 @@ public: SAL_DLLPRIVATE void StateReload_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecView_Impl( SfxRequest &rReq ); SAL_DLLPRIVATE void StateView_Impl( SfxItemSet &rSet ); - SAL_DLLPRIVATE void PropState_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecHistory_Impl( SfxRequest &rReq ); SAL_DLLPRIVATE void StateHistory_Impl( SfxItemSet &rSet ); - SAL_DLLPRIVATE void SetParentViewFrame_Impl(SfxViewFrame *pParentFrame); SAL_DLLPRIVATE SfxViewFrame* GetParentViewFrame_Impl() const; SAL_DLLPRIVATE void ForceOuterResize_Impl(BOOL bOn=TRUE); SAL_DLLPRIVATE BOOL IsResizeInToOut_Impl() const; @@ -299,16 +290,13 @@ public: SAL_DLLPRIVATE void LockObjectShell_Impl(BOOL bLock=TRUE); - SAL_DLLPRIVATE SfxViewShell* CreateView_Impl( USHORT nViewId ); SAL_DLLPRIVATE void MakeActive_Impl( BOOL bActivate ); SAL_DLLPRIVATE void SetQuietMode_Impl( BOOL ); SAL_DLLPRIVATE const Size& GetMargin_Impl() const; - SAL_DLLPRIVATE void SetMargin_Impl( const Size& ); SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* ); SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const; SAL_DLLPRIVATE BOOL IsRestoreView_Impl() const; SAL_DLLPRIVATE void SetRestoreView_Impl( BOOL ); - SAL_DLLPRIVATE void SetViewData_Impl( USHORT, const String& ); SAL_DLLPRIVATE String& GetViewData_Impl(); SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const; SAL_DLLPRIVATE static void CloseHiddenFrames_Impl(); @@ -316,7 +304,6 @@ public: SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( USHORT nId ); SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const ::rtl::OUString& sMacro); - SAL_DLLPRIVATE BOOL ClearEventFlag_Impl(); //#endif }; diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 98c2bd0f55d7..a4aaa8465ada 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -476,9 +476,6 @@ SfxDispatcher* SfxApplication::GetDispatcher_Impl() //-------------------------------------------------------------------- void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) { - if( pFrame && !pFrame->IsSetViewFrameAllowed_Impl() ) - return; - if ( pFrame != pAppData_Impl->pViewFrame ) { // get the containerframes ( if one of the frames is an InPlaceFrame ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 740698d34e7c..d5ee2b6f8eac 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -1469,46 +1469,3 @@ void SfxTopViewFrame::Deactivate( sal_Bool bMDI ) pImp->bActive = sal_False; //(mba): hier evtl. wie in Beanframe NotifyEvent ?! } - -void SfxTopFrame::CheckMenuCloser_Impl( MenuBar* pMenuBar ) -{ - Reference < ::com::sun::star::frame::XFrame > xFrame = GetFrameInterface(); - - // checks if there is more than one "real" (not help) task window - // in this case a close button is inserted into the menubar - - DBG_ASSERT( xFrame.is(), "Attention: this bug is very hard to reproduce. Please try to remember how you triggered it!"); - if ( !xFrame.is() || !xFrame->getController().is() ) - // dummy component - return; - - Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop( xFrame->getCreator(), UNO_QUERY ); - if ( !xDesktop.is() ) - // test only for task windows - return; - - sal_Bool bLastTask = sal_False; - Reference < ::com::sun::star::container::XIndexAccess > - xList ( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - if ( nCount<=1 ) - // only one task - bLastTask = sal_True; - else if ( nCount==2 ) - { - // if we have to tasks, one can be the help task, that should be ignored - for( sal_Int32 i=0; i xTask; - ::com::sun::star::uno::Any aVal = xList->getByIndex(i); - if ( (aVal>>=xTask) && xTask.is() && xTask->getName().compareToAscii("OFFICE_HELP_TASK") == COMPARE_EQUAL ) - { - // one of the two open tasks was the help task -> ignored - bLastTask = sal_True; - break; - } - } - } - - pMenuBar->ShowCloser(bLastTask); -} diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 081adde3a42f..cea0419a8e78 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -180,28 +180,22 @@ struct SfxViewFrame_Impl //SfxInPlaceFrame* pIPFrame; Window* pWindow; SfxViewFrame* pActiveChild; - SfxViewFrame* pParentViewFrame; - SfxObjectShell* pImportShell; Window* pFocusWin; - SfxMacro* pMacro; sal_uInt16 nDocViewNo; sal_uInt16 nCurViewId; sal_Bool bResizeInToOut:1; sal_Bool bDontOverwriteResizeInToOut:1; sal_Bool bObjLocked:1; sal_Bool bRestoreView:1; - sal_Bool bSetViewFrameLocked:1; sal_Bool bReloading:1; sal_Bool bIsDowning:1; sal_Bool bInCtor:1; sal_Bool bModal:1; sal_Bool bEnabled:1; - sal_Bool bEventFlag:1; sal_Bool bWindowWasEnabled:1; SfxViewFrame_Impl() : pReloader(0 ) - , pMacro( 0 ) , bWindowWasEnabled(sal_True) {} @@ -224,31 +218,6 @@ sal_Bool SfxViewFrame::IsDowning_Impl() const } -//------------------------------------------------------------------------- -void SfxViewFrame::SetSetViewFrameAllowed_Impl( sal_Bool bSet ) -{ - pImp->bSetViewFrameLocked = !bSet; -}; - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsSetViewFrameAllowed_Impl() const -{ - return !pImp->bSetViewFrameLocked; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetImportingObjectShell_Impl( SfxObjectShell* pSh ) -{ - pImp->pImportShell = pSh; -} - -//-------------------------------------------------------------------- -SfxObjectShell* SfxViewFrame::GetImportingObjectShell_Impl() const -{ - return pImp->pImportShell; -} - - //-------------------------------------------------------------------- class SfxViewNotificatedFrameList_Impl : public SfxListener, public SfxViewFrameArr_Impl @@ -1066,83 +1035,6 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) rSet.DisableItem( SID_REPEAT ); } -//-------------------------------------------------------------------- -void SfxViewFrame::SetObjectShell_Impl -( - SfxObjectShell& rObjSh, // eine initialisierte SfxObjectShell, - FASTBOOL bDefaultView // sal_True: nicht restaurieren -) - -/* [Beschreibung] - - Diese Methode setzt eine in den SfxViewFrame ein. - - Zuvor mu\s die vorherige SfxObjectShell, insofern schein eine gesetzt - wurde, mit der Methode ReleaseObjectShell() entfernt worden sein. Somit - kann durch Aufruf von ReleaseObjectShell() und SetObjectShell() die - SfxObjectShell ausgetauscht werden. - - - [Querverweise] - - -*/ - -{ - DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( !xObjSh.Is(), "old feature used: only one Object per View!" ); - - GetFrame()->ReleasingComponent_Impl( sal_False ); - - // Doc einsetzen - xObjSh = &rObjSh; - if ( xObjSh.Is() && xObjSh->IsPreview() ) - SetQuietMode_Impl( sal_True ); - - // Modulshell einf"ugen - SfxModule* pModule = xObjSh->GetModule(); - if( pModule ) - pDispatcher->InsertShell_Impl( *pModule, 1 ); - - pDispatcher->Push( rObjSh ); - pDispatcher->Flush(); - StartListening( rObjSh ); - - rObjSh.ViewAssigned(); - pDispatcher->SetReadOnly_Impl( rObjSh.IsReadOnly() ); - - const SfxMedium *pMedium = GetObjectShell()->GetMedium(); - SFX_ITEMSET_ARG( - pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( !pHiddenItem || !pHiddenItem->GetValue() ) - { - LockObjectShell_Impl(sal_True); - GetDocNumber_Impl(); - } - - // View erzeugen - if ( bDefaultView ) - SetRestoreView_Impl( sal_False ); - -// So darf man es nicht machen, da LaodWindows hierueber laeuft. Kann meiner Meinung nach -// auch nur beim Reload mit Dokumenttypwechsel passieren. -/* if ( xObjSh->Type() != pImp->aLastType ) - SetRestoreView_Impl( sal_False ); */ - - SwitchToViewShell_Impl( !IsRestoreView_Impl() ? (sal_uInt16) 0 : GetCurViewId() ); - rObjSh.PostActivateEvent_Impl( this ); - if ( Current() == this ) - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), &rObjSh ) ); - - Notify( rObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - Notify( rObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); - - // Zur Sicherheit, aber eigentlich sollte jetzt nichts mehr passieren - // ( kein erzwungenes Update ) - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl(); -} - //-------------------------------------------------------------------- void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) @@ -1611,17 +1503,13 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { pImp->bInCtor = sal_True; - pImp->pParentViewFrame = 0; pImp->bResizeInToOut = sal_True; pImp->bDontOverwriteResizeInToOut = sal_False; - pImp->pImportShell = 0; pImp->bObjLocked = sal_False; - pImp->bEventFlag = sal_True; pImp->pFocusWin = 0; pImp->pActiveChild = NULL; pImp->bRestoreView = sal_False; pImp->nCurViewId = 0; - pImp->bSetViewFrameLocked = sal_False; pImp->bReloading = sal_False; pImp->bIsDowning = sal_False; pImp->bModal = sal_False; @@ -1724,10 +1612,6 @@ SfxViewFrame::~SfxViewFrame() if ( GetFrame() && GetFrame()->GetCurrentViewFrame() == this ) GetFrame()->SetCurrentViewFrame_Impl( NULL ); - SfxObjectShell* pSh = pImp->pImportShell; - if( pSh ) - pSh->AbortImport(); - // von Frame-Liste abmelden SfxApplication *pSfxApp = SFX_APP(); SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl(); @@ -1975,21 +1859,10 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace */ -void SfxViewFrame::SetParentViewFrame_Impl(SfxViewFrame *pFrame) -{ - pImp->pParentViewFrame = pFrame; -} - -//-------------------------------------------------------------------- -/* - Beschreibung: - Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace -*/ - //TODO/LATER: is it still necessary? is there a replacement for GetParentViewFrame_Impl? SfxViewFrame* SfxViewFrame::GetParentViewFrame_Impl() const { - return pImp->pParentViewFrame; + return NULL; } //-------------------------------------------------------------------- @@ -2203,64 +2076,6 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } } -//-------------------------------------------------------------------- - -SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) - -/* [Beschreibung] - - Erzeugt eine SfxViewShell f"ur diesen SfxViewFrame. Wird auch aus - - gerufen. -*/ - -{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - LockAdjustPosSizePixel(); - - // passende View-Factory suchen - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - sal_uInt16 nNewNo = nViewId ? USHRT_MAX : 0; - for ( sal_uInt16 nNo = 0; - nNo < rDocFact.GetViewFactoryCount(); - ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( nViewId == nFoundId ) - nNewNo = nNo; - } - } - - // per Factory erzeugen - GetBindings().ENTERREGISTRATIONS(); - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - SfxViewShell *pViewShell = rViewFactory.CreateInstance(this, 0); - SetViewShell_Impl(pViewShell); - UnlockAdjustPosSizePixel(); - - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel(pViewShell, Point(), GetWindow().GetOutputSizePixel()); - - // erste jetzt anzeigen (ausser wenn MTs BASIC-IDE mal wieder keins hat) - Window *pViewWin = pViewShell->GetWindow(); - if ( pViewWin && pViewShell->IsShowView_Impl() ) - pViewWin->Show(); - - // Dispatcher - GetDispatcher()->Push( *pViewShell ); - if ( pViewShell->GetSubShell() ) - GetDispatcher()->Push( *pViewShell->GetSubShell() ); - pViewShell->PushSubShells_Impl(); - - GetBindings().LEAVEREGISTRATIONS(); - - DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); - return pViewShell; -} - //------------------------------------------------------------------------- void SfxViewFrame::SetQuietMode_Impl( sal_Bool bOn ) @@ -2275,11 +2090,6 @@ SfxObjectShell* SfxViewFrame::GetObjectShell() return xObjSh; } -void SfxViewFrame::SetMargin_Impl( const Size& rMargin ) -{ - pImp->aMargin = rMargin; -} - const Size& SfxViewFrame::GetMargin_Impl() const { return pImp->aMargin; @@ -2508,14 +2318,6 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); return sal_True; } -//-------------------------------------------------------------------- - -void SfxViewFrame::SetViewData_Impl( sal_uInt16 nViewId, const String &rViewData ) -{ - pImp->bRestoreView = sal_True; - pImp->nCurViewId = nViewId; - pImp->aViewData = rViewData; -} //------------------------------------------------------------------------- String& SfxViewFrame::GetViewData_Impl() @@ -3770,11 +3572,6 @@ SfxChildWindow* SfxViewFrame::GetChildWindow(USHORT nId) return pWork ? pWork->GetChildWindow_Impl(nId) : NULL; } -SfxMacro* SfxViewFrame::GetRecordingMacro_Impl() -{ - return pImp->pMacro; -} - void SfxViewFrame::UpdateDocument_Impl() { SfxObjectShell* pDoc = GetObjectShell(); @@ -3785,17 +3582,6 @@ void SfxViewFrame::UpdateDocument_Impl() pDoc->UpdateFromTemplate_Impl(); } -BOOL SfxViewFrame::ClearEventFlag_Impl() -{ - if ( pImp->bEventFlag ) - { - pImp->bEventFlag = FALSE; - return TRUE; - } - else - return FALSE; -} - SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nViewId, sal_Bool bHidden ) { SfxItemSet *pSet = rDoc.GetMedium()->GetItemSet(); -- cgit v1.2.3 From 85581b9144747e40c9f9374afbcfd63498cf5ac8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 09:31:42 +0100 Subject: move LoadView_Impl from SfxObjectShell to SfxTopFrame --- sfx2/inc/sfx2/objsh.hxx | 4 +-- sfx2/inc/sfx2/topfrm.hxx | 1 + sfx2/source/doc/objcont.cxx | 65 ------------------------------------------ sfx2/source/doc/objxtor.cxx | 1 - sfx2/source/view/topfrm.cxx | 69 +++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 68 insertions(+), 72 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 0ebfd74c55a9..0c940b8627e7 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -221,7 +221,7 @@ private: SfxMedium * pMedium; // Beschreibung der Datei bzw. des Storage, in dem sich das Objekt befindet SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets SfxObjectCreateMode eCreateMode; // Zweck des Objekts - sal_uInt16 nViewNo; // Numerierung der MDIWins + sal_uInt16 nUnused; sal_Bool bHasName :1, // sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt bIsTmp :1; // temp. Storage @@ -785,10 +785,8 @@ public: // public-internals SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); SAL_DLLPRIVATE void SetProgress_Impl( SfxProgress *pProgress ); - SAL_DLLPRIVATE sal_uInt16& GetAktViewNo() { return nViewNo; } SAL_DLLPRIVATE void PostActivateEvent_Impl( SfxViewFrame* ); SAL_DLLPRIVATE void SetActivateEvent_Impl(sal_uInt16 ); - SAL_DLLPRIVATE bool LoadView_Impl( SfxTopFrame& rPrefered ); SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index d64c5d6de9a4..47053774b9d4 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -78,6 +78,7 @@ public: SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; + SAL_DLLPRIVATE bool LoadView_Impl( SfxObjectShell& rDoc ); //#endif }; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 3ea51f6b54e9..e1890be33223 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -52,7 +52,6 @@ #include #include #include -#include #include #include #include @@ -89,8 +88,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -using ::com::sun::star::document::XViewDataSupplier; -using ::com::sun::star::container::XIndexAccess; //==================================================================== @@ -193,68 +190,6 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig //==================================================================== -bool SfxObjectShell::LoadView_Impl( SfxTopFrame& rTargetFrame ) -{ - DBG_ASSERT( GetMedium(), "A Medium should exist here!"); - if ( !GetMedium() ) - return false; - - // obtain view data - Reference< XViewDataSupplier > xViewDataSupplier( GetModel(), UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); - - if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) - return false; - - // obtain the ViewID from the view data - USHORT nViewId = 0; - SEQUENCE < PROPERTYVALUE > aUserData; - if ( xViewData->getByIndex( 0 ) >>= aUserData ) - { - ::comphelper::NamedValueCollection aNamedUserData( aUserData ); - ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( sViewId.getLength() ) - { - sViewId = sViewId.copy( 4 ); // format is like in "view3" - nViewId = USHORT( sViewId.toInt32() ); - } - } - - SfxItemSet* pSet = GetMedium()->GetItemSet(); - pSet->ClearItem( SID_USER_DATA ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - OSL_ENSURE( rTargetFrame.GetCurrentViewFrame() == NULL, - "SfxObjectShell::LoadView_Impl: no support (anymore) for loading into a non-empty frame!" ); - // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays - // done in higher layers, namely in the framework. - - rTargetFrame.InsertDocument_Impl( *this ); - SfxViewFrame* pViewFrame = rTargetFrame.GetCurrentViewFrame(); - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) - { - pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); - } - - if ( pViewFrame ) - // activate frame - pViewFrame->MakeActive_Impl( TRUE ); - - return true; -} - -//==================================================================== - void SfxObjectShell::UpdateDocInfoForSave() { uno::Reference xDocProps(getDocProperties()); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 22b239a3c5da..fcd618405008 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -315,7 +315,6 @@ SfxObjectShell::SfxObjectShell DBG_CTOR(SfxObjectShell, 0); bHasName = sal_False; - nViewNo = 0; pImp->bWaitingForPicklist = sal_True; diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index d5ee2b6f8eac..c5a2862ea770 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -39,9 +39,8 @@ #include #include #include -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include -#endif +#include #include #include #include @@ -59,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +104,7 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; +using ::com::sun::star::document::XViewDataSupplier; //------------------------------------------------------------------------ @@ -768,6 +769,68 @@ void SfxTopFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const } } +bool SfxTopFrame::LoadView_Impl( SfxObjectShell& rDoc ) +{ + OSL_PRECOND( rDoc.GetMedium(), "SfxTopFrame::LoadView_Impl: no medium -> no view!"); + if ( !rDoc.GetMedium() ) + return false; + + OSL_PRECOND( GetCurrentViewFrame() == NULL, + "SfxObjectShell::LoadView_Impl: no support (anymore) for loading into a non-empty frame!" ); + // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays + // done in higher layers, namely in the framework. + if ( GetCurrentViewFrame() != NULL ) + return false; + + // obtain view data + Reference< XViewDataSupplier > xViewDataSupplier( rDoc.GetModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); + + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + return false; + + // obtain the ViewID from the view data + USHORT nViewId = 0; + Sequence< PropertyValue > aUserData; + if ( xViewData->getByIndex( 0 ) >>= aUserData ) + { + ::comphelper::NamedValueCollection aNamedUserData( aUserData ); + ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( sViewId.getLength() ) + { + sViewId = sViewId.copy( 4 ); // format is like in "view3" + nViewId = USHORT( sViewId.toInt32() ); + } + } + + SfxItemSet* pSet = rDoc.GetMedium()->GetItemSet(); + pSet->ClearItem( SID_USER_DATA ); + pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + + InsertDocument_Impl( rDoc ); + SfxViewFrame* pViewFrame = GetCurrentViewFrame(); + + // only temporary data, don't hold it in the itemset + pSet->ClearItem( SID_VIEW_POS_SIZE ); + pSet->ClearItem( SID_WIN_POSSIZE ); + pSet->ClearItem( SID_VIEW_ZOOM_MODE ); + + // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE + // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet + if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) + { + pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); + } + + if ( pViewFrame ) + // activate frame + pViewFrame->MakeActive_Impl( TRUE ); + + return true; +} + sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) /* [Beschreibung] */ @@ -810,7 +873,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // aus LoadView_Impl aufgerufen wurde! if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - if ( rDoc.LoadView_Impl( *this ) ) + if ( LoadView_Impl( rDoc ) ) { if ( GetCurrentDocument() != &rDoc ) // something went wrong during insertion -- cgit v1.2.3 From 49e67cf6135582501b38e483765bb213068c46f4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 09:32:26 +0100 Subject: [CWS autorecovery] get rid of LoadView_Impl, and thus the recursive calling of InsertDocument_Impl --- sfx2/inc/sfx2/topfrm.hxx | 1 - sfx2/source/view/topfrm.cxx | 189 +++++++++++++++++++++++--------------------- 2 files changed, 97 insertions(+), 93 deletions(-) diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index 47053774b9d4..d64c5d6de9a4 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -78,7 +78,6 @@ public: SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; - SAL_DLLPRIVATE bool LoadView_Impl( SfxObjectShell& rDoc ); //#endif }; diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index c5a2862ea770..6f6c2939cc7c 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -769,85 +769,60 @@ void SfxTopFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const } } -bool SfxTopFrame::LoadView_Impl( SfxObjectShell& rDoc ) +namespace { - OSL_PRECOND( rDoc.GetMedium(), "SfxTopFrame::LoadView_Impl: no medium -> no view!"); - if ( !rDoc.GetMedium() ) - return false; - - OSL_PRECOND( GetCurrentViewFrame() == NULL, - "SfxObjectShell::LoadView_Impl: no support (anymore) for loading into a non-empty frame!" ); - // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays - // done in higher layers, namely in the framework. - if ( GetCurrentViewFrame() != NULL ) - return false; + bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) + { + _o_viewData.realloc(0); + _o_viewId = -1; - // obtain view data - Reference< XViewDataSupplier > xViewDataSupplier( rDoc.GetModel(), UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); + Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); - if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) - return false; + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + return false; - // obtain the ViewID from the view data - USHORT nViewId = 0; - Sequence< PropertyValue > aUserData; - if ( xViewData->getByIndex( 0 ) >>= aUserData ) - { - ::comphelper::NamedValueCollection aNamedUserData( aUserData ); - ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( sViewId.getLength() ) + // obtain the ViewID from the view data + _o_viewId = 0; + if ( xViewData->getByIndex( 0 ) >>= _o_viewData ) { - sViewId = sViewId.copy( 4 ); // format is like in "view3" - nViewId = USHORT( sViewId.toInt32() ); + ::comphelper::NamedValueCollection aNamedUserData( _o_viewData ); + ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( sViewId.getLength() ) + { + sViewId = sViewId.copy( 4 ); // format is like in "view3" + _o_viewId = USHORT( sViewId.toInt32() ); + } } + return true; } - - SfxItemSet* pSet = rDoc.GetMedium()->GetItemSet(); - pSet->ClearItem( SID_USER_DATA ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - InsertDocument_Impl( rDoc ); - SfxViewFrame* pViewFrame = GetCurrentViewFrame(); - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) - { - pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); - } - - if ( pViewFrame ) - // activate frame - pViewFrame->MakeActive_Impl( TRUE ); - - return true; } sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) /* [Beschreibung] */ { - const SfxObjectShell* pOldDocument = GetCurrentDocument(); - OSL_PRECOND( pOldDocument == NULL, + OSL_PRECOND( rDoc.GetMedium(), "SfxTopFrame::InsertDocument_Impl: no medium -> no view!"); + if ( !rDoc.GetMedium() ) + return sal_False; + + OSL_PRECOND( GetCurrentViewFrame() == NULL, + "SfxObjectShell::InsertDocument_Impl: no support (anymore) for loading into a non-empty frame!" ); + // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays + // done in higher layers, namely in the framework. + if ( GetCurrentViewFrame() != NULL ) + return sal_False; + + OSL_PRECOND( GetCurrentDocument() == NULL, "SfxTopFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); const SfxItemSet* pSet = GetItemSet_Impl(); if ( !pSet ) pSet = rDoc.GetMedium()->GetItemSet(); - SetItemSet_Impl(0); + SetItemSet_Impl( NULL ); - // Position und Groesse testen - // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch - // LoadView_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() - // an einer Task aufgerufen hat! ) SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size SFX_ITEMSET_ARG( pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID SFX_ITEMSET_ARG( pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom @@ -857,47 +832,58 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) SFX_ITEMSET_ARG( pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) SFX_ITEMSET_ARG( pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) - if ( pEditItem && pEditItem->GetValue() ) + // hidden? + OSL_PRECOND( !pImp->bHidden, + "SfxTopFrame::InsertDocument_Impl: quite unexpected ... the below logic might not work in all cases here ..." ); + pImp->bHidden = pHidItem ? pHidItem->GetValue() : false; + + // plugin mode + const USHORT nPluginMode = pPluginMode ? pPluginMode->GetValue() : 0; + + // view only? + if ( pEditItem && pEditItem->GetValue() ) SetMenuBarOn_Impl( FALSE ); - if ( pHidItem ) - pImp->bHidden = pHidItem->GetValue(); + // view ID + USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; if( !pImp->bHidden ) rDoc.OwnerLock( sal_True ); - const USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; + Sequence< PropertyValue > aUserData; + bool bClearPosSizeZoom = false; + bool bReadUserData = false; - // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation - // aus den Dokument geladen werden, z.B. weil InsertDocument_Impl seinerseits - // aus LoadView_Impl aufgerufen wurde! - if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + // if no view-related data exists in the set, then obtain the view data from the model + if ( !pJumpItem && !pViewDataItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - if ( LoadView_Impl( rDoc ) ) + nViewId = 0; + if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { - if ( GetCurrentDocument() != &rDoc ) - // something went wrong during insertion - return sal_False; - rDoc.OwnerLock( sal_False ); - return sal_True; + SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); + + // clear the user data item in the medium - we'll use aUserData below + pMediumSet->ClearItem( SID_USER_DATA ); + pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + + bClearPosSizeZoom = bReadUserData = true; } } UpdateDescriptor( &rDoc ); - if ( pPluginMode && pPluginMode->GetValue() != 2 ) + if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - OSL_ENSURE( GetCurrentViewFrame() == NULL, - "SfxTopFrame::InsertDocument_Impl: no support (anymore) for loading a document into a non-empty frame!" ); - // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays - // done in higher layers, namely in the framework. - SfxViewFrame* pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); if ( !pViewFrame->GetViewShell() ) + { + OSL_ENSURE( false, "SfxTopFrame::InsertDocument_Impl: something went wrong while creating the SfxTopViewFrame!" ); + pViewFrame->DoClose(); return sal_False; + } - if ( pPluginMode && pPluginMode->GetValue() == 1 ) + if ( nPluginMode == 1 ) { pViewFrame->ForceOuterResize_Impl( FALSE ); pViewFrame->GetBindings().HidePopups(TRUE); @@ -907,8 +893,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) GetWorkWindow_Impl()->Lock_Impl( TRUE ); GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, @@ -917,17 +902,21 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since loads this method // here is never called before the load process finished. if ( pViewDataItem ) + { pViewFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); + } else if( pJumpItem ) + { pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); + } // Position und Groesse setzen - if ( pAreaItem && !pOldDocument ) + if ( pAreaItem ) PositionWindow_Impl( pAreaItem->GetValue() ); if ( !pImp->bHidden ) { - if ( rDoc.IsHelpDocument() || (pPluginMode && pPluginMode->GetValue() == 2) ) + if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) pViewFrame->GetDispatcher()->HideUI( TRUE ); else pViewFrame->GetDispatcher()->HideUI( FALSE ); @@ -935,26 +924,23 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if ( IsInPlace() ) pViewFrame->LockAdjustPosSizePixel(); - if ( pPluginMode && pPluginMode->GetValue() == 3) + if ( ( nPluginMode == 3 ) ) GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); if ( !IsInPlace() ) pViewFrame->GetDispatcher()->Update_Impl(); pViewFrame->Show(); GetWindow().Show(); - if ( !IsInPlace() || (pPluginMode && pPluginMode->GetValue() == 3) ) + if ( !IsInPlace() || ( nPluginMode == 3 ) ) pViewFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); rDoc.OwnerLock( sal_False ); - // Dont show container window! Its done by framework or directly - // by SfxTopFrame::Create() or SfxViewFrame::ExecView_Impl() ... - if ( IsInPlace() ) { pViewFrame->UnlockAdjustPosSizePixel(); // force resize for OLE server to fix layout problems of writer and math // see i53651 - if ( pPluginMode && pPluginMode->GetValue() == 3 ) + if ( nPluginMode == 3 ) pViewFrame->Resize(TRUE); } } @@ -981,7 +967,26 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); - return sal_True; + + if ( bClearPosSizeZoom ) + { + SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); + pMediumSet->ClearItem( SID_VIEW_POS_SIZE ); + pMediumSet->ClearItem( SID_WIN_POSSIZE ); + pMediumSet->ClearItem( SID_VIEW_ZOOM_MODE ); + } + + if ( bReadUserData ) + { + // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE + // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet + if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) + { + pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); + } + } + + return GetCurrentDocument() == &rDoc; } -- cgit v1.2.3 From 4f36183eb9be25a723afee4b4e2b4555591ee903 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 09:33:27 +0100 Subject: broke down ::load into smaller pieces --- sfx2/inc/frmload.hxx | 45 ++++- sfx2/source/view/frmload.cxx | 379 +++++++++++++++++++++++-------------------- 2 files changed, 240 insertions(+), 184 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 5053f6a2a8f8..4d6207bcb22f 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -52,6 +52,7 @@ #include #include #include +#include class SfxFilter; class SfxFilterMatcher; @@ -59,13 +60,14 @@ class SfxFrame; #include +class SfxFrameWeak; + class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > { ::comphelper::ComponentContext m_aContext; public: SfxFrameLoader_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); - virtual ~SfxFrameLoader_Impl(); SFX_DECL_XSERVICEINFO @@ -75,6 +77,9 @@ public: virtual sal_Bool SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) throw( ::com::sun::star::uno::RuntimeException ); virtual void SAL_CALL cancel() throw( ::com::sun::star::uno::RuntimeException ); +protected: + virtual ~SfxFrameLoader_Impl(); + private: const SfxFilter* impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const; ::rtl::OUString impl_askForFilter_nothrow( @@ -84,22 +89,50 @@ private: const SfxFilter* impl_detectFilterForURL( const ::rtl::OUString& _rURL, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs, + const ::comphelper::NamedValueCollection& i_rDescriptor, const SfxFilterMatcher& rMatcher ) const; sal_Bool impl_createNewDocWithSlotParam( - const sal_uInt16 _nSlotID, - SfxFrame* _pFrame + const USHORT _nSlotID, + SfxFrame& i_rFrame ); sal_Bool impl_createNewDoc( - const SfxItemSet& _rSet, - SfxFrame* _pFrame, + const ::comphelper::NamedValueCollection& i_rDescriptor, + SfxFrame& i_rFrame, const ::rtl::OUString& _rFactoryURL ); void impl_ensureValidFrame_throw( const SfxFrame* _pFrame ); + + const SfxFilter* impl_determineFilter( + ::comphelper::NamedValueCollection& io_rDescriptor, + const SfxFilterMatcher& rMatcher + ); + + SfxAllItemSet impl_getInitialItemSet( + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; + + sal_Bool impl_loadExistingDocument( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxTargetFrame, + const ::comphelper::NamedValueCollection& i_rDescriptor + ); + + sal_Bool impl_cleanUp( + const sal_Bool i_bSuccess, + const SfxFrameWeak& i_wFrame + ); + + const SfxFilter* impl_determineTemplateDocument( + ::comphelper::NamedValueCollection& io_rDescriptor + ) const; + + USHORT impl_findSlotParam( + ::rtl::OUString& io_rFactoryURL + ); }; #endif diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index cab90ed821c4..bc566793e786 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -113,7 +113,7 @@ SfxFrameLoader_Impl::~SfxFrameLoader_Impl() // -------------------------------------------------------------------------------------------------------------------- const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUString& sURL, - const Sequence< PropertyValue >& rArgs, const SfxFilterMatcher& rMatcher ) const + const ::comphelper::NamedValueCollection& i_rDescriptor, const SfxFilterMatcher& rMatcher ) const { ::rtl::OUString sFilter; try @@ -128,11 +128,10 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt ::comphelper::NamedValueCollection aNewArgs; aNewArgs.put( "URL", sURL ); - ::comphelper::NamedValueCollection aOrgArgs( rArgs ); - if ( aOrgArgs.has( "InteractionHandler" ) ) - aNewArgs.put( "InteractionHandler", aOrgArgs.get( "InteractionHandler" ) ); - if ( aOrgArgs.has( "StatusIndicator" ) ) - aNewArgs.put( "StatusIndicator", aOrgArgs.get( "StatusIndicator" ) ); + if ( i_rDescriptor.has( "InteractionHandler" ) ) + aNewArgs.put( "InteractionHandler", i_rDescriptor.get( "InteractionHandler" ) ); + if ( i_rDescriptor.has( "StatusIndicator" ) ) + aNewArgs.put( "StatusIndicator", i_rDescriptor.get( "StatusIndicator" ) ); Sequence< PropertyValue > aQueryArgs( aNewArgs.getPropertyValues() ); ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aQueryArgs, sal_True ); @@ -250,241 +249,270 @@ namespace } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const sal_uInt16 _nSlotID, SfxFrame* _pFrame ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, SfxFrame& i_rFrame ) { SfxApplication* pApp = SFX_APP(); SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); - aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, _pFrame ) ); + aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, &i_rFrame ) ); return lcl_getDispatchResult( pApp->ExecuteSlot( aRequest ) ); } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const SfxItemSet& _rSet, SfxFrame* _pFrame, const ::rtl::OUString& _rFactoryURL ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, SfxFrame& i_rFrame, + const ::rtl::OUString& _rFactoryURL ) { - SfxApplication* pApp = SFX_APP(); + SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); - SfxRequest aRequest( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, _rSet ); - aRequest.AppendItem( SfxFrameItem( SID_DOCFRAME, _pFrame ) ); + SfxRequest aRequest( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); + aRequest.AppendItem( SfxFrameItem( SID_DOCFRAME, &i_rFrame ) ); aRequest.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, _rFactoryURL ) ); - SFX_ITEMSET_ARG( &_rSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); + SFX_ITEMSET_ARG( &aSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); if ( pDocumentTitleItem ) aRequest.AppendItem( *pDocumentTitleItem ); - return lcl_getDispatchResult( pApp->NewDocDirectExec_ImplOld( aRequest ) ); + return lcl_getDispatchResult( SFX_APP()->NewDocDirectExec_ImplOld( aRequest ) ); } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyValue >& rArgs, - const Reference< css::frame::XFrame >& _rTargetFrame ) - throw( css::uno::RuntimeException ) +const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor, const SfxFilterMatcher& rMatcher ) { - ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const ::rtl::OUString sTypeName = io_rDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); + const ::rtl::OUString sFilterName = io_rDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const Reference< XInteractionHandler > + xInteraction = io_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); - // this methods assumes that the filter is detected before, usually by calling the detect() method below - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + const SfxFilter* pFilter = NULL; - RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); + // get filter by its name directly ... + if ( sFilterName.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sFilterName ); - ::comphelper::NamedValueCollection aDescriptor( rArgs ); - const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); - const ::rtl::OUString sTypeName = aDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); - ::rtl::OUString sFilterName = aDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); - const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); - const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); - const Reference< XInteractionHandler > - xInteraction = aDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); + // or search the preferred filter for the detected type ... + if ( !pFilter && sTypeName.getLength() ) + pFilter = rMatcher.GetFilter4EA( sTypeName ); - const SfxFilter* pFilter = NULL; - const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + // or use given document service for detection too! + if ( !pFilter && sServiceName.getLength() ) + pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); - /* special mode: use already loaded model ... - In such case no filter name will be selected and no URL will be given! - Such informations are not neccessary. We have to create a new view only - and call setComponent() at the corresponding frame. */ - if( !xModel.is() ) + // or use interaction to ask user for right filter. + if ( !pFilter && xInteraction.is() && sURL.getLength() ) { + ::rtl::OUString sSelectedFilter = impl_askForFilter_nothrow( xInteraction, sURL ); + if ( sSelectedFilter.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sSelectedFilter ); + } - // get filter by its name directly ... - if ( sFilterName.getLength() ) - pFilter = rMatcher.GetFilter4FilterName( sFilterName ); + if ( pFilter ) + io_rDescriptor.put( "FilterName", ::rtl::OUString( pFilter->GetFilterName() ) ); - // or search the preferred filter for the detected type ... - if ( !pFilter && sTypeName.getLength() ) - pFilter = rMatcher.GetFilter4EA( sTypeName ); + return pFilter; +} - // or use given document service for detection too! - if ( !pFilter && sServiceName.getLength() ) - pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); +// -------------------------------------------------------------------------------------------------------------------- +SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + SfxAllItemSet aSet( SFX_APP()->GetPool() ); + TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - // or use interaction to ask user for right filter. - if ( !pFilter && xInteraction.is() && sURL.getLength() ) - { - ::rtl::OUString sSelectedFilter = impl_askForFilter_nothrow( xInteraction, sURL ); - if ( sSelectedFilter.getLength() ) - pFilter = rMatcher.GetFilter4FilterName( sSelectedFilter ); - } + SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); + if ( !pRefererItem ) + aSet.Put( SfxStringItem( SID_REFERER, String() ) ); - if( !pFilter ) - return sal_False; + return aSet; +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_loadExistingDocument( const Reference< XModel >& i_rxDocument, + const Reference< XFrame >& i_rxTargetFrame, + const ::comphelper::NamedValueCollection& i_rDescriptor ) +{ + ENSURE_OR_THROW( i_rxDocument.is() && i_rxTargetFrame.is(), "invallid model/frame" ); - // use filter names without prefix - sFilterName = pFilter->GetFilterName(); + SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); - // If detected filter indicates using of an own template format - // add property "AsTemplate" to descriptor. But suppress this step - // if such property already exists. - if ( pFilter->IsOwnTemplateFormat() && !aDescriptor.has( "AsTemplate" ) ) + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxTargetFrame ); + aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + + for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) + { + if ( i_rxDocument == pDoc->GetModel() ) { - aDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); + i_rxDocument->attachResource( i_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ), i_rDescriptor.getPropertyValues() ); + + pTargetFrame->SetItemSet_Impl( &aSet ); + return pTargetFrame->InsertDocument_Impl( *pDoc ); } } - // Achtung: beim Abraeumen der Objekte kann die SfxApp destruiert werden, vorher noch Deinitialize_Impl rufen - SfxApplication* pApp = SFX_APP(); + DBG_ERROR("Model is not based on SfxObjectShell - wrong frame loader use!"); + return sal_False; +} - // attention: Don't use rArgs, but instead aDescriptor, which is rArgs plus some - // changes - SfxAllItemSet aSet( pApp->GetPool() ); - TransformParameters( SID_OPENDOC, aDescriptor.getPropertyValues(), aSet ); +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame ) +{ + if ( !i_bSuccess && i_wFrame && !i_wFrame->GetCurrentDocument() ) + { + i_wFrame->SetFrameInterface_Impl( NULL ); + i_wFrame->DoClose(); + } - SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); - if ( !pRefererItem ) - aSet.Put( SfxStringItem( SID_REFERER, String() ) ); + return i_bSuccess; +} - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); - if ( xModel.is() ) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const +{ + const ::rtl::OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", ::rtl::OUString() ); + const ::rtl::OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + + // determine the full URL of the template to use, if any + String sTemplateURL; + if ( sTemplateRegioName.getLength() && sTemplateName.getLength() ) { - aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + SfxDocumentTemplates aTmpFac; + aTmpFac.GetFull( sTemplateRegioName, sTemplateName, sTemplateURL ); + } + else + { + if ( sServiceName.getLength() ) + sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); + else + sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); + } - for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) + if ( sTemplateURL.Len() > 0 ) + { + // detect the filter for the template. Might still be NULL (if the template is broken, or does not + // exist, or some such), but this is handled by our caller the same way as if no template/URL was present. + const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SFX_APP()->GetFilterMatcher() ); + if ( pTemplateFilter ) { - if ( xModel == pDoc->GetModel() ) - { - pTargetFrame->SetItemSet_Impl( &aSet ); + // load the template document, but, well, "as template" + io_rDescriptor.put( "FilterName", ::rtl::OUString( pTemplateFilter->GetName() ) ); + io_rDescriptor.put( "FileName", ::rtl::OUString( sTemplateURL ) ); + io_rDescriptor.put( "AsTemplate", sal_True ); + } + return pTemplateFilter; + } - aDescriptor.remove( "Model" ); - aDescriptor.remove( "URL" ); + return NULL; +} - xModel->attachResource( sURL, aDescriptor.getPropertyValues() ); +// -------------------------------------------------------------------------------------------------------------------- +USHORT SfxFrameLoader_Impl::impl_findSlotParam( ::rtl::OUString& io_rFactoryURL ) +{ + ::rtl::OUString sSlotParam; + const sal_Int32 nParamPos = io_rFactoryURL.indexOf( '?' ); + if ( nParamPos >= 0 ) + { + // currently only the "slot" parameter is supported + const sal_Int32 nSlotPos = io_rFactoryURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "slot=" ), nParamPos ); + if ( nSlotPos > 0 ) + sSlotParam = io_rFactoryURL.copy( nSlotPos + 5 ); + io_rFactoryURL = io_rFactoryURL.copy( 0, nParamPos ); + } - // TODO: replace by ViewFactory - return pTargetFrame->InsertDocument_Impl( *pDoc ); - } - } + if ( sSlotParam.getLength() ) + return USHORT( sSlotParam.toInt32() ); - DBG_ERROR("Model is not based on SfxObjectShell - wrong frame loader use!"); + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyValue >& rArgs, + const Reference< css::frame::XFrame >& _rTargetFrame ) + throw( css::uno::RuntimeException ) +{ + ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); + + // this methods assumes that the filter is detected before, usually by calling the detect() method below + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + + RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); + + ::comphelper::NamedValueCollection aDescriptor( rArgs ); + const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + + const SfxFilter* pDocumentFilter = NULL; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + + // if a model is given, just load this into a newly created frame + if ( xModel.is() ) + return impl_loadExistingDocument( xModel, _rTargetFrame, aDescriptor ); + + // determine the filter to use + pDocumentFilter = impl_determineFilter( aDescriptor, rMatcher ); + if ( !pDocumentFilter ) return sal_False; - } + + // If detected filter indicates using of an own template format + // add property "AsTemplate" to descriptor. But suppress this step + // if such property already exists. + if ( pDocumentFilter->IsOwnTemplateFormat() && !aDescriptor.has( "AsTemplate" ) ) + aDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); // check for the URL pattern of our factory URLs + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); SfxFrameWeak wFrame = pTargetFrame; - String aPrefix = String::CreateFromAscii( "private:factory/" ); - String aFact( sURL ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) - { - // it's a factory URL - aFact.Erase( 0, aPrefix.Len() ); - - // look for parameters - String aParam; - USHORT nPos = aFact.Search( '?' ); - if ( nPos != STRING_NOTFOUND ) - { - // currently only the "slot" parameter is supported - USHORT nParamPos = aFact.Search( String::CreateFromAscii("slot="), nPos ); - if ( nParamPos != STRING_NOTFOUND ) - aParam = aFact.Copy( nParamPos+5, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - } - - if ( aParam.Len() ) - { - sal_Bool bSuccess = impl_createNewDocWithSlotParam( (sal_uInt16)aParam.ToInt32(), pTargetFrame ); - if ( !bSuccess && wFrame && !wFrame->GetCurrentDocument() ) - { - wFrame->SetFrameInterface_Impl( NULL ); - wFrame->DoClose(); - } - return bSuccess; - } + const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + if ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ) + { + ::rtl::OUString sFactory( sURL.copy( sizeof( "private:factory/" ) -1 ) ); - String sTemplateURL; - SFX_ITEMSET_ARG( &aSet, pTemplateRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE ); - SFX_ITEMSET_ARG( &aSet, pTemplateNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE ); - if ( pTemplateRegionItem && pTemplateNameItem ) - { - SfxDocumentTemplates aTmpFac; - aTmpFac.GetFull( pTemplateRegionItem->GetValue(), pTemplateNameItem->GetValue(), sTemplateURL ); - } - else + USHORT nSlotParam = impl_findSlotParam( sFactory ); + if ( nSlotParam != 0 ) { - if ( sServiceName.getLength() ) - sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); - else - sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); + sal_Bool bSuccess = impl_createNewDocWithSlotParam( nSlotParam, *pTargetFrame ); + return impl_cleanUp( bSuccess, wFrame ); } - BOOL bUseTemplate = (sTemplateURL.Len()>0); - if( bUseTemplate ) + const SfxFilter* pTemplateFilter = impl_determineTemplateDocument( aDescriptor ); + if ( !pTemplateFilter ) { - // #i21583# - // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL. - // We must use the right filter, matching to this document ... not to the private URL! - const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sTemplateURL, rArgs, rMatcher); - if (pTemplateFilter) - { - pFilter = pTemplateFilter; - sFilterName = pTemplateFilter->GetName(); - // standard template set -> load it "AsTemplate" - aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - } - - // #119268# - // something is wrong with the set default template (e.g. unknown format, missing file etcpp) - // The we have to jump into the following special code, where "private:factory/ URL's are handled. - // We cant "load" such private/factory URL's! - else - bUseTemplate = FALSE; + // no or no valid template found => just create a default doc of the desired type, without any template + sal_Bool bSuccess = impl_createNewDoc( aDescriptor, *pTargetFrame, sFactory ); + return impl_cleanUp( bSuccess, wFrame ); } - if ( !bUseTemplate ) - { - // execute "NewDocument" request - sal_Bool bSuccess = impl_createNewDoc( aSet, pTargetFrame, aFact ); - if ( !bSuccess && wFrame && !wFrame->GetCurrentDocument() ) - { - wFrame->SetFrameInterface_Impl( NULL ); - wFrame->DoClose(); - } - return bSuccess; - } + // #i21583# + // ignore/forget the filter which was detected for the corresponding "private:factory/xxx" URL. + pDocumentFilter = pTemplateFilter; } else { - // load the desired file - aSet.Put( SfxStringItem ( SID_FILE_NAME, sURL ) ); + aDescriptor.put( "FileName", sURL ); } - DBG_ASSERT( pFilter, "SfxFrameLoader_Impl::load: could not determine a filter!" ); - if ( !pFilter ) + const ::rtl::OUString sFilterName = aDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); + + // at this point, we need a filter + DBG_ASSERT( pDocumentFilter, "SfxFrameLoader_Impl::load: could not determine a filter!" ); + if ( !pDocumentFilter ) return sal_False; - // !TODO: replace by direct construction of model (needs view factory) - sal_Bool bDisaster = sal_False; - SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName() ); + SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pDocumentFilter->GetServiceName() ); if ( !pDoc ) return sal_False; + aDescriptor.put( "Frame", _rTargetFrame ); + SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor ) ); + aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); - aSet.Put( SfxUnoAnyItem( SID_FILLFRAME, makeAny( _rTargetFrame ) ) ); aSet.Put( SfxStringItem( SID_FILTER_NAME, sFilterName ) ); sal_Bool bLoadSuccess = sal_False; + sal_Bool bDisaster = sal_False; try { Reference< XLoadable > xLoadable( pDoc->GetModel(), UNO_QUERY ); @@ -504,7 +532,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV /* #121119# - We dont know why _pFrame can be corrupt here. + We dont know why pTargetFrame can be corrupt here. But if it was deleted it shouldnt exists inside our global list. May be we can use the damaged pointer to detect if it was removed from this global list. @@ -513,7 +541,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); - // !TODO: replace by ViewFactory pTargetFrame->SetItemSet_Impl( &aSet ); if ( pTargetFrame->InsertDocument_Impl( *pDoc ) ) { @@ -525,19 +552,15 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV else bDisaster = sal_True; } - catch ( css::uno::Exception& ) + catch ( Exception& ) { bDisaster = sal_True; } if ( bDisaster ) { - if ( wFrame && !wFrame->GetCurrentDocument() ) - { - // document loading was not successful; close SfxFrame (but not XFrame!) - wFrame->SetFrameInterface_Impl( NULL ); - wFrame->DoClose(); - } + // document loading was not successful; close SfxFrame (but not XFrame!) and document + impl_cleanUp( false, wFrame ); Reference< XCloseable > xCloseable( pDoc->GetModel(), UNO_QUERY ); if ( xCloseable.is() ) @@ -546,7 +569,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV { xCloseable->close( sal_True ); } - catch ( css::uno::Exception& ) + catch ( Exception& ) { DBG_UNHANDLED_EXCEPTION(); } -- cgit v1.2.3 From 8f285df32df738b54e572b2e5918ba8217bbebbf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 09:34:02 +0100 Subject: [CWS autorecovery] #i65597# moved creation of new documents from application to loader The loader was the only client of the respective application code, and needs to have better control over the document creation process. In the course of this move, some dead/duplicate/obsolete code has been removed. --- sfx2/inc/frmload.hxx | 15 ++-- sfx2/inc/sfx2/app.hxx | 2 - sfx2/inc/sfx2/objsh.hxx | 1 - sfx2/source/appl/appopen.cxx | 186 --------------------------------------- sfx2/source/appl/appuno.cxx | 110 +++++++++++++---------- sfx2/source/doc/objstor.cxx | 17 ---- sfx2/source/doc/sfxbasemodel.cxx | 62 +++++++------ sfx2/source/view/frmload.cxx | 72 ++++++++++----- 8 files changed, 150 insertions(+), 315 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 4d6207bcb22f..93a960443d9f 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -56,7 +56,7 @@ class SfxFilter; class SfxFilterMatcher; -class SfxFrame; +class SfxTopFrame; #include @@ -95,24 +95,25 @@ private: sal_Bool impl_createNewDocWithSlotParam( const USHORT _nSlotID, - SfxFrame& i_rFrame + SfxTopFrame& i_rFrame ); sal_Bool impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxFrame& i_rFrame, - const ::rtl::OUString& _rFactoryURL + SfxTopFrame& i_rFrame, + const ::rtl::OUString& _rFactoryName ); - void impl_ensureValidFrame_throw( const SfxFrame* _pFrame ); + void impl_ensureValidFrame_throw( const SfxTopFrame* _pFrame ); const SfxFilter* impl_determineFilter( - ::comphelper::NamedValueCollection& io_rDescriptor, + ::comphelper::NamedValueCollection& io_rDescriptor, const SfxFilterMatcher& rMatcher ); SfxAllItemSet impl_getInitialItemSet( - const ::comphelper::NamedValueCollection& i_rDescriptor + const ::comphelper::NamedValueCollection& i_rDescriptor, + SfxTopFrame& i_rTargetFrame ) const; sal_Bool impl_loadExistingDocument( diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx index b770d47e49b5..c5093bf01375 100644 --- a/sfx2/inc/sfx2/app.hxx +++ b/sfx2/inc/sfx2/app.hxx @@ -267,7 +267,6 @@ public: SAL_DLLPRIVATE SfxDispatcher* GetAppDispatcher_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl(); - SAL_DLLPRIVATE SfxObjectShellLock NewDoc_Impl( const String& rFactory, const SfxItemSet* pSet = NULL ); SAL_DLLPRIVATE BOOL QueryExit_Impl(); SAL_DLLPRIVATE void SetOptions_Impl(const SfxItemSet &); SAL_DLLPRIVATE FASTBOOL Initialize_Impl(); @@ -293,7 +292,6 @@ public: // TODO/CLEANUP: still needed? SAL_DLLPRIVATE void NewDocDirectExec_Impl(SfxRequest &); SAL_DLLPRIVATE void NewDocExec_Impl(SfxRequest &); - SAL_DLLPRIVATE const SfxPoolItem* NewDocDirectExec_ImplOld(SfxRequest &); // used by FrameLoader to work with the old behaviour ... SAL_DLLPRIVATE void OpenDocExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 0c940b8627e7..488ae46ffb33 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -504,7 +504,6 @@ public: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetLastMark_Impl( const String & ); SAL_DLLPRIVATE const String& GetLastMark_Impl() const; - SAL_DLLPRIVATE sal_Bool DoInitNew_Impl( const ::rtl::OUString& rName ); //#endif // DDE-Interface diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index e21f8407171e..f5f0d1bb139b 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -514,65 +514,6 @@ ULONG SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String &rFil //-------------------------------------------------------------------- -SfxObjectShellLock SfxApplication::NewDoc_Impl( const String& rFact, const SfxItemSet *pSet ) -{ - SfxObjectShellLock xDoc; - String aFact( rFact ); - String aPrefix = String::CreateFromAscii( "private:factory/" ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) - aFact.Erase( 0, aPrefix.Len() ); - USHORT nPos = aFact.Search( '?' ); - String aParam; - if ( nPos != STRING_NOTFOUND ) - { - aParam = aFact.Copy( nPos, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - aParam.Erase(0,1); - } - - xDoc = SfxObjectShell::CreateObjectByFactoryName( aFact ); - aParam = INetURLObject::decode( aParam, '%', INetURLObject::DECODE_WITH_CHARSET ); - if( xDoc.Is() ) - xDoc->DoInitNew_Impl( aParam ); - - if ( xDoc.Is() ) - { - if ( pSet ) - { - // TODO/LATER: Should the other arguments be transfered as well? - SFX_ITEMSET_ARG( pSet, pDefaultPathItem, SfxStringItem, SID_DEFAULTFILEPATH, FALSE); - if ( pDefaultPathItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pDefaultPathItem ); - SFX_ITEMSET_ARG( pSet, pDefaultNameItem, SfxStringItem, SID_DEFAULTFILENAME, FALSE); - if ( pDefaultNameItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pDefaultNameItem ); - SFX_ITEMSET_ARG( pSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - if ( pTitleItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pTitleItem ); - } - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel ( xDoc->GetModel(), ::com::sun::star::uno::UNO_QUERY ); - if ( xModel.is() ) - { - SfxItemSet* pNew = xDoc->GetMedium()->GetItemSet()->Clone(); - pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; - TransformItems( SID_OPENDOC, *pNew, aArgs ); - - sal_Int32 nLength = aArgs.getLength(); - aArgs.realloc( nLength + 1 ); - - aArgs[nLength].Name = DEFINE_CONST_UNICODE("Title"); - aArgs[nLength].Value <<= ::rtl::OUString( xDoc->GetTitle( SFX_TITLE_DETECT ) ); - - xModel->attachResource( ::rtl::OUString(), aArgs ); - delete pNew; - } - } - - return xDoc; -} - void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -606,133 +547,6 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); } -const SfxPoolItem* SfxApplication::NewDocDirectExec_ImplOld( SfxRequest& rReq ) -{ - DBG_MEMTEST(); -/* - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); -//(mba)/task - - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->EnterWait(); -*/ - SfxObjectShellLock xDoc; - - // Factory-RegNo kann per Parameter angegeben sein - SfxErrorContext aEc(ERRCTX_SFX_NEWDOCDIRECT); - rReq.GetArgs(); // -Wall required?? - String aFactory; - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - SFX_REQUEST_ARG( rReq, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, FALSE ); - if( pFactoryName ) - aFactory = pFactoryName->GetValue(); - else - aFactory = SvtModuleOptions().GetDefaultModuleName(); - - SFX_REQUEST_ARG( rReq, pFileFlagsItem, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFileFlagsItem ) - { - // Werte auf einzelne Items verteilen - String aFileFlags = pFileFlagsItem->GetValue(); - aFileFlags.ToUpperAscii(); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0054 ) ) // T = 54h - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0048 ) ) // H = 48h - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0052 ) ) // R = 52h - rReq.AppendItem( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0042 ) ) // B = 42h - rReq.AppendItem( SfxBoolItem( SID_PREVIEW, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0053 ) ) // S = 53h - rReq.AppendItem( SfxBoolItem( SID_SILENT, TRUE ) ); - } - - xDoc = NewDoc_Impl( aFactory, rReq.GetArgs() ); - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pReadonly, SfxBoolItem, SID_DOC_READONLY, FALSE); - if ( pReadonly ) - xDoc->GetMedium()->GetItemSet()->Put( *pReadonly ); - - SFX_REQUEST_ARG(rReq, pPreview, SfxBoolItem, SID_PREVIEW, FALSE); - if ( pPreview ) - xDoc->GetMedium()->GetItemSet()->Put( *pPreview ); - - SFX_REQUEST_ARG(rReq, pSilent, SfxBoolItem, SID_SILENT, FALSE); - if ( pSilent ) - xDoc->GetMedium()->GetItemSet()->Put( *pSilent ); - - SFX_REQUEST_ARG(rReq, pFlags, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFlags ) - xDoc->GetMedium()->GetItemSet()->Put( *pFlags ); - } - - // View erzeugen - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); - BOOL bHidden = FALSE; - if ( pHidden ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pHidden, SID_HIDDEN ); - bHidden = pHidden->GetValue(); - } - - SFX_REQUEST_ARG(rReq, pViewId, SfxUInt16Item, SID_VIEW_ID, FALSE); - USHORT nViewId = 0; - if ( pViewId ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pViewId, SID_VIEW_ID ); - nViewId = pViewId->GetValue(); - } - - xDoc->SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); -// xDoc->Get_Impl()->nLoadedFlags = SFX_LOADED_ALL; - const SfxItemSet* pInternalArgs = rReq.GetInternalArgs_Impl(); - if( pInternalArgs ) - xDoc->GetMedium()->GetItemSet()->Put( *pInternalArgs ); - SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); - - SfxFrame* pFrame = NULL; - if (pFrameItem) - pFrame = pFrameItem->GetFrame(); - else - pFrame = (SfxFrame*)SfxTopFrame::Create(xDoc, nViewId, bHidden, pInternalArgs); - if ( pFrame ) - { - if ( pFrame->GetCurrentDocument() == xDoc || pFrame->PrepareClose_Impl( TRUE, TRUE ) == TRUE ) - { - if ( bHidden ) - { - xDoc->RestoreNoDelete(); - xDoc->OwnerLock( TRUE ); - xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; - } - - if ( pFrame->GetCurrentDocument() != xDoc ) - { - SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( pFrame ); - OSL_ENSURE( pTopFrame, "An SfxFrame which is no SfxTopFrame?!" ); - if ( pTopFrame && pTopFrame->InsertDocument_Impl( *xDoc ) ) - rReq.SetReturnValue( SfxFrameItem( 0, pFrame ) ); - else - xDoc->DoClose(); - } - } - else - xDoc.Clear(); - } - } - - return rReq.GetReturnValue(); - -//(mba)/task -/* - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->LeaveWait(); - */ -} - //-------------------------------------------------------------------- void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index c9814eb50e6a..df6fa08773b3 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -147,54 +147,56 @@ using namespace ::com::sun::star::io; #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" -static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); -static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); -static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); -static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); -static const String sViewId = String::CreateFromAscii( "ViewId" ); -static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); -static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); -static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); -static const String sFrameName = String::CreateFromAscii( "FrameName" ); -static const String sMediaType = String::CreateFromAscii( "MediaType" ); -static const String sPostData = String::CreateFromAscii( "PostData" ); -static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); -static const String sInputStream = String::CreateFromAscii( "InputStream" ); -static const String sStream = String::CreateFromAscii( "Stream" ); -static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); -static const String sHidden = String::CreateFromAscii( "Hidden" ); -static const String sPreview = String::CreateFromAscii( "Preview" ); -static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); -static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); -static const String sSilent = String::CreateFromAscii( "Silent" ); -static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); -static const String sFileName = String::CreateFromAscii( "FileName" ); -static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); -static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); -static const String sModel = String::CreateFromAscii( "Model" ); -static const String sFrame = String::CreateFromAscii( "Frame" ); -static const String sViewData = String::CreateFromAscii( "ViewData" ); -static const String sFilterData = String::CreateFromAscii( "FilterData" ); -static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); -static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); -static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); -static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); -static const String sMinimized = String::CreateFromAscii( "Minimized" ); -static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sWindowState = String::CreateFromAscii( "WindowState" ); -static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); -static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); -static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); -static const String sComponentData = String::CreateFromAscii( "ComponentData" ); -static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); -static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); -static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); -static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); -static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); -static const String sFolderName = String::CreateFromAscii( "FolderName" ); -static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); -static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); -static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); +static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); +static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); +static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); +static const String sViewId = String::CreateFromAscii( "ViewId" ); +static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); +static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); +static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); +static const String sFrameName = String::CreateFromAscii( "FrameName" ); +static const String sMediaType = String::CreateFromAscii( "MediaType" ); +static const String sPostData = String::CreateFromAscii( "PostData" ); +static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); +static const String sInputStream = String::CreateFromAscii( "InputStream" ); +static const String sStream = String::CreateFromAscii( "Stream" ); +static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); +static const String sHidden = String::CreateFromAscii( "Hidden" ); +static const String sPreview = String::CreateFromAscii( "Preview" ); +static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); +static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); +static const String sSilent = String::CreateFromAscii( "Silent" ); +static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); +static const String sFileName = String::CreateFromAscii( "FileName" ); +static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); +static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); +static const String sModel = String::CreateFromAscii( "Model" ); +static const String sFrame = String::CreateFromAscii( "Frame" ); +static const String sViewData = String::CreateFromAscii( "ViewData" ); +static const String sFilterData = String::CreateFromAscii( "FilterData" ); +static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); +static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); +static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); +static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); +static const String sMinimized = String::CreateFromAscii( "Minimized" ); +static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); +static const String sWindowState = String::CreateFromAscii( "WindowState" ); +static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); +static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); +static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); +static const String sComponentData = String::CreateFromAscii( "ComponentData" ); +static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); +static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); +static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); +static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); +static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); +static const String sFolderName = String::CreateFromAscii( "FolderName" ); +static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); +static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); +static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static const String sSuggestedSaveAsDir = String::CreateFromAscii( "SuggestedSaveAsDir" ); +static const String sSuggestedSaveAsName = String::CreateFromAscii( "SuggestedSaveAsName" ); void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -701,6 +703,18 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque rSet.Put( stringList ); } } + else if ( aName == sSuggestedSaveAsDir ) + { + SfxStringItem aItem( SID_DEFAULTFILEPATH, String() ); + if ( aItem.PutValue( rProp.Value ) ) + rSet.Put( aItem ); + } + else if ( aName == sSuggestedSaveAsName ) + { + SfxStringItem aItem( SID_DEFAULTFILENAME, String() ); + if ( aItem.PutValue( rProp.Value ) ) + rSet.Put( aItem ); + } else if ( aName == sFileName ) { ::rtl::OUString sVal; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 21515b2c6f3d..01379b72ea04 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -448,23 +448,6 @@ sal_Bool SfxObjectShell::Load( SfxMedium& rMedium ) return GeneralInit_Impl( rMedium.GetStorage(), sal_True ); } -//------------------------------------------------------------------------- -sal_Bool SfxObjectShell::DoInitNew_Impl( const ::rtl::OUString& rName ) - -/* [Beschreibung] -*/ - -{ - if ( rName.getLength() ) - { - DBG_ERROR( "This code is intended to be removed, the caller part must be checked!\n" ); - return DoInitNew(0); - } - else - return DoInitNew(0); -} - - sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) /* [Beschreibung] diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 03e6e9170153..b2d2e4b15141 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -73,6 +73,7 @@ #include #include // can be removed when this is a "real" service #include +#include #include #include #include @@ -967,53 +968,50 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& if ( m_pData->m_pObjectShell.Is() ) { m_pData->m_sURL = rURL; - uno::Sequence< beans::PropertyValue > aNewSeqArgs( rArgs.getLength() ); - sal_Int32 nNewLen = 0; - for ( sal_Int32 nInd = 0; nInd < rArgs.getLength(); nInd++ ) + SfxObjectShell* pObjectShell = m_pData->m_pObjectShell; + + ::comphelper::NamedValueCollection aArgs( rArgs ); + + Sequence< sal_Int32 > aWinExtent; + if ( ( aArgs.get( "WinExtent" ) >>= aWinExtent )&& ( aWinExtent.getLength() == 4 ) ) { - if ( rArgs[nInd].Name.equalsAscii( "WinExtent" ) ) - { - Sequence< sal_Int32 > aSize; - if ( ( rArgs[nInd].Value >>= aSize ) && aSize.getLength() == 4 ) - { - Rectangle aTmpRect( aSize[0], aSize[1], aSize[2], aSize[3] ); - aTmpRect = OutputDevice::LogicToLogic( aTmpRect, MAP_100TH_MM, m_pData->m_pObjectShell->GetMapUnit() ); - m_pData->m_pObjectShell->SetVisArea( aTmpRect ); - } - } - else if ( rArgs[nInd].Name.equalsAscii( "BreakMacroSignature" ) ) - { - sal_Bool bBreakMacroSign = sal_False; - rArgs[nInd].Value >>= bBreakMacroSign; - m_pData->m_pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); - } - else if ( !rArgs[nInd].Name.equalsAscii( "Stream" ) && !rArgs[nInd].Name.equalsAscii( "InputStream" ) ) - { - // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be ignored here - aNewSeqArgs[nNewLen++] = rArgs[nInd]; - } + Rectangle aVisArea( aWinExtent[0], aWinExtent[1], aWinExtent[2], aWinExtent[3] ); + aVisArea = OutputDevice::LogicToLogic( aVisArea, MAP_100TH_MM, pObjectShell->GetMapUnit() ); + pObjectShell->SetVisArea( aVisArea ); + } + + sal_Bool bBreakMacroSign = sal_False; + if ( aArgs.get( "BreakMacroSignature" ) >>= bBreakMacroSign ) + { + pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); } - aNewSeqArgs.realloc( nNewLen ); + aArgs.remove( "WinExtent" ); + aArgs.remove( "BreakMacroSignature" ); + aArgs.remove( "Stream" ); + aArgs.remove( "InputStream" ); - m_pData->m_seqArguments = aNewSeqArgs; + // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here - if( m_pData->m_pObjectShell->GetMedium() ) + m_pData->m_seqArguments = aArgs.getPropertyValues(); + + SfxMedium* pMedium = pObjectShell->GetMedium(); + if ( pMedium ) { - SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( pObjectShell->GetPool() ); TransformParameters( SID_OPENDOC, rArgs, aSet ); - m_pData->m_pObjectShell->GetMedium()->GetItemSet()->Put( aSet ); + pMedium->GetItemSet()->Put( aSet ); SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False ); if ( pItem ) - m_pData->m_pObjectShell->GetMedium()->SetFilter( - m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); + pMedium->SetFilter( + pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); SFX_ITEMSET_ARG( &aSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); if ( pTitleItem ) { - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjectShell ); if ( pFrame ) pFrame->UpdateTitle(); } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index bc566793e786..cf689f6af48d 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -48,6 +48,8 @@ #include #include #include +#include +#include #include #include #include @@ -75,6 +77,7 @@ namespace css = ::com::sun::star; #include #include #include +#include #include "brokenpackageint.hxx" #include "objshimp.hxx" @@ -249,7 +252,7 @@ namespace } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, SfxFrame& i_rFrame ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, SfxTopFrame& i_rFrame ) { SfxApplication* pApp = SFX_APP(); @@ -260,20 +263,44 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, SfxFrame& i_rFrame, - const ::rtl::OUString& _rFactoryURL ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, SfxTopFrame& i_rFrame, + const ::rtl::OUString& _rFactoryName ) { - SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); + OSL_PRECOND( i_rFrame.GetCurrentDocument() == NULL, + "SfxFrameLoader_Impl::impl_createNewDoc: inserting into an already-occupied frame is not supported anymore!" ); + if ( i_rFrame.GetCurrentDocument() != NULL ) + return sal_False; + + SfxErrorContext aEc( ERRCTX_SFX_NEWDOCDIRECT ); + + // create new document + SfxObjectShellLock xDoc = SfxObjectShell::CreateObjectByFactoryName( _rFactoryName ); + if ( !xDoc.Is() || !xDoc->DoInitNew( NULL ) ) + return sal_False; - SfxRequest aRequest( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); - aRequest.AppendItem( SfxFrameItem( SID_DOCFRAME, &i_rFrame ) ); - aRequest.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, _rFactoryURL ) ); + Reference< XModel > xModel( xDoc->GetModel(), UNO_QUERY ); + OSL_ENSURE( xModel.is(), "SfxFrameLoader_Impl::impl_createNewDoc: not sure this is really allowed ..." ); + if ( xModel.is() ) + { + ::comphelper::NamedValueCollection aArgs( i_rDescriptor ); + aArgs.remove( "StatusIndicator" ); // TODO: why this? + + xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); + } + + const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); + if ( bHidden ) + { + xDoc->RestoreNoDelete(); + xDoc->OwnerLock( TRUE ); + xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; + } - SFX_ITEMSET_ARG( &aSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - if ( pDocumentTitleItem ) - aRequest.AppendItem( *pDocumentTitleItem ); + if ( i_rFrame.InsertDocument_Impl( *xDoc ) ) + return sal_True; - return lcl_getDispatchResult( SFX_APP()->NewDocDirectExec_ImplOld( aRequest ) ); + xDoc->DoClose(); + return sal_False; } // -------------------------------------------------------------------------------------------------------------------- @@ -315,7 +342,8 @@ const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedV } // -------------------------------------------------------------------------------------------------------------------- -SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor ) const +SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor, + SfxTopFrame& i_rTargetFrame ) const { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); @@ -324,6 +352,8 @@ SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::N if ( !pRefererItem ) aSet.Put( SfxStringItem( SID_REFERER, String() ) ); + aSet.Put( SfxFrameItem( SID_DOCFRAME, &i_rTargetFrame ) ); + return aSet; } @@ -334,10 +364,8 @@ sal_Bool SfxFrameLoader_Impl::impl_loadExistingDocument( const Reference< XModel { ENSURE_OR_THROW( i_rxDocument.is() && i_rxTargetFrame.is(), "invallid model/frame" ); - SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxTargetFrame ); - aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { @@ -345,6 +373,7 @@ sal_Bool SfxFrameLoader_Impl::impl_loadExistingDocument( const Reference< XModel { i_rxDocument->attachResource( i_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ), i_rDescriptor.getPropertyValues() ); + SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor, *pTargetFrame ) ); pTargetFrame->SetItemSet_Impl( &aSet ); return pTargetFrame->InsertDocument_Impl( *pDoc ); } @@ -440,16 +469,16 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); ::comphelper::NamedValueCollection aDescriptor( rArgs ); - const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); - - const SfxFilter* pDocumentFilter = NULL; - const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); // if a model is given, just load this into a newly created frame if ( xModel.is() ) return impl_loadExistingDocument( xModel, _rTargetFrame, aDescriptor ); // determine the filter to use + const SfxFilter* pDocumentFilter = NULL; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + pDocumentFilter = impl_determineFilter( aDescriptor, rMatcher ); if ( !pDocumentFilter ) return sal_False; @@ -506,9 +535,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV return sal_False; aDescriptor.put( "Frame", _rTargetFrame ); - SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor ) ); - aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor, *pTargetFrame ) ); aSet.Put( SfxStringItem( SID_FILTER_NAME, sFilterName ) ); sal_Bool bLoadSuccess = sal_False; @@ -579,7 +607,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV return bLoadSuccess; } -void SfxFrameLoader_Impl::impl_ensureValidFrame_throw( const SfxFrame* _pFrame ) +void SfxFrameLoader_Impl::impl_ensureValidFrame_throw( const SfxTopFrame* _pFrame ) { SfxFrame* pTmp = NULL; for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) -- cgit v1.2.3 From 94b84872d7c5080524d365510f2a18d2aca812df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 10:45:06 +0100 Subject: oops, forgot one direction for the SID_DEFAULTFILE*<->SuggestedSaveAs* conversion --- sfx2/source/appl/appuno.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index df6fa08773b3..ff2ee44a12e4 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1494,6 +1494,16 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta ((SfxStringListItem*)pItem)->GetStringList( aList ); pValue[nActProp++].Value <<= aList ; } + if ( rSet.GetItemState( SID_DEFAULTFILEPATH, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = sSuggestedSaveAsDir; + pValue[nActProp++].Value = pItem->QueryValue; + } + if ( rSet.GetItemState( SID_DEFAULTFILENAME, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = sSuggestedSaveAsName; + pValue[nActProp++].Value = pItem->QueryValue; + } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sFrameName; -- cgit v1.2.3 From a36a719236e8991fb2f017f37e0f6db7cbbc6b64 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 10:51:52 +0100 Subject: [CWS autorecovery] also transform the Referer/SID_REFERER when translating between an UNO-MediaDescriptor ad an ItemSet --- sfx2/source/appl/appuno.cxx | 16 ++++++++++++++-- sfx2/source/view/frmload.cxx | 8 +++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index ff2ee44a12e4..dfed8d769017 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -197,6 +197,7 @@ static const String sStandardDir = String::CreateFromAscii( "Stan static const String sBlackList = String::CreateFromAscii( "BlackList" ); static const String sSuggestedSaveAsDir = String::CreateFromAscii( "SuggestedSaveAsDir" ); static const String sSuggestedSaveAsName = String::CreateFromAscii( "SuggestedSaveAsName" ); +static const String sReferer = String::CreateFromAscii( "Referer" ); void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -715,6 +716,12 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if ( aItem.PutValue( rProp.Value ) ) rSet.Put( aItem ); } + else if ( aName == sReferer ) + { + SfxStringItem aItem( SID_REFERER, String() ); + if ( aItem.PutValue( rProp.Value ) ) + rSet.Put( aItem ); + } else if ( aName == sFileName ) { ::rtl::OUString sVal; @@ -1497,12 +1504,17 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_DEFAULTFILEPATH, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sSuggestedSaveAsDir; - pValue[nActProp++].Value = pItem->QueryValue; + pItem->QueryValue( pValue[nActProp++].Value ); } if ( rSet.GetItemState( SID_DEFAULTFILENAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sSuggestedSaveAsName; - pValue[nActProp++].Value = pItem->QueryValue; + pItem->QueryValue( pValue[nActProp++].Value ); + } + if ( rSet.GetItemState( SID_REFERER, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = sReferer; + pItem->QueryValue( pValue[nActProp++].Value ); } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index cf689f6af48d..af6a4eb95fef 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -348,10 +348,6 @@ SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::N SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); - if ( !pRefererItem ) - aSet.Put( SfxStringItem( SID_REFERER, String() ) ); - aSet.Put( SfxFrameItem( SID_DOCFRAME, &i_rTargetFrame ) ); return aSet; @@ -469,9 +465,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); ::comphelper::NamedValueCollection aDescriptor( rArgs ); - const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + if ( !aDescriptor.has( "Referer" ) ) + aDescriptor.put( "Referer", ::rtl::OUString() ); // if a model is given, just load this into a newly created frame + const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); if ( xModel.is() ) return impl_loadExistingDocument( xModel, _rTargetFrame, aDescriptor ); -- cgit v1.2.3 From ae1079bff5fa5cd0f79ec553cdbe7f1d9ba4465e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 25 Nov 2009 11:13:46 +0100 Subject: do not explicitly transform SuggestedSaveAs* and Referer, they're covered by the implicit transformation of the SID_OPENDOC arguments --- sfx2/source/appl/appuno.cxx | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index dfed8d769017..1a1991a59e56 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -195,9 +195,6 @@ static const String sFolderName = String::CreateFromAscii( "Fold static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); static const String sBlackList = String::CreateFromAscii( "BlackList" ); -static const String sSuggestedSaveAsDir = String::CreateFromAscii( "SuggestedSaveAsDir" ); -static const String sSuggestedSaveAsName = String::CreateFromAscii( "SuggestedSaveAsName" ); -static const String sReferer = String::CreateFromAscii( "Referer" ); void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -704,24 +701,6 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque rSet.Put( stringList ); } } - else if ( aName == sSuggestedSaveAsDir ) - { - SfxStringItem aItem( SID_DEFAULTFILEPATH, String() ); - if ( aItem.PutValue( rProp.Value ) ) - rSet.Put( aItem ); - } - else if ( aName == sSuggestedSaveAsName ) - { - SfxStringItem aItem( SID_DEFAULTFILENAME, String() ); - if ( aItem.PutValue( rProp.Value ) ) - rSet.Put( aItem ); - } - else if ( aName == sReferer ) - { - SfxStringItem aItem( SID_REFERER, String() ); - if ( aItem.PutValue( rProp.Value ) ) - rSet.Put( aItem ); - } else if ( aName == sFileName ) { ::rtl::OUString sVal; @@ -1501,21 +1480,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta ((SfxStringListItem*)pItem)->GetStringList( aList ); pValue[nActProp++].Value <<= aList ; } - if ( rSet.GetItemState( SID_DEFAULTFILEPATH, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = sSuggestedSaveAsDir; - pItem->QueryValue( pValue[nActProp++].Value ); - } - if ( rSet.GetItemState( SID_DEFAULTFILENAME, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = sSuggestedSaveAsName; - pItem->QueryValue( pValue[nActProp++].Value ); - } - if ( rSet.GetItemState( SID_REFERER, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = sReferer; - pItem->QueryValue( pValue[nActProp++].Value ); - } if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sFrameName; -- cgit v1.2.3 From 5f37fa34fd0e03c58fe3b0be04c4faf9e6a922cf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 26 Nov 2009 10:31:39 +0100 Subject: [CWS autorecovery] removed unused *_Impl methods --- sfx2/inc/sfx2/objsh.hxx | 25 ------------------------- sfx2/inc/sfx2/viewfrm.hxx | 5 +---- sfx2/source/doc/objmisc.cxx | 6 ------ sfx2/source/doc/objstor.cxx | 25 ------------------------- sfx2/source/doc/objxtor.cxx | 21 --------------------- sfx2/source/view/viewfrm.cxx | 37 ++----------------------------------- 6 files changed, 3 insertions(+), 116 deletions(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 488ae46ffb33..d43d43c1dd86 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -227,11 +227,8 @@ private: private: //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void Construct_Impl(); SAL_DLLPRIVATE void UpdateTime_Impl(const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties> & i_xDocProps); - SAL_DLLPRIVATE sal_Bool MakeBackup_Impl(const String &rName, - sal_Bool bCopyAllways = sal_False); SAL_DLLPRIVATE sal_Bool SaveTo_Impl(SfxMedium &rMedium, const SfxItemSet* pSet ); @@ -250,10 +247,6 @@ protected: */ void SetHasNoBasic(); -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void StartLoading_Impl(); -//#endif - /// template method, called by FlushDocInfo; this implementation is empty virtual void DoFlushDocInfo(); @@ -501,10 +494,6 @@ public: void SetTitle( const String& rTitle ); String GetTitle( sal_uInt16 nMaxLen = 0 ) const; void InvalidateName(); // Zuruecksetzen auf unbenannt -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void SetLastMark_Impl( const String & ); - SAL_DLLPRIVATE const String& GetLastMark_Impl() const; -//#endif // DDE-Interface virtual long DdeExecute( const String& rCmd ); @@ -618,9 +607,6 @@ public: virtual SEQUENCE< OUSTRING > GetEventNames(); -//REMOVE SotStorageStreamRef GetConfigurationStream( const String& rName, BOOL bCreate=FALSE ); -//REMOVE SvStorageRef GetConfigurationStorage( SotStorage* pStor=NULL ); - Window* GetDialogParent( SfxMedium* pMedium=0 ); String UpdateTitle( SfxMedium* pMed=NULL, USHORT nDocViewNo=0 ); static SfxObjectShell* CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD ); @@ -673,12 +659,10 @@ public: virtual Printer * GetDocumentPrinter(); virtual OutputDevice* GetDocumentRefDev(); virtual void OnDocumentPrinterChanged( Printer * pNewPrinter ); - //virtual UINT32 GetViewAspect() const; virtual Rectangle GetVisArea( USHORT nAspect ) const; virtual void SetVisArea( const Rectangle & rVisArea ); const Rectangle & GetVisArea() const; void SetVisAreaSize( const Size & rVisSize ); -//REMOVE virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CreateTransferableSnapshot(); virtual ULONG GetMiscStatus() const; MapUnit GetMapUnit() const; @@ -722,9 +706,6 @@ public: SAL_DLLPRIVATE ::rtl::OUString CreateTempCopyOfStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); - SAL_DLLPRIVATE static sal_Bool NoDependencyFromManifest_Impl( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); - SAL_DLLPRIVATE void InitOwnModel_Impl(); SAL_DLLPRIVATE void BreakMacroSign_Impl( sal_Bool bBreakMacroSing ); SAL_DLLPRIVATE void CheckSecurityOnLoading_Impl(); @@ -733,7 +714,6 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation >& aInfos ); SAL_DLLPRIVATE void CheckEncryption_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); - SAL_DLLPRIVATE SEQUENCE< OUSTRING > GetEventNames_Impl(); SAL_DLLPRIVATE void InitBasicManager_Impl(); SAL_DLLPRIVATE SfxObjectShell_Impl* Get_Impl() { return pImp; } @@ -767,12 +747,10 @@ public: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr ); SAL_DLLPRIVATE void PositionView_Impl(); SAL_DLLPRIVATE void UpdateFromTemplate_Impl(); - SAL_DLLPRIVATE void Reload_Impl(); SAL_DLLPRIVATE sal_Bool CanReload_Impl(); SAL_DLLPRIVATE void SetNamedVisibility_Impl(); SAL_DLLPRIVATE sal_Bool DoSave_Impl( const SfxItemSet* pSet=0 ); SAL_DLLPRIVATE sal_Bool Save_Impl( const SfxItemSet* pSet=0 ); - SAL_DLLPRIVATE void UpdatePickList_Impl(); SAL_DLLPRIVATE sal_Bool PreDoSaveAs_Impl(const String &rFileName, const String &rFiltName, SfxItemSet *); SAL_DLLPRIVATE sal_Bool APISaveAs_Impl ( const String& aFileName, SfxItemSet* aParams ); SAL_DLLPRIVATE sal_Bool CommonSaveAs_Impl ( const INetURLObject& aURL, const String& aFilterName, SfxItemSet* aParams ); @@ -789,9 +767,6 @@ public: SAL_DLLPRIVATE SfxObjectShell* GetParentShellByModel_Impl(); // configuration items - SAL_DLLPRIVATE SfxEventConfigItem_Impl* GetEventConfig_Impl( sal_Bool bForce=sal_False ); - SAL_DLLPRIVATE SfxAcceleratorManager* GetAccMgr_Impl(); - SAL_DLLPRIVATE SfxToolBoxConfig* GetToolBoxConfig_Impl(); SAL_DLLPRIVATE sal_uInt16 ImplGetSignatureState( sal_Bool bScriptingContent = FALSE ); SAL_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index f39bc555aeb5..b759195c9b1c 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -270,7 +270,7 @@ public: SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE BOOL IsDowning_Impl() const; SAL_DLLPRIVATE void SetViewShell_Impl( SfxViewShell *pVSh ); - SAL_DLLPRIVATE void ReleaseObjectShell_Impl( BOOL bStoreView = FALSE ); + SAL_DLLPRIVATE void ReleaseObjectShell_Impl(); SAL_DLLPRIVATE void GetState_Impl( SfxItemSet &rSet ); SAL_DLLPRIVATE void ExecReload_Impl( SfxRequest &rReq ); @@ -295,9 +295,6 @@ public: SAL_DLLPRIVATE const Size& GetMargin_Impl() const; SAL_DLLPRIVATE void SetActiveChildFrame_Impl( SfxViewFrame* ); SAL_DLLPRIVATE SfxViewFrame* GetActiveChildFrame_Impl() const; - SAL_DLLPRIVATE BOOL IsRestoreView_Impl() const; - SAL_DLLPRIVATE void SetRestoreView_Impl( BOOL ); - SAL_DLLPRIVATE String& GetViewData_Impl(); SAL_DLLPRIVATE String GetActualPresentationURL_Impl() const; SAL_DLLPRIVATE static void CloseHiddenFrames_Impl(); SAL_DLLPRIVATE void MiscExec_Impl(SfxRequest &); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index fe0c222c2c92..0648767fa549 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -2022,12 +2022,6 @@ void SfxObjectShell::SetHeaderAttributesForSourceViewHack() ->SetAttributes(); } -void SfxObjectShell::StartLoading_Impl() -{ - pImp->nLoadedFlags = 0; - pImp->bModelInitialized = sal_False; -} - sal_Bool SfxObjectShell::IsPreview() const { if ( !pMedium ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 01379b72ea04..87e3915287f5 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -211,31 +211,6 @@ sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ) return sal_False; } -//------------------------------------------------------------------------- -sal_Bool SfxObjectShell::NoDependencyFromManifest_Impl( const uno::Reference< embed::XStorage >& xStorage ) -{ - uno::Sequence< ::rtl::OUString > aElements = xStorage->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) - { - if ( xStorage->isStorageElement( aElements[nInd] ) ) - { - // if there are other standard elements that do not need manifest.xml the following - // list can be extended - if ( !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations2" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Thumbnails" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) ) ) - { - // the substorage is not know as one that does not need manifest.xml - return sal_False; - } - } - } - - return sal_True; -} - //------------------------------------------------------------------------- sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl( ::rtl::OUString aURL, diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index fcd618405008..d637083d2f4a 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -862,20 +862,6 @@ sal_Bool SfxObjectShell::DoClose() //-------------------------------------------------------------------- -void SfxObjectShell::SetLastMark_Impl( const String &rMark ) -{ - pImp->aMark = rMark; -} - -//-------------------------------------------------------------------- - -const String& SfxObjectShell::GetLastMark_Impl() const -{ - return pImp->aMark; -} - -//-------------------------------------------------------------------- - SfxObjectShell* SfxObjectShell::GetObjectShell() { return this; @@ -900,13 +886,6 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() return *pEventNameContainer; } -SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() -{ - if (!pImp->xEventNames.getLength()) - pImp->xEventNames = GetEventNames(); - return pImp->xEventNames; -} - //-------------------------------------------------------------------- void SfxObjectShell::SetModel( SfxBaseModel* pModel ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d2ba37afa9b4..8835886b857b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -170,11 +170,9 @@ struct SfxViewFrame_Impl SvBorder aBorder; Size aMargin; Size aSize; - String aViewData; String aFrameTitle; TypeId aLastType; String aActualURL; - String aActualPresentationURL; SfxFrame* pFrame; svtools::AsynchronLink* pReloader; //SfxInPlaceFrame* pIPFrame; @@ -186,7 +184,6 @@ struct SfxViewFrame_Impl sal_Bool bResizeInToOut:1; sal_Bool bDontOverwriteResizeInToOut:1; sal_Bool bObjLocked:1; - sal_Bool bRestoreView:1; sal_Bool bReloading:1; sal_Bool bIsDowning:1; sal_Bool bInCtor:1; @@ -1035,7 +1032,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) } //-------------------------------------------------------------------- -void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) +void SfxViewFrame::ReleaseObjectShell_Impl() /* [Beschreibung] @@ -1068,10 +1065,6 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) SfxViewShell *pDyingViewSh = GetViewShell(); if ( pDyingViewSh ) { - SetRestoreView_Impl( bStoreView ); - if ( bStoreView ) - pDyingViewSh->WriteUserData( GetViewData_Impl(), sal_True ); - // Jetzt alle SubShells wechhauen pDyingViewSh->PushSubShells_Impl( sal_False ); sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pDyingViewSh ); @@ -1507,7 +1500,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) pImp->bObjLocked = sal_False; pImp->pFocusWin = 0; pImp->pActiveChild = NULL; - pImp->bRestoreView = sal_False; pImp->nCurViewId = 0; pImp->bReloading = sal_False; pImp->bIsDowning = sal_False; @@ -2280,13 +2272,6 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl pSh->PushSubShells_Impl(); GetDispatcher()->Flush(); - if ( pImp->bRestoreView && pImp->aViewData.Len() ) - { - // restore view data if required - pSh->ReadUserData( pImp->aViewData, sal_True ); - pImp->bRestoreView = sal_False; - } - // create UI elements before size is set if ( SfxViewFrame::Current() == this ) GetDispatcher()->Update_Impl( sal_True ); @@ -2318,24 +2303,6 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl return sal_True; } -//------------------------------------------------------------------------- -String& SfxViewFrame::GetViewData_Impl() -{ - return pImp->aViewData; -} - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsRestoreView_Impl() const -{ - return pImp->bRestoreView; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetRestoreView_Impl( sal_Bool bOn ) -{ - pImp->bRestoreView = bOn; -} - //------------------------------------------------------------------------- sal_uInt16 SfxViewFrame::GetCurViewId() const { @@ -2762,7 +2729,7 @@ String SfxViewFrame::GetActualPresentationURL_Impl() const { if ( xObjSh.Is() ) return xObjSh->GetMedium()->GetName(); - return pImp->aActualPresentationURL; + return String(); } void SfxViewFrame::SetModalMode( sal_Bool bModal ) -- cgit v1.2.3 From abf0898b5d08697673f29532502bf4bee171cca7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 26 Nov 2009 11:18:19 +0100 Subject: [CWS autorecovery] further streamlined the SFX frame loader's load method --- sfx2/inc/frmload.hxx | 18 ++-- sfx2/source/doc/sfxbasemodel.cxx | 7 ++ sfx2/source/view/frmload.cxx | 218 ++++++++++++++++----------------------- 3 files changed, 103 insertions(+), 140 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 93a960443d9f..089315d0c1c5 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -95,25 +95,21 @@ private: sal_Bool impl_createNewDocWithSlotParam( const USHORT _nSlotID, - SfxTopFrame& i_rFrame + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame ); sal_Bool impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, const ::rtl::OUString& _rFactoryName ); - void impl_ensureValidFrame_throw( const SfxTopFrame* _pFrame ); - - const SfxFilter* impl_determineFilter( - ::comphelper::NamedValueCollection& io_rDescriptor, - const SfxFilterMatcher& rMatcher + void impl_determineFilter( + ::comphelper::NamedValueCollection& io_rDescriptor ); SfxAllItemSet impl_getInitialItemSet( - const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rTargetFrame + const ::comphelper::NamedValueCollection& i_rDescriptor ) const; sal_Bool impl_loadExistingDocument( @@ -127,12 +123,12 @@ private: const SfxFrameWeak& i_wFrame ); - const SfxFilter* impl_determineTemplateDocument( + bool impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const; USHORT impl_findSlotParam( - ::rtl::OUString& io_rFactoryURL + const ::rtl::OUString& i_rFactoryURL ); }; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index b2d2e4b15141..ce78ddb50799 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1911,6 +1911,13 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& nError ? nError : ERRCODE_IO_CANTREAD ); } } + + BOOL bHidden = FALSE; + SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); + if ( pHidItem ) + bHidden = pHidItem->GetValue(); + // !TODO: will be done by Framework! + pMedium->SetUpdatePickList( !bHidden ); } } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index af6a4eb95fef..c157940a2c5b 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -252,24 +252,26 @@ namespace } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, SfxTopFrame& i_rFrame ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame ) { - SfxApplication* pApp = SFX_APP(); + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + SfxFrameWeak wFrame = pTargetFrame; - SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); - aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, &i_rFrame ) ); + SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); + aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, pTargetFrame ) ); - return lcl_getDispatchResult( pApp->ExecuteSlot( aRequest ) ); + sal_Bool bSuccess = lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); + return impl_cleanUp( bSuccess, wFrame ); } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, SfxTopFrame& i_rFrame, +sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, const Reference< XFrame >& i_rxFrame, const ::rtl::OUString& _rFactoryName ) { - OSL_PRECOND( i_rFrame.GetCurrentDocument() == NULL, - "SfxFrameLoader_Impl::impl_createNewDoc: inserting into an already-occupied frame is not supported anymore!" ); - if ( i_rFrame.GetCurrentDocument() != NULL ) - return sal_False; + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + SfxFrameWeak wFrame = pTargetFrame; SfxErrorContext aEc( ERRCTX_SFX_NEWDOCDIRECT ); @@ -296,15 +298,12 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueC xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; } - if ( i_rFrame.InsertDocument_Impl( *xDoc ) ) - return sal_True; - - xDoc->DoClose(); - return sal_False; + sal_Bool bSuccess = pTargetFrame->InsertDocument_Impl( *xDoc ); + return impl_cleanUp( bSuccess, wFrame ); } // -------------------------------------------------------------------------------------------------------------------- -const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor, const SfxFilterMatcher& rMatcher ) +void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) { const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); const ::rtl::OUString sTypeName = io_rDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); @@ -313,6 +312,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedV const Reference< XInteractionHandler > xInteraction = io_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); const SfxFilter* pFilter = NULL; // get filter by its name directly ... @@ -323,7 +323,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedV if ( !pFilter && sTypeName.getLength() ) pFilter = rMatcher.GetFilter4EA( sTypeName ); - // or use given document service for detection too! + // or use given document service for detection, too if ( !pFilter && sServiceName.getLength() ) pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); @@ -336,20 +336,26 @@ const SfxFilter* SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedV } if ( pFilter ) + { io_rDescriptor.put( "FilterName", ::rtl::OUString( pFilter->GetFilterName() ) ); - return pFilter; + // If detected filter indicates using of an own template format + // add property "AsTemplate" to descriptor. But suppress this step + // if such property already exists. + if ( pFilter->IsOwnTemplateFormat() && !io_rDescriptor.has( "AsTemplate" ) ) + io_rDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); + + // The DocumentService property will finally be used to determine the document type to create, so + // override it with the service name as indicated by the found filter. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pFilter->GetServiceName() ) ); + } } // -------------------------------------------------------------------------------------------------------------------- -SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rTargetFrame ) const +SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor ) const { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - - aSet.Put( SfxFrameItem( SID_DOCFRAME, &i_rTargetFrame ) ); - return aSet; } @@ -369,7 +375,7 @@ sal_Bool SfxFrameLoader_Impl::impl_loadExistingDocument( const Reference< XModel { i_rxDocument->attachResource( i_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ), i_rDescriptor.getPropertyValues() ); - SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor, *pTargetFrame ) ); + SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); pTargetFrame->SetItemSet_Impl( &aSet ); return pTargetFrame->InsertDocument_Impl( *pDoc ); } @@ -392,7 +398,7 @@ sal_Bool SfxFrameLoader_Impl::impl_cleanUp( const sal_Bool i_bSuccess, const Sfx } // -------------------------------------------------------------------------------------------------------------------- -const SfxFilter* SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const +bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const { const ::rtl::OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", ::rtl::OUString() ); const ::rtl::OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", ::rtl::OUString() ); @@ -425,25 +431,28 @@ const SfxFilter* SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelp io_rDescriptor.put( "FilterName", ::rtl::OUString( pTemplateFilter->GetName() ) ); io_rDescriptor.put( "FileName", ::rtl::OUString( sTemplateURL ) ); io_rDescriptor.put( "AsTemplate", sal_True ); + + // #i21583# + // the DocumentService property will finally be used to create the document. Thus, override any possibly + // present value with the document service of the template. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pTemplateFilter->GetServiceName() ) ); + return true; } - return pTemplateFilter; } - - return NULL; + return false; } // -------------------------------------------------------------------------------------------------------------------- -USHORT SfxFrameLoader_Impl::impl_findSlotParam( ::rtl::OUString& io_rFactoryURL ) +USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ) { ::rtl::OUString sSlotParam; - const sal_Int32 nParamPos = io_rFactoryURL.indexOf( '?' ); + const sal_Int32 nParamPos = i_rFactoryURL.indexOf( '?' ); if ( nParamPos >= 0 ) { // currently only the "slot" parameter is supported - const sal_Int32 nSlotPos = io_rFactoryURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "slot=" ), nParamPos ); + const sal_Int32 nSlotPos = i_rFactoryURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "slot=" ), nParamPos ); if ( nSlotPos > 0 ) - sSlotParam = io_rFactoryURL.copy( nSlotPos + 5 ); - io_rFactoryURL = io_rFactoryURL.copy( 0, nParamPos ); + sSlotParam = i_rFactoryURL.copy( nSlotPos + 5 ); } if ( sSlotParam.getLength() ) @@ -465,125 +474,90 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); ::comphelper::NamedValueCollection aDescriptor( rArgs ); + + // ensure the descriptor contains a referrer if ( !aDescriptor.has( "Referer" ) ) aDescriptor.put( "Referer", ::rtl::OUString() ); - // if a model is given, just load this into a newly created frame + // if a model is given, just plug this into a newly created frame const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); if ( xModel.is() ) return impl_loadExistingDocument( xModel, _rTargetFrame, aDescriptor ); - // determine the filter to use - const SfxFilter* pDocumentFilter = NULL; - const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); - - pDocumentFilter = impl_determineFilter( aDescriptor, rMatcher ); - if ( !pDocumentFilter ) - return sal_False; - - // If detected filter indicates using of an own template format - // add property "AsTemplate" to descriptor. But suppress this step - // if such property already exists. - if ( pDocumentFilter->IsOwnTemplateFormat() && !aDescriptor.has( "AsTemplate" ) ) - aDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); - - // check for the URL pattern of our factory URLs - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); - SfxFrameWeak wFrame = pTargetFrame; - + // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); - if ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ) + const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); + if ( bIsFactoryURL ) { - ::rtl::OUString sFactory( sURL.copy( sizeof( "private:factory/" ) -1 ) ); - - USHORT nSlotParam = impl_findSlotParam( sFactory ); + USHORT nSlotParam = impl_findSlotParam( sURL.copy( sizeof( "private:factory/" ) -1 ) ); if ( nSlotParam != 0 ) { - sal_Bool bSuccess = impl_createNewDocWithSlotParam( nSlotParam, *pTargetFrame ); - return impl_cleanUp( bSuccess, wFrame ); + return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame ); } + } - const SfxFilter* pTemplateFilter = impl_determineTemplateDocument( aDescriptor ); - if ( !pTemplateFilter ) + // determine the filter to use, and update the descriptor with its information + impl_determineFilter( aDescriptor ); + + // check for factory URLs to create a new doc, instead of loading one + if ( bIsFactoryURL ) + { + bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); + if ( !bDescribesValidTemplate ) { // no or no valid template found => just create a default doc of the desired type, without any template - sal_Bool bSuccess = impl_createNewDoc( aDescriptor, *pTargetFrame, sFactory ); - return impl_cleanUp( bSuccess, wFrame ); + return impl_createNewDoc( aDescriptor, _rTargetFrame, sURL.copy( sizeof( "private:factory/" ) -1 ) ); } - - // #i21583# - // ignore/forget the filter which was detected for the corresponding "private:factory/xxx" URL. - pDocumentFilter = pTemplateFilter; } else { - aDescriptor.put( "FileName", sURL ); + // compatibility + aDescriptor.put( "FileName", aDescriptor.get( "URL" ) ); } - const ::rtl::OUString sFilterName = aDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); - - // at this point, we need a filter - DBG_ASSERT( pDocumentFilter, "SfxFrameLoader_Impl::load: could not determine a filter!" ); - if ( !pDocumentFilter ) - return sal_False; + // TODO: is this needed? finally, when loading is successfull, then ther should be no need for this item, + // as the document can always obtain its frame. In particular, there might be situations where this frame + // is access, but already disposed: Imagine the user loading a document, opening a second view on it, and + // then closing the first view/frame. + aDescriptor.put( "Frame", _rTargetFrame ); - SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pDocumentFilter->GetServiceName() ); + // create a new doc + ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + SfxObjectShell* pDoc = SfxObjectShell::CreateObject( sServiceName ); if ( !pDoc ) return sal_False; - aDescriptor.put( "Frame", _rTargetFrame ); - - SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor, *pTargetFrame ) ); - aSet.Put( SfxStringItem( SID_FILTER_NAME, sFilterName ) ); - sal_Bool bLoadSuccess = sal_False; - sal_Bool bDisaster = sal_False; + SfxFrameWeak wFrame; try { - Reference< XLoadable > xLoadable( pDoc->GetModel(), UNO_QUERY ); - Sequence< PropertyValue > aLoadArgs; - TransformItems( SID_OPENDOC, aSet, aLoadArgs ); - - xLoadable->load( aLoadArgs ); - - SfxMedium* pDocMedium = pDoc->GetMedium(); - BOOL bHidden = FALSE; - SFX_ITEMSET_ARG( pDocMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - if ( pHidItem ) - bHidden = pHidItem->GetValue(); + // load the document + Reference< XLoadable > xLoadable( pDoc->GetModel(), UNO_QUERY_THROW ); + xLoadable->load( aDescriptor.getPropertyValues() ); - // !TODO: will be done by Framework! - pDocMedium->SetUpdatePickList( !bHidden ); + // create a frame + SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + wFrame = pTargetFrame; - /* - #121119# - We dont know why pTargetFrame can be corrupt here. - But if it was deleted it shouldnt exists inside our global list. - May be we can use the damaged pointer to detect if it was removed from - this global list. - */ - impl_ensureValidFrame_throw( pTargetFrame ); + // insert the document into the frame + SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor ) ); + pTargetFrame->SetItemSet_Impl( &aSet ); + if ( !pTargetFrame->InsertDocument_Impl( *pDoc ) ) + throw RuntimeException(); - aSet.Put( SfxFrameItem( SID_DOCFRAME, pTargetFrame ) ); + pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); + String aURL = pDoc->GetMedium()->GetName(); + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - pTargetFrame->SetItemSet_Impl( &aSet ); - if ( pTargetFrame->InsertDocument_Impl( *pDoc ) ) - { - pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = pDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - bLoadSuccess = sal_True; - } - else - bDisaster = sal_True; + bLoadSuccess = sal_True; } catch ( Exception& ) { - bDisaster = sal_True; + DBG_UNHANDLED_EXCEPTION(); } - if ( bDisaster ) + if ( !bLoadSuccess ) { // document loading was not successful; close SfxFrame (but not XFrame!) and document impl_cleanUp( false, wFrame ); @@ -605,20 +579,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV return bLoadSuccess; } -void SfxFrameLoader_Impl::impl_ensureValidFrame_throw( const SfxTopFrame* _pFrame ) -{ - SfxFrame* pTmp = NULL; - for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) - { - if ( _pFrame == pTmp ) - // all fine, frame still alive - return; - } - - DBG_ERROR( "#121119# You found the reason for a stacktrace! Frame destroyed while loading document." ); - throw RuntimeException( ::rtl::OUString(), *this ); -} - void SfxFrameLoader_Impl::cancel() throw( RuntimeException ) { } -- cgit v1.2.3 From 22f2884d9cb4f3759ce760ba4f1563467c9a7800 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 26 Nov 2009 11:18:19 +0100 Subject: [CWS autorecovery] even closer to an SFX document loader working in the proper order --- sfx2/inc/frmload.hxx | 32 ++++---- sfx2/source/view/frmload.cxx | 174 +++++++++++++++++++++++++------------------ 2 files changed, 122 insertions(+), 84 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 089315d0c1c5..ea0b5992ee72 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -31,6 +31,9 @@ #ifndef _SFX_FRMLOAD_HXX #define _SFX_FRMLOAD_HXX +#include "sfx2/sfxuno.hxx" +#include "sfx2/objsh.hxx" + /** === begin UNO includes === **/ #include #include @@ -58,8 +61,6 @@ class SfxFilter; class SfxFilterMatcher; class SfxTopFrame; -#include - class SfxFrameWeak; class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > @@ -101,23 +102,13 @@ private: sal_Bool impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, - const ::rtl::OUString& _rFactoryName + const ::rtl::OUString& i_rFactoryName ); void impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ); - SfxAllItemSet impl_getInitialItemSet( - const ::comphelper::NamedValueCollection& i_rDescriptor - ) const; - - sal_Bool impl_loadExistingDocument( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxTargetFrame, - const ::comphelper::NamedValueCollection& i_rDescriptor - ); - sal_Bool impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame @@ -130,6 +121,21 @@ private: USHORT impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ); + + SfxObjectShellLock impl_findObjectShell( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument + ); + + sal_Bool impl_plugDocIntoFrame( + const ::comphelper::NamedValueCollection& i_rDescriptor, + SfxTopFrame& i_rTargetFrame, + SfxObjectShell& i_rDocument + ); + + void impl_lockHiddenDocument( + SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ); }; #endif diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index c157940a2c5b..1d0e22d55fee 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -265,40 +265,55 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo return impl_cleanUp( bSuccess, wFrame ); } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) +{ + const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); + if ( bHidden ) + { + i_rDocument.RestoreNoDelete(); + i_rDocument.OwnerLock( TRUE ); + i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; + } +} + // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, const Reference< XFrame >& i_rxFrame, - const ::rtl::OUString& _rFactoryName ) + const ::rtl::OUString& i_rFactoryName ) { SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxFrame ); ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); SfxFrameWeak wFrame = pTargetFrame; - SfxErrorContext aEc( ERRCTX_SFX_NEWDOCDIRECT ); - // create new document - SfxObjectShellLock xDoc = SfxObjectShell::CreateObjectByFactoryName( _rFactoryName ); - if ( !xDoc.Is() || !xDoc->DoInitNew( NULL ) ) - return sal_False; - - Reference< XModel > xModel( xDoc->GetModel(), UNO_QUERY ); - OSL_ENSURE( xModel.is(), "SfxFrameLoader_Impl::impl_createNewDoc: not sure this is really allowed ..." ); - if ( xModel.is() ) + SfxObjectShellLock xDoc; + try { + const ::rtl::OUString sServiceName = SfxObjectShell::GetServiceNameFromFactory( i_rFactoryName ); + Reference< XModel > xModel( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); + + Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); + xLoadable->initNew(); + + xDoc = impl_findObjectShell( xModel ); + ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the newly created model" ); + ::comphelper::NamedValueCollection aArgs( i_rDescriptor ); aArgs.remove( "StatusIndicator" ); // TODO: why this? xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); } - - const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); - if ( bHidden ) + catch( const Exception& ) { - xDoc->RestoreNoDelete(); - xDoc->OwnerLock( TRUE ); - xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; + // TODO: catch (and handle?) ErrorCodeIOException, and perhaps others ... + DBG_UNHANDLED_EXCEPTION(); + return sal_False; } - sal_Bool bSuccess = pTargetFrame->InsertDocument_Impl( *xDoc ); + // if the document is created hidden, prevent it being deleted until it is shown or disposed + impl_lockHiddenDocument( *xDoc, i_rDescriptor ); + + const sal_Bool bSuccess = pTargetFrame->InsertDocument_Impl( *xDoc ); return impl_cleanUp( bSuccess, wFrame ); } @@ -352,37 +367,28 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti } // -------------------------------------------------------------------------------------------------------------------- -SfxAllItemSet SfxFrameLoader_Impl::impl_getInitialItemSet( const ::comphelper::NamedValueCollection& i_rDescriptor ) const +sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, + SfxTopFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - return aSet; + i_rTargetFrame.SetItemSet_Impl( &aSet ); + return i_rTargetFrame.InsertDocument_Impl( i_rDocument ); } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_loadExistingDocument( const Reference< XModel >& i_rxDocument, - const Reference< XFrame >& i_rxTargetFrame, - const ::comphelper::NamedValueCollection& i_rDescriptor ) +SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel >& i_rxDocument ) { - ENSURE_OR_THROW( i_rxDocument.is() && i_rxTargetFrame.is(), "invallid model/frame" ); - - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxTargetFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); - for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { if ( i_rxDocument == pDoc->GetModel() ) { - i_rxDocument->attachResource( i_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ), i_rDescriptor.getPropertyValues() ); - - SfxAllItemSet aSet( impl_getInitialItemSet( i_rDescriptor ) ); - pTargetFrame->SetItemSet_Impl( &aSet ); - return pTargetFrame->InsertDocument_Impl( *pDoc ); + return pDoc; } } - DBG_ERROR("Model is not based on SfxObjectShell - wrong frame loader use!"); - return sal_False; + DBG_ERROR( "SfxFrameLoader_Impl::impl_findObjectShell: model is not based on SfxObjectShell - wrong frame loader usage!" ); + return NULL; } // -------------------------------------------------------------------------------------------------------------------- @@ -468,7 +474,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV { ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); - // this methods assumes that the filter is detected before, usually by calling the detect() method below ::vos::OGuard aGuard( Application::GetSolarMutex() ); RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); @@ -479,34 +484,36 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( !aDescriptor.has( "Referer" ) ) aDescriptor.put( "Referer", ::rtl::OUString() ); - // if a model is given, just plug this into a newly created frame - const Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); - if ( xModel.is() ) - return impl_loadExistingDocument( xModel, _rTargetFrame, aDescriptor ); + // TODO: is this needed? finally, when loading is successfull, then ther should be no need for this item, + // as the document can always obtain its frame. In particular, there might be situations where this frame + // is access, but already disposed: Imagine the user loading a document, opening a second view on it, and + // then closing the first view/frame. + aDescriptor.put( "Frame", _rTargetFrame ); - // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 + // check for factory URLs to create a new doc, instead of loading one const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); if ( bIsFactoryURL ) { - USHORT nSlotParam = impl_findSlotParam( sURL.copy( sizeof( "private:factory/" ) -1 ) ); + OSL_ENSURE( !aDescriptor.has( "Model" ), "SfxFrameLoader_Impl::load: sure you know what you're doing?" ); + // Before the loader refactoring, the model would have won over the URL, that is, the model would have been + // loaded into a newly created frame. /me thinks this doesn't make sense at all, also, it made the code + // in this method more complex. So, the order was changed, now the factory URL wins over the Model. + // If somebody *rightfully* passes both of them, we might need to re-consider the behavior. + + const ::rtl::OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 ); + // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 + USHORT nSlotParam = impl_findSlotParam( sFactory ); if ( nSlotParam != 0 ) { return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame ); } - } - - // determine the filter to use, and update the descriptor with its information - impl_determineFilter( aDescriptor ); - // check for factory URLs to create a new doc, instead of loading one - if ( bIsFactoryURL ) - { bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); if ( !bDescribesValidTemplate ) { // no or no valid template found => just create a default doc of the desired type, without any template - return impl_createNewDoc( aDescriptor, _rTargetFrame, sURL.copy( sizeof( "private:factory/" ) -1 ) ); + return impl_createNewDoc( aDescriptor, _rTargetFrame, sFactory ); } } else @@ -515,40 +522,65 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV aDescriptor.put( "FileName", aDescriptor.get( "URL" ) ); } - // TODO: is this needed? finally, when loading is successfull, then ther should be no need for this item, - // as the document can always obtain its frame. In particular, there might be situations where this frame - // is access, but already disposed: Imagine the user loading a document, opening a second view on it, and - // then closing the first view/frame. - aDescriptor.put( "Frame", _rTargetFrame ); - - // create a new doc - ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); - SfxObjectShell* pDoc = SfxObjectShell::CreateObject( sServiceName ); - if ( !pDoc ) - return sal_False; + // did the caller already pass a model? + Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + const bool bExternalModel = xModel.is(); sal_Bool bLoadSuccess = sal_False; SfxFrameWeak wFrame; try { - // load the document - Reference< XLoadable > xLoadable( pDoc->GetModel(), UNO_QUERY_THROW ); - xLoadable->load( aDescriptor.getPropertyValues() ); + // no model passed from outside? => create one from scratch + if ( !xModel.is() ) + { + // beforehand, determine the filter to use, and update the descriptor with its information + impl_determineFilter( aDescriptor ); + + // create the new doc + ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); + + // load it + Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); + xLoadable->load( aDescriptor.getPropertyValues() ); + } + else + { + // tell the doc its load args. + xModel->attachResource( aDescriptor.getOrDefault( "URL", ::rtl::OUString() ), aDescriptor.getPropertyValues() ); + + // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could + // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) + // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document + // might have a mode other than the one passed to the loader, and we always overwrite the former with + // the latter. + } // create a frame SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); wFrame = pTargetFrame; + // get the SfxObjectShell (still needed at the moment) + SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); + + // if the document is created hidden, prevent it being deleted until it is shown or disposed + impl_lockHiddenDocument( *xDoc, aDescriptor ); + // insert the document into the frame - SfxAllItemSet aSet( impl_getInitialItemSet( aDescriptor ) ); - pTargetFrame->SetItemSet_Impl( &aSet ); - if ( !pTargetFrame->InsertDocument_Impl( *pDoc ) ) + if ( !impl_plugDocIntoFrame( aDescriptor, *pTargetFrame, *xDoc ) ) throw RuntimeException(); - pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = pDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); + if ( !bExternalModel ) + { + // TODO: which of those statements are allowed in the ExternalModel-case, too? + // I think the broadcast isn't, but the UpdateDocument_Impl might. + pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); + String aURL = xDoc->GetMedium()->GetName(); + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); + // TODO: grokking suggests nobody might be interested in this SID_OPENURL broadcast, anyway? + } bLoadSuccess = sal_True; } @@ -562,11 +594,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV // document loading was not successful; close SfxFrame (but not XFrame!) and document impl_cleanUp( false, wFrame ); - Reference< XCloseable > xCloseable( pDoc->GetModel(), UNO_QUERY ); - if ( xCloseable.is() ) + if ( !bExternalModel ) { try { + Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); xCloseable->close( sal_True ); } catch ( Exception& ) -- cgit v1.2.3 From 4a8c1c6afd7db2b3e58534f6af15edf603d4f6ae Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 26 Nov 2009 11:18:19 +0100 Subject: [CWS autorecovery] last step, for the moment, of loader streamlining --- sfx2/inc/frmload.hxx | 32 ++--- sfx2/source/view/frmload.cxx | 292 +++++++++++++++++++++++-------------------- 2 files changed, 171 insertions(+), 153 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index ea0b5992ee72..1421c3df25e4 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -82,10 +82,13 @@ protected: virtual ~SfxFrameLoader_Impl(); private: - const SfxFilter* impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const; + const SfxFilter* impl_getFilterFromServiceName_nothrow( + const ::rtl::OUString& i_rServiceName + ) const; + ::rtl::OUString impl_askForFilter_nothrow( - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler, - const ::rtl::OUString& _rDocumentURL + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& i_rxHandler, + const ::rtl::OUString& i_rDocumentURL ) const; const SfxFilter* impl_detectFilterForURL( @@ -99,20 +102,14 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame ); - sal_Bool impl_createNewDoc( - const ::comphelper::NamedValueCollection& i_rDescriptor, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, - const ::rtl::OUString& i_rFactoryName - ); - void impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor - ); + ) const; sal_Bool impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame - ); + ) const; bool impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor @@ -120,22 +117,27 @@ private: USHORT impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL - ); + ) const; SfxObjectShellLock impl_findObjectShell( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument - ); + ) const; sal_Bool impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, SfxTopFrame& i_rTargetFrame, SfxObjectShell& i_rDocument - ); + ) const; void impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor - ); + ) const; + + void impl_handleCaughtError_nothrow( + const ::com::sun::star::uno::Any& i_rCaughtError, + const ::comphelper::NamedValueCollection& i_rDescriptor + ) const; }; #endif diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 1d0e22d55fee..722775df4cc2 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -32,80 +32,76 @@ #include "precompiled_sfx2.hxx" #include "frmload.hxx" - -#include - -#include +#include "objshimp.hxx" +#include "sfx2/app.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/docfilt.hxx" +#include "sfx2/doctempl.hxx" +#include "sfx2/fcontnr.hxx" +#include "sfx2/frame.hxx" +#include "sfx2/request.hxx" +#include "sfx2/sfx.hrc" +#include "sfx2/sfxsids.hrc" +#include "sfx2/sfxuno.hxx" +#include "sfx2/topfrm.hxx" +#include "sfx2/viewfrm.hxx" + +/** === begin UNO includes === **/ #include +#include #include +#include #include -#include -#include +#include +/** === end UNO includes === **/ -#include -#include - -#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include #include -#include #include +#include +#include +#include #include +#include #include -#include -#include -#include -#include -#include - -#ifndef css -namespace css = ::com::sun::star; -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "brokenpackageint.hxx" -#include "objshimp.hxx" +#include +#include -// do not remove the markers below /** === begin UNO using === **/ -using ::com::sun::star::uno::Reference; -using ::com::sun::star::task::XInteractionHandler; -using ::com::sun::star::frame::XModel; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::uno::UNO_QUERY_THROW; -using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::container::XContainerQuery; using ::com::sun::star::container::XEnumeration; -using ::com::sun::star::uno::makeAny; +using ::com::sun::star::document::XTypeDetection; using ::com::sun::star::frame::XFrame; -using ::com::sun::star::uno::Exception; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::task::XInteractionHandler; +using ::com::sun::star::task::XInteractionHandler2; using ::com::sun::star::task::XInteractionRequest; -using ::com::sun::star::uno::UNO_SET_THROW; -using ::com::sun::star::uno::Sequence; -using ::com::sun::star::beans::PropertyValue; -using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::task::XStatusIndicator; -using ::com::sun::star::document::XTypeDetection; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::makeAny; using ::com::sun::star::util::XCloseable; -using ::com::sun::star::frame::XLoadable; /** === end UNO using === **/ -SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< css::lang::XMultiServiceFactory >& _rxFactory ) +SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) :m_aContext( _rxFactory ) { } @@ -149,7 +145,7 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt { throw; } - catch( const css::uno::Exception& ) + catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); sFilter = ::rtl::OUString(); @@ -162,12 +158,12 @@ const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUSt } // -------------------------------------------------------------------------------------------------------------------- -const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& _rServiceName ) const +const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& i_rServiceName ) const { try { ::comphelper::NamedValueCollection aQuery; - aQuery.put( "DocumentService", _rServiceName ); + aQuery.put( "DocumentService", i_rServiceName ); const Reference< XContainerQuery > xQuery( m_aContext.createComponent( "com.sun.star.document.FilterFactory" ), @@ -207,17 +203,17 @@ const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( con } // -------------------------------------------------------------------------------------------------------------------- -::rtl::OUString SfxFrameLoader_Impl::impl_askForFilter_nothrow( const Reference< XInteractionHandler >& _rxHandler, - const ::rtl::OUString& _rDocumentURL ) const +::rtl::OUString SfxFrameLoader_Impl::impl_askForFilter_nothrow( const Reference< XInteractionHandler >& i_rxHandler, + const ::rtl::OUString& i_rDocumentURL ) const { - ENSURE_OR_THROW( _rxHandler.is(), "invalid interaction handler" ); + ENSURE_OR_THROW( i_rxHandler.is(), "invalid interaction handler" ); ::rtl::OUString sFilterName; try { - ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( _rDocumentURL ); + ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( i_rDocumentURL ); Reference< XInteractionRequest > xRequest ( pRequest ); - _rxHandler->handle( xRequest ); + i_rxHandler->handle( xRequest ); if( !pRequest->isAbort() ) sFilterName = pRequest->getFilter(); } @@ -266,7 +262,7 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo } // -------------------------------------------------------------------------------------------------------------------- -void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) +void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const { const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); if ( bHidden ) @@ -278,47 +274,7 @@ void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDoc( const ::comphelper::NamedValueCollection& i_rDescriptor, const Reference< XFrame >& i_rxFrame, - const ::rtl::OUString& i_rFactoryName ) -{ - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); - SfxFrameWeak wFrame = pTargetFrame; - - // create new document - SfxObjectShellLock xDoc; - try - { - const ::rtl::OUString sServiceName = SfxObjectShell::GetServiceNameFromFactory( i_rFactoryName ); - Reference< XModel > xModel( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); - - Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); - xLoadable->initNew(); - - xDoc = impl_findObjectShell( xModel ); - ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the newly created model" ); - - ::comphelper::NamedValueCollection aArgs( i_rDescriptor ); - aArgs.remove( "StatusIndicator" ); // TODO: why this? - - xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); - } - catch( const Exception& ) - { - // TODO: catch (and handle?) ErrorCodeIOException, and perhaps others ... - DBG_UNHANDLED_EXCEPTION(); - return sal_False; - } - - // if the document is created hidden, prevent it being deleted until it is shown or disposed - impl_lockHiddenDocument( *xDoc, i_rDescriptor ); - - const sal_Bool bSuccess = pTargetFrame->InsertDocument_Impl( *xDoc ); - return impl_cleanUp( bSuccess, wFrame ); -} - -// -------------------------------------------------------------------------------------------------------------------- -void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) +void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const { const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); const ::rtl::OUString sTypeName = io_rDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); @@ -368,7 +324,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) + SfxTopFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) const { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); @@ -377,7 +333,7 @@ sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedVa } // -------------------------------------------------------------------------------------------------------------------- -SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel >& i_rxDocument ) +SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel >& i_rxDocument ) const { for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { @@ -392,7 +348,7 @@ SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< X } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame ) +sal_Bool SfxFrameLoader_Impl::impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame ) const { if ( !i_bSuccess && i_wFrame && !i_wFrame->GetCurrentDocument() ) { @@ -449,7 +405,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal } // -------------------------------------------------------------------------------------------------------------------- -USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ) +USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ) const { ::rtl::OUString sSlotParam; const sal_Int32 nParamPos = i_rFactoryURL.indexOf( '?' ); @@ -468,9 +424,41 @@ USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactor } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyValue >& rArgs, - const Reference< css::frame::XFrame >& _rTargetFrame ) - throw( css::uno::RuntimeException ) +void SfxFrameLoader_Impl::impl_handleCaughtError_nothrow( const Any& i_rCaughtError, const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + try + { + const Reference< XInteractionHandler > xInteraction = + i_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); + if ( !xInteraction.is() ) + return; + ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( i_rCaughtError ) ); + ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); + pRequest->addContinuation( pApprove.get() ); + + const Reference< XInteractionHandler2 > xHandler( xInteraction, UNO_QUERY_THROW ); + #if OSL_DEBUG_LEVEL > 0 + const sal_Bool bHandled = + #endif + xHandler->handleInteractionRequest( pRequest.get() ); + + #if OSL_DEBUG_LEVEL > 0 + if ( !bHandled ) + // the interaction handler couldn't deal with this error + // => report it as assertion, at least (done in the DBG_UNHANDLED_EXCEPTION below) + ::cppu::throwException( i_rCaughtError ); + #endif + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, + const Reference< XFrame >& _rTargetFrame ) + throw( RuntimeException ) { ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); @@ -493,6 +481,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV // check for factory URLs to create a new doc, instead of loading one const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); + bool bInitNewModel = bIsFactoryURL; if ( bIsFactoryURL ) { OSL_ENSURE( !aDescriptor.has( "Model" ), "SfxFrameLoader_Impl::load: sure you know what you're doing?" ); @@ -510,10 +499,17 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV } bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); - if ( !bDescribesValidTemplate ) + if ( bDescribesValidTemplate ) { - // no or no valid template found => just create a default doc of the desired type, without any template - return impl_createNewDoc( aDescriptor, _rTargetFrame, sFactory ); + // if the media descriptor allowed us to determine a template document to create the new document + // from, then do not init a new document model from scratch (below), but instead load the + // template document + bInitNewModel = false; + } + else + { + const ::rtl::OUString sServiceName = SfxObjectShell::GetServiceNameFromFactory( sFactory ); + aDescriptor.put( "DocumentService", sServiceName ); } } else @@ -534,15 +530,30 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( !xModel.is() ) { // beforehand, determine the filter to use, and update the descriptor with its information - impl_determineFilter( aDescriptor ); + if ( !bInitNewModel ) + { + impl_determineFilter( aDescriptor ); + } // create the new doc ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); - // load it + // load resp. init it Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); - xLoadable->load( aDescriptor.getPropertyValues() ); + if ( bInitNewModel ) + { + xLoadable->initNew(); + + ::comphelper::NamedValueCollection aArgs( aDescriptor ); + aArgs.remove( "StatusIndicator" ); // TODO: why this? + + xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); + } + else + { + xLoadable->load( aDescriptor.getPropertyValues() ); + } } else { @@ -567,6 +578,13 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV // if the document is created hidden, prevent it being deleted until it is shown or disposed impl_lockHiddenDocument( *xDoc, aDescriptor ); + // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, + // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter + // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the + // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature + // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the + // code at the very end of this method cares for closing the XModel, which should also close the + // ObjectShell. // insert the document into the frame if ( !impl_plugDocIntoFrame( aDescriptor, *pTargetFrame, *xDoc ) ) @@ -574,37 +592,35 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< PropertyV if ( !bExternalModel ) { - // TODO: which of those statements are allowed in the ExternalModel-case, too? - // I think the broadcast isn't, but the UpdateDocument_Impl might. pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = xDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - // TODO: grokking suggests nobody might be interested in this SID_OPENURL broadcast, anyway? + String sURL = xDoc->GetMedium()->GetName(); + if ( sURL.Len() ) + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sURL ) ); } bLoadSuccess = sal_True; } catch ( Exception& ) { - DBG_UNHANDLED_EXCEPTION(); + Any aError( ::cppu::getCaughtException() ); + if ( !aDescriptor.getOrDefault( "Silent", sal_False ) ) + impl_handleCaughtError_nothrow( aError, aDescriptor ); } - if ( !bLoadSuccess ) - { - // document loading was not successful; close SfxFrame (but not XFrame!) and document - impl_cleanUp( false, wFrame ); + // clean up, if necessary + impl_cleanUp( bLoadSuccess, wFrame ); - if ( !bExternalModel ) + // if loading was not successful, also close the document (the SfxFrame was already closed by impl_cleanUp) + if ( !bLoadSuccess && !bExternalModel ) + { + try { - try - { - Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); - xCloseable->close( sal_True ); - } - catch ( Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); + xCloseable->close( sal_True ); + } + catch ( Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } } -- cgit v1.2.3 From 1a84a8f2b2aea31b5e1762c285608993f0a941e2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 26 Nov 2009 11:39:31 +0100 Subject: #i10000# --- sfx2/source/view/frmload.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 722775df4cc2..5aec53b70baa 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -593,9 +593,9 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA if ( !bExternalModel ) { pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String sURL = xDoc->GetMedium()->GetName(); - if ( sURL.Len() ) - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sURL ) ); + String sDocumentURL = xDoc->GetMedium()->GetName(); + if ( sDocumentURL.Len() ) + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); } bLoadSuccess = sal_True; -- cgit v1.2.3 From d96b191fe42ab3396f0386d74da4c92730dbcc65 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 09:58:13 +0100 Subject: #i10000# --- sfx2/inc/pch/precompiled_sfx2.hxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index b1f81aa620d2..4ee5a26ef03c 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -496,7 +496,6 @@ #include "svtools/aeitem.hxx" #include "svtools/asynclink.hxx" #include "svtools/brdcst.hxx" -#include "svtools/cancel.hxx" #include "svtools/cntwids.hrc" #include "svtools/controldims.hrc" #include "svtools/cstitem.hxx" -- cgit v1.2.3 From 83ee99a9a2119bdd7948f702977c8a017e9aff0c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 11:49:21 +0100 Subject: [CWS autorecovery] #i65597# refactored SfxViewFrame::SwitchToViewShell_Impl to move some functionality to the UNO implementations, instead of doing it here. This is another step towards a fully UNOized view factory for SFX documents. --- sfx2/inc/frmload.hxx | 2 +- sfx2/inc/sfx2/docfac.hxx | 1 + sfx2/inc/sfx2/sfxbasecontroller.hxx | 12 +- sfx2/inc/sfx2/viewfrm.hxx | 4 + sfx2/inc/sfx2/viewsh.hxx | 2 +- sfx2/source/control/dispatch.cxx | 2 +- sfx2/source/doc/docfac.cxx | 16 ++- sfx2/source/view/sfxbasecontroller.cxx | 87 ++++++------ sfx2/source/view/topfrm.cxx | 10 +- sfx2/source/view/viewfrm.cxx | 236 ++++++++++++++------------------- sfx2/source/view/viewsh.cxx | 11 +- 11 files changed, 178 insertions(+), 205 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 1421c3df25e4..dbd8eb1ef9fb 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -63,7 +63,7 @@ class SfxTopFrame; class SfxFrameWeak; -class SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > +class SAL_DLLPRIVATE SfxFrameLoader_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XSynchronousFrameLoader, ::com::sun::star::lang::XServiceInfo > { ::comphelper::ComponentContext m_aContext; diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index d7c7999db8e1..52e6c5e579a7 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -109,6 +109,7 @@ public: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); SAL_DLLPRIVATE static void UpdateFilterContainers_Impl(); + SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ); //#endif private: diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index c952e550996e..125b5af21908 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -499,21 +499,13 @@ public: SAL_DLLPRIVATE BOOL HasMouseClickListeners_Impl(); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper (); //#endif +private: + SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const bool i_bConnect ); //________________________________________________________________________________________________________ // private variables //________________________________________________________________________________________________________ - /** With this method you can set the flag that controlls whether the - frame is released together with a controller when the later one is - disposed. - @param bFlag - When passing , the default value of this flag, then - disposing the controller results in releasing the frame. - Passing leaves the frame unaffected. - */ - void FrameIsReleasedWithController (sal_Bool bFlag); - private: IMPL_SfxBaseController_DataContainer* m_pData ; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index b759195c9b1c..7b73682c636a 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -301,7 +301,11 @@ public: SAL_DLLPRIVATE void MiscState_Impl(SfxItemSet &); SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( USHORT nId ); SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const ::rtl::OUString& sMacro); + //#endif +private: + SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ); + SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); }; //-------------------------------------------------------------------- diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index d0ac30a9fcd9..9b4e66ff84c6 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -339,11 +339,11 @@ public: SAL_DLLPRIVATE void SetFrameSet_Impl(SfxFrameSetDescriptor*); SAL_DLLPRIVATE void CheckIPClient_Impl( SfxInPlaceClient*, const Rectangle& ); SAL_DLLPRIVATE void PushSubShells_Impl( BOOL bPush=TRUE ); + SAL_DLLPRIVATE void PopSubShells_Impl() { PushSubShells_Impl( FALSE ); } SAL_DLLPRIVATE void TakeOwnerShip_Impl(); SAL_DLLPRIVATE void CheckOwnerShip_Impl(); SAL_DLLPRIVATE void TakeFrameOwnerShip_Impl(); SAL_DLLPRIVATE BOOL ExecKey_Impl(const KeyEvent& aKey); - #endif }; diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index e4a292857e49..6e834dbd7678 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -522,7 +522,7 @@ void SfxDispatcher::Pop SfxApplication *pSfxApp = SFX_APP(); #ifdef DBG_UTIL - ByteString aMsg( "SfxDispatcher(" ); + ByteString aMsg( "-SfxDispatcher(" ); aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) this ); aMsg += bPush ? ")::Push(" : ")::Pop("; if ( rShell.GetInterface() ) diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 3a00bbe3097a..0a4150604d27 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -305,10 +305,22 @@ String SfxObjectFactory::GetModuleName() const ::rtl::OUString sModuleName = aPropSet.getUnpackedValueOrDefault(PROP_MODULEUINAME, ::rtl::OUString()); return String(sModuleName); } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } + catch(const css::uno::RuntimeException&) + { throw; } catch(const css::uno::Exception&) {} return String(); } + + +sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) +{ + for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo ) + { + const sal_uInt16 curViewId = GetViewFactory( curViewNo ).GetOrdinal(); + if ( i_nViewId == curViewId ) + return curViewNo; + } + return i_nFallback; +} diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 54ccd29a7dd7..6a609f15ca3f 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ #include #include #include +#include #include @@ -440,17 +442,6 @@ struct IMPL_SfxBaseController_DataContainer SfxBaseController* m_pController ; sal_Bool m_bDisposing ; sal_Bool m_bSuspendState; - /** When this flag is (the default) then in dispose() the frame - and with it the view shell are released together with the - controller. - A derived class can set the flag to when it wants to - exchange controllers that work on the same view shell. One - application is the Impress Multi Pane GUI that changes shells that - are stacked on one view shell. Controllers are associated with the - stacked shells and thus must not destroy the view shell which is not - affected by the switching. - */ - sal_Bool m_bIsFrameReleasedWithController; css::uno::Reference< css::frame::XTitle > m_xTitleHelper; IMPL_SfxBaseController_DataContainer( MUTEX& aMutex , @@ -465,7 +456,6 @@ struct IMPL_SfxBaseController_DataContainer , m_pController ( pController ) , m_bDisposing ( sal_False ) , m_bSuspendState ( sal_False ) - , m_bIsFrameReleasedWithController( sal_True ) { } @@ -703,9 +693,7 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( true ); } } } @@ -766,9 +754,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: BOOL bRet = bOther || pDocShell->PrepareClose(); if ( bRet ) { - // disable window and dispatcher until suspend call is withdrawn - pActFrame->Enable( FALSE ); - pActFrame->GetDispatcher()->Lock( TRUE ); + ConnectSfxFrame_Impl( false ); m_pData->m_bSuspendState = sal_True; } @@ -781,9 +767,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( true ); } m_pData->m_bSuspendState = sal_False; @@ -1102,11 +1086,6 @@ void SfxBaseController::BorderWidthsChanged_Impl() // SfxBaseController -> XComponent //________________________________________________________________________________________________________ -void SfxBaseController::FrameIsReleasedWithController (sal_Bool bFlag) -{ - m_pData->m_bIsFrameReleasedWithController = bFlag; -} - void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -1123,13 +1102,10 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( m_pData->m_pViewShell ) { SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ; - if (m_pData->m_bIsFrameReleasedWithController) - { - if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) - pFrame->GetFrame()->SetIsClosing_Impl(); - m_pData->m_pViewShell->DiscardClients_Impl(); - m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; - } + if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) + pFrame->GetFrame()->SetIsClosing_Impl(); + m_pData->m_pViewShell->DiscardClients_Impl(); + m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; if ( pFrame ) { @@ -1146,12 +1122,9 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime pView = SfxViewFrame::GetNext( *pView, pDoc ); } - if ( m_pData->m_bIsFrameReleasedWithController ) - { - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); - if ( !pView ) - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); - } + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); + if ( !pView ) + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); REFERENCE< XMODEL > xModel = pDoc->GetModel(); REFERENCE < ::com::sun::star::util::XCloseable > xCloseable( xModel, com::sun::star::uno::UNO_QUERY ); @@ -1168,8 +1141,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime m_pData->m_xListener->disposing( aObject ); SfxViewShell *pShell = m_pData->m_pViewShell; m_pData->m_pViewShell = NULL; - if ( pFrame->GetViewShell() == pShell - && m_pData->m_bIsFrameReleasedWithController) + if ( pFrame->GetViewShell() == pShell ) { // Enter registrations only allowed if we are the owner! if ( pFrame->GetFrame()->OwnsBindings_Impl() ) @@ -1374,6 +1346,39 @@ BOOL SfxBaseController::HasMouseClickListeners_Impl() return m_pData->m_aUserInputInterception.hasMouseClickListeners(); } +void SfxBaseController::ConnectSfxFrame_Impl( const bool i_bConnect ) +{ + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + + // disable window and dispatcher + pActFrame->Enable( i_bConnect ); + pActFrame->GetDispatcher()->Lock( !i_bConnect ); + + if ( i_bConnect ) + { + pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); + if ( m_pData->m_pViewShell->GetSubShell() ) + pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); + m_pData->m_pViewShell->PushSubShells_Impl(); + pActFrame->GetDispatcher()->Flush(); + + Window* pEditWin = m_pData->m_pViewShell->GetWindow(); + if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() ) + pEditWin->Show(); + + if ( SfxViewFrame::Current() == pActFrame ) + pActFrame->GetDispatcher()->Update_Impl( sal_True ); + } + + // invalidate slot corresponding to the view shell + const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pActFrame->GetCurViewId(), USHRT_MAX ); + DBG_ASSERT( nViewNo != USHRT_MAX, "view shell id not found" ); + if ( nViewNo != USHRT_MAX ) + pActFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 ); +} + //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper () { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 6f6c2939cc7c..d3f094dbc947 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -1180,15 +1180,9 @@ SfxTopViewFrame::SfxTopViewFrame LockAdjustPosSizePixel(); } - try - { - if ( pObjShell ) - SwitchToViewShell_Impl( nViewId ); - } - catch (com::sun::star::uno::Exception& ) + if ( pObjShell && !SwitchToViewShell_Impl( nViewId ) ) { - // make sure that the ctor is left regularly - ReleaseObjectShell_Impl(); + // TODO: better error handling? Under which conditions can this fail? return; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 8835886b857b..042e48edeb70 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -101,6 +101,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using ::com::sun::star::awt::XWindow; namespace css = ::com::sun::star; #ifndef GCC @@ -1031,6 +1032,29 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) rSet.DisableItem( SID_REPEAT ); } +//-------------------------------------------------------------------- +void SfxViewFrame::PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ) +{ + i_rViewShell.PopSubShells_Impl(); + sal_uInt16 nLevel = pDispatcher->GetShellLevel( i_rViewShell ); + if ( nLevel != USHRT_MAX ) + { + if ( nLevel ) + { + // more sub shells on the stack, which were not affected by PopSubShells_Impl + SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); + if ( pSubShell == i_rViewShell.GetSubShell() ) + // "real" sub shells will be deleted elsewhere + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); + else + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); + } + pDispatcher->Pop( i_rViewShell ); + pDispatcher->Flush(); + } + +} + //-------------------------------------------------------------------- void SfxViewFrame::ReleaseObjectShell_Impl() @@ -1044,7 +1068,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl() die SfxObjectShell ausgetauscht werden. Zwischen RealeaseObjectShell() und SetObjectShell() darf die Kontrolle - nicht an das ::com::sun::star::chaos::System abgegeben werden. + nicht an das System abgegeben werden. [Querverweise] @@ -1065,21 +1089,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl() SfxViewShell *pDyingViewSh = GetViewShell(); if ( pDyingViewSh ) { - // Jetzt alle SubShells wechhauen - pDyingViewSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pDyingViewSh ); - if ( nLevel && nLevel != USHRT_MAX ) - { - // Es gibt immer nocht SubShells - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pDyingViewSh->GetSubShell() ) - //"Echte" Subshells nicht deleten - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - pDispatcher->Pop( *pDyingViewSh ); - pDispatcher->Flush(); + PopShellAndSubShells_Impl( *pDyingViewSh ); pDyingViewSh->DisconnectAllClients(); SetViewShell_Impl(0); delete pDyingViewSh; @@ -2126,11 +2136,58 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const return pViewFrame; } +//-------------------------------------------------------------------- +SfxViewShell* SfxViewFrame::LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ) +{ + OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewView_Impl: not allowed to be called with an exsiting view shell!" ); + OSL_PRECOND( GetObjectShell() != NULL, "SfxViewFrame::LoadNewView_Impl: no document -> no loading!" ); + + // our UNO doc + const Reference < XModel > xModel( GetObjectShell()->GetModel(), UNO_QUERY_THROW ); + + // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + // >>> to be moved into a UNO view factory implementation + SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + + // remember ViewID + pImp->nCurViewId = rDocumentFactory.GetViewFactory( i_nNewViewNo ).GetOrdinal(); + // TODO: shouldn't this be done in success case only? + + SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( i_nNewViewNo ); + + SfxViewShell* pViewShell = rViewFactory.CreateInstance( this, i_pOldShell ); + ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); + + // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also + GetDispatcher()->SetDisableFlags( 0 ); + SetViewShell_Impl( pViewShell ); + + // ensure a default controller, if the view shell did not provide an own implementation + if ( !pViewShell->GetController().is() ) + pViewShell->SetController( new SfxBaseController( pViewShell ) ); + + // <<< to be moved into a UNO view factory implementation + // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + // introduce model/view/controller to each other + Reference < XWindow > xWindow( GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY ); + Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); + Reference < XController > xController( pViewShell->GetController() ); + + xController->attachModel( xModel ); + xModel->connectController( xController ); + xFrame->setComponent( xWindow, xController ); + xController->attachFrame( xFrame ); + xModel->setCurrentController( xController ); + + return pViewShell; +} + //-------------------------------------------------------------------- sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( - sal_uInt16 nViewId, /* > 0 + sal_uInt16 nViewIdOrNo, /* > 0 Registrierungs-Id der View, auf die umge- schaltet werden soll, bzw. die erstmalig erzeugt werden soll. @@ -2139,7 +2196,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl Es soll die Default-View verwendet werden. */ sal_Bool bIsIndex /* sal_True - 'nViewId' ist keine Registrations-Id sondern + 'nViewIdOrNo' ist keine Registrations-Id sondern ein Index in die f"ur die in diesem dargestellte . */ @@ -2166,133 +2223,44 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl */ { - try{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - - // find index of old and new ViewShell - sal_uInt16 nOldNo = USHRT_MAX, nNewNo = USHRT_MAX; - bIsIndex |= 0 == nViewId; - for ( sal_uInt16 nNo = 0; nNo < rDocFact.GetViewFactoryCount(); ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( bIsIndex && nViewId == nNo ) - { - nNewNo = nNo; - nViewId = nFoundId; // for nViewId == 0 - } - else if ( !bIsIndex && nViewId == nFoundId ) - nNewNo = nNo; - } - if ( pImp->nCurViewId == nFoundId ) - nOldNo = nNo; - } - - if ( nNewNo == USHRT_MAX ) + try { - // unknown ID -> fall back to default - sal_uInt16 nFoundId = rDocFact.GetViewFactory(0).GetOrdinal(); - nNewNo = 0; - nViewId = nFoundId; - if ( pImp->nCurViewId == nFoundId ) - nOldNo = 0; - } - - SfxViewShell *pSh = GetViewShell(); + ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - DBG_ASSERT( !pSh || nOldNo != USHRT_MAX, "old shell id not found" ); - - // does a ViewShell exist already? - SfxViewShell *pOldSh = pSh; - if ( pOldSh ) - { - // ask wether it can be closed - if ( !pOldSh->PrepareClose() ) - return sal_False; + GetBindings().ENTERREGISTRATIONS(); + LockAdjustPosSizePixel(); - // remove SubShells from Dispatcher before switching to new ViewShell - pOldSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pOldSh ); - if ( nLevel ) + // if we already have a view shell, remove it + SfxViewShell* pOldSh = GetViewShell(); + if ( pOldSh ) { - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pOldSh->GetSubShell() ) - //"real" SubShells are not deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - // SubShells only known to Dispatcher must be deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - - pDispatcher->Pop( *pOldSh ); - GetBindings().Invalidate( nOldNo + SID_VIEWSHELL0 ); - } - - // remember ViewID - pImp->nCurViewId = nViewId; - GetBindings().Invalidate( nNewNo + SID_VIEWSHELL0 ); + // ask wether it can be closed + Reference< XController > xController( pOldSh->GetController(), UNO_SET_THROW ); + if ( !xController->suspend( sal_True ) ) + return sal_False; - // create new ViewShell - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - LockAdjustPosSizePixel(); - - GetBindings().ENTERREGISTRATIONS(); - pSh = rViewFactory.CreateInstance(this, pOldSh); - - Window *pEditWin = pSh->GetWindow(); - DBG_ASSERT( !pEditWin || !pEditWin->IsReallyVisible(), "don`t show your ViewShell`s Window by yourself!" ); - - // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also - GetDispatcher()->SetDisableFlags( 0 ); - SetViewShell_Impl(pSh); + // remove sub shells from Dispatcher before switching to new ViewShell + PopShellAndSubShells_Impl( *pOldSh ); - Reference < ::com::sun::star::awt::XWindow > xWindow( - GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY ); - Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); - if ( !pSh->GetController().is() ) - pSh->SetController( new SfxBaseController( pSh ) ); - Reference < XController > xController( pSh->GetController() ); - xFrame->setComponent( xWindow, xController ); - - xController->attachFrame( xFrame ); - Reference < XModel > xModel( GetObjectShell()->GetModel() ); - if ( xModel.is() ) - { - xController->attachModel( xModel ); - xModel->connectController( xController ); - xModel->setCurrentController( xController ); - } - - GetDispatcher()->Push( *pSh ); - if ( pSh->GetSubShell() ) - GetDispatcher()->Push( *pSh->GetSubShell() ); - pSh->PushSubShells_Impl(); - GetDispatcher()->Flush(); - - // create UI elements before size is set - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl( sal_True ); - - // allow resize events to be processed - UnlockAdjustPosSizePixel(); + // reset view shell, that's a precondition for the LoadNewView_Impl below + SetViewShell_Impl( NULL ); + } - Window* pFrameWin = &GetWindow(); - if ( pFrameWin != &GetFrame()->GetWindow() ) - pFrameWin->Show(); + // create and load new ViewShell + SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); + const sal_uInt16 nNewNo = ( bIsIndex || !nViewIdOrNo ) ? nViewIdOrNo : rDocFact.GetViewNo_Impl( nViewIdOrNo, 0 ); + SfxViewShell* pNewSh = LoadNewView_Impl( nNewNo, pOldSh ); - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel( pSh, Point(), GetWindow().GetOutputSizePixel() ); + // allow resize events to be processed + UnlockAdjustPosSizePixel(); - if ( pEditWin && pSh->IsShowView_Impl() ) - pEditWin->Show(); + if ( GetWindow().IsReallyVisible() ) + DoAdjustPosSizePixel( pNewSh, Point(), GetWindow().GetOutputSizePixel() ); - GetBindings().LEAVEREGISTRATIONS(); - delete pOldSh; + GetBindings().LEAVEREGISTRATIONS(); + delete pOldSh; } - catch ( com::sun::star::uno::Exception& ) + catch ( const com::sun::star::uno::Exception& ) { // the SfxCode is not able to cope with exceptions thrown while creating views // the code will crash in the stack unwinding procedure, so we shouldn't let exceptions go through here diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index f6053a467ed4..755859dcdcd7 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1517,16 +1517,12 @@ void SfxViewShell::PushSubShells_Impl( BOOL bPush ) { for ( USHORT n=0; nPush( *pImp->aArr[n] ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED4 ) ); } else if ( nCount ) { - pDisp->Pop( *pImp->aArr[0], SFX_SHELL_POP_UNTIL ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED3 ) ); + SfxShell& rPopUntil = *pImp->aArr[0]; + if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX ) + pDisp->Pop( rPopUntil, SFX_SHELL_POP_UNTIL ); } pDisp->Flush(); @@ -2243,3 +2239,4 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf { } } + -- cgit v1.2.3 From 4bd5ed95561730fe157252396f5c2cbfc8b2348b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 13:45:16 +0100 Subject: [CWS autorecovery] removed nUnused --- sfx2/inc/sfx2/objsh.hxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index d43d43c1dd86..3f23e3eda0db 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -221,7 +221,6 @@ private: SfxMedium * pMedium; // Beschreibung der Datei bzw. des Storage, in dem sich das Objekt befindet SfxStyleSheetBasePool* pStyleSheetPool; // StyleSheets SfxObjectCreateMode eCreateMode; // Zweck des Objekts - sal_uInt16 nUnused; sal_Bool bHasName :1, // sal_True := bestehendes Objekt, sal_False := es ist ein neues Objekt bIsTmp :1; // temp. Storage -- cgit v1.2.3 From ec10256b0b70421a64af47e85bf1e63bdf2f09e2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 15:48:45 +0100 Subject: on wntmsci* platforms, do not echo to to-be-compiled C(++) file name twice, if not in verbose mode --- solenv/inc/rules.mk | 44 ++++++++++++++++++++++---------------------- solenv/inc/settings.mk | 2 ++ solenv/inc/wntmsci11.mk | 5 +++++ 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/solenv/inc/rules.mk b/solenv/inc/rules.mk index 71909c8d348b..2c00889cfc25 100644 --- a/solenv/inc/rules.mk +++ b/solenv/inc/rules.mk @@ -32,7 +32,7 @@ MKFILENAME:=RULES.MK $(OBJ)/%.obj : %.cxx - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(CFLAGSINCXX)$(PWD)/$*.cxx @@ -56,7 +56,7 @@ $(OBJ)/%.obj : %.cxx .ENDIF # "$(nodep)"=="" $(OBJ)/%.obj : %.cpp - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(CFLAGSINCXX)$(PWD)/$*.cpp @@ -78,7 +78,7 @@ $(OBJ)/%.obj : %.cpp .ENDIF # "$(nodep)"=="" $(OBJ)/%.obj : %.cc - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(CFLAGSINCXX)$(PWD)/$*.cc @@ -159,7 +159,7 @@ $(SLO)/precompiled_ex.% .PHONY: .ENDIF # "$(ENABLE_PCH)"!="" $(SLO)/%.obj : %.cxx - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(ENABLE_PCH)"!="" && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" ) # just a helper var @noop $(assign used_exc_switches=$(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS))) @@ -198,7 +198,7 @@ $(SLO)/%.obj : %.cxx .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : %.cpp - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXSLO) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) -E $(CFLAGSINCXX)$(PWD)/$*.cpp @@ -224,7 +224,7 @@ $(SLO)/%.obj : %.cpp .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : $(MISC)/%.cxx - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXSLO) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) -E $(CFLAGSINCXX)$(MISC)/$*.cxx @@ -249,7 +249,7 @@ $(SLO)/%.obj : $(MISC)/%.cxx .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : $(MISC)/%.cc - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXSLO) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) -E $(CFLAGSINCXX)$(MISC)/$*.cc @@ -266,7 +266,7 @@ $(SLO)/%.obj : $(MISC)/%.cc .ENDIF $(OBJ)/%.obj : $(MISC)/%.cxx - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(CXX) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(CFLAGSCXXOBJ) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CDEFSMT) $(!eq,$(EXCEPTIONSFILES),$(subst,$@, $(EXCEPTIONSFILES)) $(LOCAL_EXCEPTIONS_FLAGS) $(GLOBAL_EXCEPTIONS_FLAGS)) -E $(CFLAGSINCXX)$(MISC)/$*.cxx @@ -291,7 +291,7 @@ $(OBJ)/%.obj : $(MISC)/%.cxx .ENDIF # "$(nodep)"=="" $(OBJ)/%.obj : %.c - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(CC) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $*.c @@ -321,7 +321,7 @@ $(OBJ)/%.obj : %.c .ENDIF # "$(nodep)"=="" $(OBJ)/%.obj : $(MISC)/%.c - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CC) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(MISC)/$*.c @@ -343,7 +343,7 @@ $(OBJ)/%.obj : $(MISC)/%.c .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : $(MISC)/%.c - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CC) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $(MISC)/$*.c @@ -366,7 +366,7 @@ $(SLO)/%.obj : $(MISC)/%.c .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : %.c - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(GUI)"=="UNX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(CC) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $*.c @@ -389,7 +389,7 @@ $(SLO)/%.obj : %.c # Objective-C files $(OBJ)/%.obj : %.m - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(objc) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(OBJCFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $*.m @@ -404,7 +404,7 @@ $(OBJ)/%.obj : %.m # Objective-C files $(OBJ)/%.obj : $(MISC)/%.m - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objc) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(OBJCFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(MISC)/$*.m @@ -415,7 +415,7 @@ $(OBJ)/%.obj : $(MISC)/%.m # Objective-C files $(SLO)/%.obj : $(MISC)/%.m - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objc) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(OBJCFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $(MISC)/$*.m @@ -426,7 +426,7 @@ $(SLO)/%.obj : $(MISC)/%.m # Objective-C files $(SLO)/%.obj : %.m - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objc) $(CFLAGS) $(INCLUDE_C) $(CFLAGSCC) $(OBJCFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $*.m @@ -442,7 +442,7 @@ not_existing/o_%.dpcc : %.c;@noop $(assign all_local_obj+:=$<) # Objective-C++ files $(OBJ)/%.obj : %.mm - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" .IF "$(TEST)"!="" $(COMMAND_ECHO)$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCC) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) -E $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $*.mm @@ -461,7 +461,7 @@ $(OBJ)/%.obj : %.mm # Objective-C++ files $(OBJ)/%.obj : $(MISC)/%.mm - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSOBJ) $(CDEFS) $(CDEFSOBJ) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(OBJ)/$*.o $(MISC)/$*.mm @@ -476,7 +476,7 @@ $(OBJ)/%.obj : $(MISC)/%.mm # Objective-C++ files $(SLO)/%.obj : $(MISC)/%.mm - @echo Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(<:f) + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(OUTPATH)/misc/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $(MISC)/$*.mm @@ -491,7 +491,7 @@ $(SLO)/%.obj : $(MISC)/%.mm # Objective-C++ files $(SLO)/%.obj : %.mm - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(OS)"=="MACOSX" @$(RM) $@ $(@:s/.obj/.o/) $(COMMAND_ECHO)$(objcpp) $(CFLAGS) $(INCLUDE) $(CFLAGSCXX) $(OBJCXXFLAGS) $(CFLAGSSLO) $(CDEFS) $(CDEFSSLO) $(CDEFSMT) $(CFLAGSAPPEND) $(CFLAGSOUTOBJ) $(SLO)/$*.o $*.mm @@ -639,7 +639,7 @@ $(MISC)/%.dpj : .ENDIF # "$(nodep)"=="" $(SLO)/%.obj : %.asm - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(COM)"=="GCC" .IF "$(ASM)"=="ml" $(COMMAND_ECHO)$(ASM) $(AFLAGS) -D$(COM) /Fo$(SLO)/$*.obj $*.asm @@ -666,7 +666,7 @@ $(SLO)/%.obj : %.asm .ENDIF $(OBJ)/%.obj : %.asm - @echo Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$< + @echo $(COMPILE_ECHO_SWITCH) Compiling: $(PRJNAME)/$(PATH_IN_MODULE)/$(COMPILE_ECHO_FILE) .IF "$(COM)"=="GCC" .IF "$(ASM)"=="ml" $(COMMAND_ECHO)$(ASM) $(AFLAGS) -D$(COM) /Fo$(OBJ)/$*.obj $*.asm diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk index 8d068bd28c04..6fe04256af36 100644 --- a/solenv/inc/settings.mk +++ b/solenv/inc/settings.mk @@ -993,6 +993,8 @@ RSC=$(AUGMENT_LIBRARY_PATH) $(FLIPCMD) $(SOLARBINDIR)/rsc ULFEX_VERBOSITY=-QQ .ENDIF .ENDIF # "$(VERBOSE)" == "TRUE" +COMPILE_ECHO_SWITCH= +COMPILE_ECHO_FILE=$(<:f) #new RSCUPDVER=$(RSCREVISION) diff --git a/solenv/inc/wntmsci11.mk b/solenv/inc/wntmsci11.mk index 3d2750fd2dc6..1bb994f1ad6f 100644 --- a/solenv/inc/wntmsci11.mk +++ b/solenv/inc/wntmsci11.mk @@ -75,6 +75,11 @@ CXX+= /NMttNoLines NOLOGO*=-nologo .ENDIF +.IF "$(VERBOSE)" != "TRUE" +COMPILE_ECHO_SWITCH=-n +COMPILE_ECHO_FILE= +.ENDIF + # Flags for COMEX == 11 # disable "warning C4675: resolved overload was found by argument-dependent -- cgit v1.2.3 From 93a7b558588be1f12e137329548b706daccc07df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 21:16:24 +0100 Subject: [CWS autorecovery] merged SfxTopFrame into SfxFrame SfxTopFrame was the only class deriving from the abstract class SfxFrame, so both can effectively be treated as one class. --- sfx2/inc/frmload.hxx | 3 +- sfx2/inc/sfx2/frame.hxx | 55 +++++++------ sfx2/inc/sfx2/objsh.hxx | 1 - sfx2/inc/sfx2/topfrm.hxx | 40 ---------- sfx2/source/control/bindings.cxx | 2 +- sfx2/source/control/dispatch.cxx | 4 +- sfx2/source/view/frame.cxx | 51 ++++-------- sfx2/source/view/frmload.cxx | 6 +- sfx2/source/view/impframe.hxx | 53 +++++++------ sfx2/source/view/ipclient.cxx | 8 +- sfx2/source/view/topfrm.cxx | 166 ++++++++++++--------------------------- sfx2/source/view/viewfrm.cxx | 14 ++-- 12 files changed, 138 insertions(+), 265 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index dbd8eb1ef9fb..faace37d1388 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -59,7 +59,6 @@ class SfxFilter; class SfxFilterMatcher; -class SfxTopFrame; class SfxFrameWeak; @@ -125,7 +124,7 @@ private: sal_Bool impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rTargetFrame, + SfxFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) const; diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index c33626a5f648..f24ca488ea30 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -90,6 +90,7 @@ class Rectangle; class SfxRequest; class SfxUnoControllerItem; class SvCompatWeakHdl; +class SystemWindow; typedef SfxFrame* SfxFramePtr; class SfxFrameArr_Impl; @@ -129,43 +130,47 @@ class SfxUnoFrame; class SFX2_DLLPUBLIC SfxFrame { friend class SfxFrameIterator; - friend struct SfxFramePickEntry_Impl; - friend class SfxUnoFrame; - friend class SfxViewFrame; /*HACK!*/ + friend class SfxTopWindow_Impl; +// friend struct SfxFramePickEntry_Impl; +// friend class SfxUnoFrame; +// friend class SfxViewFrame; /*HACK!*/ private: - String aName; SfxFrame* pParentFrame; SfxFrameArr_Impl* pChildArr; SfxFrame_Impl* pImp; - SfxUnoFrame* pUnoImp; + Window* pWindow; protected: - virtual sal_Bool Close() = 0; + sal_Bool Close(); virtual ~SfxFrame(); //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void SetCurrentDocument_Impl( SfxObjectShell* ); - SAL_DLLPRIVATE void InsertChildFrame_Impl( SfxFrame*, sal_uInt16 nPos = 0 ); SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); - SAL_DLLPRIVATE void SetIsTop_Impl( sal_Bool bIsTop = sal_True ); //#endif + SfxFrame( ); // not implemented + SAL_DLLPRIVATE SfxFrame( Window& i_rExternalWindow, bool bHidden ); + public: TYPEINFO(); - SfxFrame(SfxFrame* pParent = 0); + + static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); + static SfxFrame* Create( SfxObjectShell* pDoc = NULL, USHORT nViewId = NULL, bool bHidden = false, const SfxItemSet* pSet = NULL); + static SfxFrame* Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewId = 0, bool bHidden = false, const SfxItemSet* pSet = NULL ); SvCompatWeakHdl* GetHdl(); - virtual Window& GetWindow() const = 0; + Window& GetWindow() const; void CancelTransfers( sal_Bool bCancelLoadEnv = sal_True ); sal_Bool DoClose(); sal_uInt16 GetChildFrameCount() const; SfxFrame* GetChildFrame( sal_uInt16 nPos ) const; - const String& GetFrameName() const - { return aName; } SfxFrame* GetParentFrame() const { return pParentFrame; } + void SetPresentationMode( BOOL bSet ); + SystemWindow* GetSystemWindow() const; + static SfxFrame* GetFirst(); static SfxFrame* GetNext( SfxFrame& ); @@ -202,13 +207,7 @@ public: SAL_DLLPRIVATE sal_Bool DoClose_Impl(); SAL_DLLPRIVATE void SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); SAL_DLLPRIVATE void ReleasingComponent_Impl( sal_Bool bSet ); - SAL_DLLPRIVATE sal_uInt16 LoadComponent_Impl( const ::rtl::OUString& rURL, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrameLoader > & rLoader, - SfxItemSet* pSet=0, sal_Bool bDontClose=sal_False ); - DECL_DLLPRIVATE_STATIC_LINK( SfxFrame, BindingHasNewPart_Impl, void* ); SAL_DLLPRIVATE void GetViewData_Impl(); - SAL_DLLPRIVATE void ActivatePickEntry_Impl( SfxFramePickEntry_Impl*, sal_uInt16 nMode, SfxFrameDescriptor *pD = NULL ); SAL_DLLPRIVATE void SetFrameType_Impl( sal_uInt32 ); SAL_DLLPRIVATE sal_uInt16 PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing=sal_False ); SAL_DLLPRIVATE sal_Bool DocIsModified_Impl(); @@ -221,11 +220,6 @@ public: SAL_DLLPRIVATE SfxFrameDescriptor* GetDescriptor() const; SAL_DLLPRIVATE void Lock_Impl( sal_Bool bLock ); - SAL_DLLPRIVATE sal_uInt16 GetLockCount_Impl() const; - //sal_Bool IsLocked_Impl() const - // { return GetLockCount_Impl() > 0; } - SAL_DLLPRIVATE void CloseOnUnlock_Impl(); - SAL_DLLPRIVATE SfxViewFrame* ActivateChildFrame_Impl(); SAL_DLLPRIVATE SfxDispatcher* GetDispatcher_Impl() const; SAL_DLLPRIVATE sal_Bool IsAutoLoadLocked_Impl() const; @@ -243,13 +237,18 @@ public: SAL_DLLPRIVATE Rectangle GetTopOuterRectPixel_Impl() const; SAL_DLLPRIVATE void CreateWorkWindow_Impl(); SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* pWorkwin ); - SAL_DLLPRIVATE const SvBorder& GetBorder_Impl() const; SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); - SAL_DLLPRIVATE void ReFill_Impl( const SfxFrameSetDescriptor* pSet ); - SAL_DLLPRIVATE void CloseDocument_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); -// sal_Bool IsPlugin_Impl() const; + + SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc ); + SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); + SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); + SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; + SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; + SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; //#endif +private: + SAL_DLLPRIVATE void Construct_Impl(); }; SV_DECL_COMPAT_WEAK( SfxFrame ) diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 3f23e3eda0db..94d04c20a040 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -95,7 +95,6 @@ class GDIMetaFile; class Bitmap; class INetURLObject; class IndexBitSet; -class SfxTopFrame; class SfxAcceleratorManager; class JobSetup; class Size; diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx index d64c5d6de9a4..eedfbb550228 100644 --- a/sfx2/inc/sfx2/topfrm.hxx +++ b/sfx2/inc/sfx2/topfrm.hxx @@ -41,46 +41,8 @@ #include class SfxViewShell; -class SfxTopFrame; -class SfxTopFrame_Impl; namespace svtools { class AsynchronLink; } -// class SfxTopFrame ----------------------------------------------------- - -class SFX2_DLLPUBLIC SfxTopFrame : public SfxFrame -{ -friend class SfxTopWindow_Impl; -friend class SfxTopFrameWindow_Impl; -friend class SfxTopFrame_Impl; - - SfxTopFrame_Impl* pImp; - Window* pWindow; - SAL_DLLPRIVATE SfxTopFrame( Window* pWindow=NULL, sal_Bool bHidden = sal_False ); - SAL_DLLPRIVATE virtual ~SfxTopFrame(); -public: - TYPEINFO(); - - static SfxTopFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); - static SfxTopFrame* Create( SfxObjectShell* pDoc=0, USHORT nViewId=0, BOOL bHidden=sal_False, const SfxItemSet* pSet=NULL ); - static SfxTopFrame* Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId=0, BOOL bHidden=sal_False, const SfxItemSet* pSet=NULL ); - - virtual Window& GetWindow() const; - virtual BOOL Close(); - String GetWindowData(); - - void SetPresentationMode( BOOL bSet ); - SystemWindow* GetSystemWindow() const; - -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc ); - SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); - SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); - SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; - SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; - SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; -//#endif -}; - // class SfxTopViewFrame ------------------------------------------------- class SfxTopViewFrame_Impl; @@ -115,8 +77,6 @@ public: SAL_DLLPRIVATE void GetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); - SAL_DLLPRIVATE SfxTopFrame* GetTopFrame_Impl() - { return (SfxTopFrame*) GetFrame(); } //#endif }; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 48c4b16fbf8c..3a2796aba995 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2350,7 +2350,7 @@ SystemWindow* SfxBindings::GetSystemWindow() const while ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); SfxTopViewFrame* pTop = PTR_CAST( SfxTopViewFrame, pFrame->GetTopViewFrame() ); - return pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + return pTop->GetFrame()->GetTopWindow_Impl(); } BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 6e834dbd7678..6cd32f4b24f8 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1679,7 +1679,7 @@ void SfxDispatcher::SetMenu_Impl() SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); + SfxFrame* pFrm = pTop->GetFrame(); if ( pFrm->IsMenuBarOn_Impl() ) { com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); @@ -2914,7 +2914,7 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); + SfxFrame* pFrm = pTop->GetFrame(); if ( pFrm->IsMenuBarOn_Impl() ) { com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index a72822ec7c53..15b3deb67942 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -104,28 +104,27 @@ TYPEINIT1(SfxFrame, SfxListener); TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem); TYPEINIT1(SfxUsrAnyItem, SfxPoolItem); -SfxFrame::SfxFrame(SfxFrame* pParent): - pParentFrame( pParent ), - pChildArr(0), - pUnoImp(0) +SvCompatWeakHdl* SfxFrame::GetHdl() +{ + return pImp->GetHdl(); +} + +//-------------------------------------------------------------------- +void SfxFrame::Construct_Impl() { pImp = new SfxFrame_Impl( this ); - if ( pParent ) - pParent->InsertChildFrame_Impl( this ); if ( !pFramesArr_Impl ) pFramesArr_Impl = new SfxFrameArr_Impl; pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() ); } -SvCompatWeakHdl* SfxFrame::GetHdl() -{ - return pImp->GetHdl(); -} - //-------------------------------------------------------------------- SfxFrame::~SfxFrame() { + RemoveTopFrame_Impl( this ); + DELETEZ( pWindow ); + pFramesArr_Impl->Remove( pFramesArr_Impl->GetPos( this ) ); if ( pParentFrame ) @@ -277,14 +276,6 @@ SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const return 0L; } -void SfxFrame::InsertChildFrame_Impl( SfxFrame* pFrame, sal_uInt16 nPos ) -{ - if ( !pChildArr ) - pChildArr = new SfxFrameArr_Impl; - pChildArr->Insert( pFrame, nPos ); - pFrame->pParentFrame = this; -} - void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) { DBG_ASSERT( pChildArr, "Unbekannter Frame!"); @@ -294,10 +285,10 @@ void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) SfxFrame* SfxFrame::GetTopFrame() const { - SfxFrame *pParent = (SfxFrame*) this; + const SfxFrame* pParent = this; while ( pParent->pParentFrame ) pParent = pParent->pParentFrame; - return pParent; + return const_cast< SfxFrame* >( pParent ); } sal_Bool SfxFrame::IsClosing_Impl() const @@ -321,11 +312,9 @@ SfxViewFrame* SfxFrame::InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTarge if ( rpTargetFrame ) { - SfxTopFrame* pTopFrame = dynamic_cast< SfxTopFrame* >( rpTargetFrame ); - OSL_ENSURE( pTopFrame, "SfxFrame::InsertDocument: an SfxFrame which is no SfxTopFrame?!" ); if ( bHidden ) rDoc.PutItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - pTopFrame->InsertDocument_Impl( rDoc ); + rpTargetFrame->InsertDocument_Impl( rDoc ); pViewFrame = rpTargetFrame->GetCurrentViewFrame(); } else @@ -385,12 +374,7 @@ SfxObjectShell* SfxFrame::GetCurrentDocument() const { return pImp->pCurrentViewFrame ? pImp->pCurrentViewFrame->GetObjectShell() : - pImp->pCurrentObjectShell; -} - -void SfxFrame::SetCurrentDocument_Impl( SfxObjectShell *pDoc ) -{ - pImp->pCurrentObjectShell = pDoc; + NULL; } void SfxFrame::SetCurrentViewFrame_Impl( SfxViewFrame *pFrame ) @@ -558,8 +542,6 @@ void SfxFrame::GetTargetList( TargetList& rList ) const for ( sal_uInt16 n=0; nGetFrameName().Len() ) - rList.Insert( new String (pFrame->GetFrameName()) ); pFrame->GetTargetList( rList ); } } @@ -915,11 +897,6 @@ void SfxFrame::CreateWorkWindow_Impl() pImp->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame ); } -const SvBorder& SfxFrame::GetBorder_Impl() const -{ - return pImp->aBorder; -} - void SfxFrame::GrabFocusOnComponent_Impl() { if ( pImp->bReleasingComponent ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 5aec53b70baa..09687006e3c2 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -250,7 +250,7 @@ namespace // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame ) { - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( i_rxFrame ); + SfxFrame* pTargetFrame = SfxFrame::Create( i_rxFrame ); ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); SfxFrameWeak wFrame = pTargetFrame; @@ -324,7 +324,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxTopFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) const + SfxFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) const { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); @@ -568,7 +568,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } // create a frame - SfxTopFrame* pTargetFrame = SfxTopFrame::Create( _rTargetFrame ); + SfxFrame* pTargetFrame = SfxFrame::Create( _rTargetFrame ); ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); wFrame = pTargetFrame; diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index f5bcc27733b0..46cf52fea19f 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -54,14 +54,12 @@ class SfxObjectShell; class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase { -friend class SfxFrame; - +public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; String aFrameIdName; sal_uInt32 nType; sal_uInt32 nHistoryPos; SfxViewFrame* pCurrentViewFrame; - SfxObjectShell* pCurrentObjectShell; SfxFrameDescriptor* pDescr; sal_uInt16 nFrameId; sal_uInt16 nLocks; @@ -76,27 +74,36 @@ friend class SfxFrame; const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; SvBorder aBorder; + // formerly SfxTopFrame + Window* pExternalWindow; + bool bHidden; + bool bLockResize; + bool bMenuBarOn; - SfxFrame_Impl( SfxFrame* pAntiImplP ) : - SvCompatWeakBase( pAntiImplP ), - nType( 0L ), - nHistoryPos( 0 ), - pCurrentViewFrame( NULL ), - pCurrentObjectShell( NULL ), - pDescr( NULL ), - nFrameId( 0 ), - nLocks( 0 ), - bCloseOnUnlock( sal_False ), - bClosing(sal_False), - bPrepClosing(sal_False), - bInCancelTransfers( sal_False ), - bOwnsBindings( sal_False ), - bReleasingComponent( sal_False ), - bInPlace( sal_False ), - pFrame( pAntiImplP ), - pSet( 0 ), - pWorkWin( 0 ) - {} + SfxFrame_Impl( SfxFrame* pAntiImplP ) + :SvCompatWeakBase( pAntiImplP ) + ,nType( 0L ) + ,nHistoryPos( 0 ) + ,pCurrentViewFrame( NULL ) + ,pDescr( NULL ) + ,nFrameId( 0 ) + ,nLocks( 0 ) + ,bCloseOnUnlock( sal_False ) + ,bClosing(sal_False) + ,bPrepClosing(sal_False) + ,bInCancelTransfers( sal_False ) + ,bOwnsBindings( sal_False ) + ,bReleasingComponent( sal_False ) + ,bInPlace( sal_False ) + ,pFrame( pAntiImplP ) + ,pSet( 0 ) + ,pWorkWin( 0 ) + ,pExternalWindow( NULL ) + ,bHidden( false ) + ,bLockResize( false ) + ,bMenuBarOn( true ) + { + } virtual ~SfxFrame_Impl() { } }; diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index a8b57be6714b..f025a373f1ae 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -986,7 +986,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame()->LockResize_Impl(TRUE); try { m_pImp->m_xObject->setClientSite( m_pImp->m_xClient ); @@ -1036,7 +1036,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( m_pViewSh ) { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); + pFrame->GetTopFrame()->LockResize_Impl(FALSE); pFrame->GetTopFrame()->Resize(); } } @@ -1097,7 +1097,7 @@ void SfxInPlaceClient::DeactivateObject() } if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame()->LockResize_Impl(TRUE); if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) { @@ -1119,7 +1119,7 @@ void SfxInPlaceClient::DeactivateObject() { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); SfxViewFrame::SetViewFrame( pFrame ); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); + pFrame->GetTopFrame()->LockResize_Impl(FALSE); pFrame->GetTopFrame()->Resize(); } } diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index d3f094dbc947..5913503e6254 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -71,6 +71,7 @@ #include #include #include +#include #include @@ -97,6 +98,7 @@ #include #include "statcach.hxx" #include +#include "impframe.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -134,24 +136,12 @@ static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) return sVar; } -class SfxTopFrame_Impl -{ -public: - Window* pWindow; // maybe external - BOOL bHidden; - BOOL bLockResize; - BOOL bMenuBarOn; -}; - class SfxTopWindow_Impl : public Window { public: - SfxTopFrame* pFrame; + SfxFrame* pFrame; - SfxTopWindow_Impl( SfxTopFrame* pF ); -// : Window( pF->pImp->pWindow, WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) -// , pFrame( pF ) -// { SetBackground(); } + SfxTopWindow_Impl( SfxFrame* pF, Window& i_rExternalWindow ); ~SfxTopWindow_Impl( ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); @@ -164,8 +154,8 @@ public: DECL_LINK( CloserHdl, void* ); }; -SfxTopWindow_Impl::SfxTopWindow_Impl( SfxTopFrame* pF ) - : Window( pF->pImp->pWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) +SfxTopWindow_Impl::SfxTopWindow_Impl( SfxFrame* pF, Window& i_rExternalWindow ) + : Window( &i_rExternalWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) , pFrame( pF ) { } @@ -195,7 +185,7 @@ long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt ) { if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) { - DBG_TRACE("SfxTopFrame: GotFocus"); + DBG_TRACE("SfxFrame: GotFocus"); pView->MakeActive_Impl( FALSE ); } @@ -390,10 +380,10 @@ static String _getTabString() return result; } -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) +SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, const SfxItemSet* pSet ) { Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - SfxTopFrame *pFrame = NULL; + SfxFrame *pFrame = NULL; BOOL bNewView = FALSE; if ( pSet ) { @@ -470,7 +460,7 @@ SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHi SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; for( USHORT nPos = rArr.Count(); nPos--; ) { - SfxTopFrame *pF = (SfxTopFrame*) rArr[ nPos ]; + SfxFrame *pF = rArr[ nPos ]; if ( pF->GetCurrentDocument() == pDoc ) { pFrame = pF; @@ -539,21 +529,21 @@ SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHi return pFrame; } -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) +SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewId, bool bHidden, const SfxItemSet* pSet ) { Reference < ::com::sun::star::lang::XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); Reference < XFramesSupplier > xDesktop ( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); Reference < XFrame > xFrame( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), UNO_QUERY ); - xFrame->initialize( VCLUnoHelper::GetInterface ( pWindow ) ); + uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY ); + xFrame->initialize( xWin.get() ); if ( xDesktop.is() ) xDesktop->getFrames()->append( xFrame ); - uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( pWindow ), uno::UNO_QUERY ); if ( xWin.is() && xWin->isActive() ) xFrame->activate(); - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); + SfxFrame* pFrame = new SfxFrame( rWindow, false ); pFrame->SetFrameInterface_Impl( xFrame ); pFrame->pImp->bHidden = bHidden; @@ -568,59 +558,34 @@ SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT return pFrame; } -SfxTopFrame* SfxTopFrame::Create( Reference < XFrame > xFrame ) +SfxFrame* SfxFrame::Create( Reference < XFrame > xFrame ) { // create a new TopFrame to an external XFrame object ( wrap controller ) - DBG_ASSERT( xFrame.is(), "Wrong parameter!" ); - + ENSURE_OR_THROW( xFrame.is(), "NULL frame not allowed" ); Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); + ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); + + SfxFrame* pFrame = new SfxFrame( *pWindow, false ); pFrame->SetFrameInterface_Impl( xFrame ); return pFrame; } -SfxTopFrame::SfxTopFrame( Window* pExternal, sal_Bool bHidden ) - : SfxFrame( NULL ) - , pWindow( NULL ) +SfxFrame::SfxFrame( Window& i_rExternalWindow, bool i_bHidden ) + :pParentFrame( NULL ) + ,pChildArr( NULL ) + ,pImp( NULL ) + ,pWindow( NULL ) { - pImp = new SfxTopFrame_Impl; - pImp->bHidden = bHidden; - pImp->bLockResize = FALSE; - pImp->bMenuBarOn = TRUE; - InsertTopFrame_Impl( this ); - if ( pExternal ) - { - pImp->pWindow = pExternal; - } - else - { - DBG_ERROR( "TopFrame without window created!" ); -/* - pImp->pWindow = new SfxTopFrameWindow_Impl( this ); - pImp->pWindow->SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); - pImp->pWindow->SetPosSizePixel( Point( 20,20 ), Size( 800,600 ) ); - if ( GetFrameInterface().is() ) - GetFrameInterface()->initialize( VCLUnoHelper::GetInterface( pImp->pWindow ) ); - pImp->pWindow->Show(); - */ - } + Construct_Impl(); - pWindow = new SfxTopWindow_Impl( this ); -/** AS: - Hide this window till the component was realy loaded. Otherwhise it overpaint e.g. the old component hardly - and produce repaint errors. - pWindow->Show(); - */ -} + pImp->bHidden = i_bHidden; + InsertTopFrame_Impl( this ); + pImp->pExternalWindow = &i_rExternalWindow; -SfxTopFrame::~SfxTopFrame() -{ - RemoveTopFrame_Impl( this ); - DELETEZ( pWindow ); - delete pImp; + pWindow = new SfxTopWindow_Impl( this, i_rExternalWindow ); } -void SfxTopFrame::SetPresentationMode( BOOL bSet ) +void SfxFrame::SetPresentationMode( BOOL bSet ) { if ( GetCurrentViewFrame() ) GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); @@ -644,32 +609,31 @@ void SfxTopFrame::SetPresentationMode( BOOL bSet ) GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); } -SystemWindow* -SfxTopFrame::GetSystemWindow() const +SystemWindow* SfxFrame::GetSystemWindow() const { return GetTopWindow_Impl(); } -SystemWindow* SfxTopFrame::GetTopWindow_Impl() const +SystemWindow* SfxFrame::GetTopWindow_Impl() const { - if ( pImp->pWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pWindow; + if ( pImp->pExternalWindow->IsSystemWindow() ) + return (SystemWindow*) pImp->pExternalWindow; else return NULL; } -Window& SfxTopFrame::GetWindow() const +Window& SfxFrame::GetWindow() const { return *pWindow; } -sal_Bool SfxTopFrame::Close() +sal_Bool SfxFrame::Close() { delete this; return sal_True; } -void SfxTopFrame::LockResize_Impl( BOOL bLock ) +void SfxFrame::LockResize_Impl( BOOL bLock ) { pImp->bLockResize = bLock; } @@ -684,7 +648,7 @@ IMPL_LINK( SfxTopWindow_Impl, CloserHdl, void*, EMPTYARG ) return 0L; } -void SfxTopFrame::SetMenuBarOn_Impl( BOOL bOn ) +void SfxFrame::SetMenuBarOn_Impl( BOOL bOn ) { pImp->bMenuBarOn = bOn; @@ -708,48 +672,17 @@ void SfxTopFrame::SetMenuBarOn_Impl( BOOL bOn ) } } -BOOL SfxTopFrame::IsMenuBarOn_Impl() const +BOOL SfxFrame::IsMenuBarOn_Impl() const { return pImp->bMenuBarOn; } -String SfxTopFrame::GetWindowData() -{ - String aActWinData; - char cToken = ','; - - SfxViewFrame *pActFrame = SfxViewFrame::Current(); - SfxViewFrame *pFrame = GetCurrentViewFrame(); - const sal_Bool bActWin = ( pActFrame->GetTopViewFrame() == pFrame ); - - // ::com::sun::star::sdbcx::User-Daten der ViewShell - String aUserData; - pFrame->GetViewShell()->WriteUserData(aUserData); - - // assemble ini-data - String aWinData; - aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); - aWinData += cToken; - - aWinData += '1'; // former attribute "isfloating" - aWinData += cToken; - - // aktives kennzeichnen - aWinData += cToken; - aWinData += bActWin ? '1' : '0'; - - aWinData += cToken; - aWinData += aUserData; - - return aWinData; -} - -void SfxTopFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const +void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const { - Window *pWin = pImp->pWindow; + Window *pWin = pImp->pExternalWindow; // Groesse setzen - const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() ); + const Size aAppWindow( pImp->pExternalWindow->GetDesktopRectPixel().GetSize() ); Point aPos( rWinArea.TopLeft() ); Size aSz( rWinArea.GetSize() ); if ( aSz.Width() && aSz.Height() ) @@ -800,11 +733,11 @@ namespace } } -sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) +sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) /* [Beschreibung] */ { - OSL_PRECOND( rDoc.GetMedium(), "SfxTopFrame::InsertDocument_Impl: no medium -> no view!"); + OSL_PRECOND( rDoc.GetMedium(), "SfxFrame::InsertDocument_Impl: no medium -> no view!"); if ( !rDoc.GetMedium() ) return sal_False; @@ -816,7 +749,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) return sal_False; OSL_PRECOND( GetCurrentDocument() == NULL, - "SfxTopFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); + "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); const SfxItemSet* pSet = GetItemSet_Impl(); if ( !pSet ) @@ -834,7 +767,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // hidden? OSL_PRECOND( !pImp->bHidden, - "SfxTopFrame::InsertDocument_Impl: quite unexpected ... the below logic might not work in all cases here ..." ); + "SfxFrame::InsertDocument_Impl: quite unexpected ... the below logic might not work in all cases here ..." ); pImp->bHidden = pHidItem ? pHidItem->GetValue() : false; // plugin mode @@ -878,7 +811,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) SfxViewFrame* pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); if ( !pViewFrame->GetViewShell() ) { - OSL_ENSURE( false, "SfxTopFrame::InsertDocument_Impl: something went wrong while creating the SfxTopViewFrame!" ); + OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxTopViewFrame!" ); pViewFrame->DoClose(); return sal_False; } @@ -897,7 +830,7 @@ sal_Bool SfxTopFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) } OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, - "SfxTopFrame::InsertDocument_Impl: so this code wasn't dead?" ); + "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); // Before CWS autorecovery, there was code which postponed setting the ViewData/Mark to a later time // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since loads this method // here is never called before the load process finished. @@ -998,7 +931,6 @@ long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg ) return 0; } -TYPEINIT1(SfxTopFrame, SfxFrame); TYPEINIT1(SfxTopViewFrame, SfxViewFrame); //-------------------------------------------------------------------- @@ -1078,7 +1010,7 @@ String SfxTopViewFrame::UpdateTitle() GetBindings().Invalidate( SID_NEWDOCDIRECT ); /* AS_TITLE - Window* pWindow = GetTopFrame_Impl()->GetTopWindow_Impl(); + Window* pWindow = GetFrame()->GetTopWindow_Impl(); if ( pWindow && pWindow->GetText() != aTitle ) pWindow->SetText( aTitle ); */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 042e48edeb70..7c2cb939c375 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2391,10 +2391,10 @@ void SfxViewFrame::ExecView_Impl if ( pFrameItem ) { pFrameItem->GetValue() >>= xFrame; - pFrame = SfxTopFrame::Create( xFrame ); + pFrame = SfxFrame::Create( xFrame ); } else - pFrame = SfxTopFrame::Create(); + pFrame = SfxFrame::Create(); SfxAllItemSet aSet( SFX_APP()->GetPool() ); SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); @@ -2431,7 +2431,7 @@ void SfxViewFrame::ExecView_Impl { Reference < XFrame > xFrame; pFrameItem->GetValue() >>= xFrame; - SfxTopFrame* pFrame = SfxTopFrame::Create( xFrame ); + SfxFrame* pFrame = SfxFrame::Create( xFrame ); pMed->GetItemSet()->ClearItem( SID_HIDDEN ); pFrame->InsertDocument_Impl( *GetObjectShell() ); if ( !bHidden ) @@ -2441,7 +2441,7 @@ void SfxViewFrame::ExecView_Impl { SfxAllItemSet aSet( GetPool() ); aSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, TRUE ) ); - SfxFrame* pFrame = SfxTopFrame::Create( GetObjectShell(), GetCurViewId(), bHidden, &aSet ); + SfxFrame* pFrame = SfxFrame::Create( GetObjectShell(), GetCurViewId(), bHidden, &aSet ); if ( bHidden ) pFrame->GetCurrentViewFrame()->LockObjectShell_Impl( TRUE ); } @@ -3125,7 +3125,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); if ( pWork ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( @@ -3276,7 +3276,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); if ( pWork ) { rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) ); @@ -3524,7 +3524,7 @@ SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nV if ( bHidden ) pSet->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - SfxFrame *pFrame = SfxTopFrame::Create( &rDoc, 0, bHidden ); + SfxFrame *pFrame = SfxFrame::Create( &rDoc, 0, bHidden ); return pFrame->GetCurrentViewFrame(); } -- cgit v1.2.3 From 3b932a289f87ee4218fc916fa18aa21e79edda59 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 21:16:24 +0100 Subject: [CWS autorecovery] merged SfxTopFrame into SfxFrame SfxTopFrame was the only class deriving from the abstract class SfxFrame, so both can effectively be treated as one class. --- sd/source/ui/slideshow/slideshow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 6d5e3e31ad80..30b91e5f2100 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -1202,7 +1202,7 @@ void SlideShow::StartFullscreenPresentation( ) // The new frame is created hidden. To make it visible and activate the // new view shell--a prerequisite to process slot calls and initialize // its panes--a GrabFocus() has to be called later on. - SfxTopFrame* pNewFrame = SfxTopFrame::Create( mpDoc->GetDocSh(), pWorkWindow, PRESENTATION_FACTORY_ID, TRUE); + SfxFrame* pNewFrame = SfxFrame::Create( mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true ); pNewFrame->SetPresentationMode(TRUE); mpFullScreenViewShellBase = static_cast(pNewFrame->GetCurrentViewFrame()->GetViewShell()); -- cgit v1.2.3 From 5bbcb97151781c0048d84f3c65b7f4d12ea122c9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 27 Nov 2009 21:16:24 +0100 Subject: [CWS autorecovery] merged SfxTopFrame into SfxFrame SfxTopFrame was the only class deriving from the abstract class SfxFrame, so both can effectively be treated as one class. --- sc/source/ui/vba/vbawindow.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index a38ba7c9ed46..bc5b61a343e8 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -404,7 +404,7 @@ ScVbaWindow::getWindowState() throw (uno::RuntimeException) SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); if ( pWork ) { if ( pWork -> IsMaximized()) @@ -426,7 +426,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); if ( pWork ) { if ( nwindowState == xlMaximized) -- cgit v1.2.3 From 3aa7d26a8c5d6a09f2653b701d905c3ac7d260b8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 29 Nov 2009 20:56:55 +0100 Subject: #i10000# --- sfx2/source/view/frame.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 15b3deb67942..8b0380010a18 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -905,12 +905,12 @@ void SfxFrame::GrabFocusOnComponent_Impl() return; } - Window* pWindow = &GetWindow(); + Window* pFocusWindow = &GetWindow(); if ( GetCurrentViewFrame() && GetCurrentViewFrame()->GetViewShell() && GetCurrentViewFrame()->GetViewShell()->GetWindow() ) - pWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); + pFocusWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); - if( !pWindow->HasChildPathFocus() ) - pWindow->GrabFocus(); + if( !pFocusWindow->HasChildPathFocus() ) + pFocusWindow->GrabFocus(); } void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) -- cgit v1.2.3 From 14ce234fa0e33753a930e527da9c0ad8ce39723f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] merged SfxTopViewFrame into SfxViewFrame SfxTopViewFrame was the only class deriving from the abstract class SfxViewFrame, so both can effectively be treated as one class. This change was done to make subsequent refactorings easier. --- sw/source/ui/app/docsh2.cxx | 6 +++--- sw/source/ui/app/swwait.cxx | 8 ++++---- sw/source/ui/uiview/pview.cxx | 6 ++---- sw/source/ui/uno/unomailmerge.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 6 ++---- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 3fd1e879b063..46d2ee5006a3 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1800,15 +1800,15 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView ) // Currently there can be only one view (layout) if the document is viewed in Web layout // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed - SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE); + SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, FALSE); do { if( pTmpFrm != pTempView->GetViewFrame() ) { pTmpFrm->DoClose(); - pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE); + pTmpFrm = SfxViewFrame::GetFirst(this, FALSE); } else - pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, 0, FALSE); + pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, FALSE); } while ( pTmpFrm ); diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx index 5ab9258025e8..54b5b83757a3 100644 --- a/sw/source/ui/app/swwait.cxx +++ b/sw/source/ui/app/swwait.cxx @@ -41,25 +41,25 @@ void SwDocShell::EnterWait( BOOL bLockDispatcher ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE ); while ( pFrame ) { pFrame->GetWindow().EnterWait(); if ( bLockDispatcher ) pFrame->GetDispatcher()->Lock( TRUE ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE ); + pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE ); } } void SwDocShell::LeaveWait( BOOL bLockDispatcher ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, 0, FALSE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE ); while ( pFrame ) { pFrame->GetWindow().LeaveWait(); if ( bLockDispatcher ) pFrame->GetDispatcher()->Lock( FALSE ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, 0, FALSE ); + pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE ); } } diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 93ae56fbca73..12cf21ede0ae 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1909,10 +1909,8 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): delete pPageDownBtn; /* SfxObjectShell* pDocSh = GetDocShell(); - TypeId aType = TYPE( SfxTopViewFrame ); - - for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh, aType ); - pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh, aType ) ) + for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh ); + pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) if( pFrame != GetViewFrame() ) { // es gibt noch eine weitere Sicht auf unser Dokument, also diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index fed4c2b201cf..44c5d011fe75 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -627,7 +627,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( aCurSelection = aTranslated; } - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, 0, FALSE); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, FALSE); SwView *pView = PTR_CAST( SwView, pFrame->GetViewShell() ); if (!pView) throw RuntimeException(); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index fe3d8639bf84..1336e01e55f4 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -185,7 +185,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) { // check if the view frame still exists SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell, - 0, FALSE ); while(pFound) { @@ -196,7 +195,6 @@ void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) } pFound = SfxViewFrame::GetNext( *pFound, pDocShell, - 0, FALSE ); } } @@ -2691,7 +2689,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell() SfxViewShell *pView = 0; SwView *pSwView = 0; SwPagePreView *pSwPagePreView = 0; - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, 0, sal_False ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False ); while (pFrame) { pView = pFrame->GetViewShell(); @@ -2700,7 +2698,7 @@ SfxViewShell * SwXTextDocument::GuessViewShell() break; if (!pSwPagePreView) pSwPagePreView = dynamic_cast< SwPagePreView * >(pView); - pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, 0, sal_False ); + pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False ); } return pSwView ? pSwView : dynamic_cast< SwView * >(pSwPagePreView); -- cgit v1.2.3 From 040f7a237d1aaec9b00c977be7354af383a2ea5b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] merged SfxTopViewFrame into SfxViewFrame SfxTopViewFrame was the only class deriving from the abstract class SfxViewFrame, so both can effectively be treated as one class. This change was done to make subsequent refactorings easier. --- sd/source/ui/docshell/docshell.cxx | 12 ++++++------ .../ui/slidesorter/controller/SlideSorterController.cxx | 2 +- sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 9 +-------- sd/source/ui/view/ViewShellBase.cxx | 2 +- sd/source/ui/view/frmview.cxx | 6 ++---- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index f9381d08a219..9ef4825b1ef5 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -371,7 +371,7 @@ void DrawDocShell::InPlaceActivate( BOOL bActive ) ViewShell* pViewSh = NULL; SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, 0, false); + SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); while (pSfxViewFrame) { @@ -385,7 +385,7 @@ void DrawDocShell::InPlaceActivate( BOOL bActive ) pFrameViewList->Insert( new FrameView( mpDoc, pViewSh->GetFrameView() ) ); } - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, 0, false); + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); } } } @@ -401,7 +401,7 @@ void DrawDocShell::InPlaceActivate( BOOL bActive ) { ViewShell* pViewSh = NULL; SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, 0,false); + SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); sal_uInt32 i; for( i = 0; pSfxViewFrame && (i < pFrameViewList->Count()); i++ ) @@ -415,7 +415,7 @@ void DrawDocShell::InPlaceActivate( BOOL bActive ) pViewSh->ReadFrameViewData( (FrameView*)pFrameViewList->GetObject(i) ); } - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, 0,false); + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); } } } @@ -579,7 +579,7 @@ IMPL_LINK(DrawDocShell, OnlineSpellCallback, SpellCallbackInfo*, pInfo) void DrawDocShell::ClearUndoBuffer() { // clear possible undo buffers of outliners - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, 0, false); + SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(this, false); while(pSfxViewFrame) { ViewShellBase* pViewShellBase = dynamic_cast< ViewShellBase* >( pSfxViewFrame->GetViewShell() ); @@ -602,7 +602,7 @@ void DrawDocShell::ClearUndoBuffer() } } } - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, 0, false); + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, this, false); } SfxUndoManager* pUndoManager = GetUndoManager(); diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index f355ada7089f..e5e9dd638da9 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -652,7 +652,7 @@ void SlideSorterController::GetCtrlState (SfxItemSet& rSet) SfxViewFrame* pSlideViewFrame = SfxViewFrame::Current(); DBG_ASSERT(pSlideViewFrame!=NULL, "SlideSorterController::GetCtrlState: ViewFrame not found"); - if (pSlideViewFrame && pSlideViewFrame->ISA(SfxTopViewFrame)) + if (pSlideViewFrame) { pSlideViewFrame->GetSlotState (SID_RELOAD, NULL, &rSet); } diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 4b48aa60678d..c06aa89ac310 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -501,14 +501,7 @@ void SlotManager::GetCtrlState (SfxItemSet& rSet) SfxViewFrame* pSlideViewFrame = pShell->GetViewFrame(); DBG_ASSERT(pSlideViewFrame!=NULL, "SlideSorterController::GetCtrlState: ViewFrame not found"); - if (pSlideViewFrame->ISA(SfxTopViewFrame)) - { - pSlideViewFrame->GetSlotState (SID_RELOAD, NULL, &rSet); - } - else // MI sagt: kein MDIFrame --> disablen - { - rSet.DisableItem(SID_RELOAD); - } + pSlideViewFrame->GetSlotState (SID_RELOAD, NULL, &rSet); } } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 25fca9e0bae7..26a39d01a21f 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1003,7 +1003,7 @@ void ViewShellBase::UpdateBorder ( bool bForce /* = false */ ) // calls for the views in side panes but prevents calling an already // dying SfxViewShell base class. // For issue #140703# we have to check the existence of the window, - // too. The SfxTopViewFrame accesses the window without checking it. + // too. The SfxViewFrame accesses the window without checking it. ViewShell* pMainViewShell = GetMainViewShell().get(); if (pMainViewShell != NULL && GetWindow()!=NULL) { diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 503fc5ab0624..43dc6dee639d 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -103,8 +103,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * ULONG nSdViewShellCount = 0; ViewShellBase* pBase = NULL; SfxViewShell* pSfxViewSh = NULL; - SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(pDocShell, - TYPE(SfxTopViewFrame)); + SfxViewFrame* pSfxViewFrame = SfxViewFrame::GetFirst(pDocShell); while (pSfxViewFrame) { @@ -145,8 +144,7 @@ FrameView::FrameView(SdDrawDocument* pDrawDoc, FrameView* pFrameView /* = NULK * } } - pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, pDocShell, - TYPE(SfxTopViewFrame)); + pSfxViewFrame = SfxViewFrame::GetNext(*pSfxViewFrame, pDocShell); } SdDrawDocument* pDoc = pDocShell->GetDoc(); -- cgit v1.2.3 From 419e42ede0639d5ed3098356a3613fc065d27c63 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] merged SfxTopViewFrame into SfxViewFrame SfxTopViewFrame was the only class deriving from the abstract class SfxViewFrame, so both can effectively be treated as one class. This change was done to make subsequent refactorings easier. --- sfx2/inc/sfx2/bindings.hxx | 3 +- sfx2/inc/sfx2/shell.hxx | 1 - sfx2/inc/sfx2/topfrm.hxx | 84 --------- sfx2/inc/sfx2/viewfrm.hxx | 43 ++--- sfx2/inc/sfx2/viewsh.hxx | 4 - sfx2/prj/d.lst | 1 - sfx2/sdi/frmslots.sdi | 14 +- sfx2/sdi/makefile.mk | 1 - sfx2/sdi/mdislots.sdi | 48 ----- sfx2/sdi/sfxslots.sdi | 1 - sfx2/source/appl/app.cxx | 2 +- sfx2/source/appl/appbas.cxx | 2 +- sfx2/source/appl/appdde.cxx | 4 +- sfx2/source/appl/appmisc.cxx | 2 +- sfx2/source/appl/appopen.cxx | 12 +- sfx2/source/appl/appreg.cxx | 3 +- sfx2/source/appl/appserv.cxx | 2 +- sfx2/source/appl/sfxpicklist.cxx | 2 +- sfx2/source/appl/workwin.cxx | 2 +- sfx2/source/bastyp/fltfnc.cxx | 2 +- sfx2/source/control/bindings.cxx | 4 +- sfx2/source/control/dispatch.cxx | 29 +-- sfx2/source/doc/objcont.cxx | 2 +- sfx2/source/doc/objserv.cxx | 9 +- sfx2/source/doc/objxtor.cxx | 12 +- sfx2/source/doc/printhelper.cxx | 6 +- sfx2/source/doc/sfxbasemodel.cxx | 16 +- sfx2/source/inc/objshimp.hxx | 1 - sfx2/source/view/frame.cxx | 2 +- sfx2/source/view/impviewframe.hxx | 87 +++++++++ sfx2/source/view/ipclient.cxx | 2 +- sfx2/source/view/topfrm.cxx | 335 +++++++++-------------------------- sfx2/source/view/viewfrm.cxx | 364 ++++++++++++++++---------------------- sfx2/source/view/viewsh.cxx | 2 +- 34 files changed, 397 insertions(+), 707 deletions(-) delete mode 100644 sfx2/inc/sfx2/topfrm.hxx delete mode 100644 sfx2/sdi/mdislots.sdi create mode 100644 sfx2/source/view/impviewframe.hxx diff --git a/sfx2/inc/sfx2/bindings.hxx b/sfx2/inc/sfx2/bindings.hxx index ee981d7d7ce1..be2a71b5611d 100644 --- a/sfx2/inc/sfx2/bindings.hxx +++ b/sfx2/inc/sfx2/bindings.hxx @@ -99,8 +99,7 @@ class SFX2_DLLPUBLIC SfxBindings: public SfxBroadcaster der Klasse SfxBindings. Sie wird von der SfxApplication automatisch angelegt und zerst"ort. Instanzen werden aber i.d.R. "uber das Makro oder den zugeh"origen besorgt - werden. Bestimmte SfxViewFrame Subklassen (z.B. ) - legen ihre eigene Instanz der SfxBindings an. + werden. Die SfxBindings verwalten alle in den an ihr angemeldeten Controllern gebundenen Slot-Ids und cachen die jeweiligen diff --git a/sfx2/inc/sfx2/shell.hxx b/sfx2/inc/sfx2/shell.hxx index 69169a6d3d10..4a41149c41ba 100644 --- a/sfx2/inc/sfx2/shell.hxx +++ b/sfx2/inc/sfx2/shell.hxx @@ -89,7 +89,6 @@ enum SfxInterfaceId SFX_INTERFACE_NONE, SFX_INTERFACE_SFXAPP, SFX_INTERFACE_SFXDOCSH, - SFX_INTERFACE_SFXTOPFRM, SFX_INTERFACE_SFXIPFRM, SFX_INTERFACE_SFXVIEWSH, SFX_INTERFACE_SFXVIEWFRM, diff --git a/sfx2/inc/sfx2/topfrm.hxx b/sfx2/inc/sfx2/topfrm.hxx deleted file mode 100644 index eedfbb550228..000000000000 --- a/sfx2/inc/sfx2/topfrm.hxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: topfrm.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SFX_TOPFRM_HXX -#define _SFX_TOPFRM_HXX - -#include "sal/config.h" -#include "sfx2/dllapi.h" -#include "sal/types.h" -#include -#include -#include - -#include -#include - -class SfxViewShell; -namespace svtools { class AsynchronLink; } - -// class SfxTopViewFrame ------------------------------------------------- - -class SfxTopViewFrame_Impl; -class SFX2_DLLPUBLIC SfxTopViewFrame : public SfxViewFrame -{ -friend class SfxTopWindow_Impl; -friend class SfxTopViewFrame_Impl; - - SfxTopViewFrame_Impl* pImp; - svtools::AsynchronLink* pCloser; - -protected: - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - virtual void Activate( BOOL bUI ); - virtual void Deactivate( BOOL bUI ); - virtual BOOL Close(); - virtual ~SfxTopViewFrame(); - -public: - TYPEINFO(); - SFX_DECL_INTERFACE(SFX_INTERFACE_SFXTOPFRM) - - SfxTopViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc=NULL, USHORT nViewId=0 ); - - virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); - SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); - virtual String UpdateTitle(); - -//#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); - SAL_DLLPRIVATE void GetState_Impl(SfxItemSet &); - SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); - SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); -//#endif -}; - -#endif // #ifndef _SFX_TOPFRM_HXX - diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 7b73682c636a..d95bcf9eb2d5 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -61,6 +61,10 @@ namespace sfx2 { class SvLinkSource; } +namespace svtools +{ + class AsynchronLink; +} #ifndef SFX_DECL_OBJECTSHELL_DEFINED #define SFX_DECL_OBJECTSHELL_DEFINED @@ -129,6 +133,7 @@ Rectangle & operator += ( Rectangle & rRect, const SvBorder & rBorder ); Rectangle & operator -= ( Rectangle & rRect, const SvBorder & rBorder ); +DBG_NAMEEX(SfxViewFrame) class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener { struct SfxViewFrame_Impl* pImp; @@ -143,11 +148,13 @@ private: SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh=NULL ); #endif +// SfxViewFrame( SfxBindings&, SfxFrame*, SfxObjectShell *pDoc, sal_uInt32 nType ); +// SfxViewFrame( SfxObjectShell&, SfxBindings&, SfxFrame* p = NULL, sal_uInt32 nType = NULL ); +// SfxViewFrame( const SfxViewFrame &, SfxBindings &, SfxFrame *pFrame ); + protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - SAL_DLLPRIVATE void SetWindow_Impl( Window *pWin ); - #ifndef _SFX_HXX SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void KillDispatcher_Impl(); @@ -156,28 +163,20 @@ protected: virtual ~SfxViewFrame(); public: + SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL, USHORT nViewId = 0 ); + TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) - SfxViewFrame( SfxBindings&, SfxFrame*, SfxObjectShell *pDoc=0, sal_uInt32 nType = 0 ); - SfxViewFrame(SfxObjectShell&, SfxBindings&, SfxFrame*p=0, sal_uInt32 nType = 0); - SfxViewFrame( - const SfxViewFrame &, SfxBindings &, SfxFrame *pFrame); - static void SetViewFrame( SfxViewFrame* ); static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden=FALSE ); static SfxViewFrame* Current(); - static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, - TypeId aType = 0, - BOOL bOnlyVisible = TRUE ); - static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, - const SfxObjectShell* pDoc = 0, - TypeId aType = 0 , - BOOL bOnlyVisible = TRUE ); - static USHORT Count(TypeId = 0); + static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); + static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); + static USHORT Count(); void DoActivate(BOOL bMDI, SfxViewFrame *pOld=NULL); void DoDeactivate(BOOL bMDI, SfxViewFrame *pOld=NULL); @@ -189,8 +188,7 @@ public: SfxBindings& GetBindings() { return *pBindings; } const SfxBindings& GetBindings() const { return *pBindings; } Window& GetWindow() const; - virtual void SetZoomFactor( const Fraction &rZoomX, - const Fraction &rZoomY ) = 0; + virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ); SfxProgress* GetProgress() const; #ifdef ENABLE_INIMANAGER//MUSTINI @@ -214,6 +212,8 @@ public: void ToTop(); void Enable( BOOL bEnable ); virtual BOOL Close(); + virtual void Activate( BOOL bUI ); + virtual void Deactivate( BOOL bUI ); // DDE-Interface virtual long DdeExecute( const String& rCmd ); @@ -225,10 +225,10 @@ public: const ::com::sun::star::uno::Any & rValue ); virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem ); - virtual void ShowStatusText( const String& rText ); - virtual void HideStatusText(); + void ShowStatusText( const String& rText ); + void HideStatusText(); - virtual String UpdateTitle(); + String UpdateTitle(); // interne Handler SAL_DLLPRIVATE virtual BOOL SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); @@ -302,6 +302,9 @@ public: SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl( USHORT nId ); SAL_DLLPRIVATE void AddDispatchMacroToBasic_Impl(const ::rtl::OUString& sMacro); + SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); + SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); //#endif private: SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ); diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 9b4e66ff84c6..3d5681e7f468 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -160,11 +160,7 @@ class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener { #ifdef _SFXVIEWSH_HXX friend class SfxViewFrame; -friend class SfxTopViewFrame; friend class SfxPlugInFrame; -friend class SfxInternalFrame; -friend class SfxExternalTopViewFrame_Impl; -friend class SfxOfficeDocController; friend class SfxBaseController; #endif diff --git a/sfx2/prj/d.lst b/sfx2/prj/d.lst index 77acce9a7be9..ed411940ed0a 100644 --- a/sfx2/prj/d.lst +++ b/sfx2/prj/d.lst @@ -57,7 +57,6 @@ mkdir: %_DEST%\inc%_EXT%\sfx2 ..\inc\sfx2\imgdef.hxx %_DEST%\inc%_EXT%\sfx2\imgdef.hxx ..\inc\sfx2\ipclient.hxx %_DEST%\inc%_EXT%\sfx2\ipclient.hxx ..\inc\sfx2\macrconf.hxx %_DEST%\inc%_EXT%\sfx2\macrconf.hxx -..\inc\sfx2\topfrm.hxx %_DEST%\inc%_EXT%\sfx2\topfrm.hxx ..\inc\sfx2\mgetempl.hxx %_DEST%\inc%_EXT%\sfx2\mgetempl.hxx ..\inc\mieclip.hxx %_DEST%\inc%_EXT%\sfx2\mieclip.hxx ..\inc\sfx2\minarray.hxx %_DEST%\inc%_EXT%\sfx2\minarray.hxx diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index f1431a325773..00165e55886b 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -441,11 +441,23 @@ interface TopWindow : BrowseWindow shell SfxViewFrame { - import BrowseWindow [Automation]; + import TopWindow [Automation]; SID_FORMATMENUSTATE [ StateMethod = MiscState_Impl ; ] + + SID_ACTIVATE // ole(no) api(final/play/rec) + [ + ExecMethod = Exec_Impl ; + StateMethod = GetState_Impl ; + ] + + SID_SHOWPOPUPS + [ + ExecMethod = Exec_Impl ; + StateMethod = GetState_Impl ; + ] } diff --git a/sfx2/sdi/makefile.mk b/sfx2/sdi/makefile.mk index f8def0a3c23c..3e353b67b9f1 100644 --- a/sfx2/sdi/makefile.mk +++ b/sfx2/sdi/makefile.mk @@ -54,7 +54,6 @@ SVSDI1DEPEND= \ appslots.sdi \ sfxslots.sdi \ docslots.sdi \ - mdislots.sdi \ viwslots.sdi \ frmslots.sdi diff --git a/sfx2/sdi/mdislots.sdi b/sfx2/sdi/mdislots.sdi deleted file mode 100644 index 88ffba45051e..000000000000 --- a/sfx2/sdi/mdislots.sdi +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile - * - * $Revision$ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -shell SfxTopViewFrame : SfxViewFrame -{ - import TopWindow [Automation]; - - SID_ACTIVATE // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] - - SID_SHOWPOPUPS - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] -} - diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi index e439e8c776a0..a5a76df5f13d 100644 --- a/sfx2/sdi/sfxslots.sdi +++ b/sfx2/sdi/sfxslots.sdi @@ -132,7 +132,6 @@ TypeLibFile( "sfxslots.tlb" ) include "docslots.sdi" include "frmslots.sdi" include "viwslots.sdi" - include "mdislots.sdi" include "appslots.sdi" } diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index a4aaa8465ada..2c2f406affa3 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -111,7 +111,7 @@ #include #include #include -#include +#include #include "appdata.hxx" #include "openflag.hxx" #include "app.hrc" diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 37ba123b2aca..042ab05318b5 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -354,7 +354,7 @@ void SfxApplication::EnterBasicCall() } // die SbxObjects der SfxShells auf den Stacks der Frames erzeugen - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,0,sal_False); + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,sal_False); pFrame; pFrame = SfxViewFrame::GetNext(*pFrame,0,0,sal_False) ) { diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index ec26ead8a792..0fe1bb32162c 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -49,7 +49,7 @@ #include "appdata.hxx" #include #include -#include +#include #include #include "sfxtypes.hxx" #include @@ -632,7 +632,7 @@ String ImplDdeService::Topics() SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); while( pShell ) { - if( SfxViewFrame::GetFirst( pShell, TYPE(SfxTopViewFrame) )) + if( SfxViewFrame::GetFirst( pShell ) ) { if( sRet.Len() ) sRet += '\t'; diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index e9e0cb386ed8..06f5ce5454a7 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -89,7 +89,7 @@ #include #include #include -#include +#include #include "openflag.hxx" #include #include diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index f5f0d1bb139b..f0d5e2322ba6 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -104,7 +104,7 @@ #include "sfxresid.hxx" #include #include "app.hrc" -#include +#include #include #include #include @@ -196,7 +196,7 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded // Vergleiche anhand der URLs INetURLObject aUrl( xDoc->GetMedium()->GetName() ); if ( !aUrl.HasError() && aUrl == aUrlToFind && - (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, 0, TRUE )) && + (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, TRUE )) && !xDoc->IsLoading()) { break; @@ -213,12 +213,10 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded DBG_ASSERT( !bForbidVisible, "Unsichtbares kann nicht aktiviert werden" ); - SfxTopViewFrame *pFrame; - for( pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetFirst( xDoc, TYPE(SfxTopViewFrame) ); + SfxViewFrame* pFrame; + for( pFrame = SfxViewFrame::GetFirst( xDoc ); pFrame && !pFrame->IsVisible_Impl(); - pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetNext( *pFrame, xDoc, TYPE(SfxTopViewFrame) ) ) ; + pFrame = SfxViewFrame::GetNext( *pFrame, xDoc ) ) ; if ( pFrame ) { SfxViewFrame *pCur = SfxViewFrame::Current(); diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index aa5205f739c4..83ba8ddff705 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -46,7 +46,7 @@ #include "stbitem.hxx" #include #include -#include +#include #include "partwnd.hxx" #include #include "recfloat.hxx" @@ -62,7 +62,6 @@ void SfxApplication::Registrations_Impl() SfxApplication::RegisterInterface(); SfxModule::RegisterInterface(); SfxViewFrame::RegisterInterface(); - SfxTopViewFrame::RegisterInterface(); SfxObjectShell::RegisterInterface(); SfxViewShell::RegisterInterface(); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 24498c19516f..268fdcdf386a 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -131,7 +131,7 @@ #include "minfitem.hxx" #include #include -#include +#include #include "sfxpicklist.hxx" #include "imestatuswindow.hxx" #include diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 91227e3e34ec..96d7cc295cac 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -449,7 +449,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) return; // ignore hidden documents - if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) ) + if ( !SfxViewFrame::GetFirst( pDocSh, TRUE ) ) return; ::rtl::OUString aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index d2338a9c7226..c1780cd7be5f 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -41,7 +41,7 @@ #include #include #include "workwin.hxx" -#include +#include #include "arrdecl.hxx" #include #include diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 358c226d6c4a..ab82e498e72b 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -127,7 +127,7 @@ using namespace ::vos; #include #include #include -#include +#include #include "helper.hxx" #include "fltlst.hxx" #include diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 3a2796aba995..edf19cafb179 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -71,7 +71,7 @@ #include #include #include -#include +#include #include #include @@ -2349,7 +2349,7 @@ SystemWindow* SfxBindings::GetSystemWindow() const SfxViewFrame *pFrame = pDispatcher->GetFrame(); while ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); - SfxTopViewFrame* pTop = PTR_CAST( SfxTopViewFrame, pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pFrame->GetTopViewFrame(); return pTop->GetFrame()->GetTopWindow_Impl(); } diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 6cd32f4b24f8..a2697c4fe947 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -79,7 +79,7 @@ #include #include #include -#include +#include #include #include #include @@ -1676,7 +1676,7 @@ void SfxDispatcher::SetMenu_Impl() { if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { SfxFrame* pFrm = pTop->GetFrame(); @@ -1732,7 +1732,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) if ( !bUpdate || pImp->pFrame->GetFrame()->IsClosing_Impl() ) return 0; - SfxTopViewFrame* pTop = pImp->pFrame ? PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ) : NULL; + SfxViewFrame* pTop = pImp->pFrame ? pImp->pFrame->GetTopViewFrame() : NULL; sal_Bool bUIActive = pTop && pTop->GetBindings().GetDispatcher() == this; if ( !bUIActive && pTop && GetBindings() == &pTop->GetBindings() ) @@ -2911,7 +2911,7 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) pImp->bNoUI = bHide; if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { SfxFrame* pFrm = pTop->GetFrame(); @@ -3160,27 +3160,6 @@ void SfxDispatcher::InvalidateBindings_Impl( sal_Bool bModify ) pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) pFrame->GetBindings().InvalidateAll(bModify); -/* - // alle Bindings sind betroffen - for ( SfxInPlaceFrame *pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxInPlaceFrame)); - pIPFrame; - pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetNext(*pIPFrame, 0, TYPE(SfxInPlaceFrame)) ) - pIPFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxPlugInFrame *pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxPlugInFrame)); - pPIFrame; - pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetNext(*pPIFrame, 0, TYPE(SfxPlugInFrame)) ) - pPIFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxTask* pTask = SfxTask::GetFirst(); pTask; - pTask = SfxTask::GetNext( *pTask ) ) - if ( !pTask->IsExternal() ) - pTask->GetBindings()->InvalidateAll(bModify); -*/ } else { diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index e1890be33223..4faa96c3d9c9 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -76,7 +76,7 @@ #include "sfxhelp.hxx" #include #include -#include +#include #include "basmgr.hxx" #include #include "doc.hrc" diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 8a8512a37af0..e80ab038c26b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -88,7 +88,7 @@ #include "sfxtypes.hxx" //#include "interno.hxx" #include -#include +#include #include "versdlg.hxx" #include "doc.hrc" #include @@ -140,8 +140,6 @@ public: #define SfxObjectShell #include "sfxslots.hxx" -svtools::AsynchronLink* pPendingCloser = 0; - //========================================================================= @@ -283,7 +281,7 @@ void SfxObjectShell::PrintExec_Impl(SfxRequest &rReq) void SfxObjectShell::PrintState_Impl(SfxItemSet &rSet) { bool bPrinting = false; - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { SfxPrinter *pPrinter = pFrame->GetViewShell()->GetPrinter(); @@ -1218,8 +1216,7 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) { case SID_ACTIVATE: { - SfxViewFrame *pFrame = - SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame), TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, TRUE ); if ( pFrame ) pFrame->GetFrame()->Appear(); rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index d637083d2f4a..2adda6d209fd 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -134,7 +134,6 @@ DBG_NAME(SfxObjectShell) #define DocumentInfo #include "sfxslots.hxx" -extern svtools::AsynchronLink* pPendingCloser; static WeakReference< XInterface > s_xCurrentComponent; //========================================================================= @@ -251,7 +250,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,pFrame( 0 ) ,pTbxConfig( 0 ) ,eFlags( SFXOBJECTSHELL_UNDEFINED ) - ,pCloser( 0 ) ,bReadOnlyUI( sal_False ) ,bHiddenLockedByAPI( sal_False ) ,bInCloseEvent( sal_False ) @@ -271,9 +269,6 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) SfxObjectShell_Impl::~SfxObjectShell_Impl() { - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; delete pBasicManager; } @@ -489,7 +484,7 @@ SfxObjectShell* SfxObjectShell::GetFirst continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } @@ -522,7 +517,7 @@ SfxObjectShell* SfxObjectShell::GetNext continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } return 0; @@ -566,8 +561,7 @@ sal_uInt16 SfxObjectShell::PrepareClose return sal_False; // prepare views for closing - for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( - this, TYPE(SfxViewFrame)); + for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); pFrm; pFrm = SfxViewFrame::GetNext( *pFrm, this ) ) { DBG_ASSERT(pFrm->GetViewShell(),"KeineShell"); diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index cd8e28ee771c..0c8f1e63835a 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -269,7 +269,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return uno::Sequence< beans::PropertyValue >(); @@ -320,7 +320,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > { // alten Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; @@ -583,7 +583,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // get view for sfx printing capabilities SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; SfxViewShell* pView = pViewFrm->GetViewShell(); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index ce78ddb50799..0c2c6a54442f 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -118,7 +118,7 @@ #include #include #include -#include +#include #include "appdata.hxx" #include #include @@ -361,8 +361,10 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell ) if ( !pObjectShell ) return; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pObjectShell ); + pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pObjectShell ) + ) { SfxFrame* pSfxFrame = pFrame->GetFrame(); if ( pSfxFrame ) @@ -2937,7 +2939,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() { SfxViewFrame *pActFrame = SfxViewFrame::Current(); if ( !pActFrame || pActFrame->GetObjectShell() != m_pData->m_pObjectShell ) - pActFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame)); + pActFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); if ( !pActFrame || !pActFrame->GetViewShell() ) // currently no frame for this document at all or View is under construction @@ -2958,8 +2960,8 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() sal_Int32 nCount = 0; uno::Sequence < beans::PropertyValue > aSeq; ::com::sun::star::uno::Any aAny; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell ) ) { BOOL bIsActive = ( pFrame == pActFrame ); pFrame->GetViewShell()->WriteUserDataSequence( aSeq ); @@ -3391,7 +3393,7 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling - SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ); + SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ); if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame()->IsInPlace() ) { Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame()->GetFrameInterface()->getContainerWindow() ); diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 9e5bc0cc8ce1..be19b263115e 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -143,7 +143,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess SfxFrame* pFrame; SfxToolBoxConfig* pTbxConfig; SfxObjectShellFlags eFlags; - svtools::AsynchronLink* pCloser; String aBaseURL; sal_Bool bReadOnlyUI; SvRefBaseRef xHeaderAttributes; diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 8b0380010a18..ca09048fe082 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -80,7 +80,7 @@ #include #include "impframe.hxx" #include -#include +#include #include "workwin.hxx" #include #include diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx new file mode 100644 index 000000000000..9b57237ae5bc --- /dev/null +++ b/sfx2/source/view/impviewframe.hxx @@ -0,0 +1,87 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef SFX2_IMPVIEWFRAME_HXX +#define SFX2_IMPVIEWFRAME_HXX + +struct SfxViewFrame_Impl +{ + SvBorder aBorder; + Size aMargin; + Size aSize; + String aFrameTitle; + TypeId aLastType; + String aActualURL; + SfxFrame* pFrame; + svtools::AsynchronLink* pReloader; + Window* pWindow; + SfxViewFrame* pActiveChild; + Window* pFocusWin; + sal_uInt16 nDocViewNo; + sal_uInt16 nCurViewId; + sal_Bool bResizeInToOut:1; + sal_Bool bDontOverwriteResizeInToOut:1; + sal_Bool bObjLocked:1; + sal_Bool bReloading:1; + sal_Bool bIsDowning:1; + sal_Bool bInCtor:1; + sal_Bool bModal:1; + sal_Bool bEnabled:1; + sal_Bool bWindowWasEnabled:1; + sal_Bool bActive; + String aFactoryName; + + SfxViewFrame_Impl() + : pReloader(0 ) + , pWindow( 0 ) + , bWindowWasEnabled(sal_True) + , bActive( sal_False ) + {} + + ~SfxViewFrame_Impl() + { + delete pReloader; + } +}; + +class SfxTopViewWin_Impl : public Window +{ + BOOL bActive; + SfxViewFrame* pFrame; + +public: + SfxTopViewWin_Impl( SfxViewFrame* p, Window& rParent, WinBits nBits=0 ) : + Window( &rParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), + bActive( FALSE ), + pFrame( p ) + { + p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + virtual void Resize(); + virtual void StateChanged( StateChangedType nStateChange ); +}; + +#endif SFX2_IMPVIEWFRAME_HXX diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index f025a373f1ae..51752e25c81a 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -60,7 +60,7 @@ #include #include "workwin.hxx" #include "guisaveas.hxx" -#include +#include #include #include #include diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 5913503e6254..b1e7180dc5e8 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -33,7 +33,7 @@ #ifndef GCC #endif -#include +#include #include #include #include @@ -99,6 +99,7 @@ #include "statcach.hxx" #include #include "impframe.hxx" +#include "impviewframe.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -110,11 +111,6 @@ using ::com::sun::star::document::XViewDataSupplier; //------------------------------------------------------------------------ -#define SfxTopViewFrame -#include "sfxslots.hxx" - -DBG_NAME(SfxTopViewFrame) - #include static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) { @@ -298,27 +294,6 @@ void SfxTopWindow_Impl::DoResize() pFrame->Resize(); } -class SfxTopViewWin_Impl : public Window -{ -friend class SfxInternalFrame; - - BOOL bActive; - SfxTopViewFrame* pFrame; - -public: - SfxTopViewWin_Impl( SfxTopViewFrame* p, - Window *pParent, WinBits nBits=0 ) : - Window( pParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), - bActive( FALSE ), - pFrame( p ) - { - p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - - virtual void Resize(); - virtual void StateChanged( StateChangedType nStateChange ); -}; - //-------------------------------------------------------------------- void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange ) { @@ -343,18 +318,11 @@ void SfxTopViewWin_Impl::Resize() class SfxTopViewFrame_Impl { public: - sal_Bool bActive; - Window* pWindow; - String aFactoryName; SfxTopViewFrame_Impl() - : bActive( sal_False ) - , pWindow( 0 ) {} }; -static svtools::AsynchronLink* pPendingCloser = 0; - static String _getTabString() { String result; @@ -808,10 +776,10 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - SfxViewFrame* pViewFrame = new SfxTopViewFrame( this, &rDoc, nViewId ); + SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc, nViewId ); if ( !pViewFrame->GetViewShell() ) { - OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxTopViewFrame!" ); + OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); pViewFrame->DoClose(); return sal_False; } @@ -931,19 +899,12 @@ long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg ) return 0; } -TYPEINIT1(SfxTopViewFrame, SfxViewFrame); - //-------------------------------------------------------------------- -SFX_IMPL_INTERFACE(SfxTopViewFrame,SfxViewFrame,SfxResId(0)) -{ -} - -//-------------------------------------------------------------------- -String SfxTopViewFrame::UpdateTitle() +String SfxViewFrame::UpdateTitle() /* [Beschreibung] - Mit dieser Methode kann der SfxTopViewFrame gezwungen werden, sich sofort + Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort den neuen Titel vom der zu besorgen. [Anmerkung] @@ -964,11 +925,9 @@ String SfxTopViewFrame::UpdateTitle() switch( ( (SfxSimpleHint&) rHint ).GetId() ) { case SFX_HINT_TITLECHANGED: - for ( SfxTopViewFrame *pTop = (SfxTopViewFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); + for ( SfxViewFrame *pTop = SfxViewFrame::GetFirst( this ); pTop; - pTop = (SfxTopViewFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxTopViewFrame)); + pTop = SfxViewFrame::GetNext( this ); { pTop->UpdateTitle(); ... pTop->GetName() ... @@ -981,12 +940,61 @@ String SfxTopViewFrame::UpdateTitle() */ { - DBG_CHKTHIS(SfxTopViewFrame, 0); + DBG_CHKTHIS(SfxViewFrame, 0); const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); - String aTitle = SfxViewFrame::UpdateTitle(); + SfxObjectShell *pObjSh = GetObjectShell(); + if ( !pObjSh ) + return String(); + +// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +// // kein UpdateTitle mit Embedded-ObjectShell +// return String(); + + const SfxMedium *pMedium = pObjSh->GetMedium(); + String aURL; + GetFrame(); // -Wall required?? + if ( pObjSh->HasName() ) + { + INetURLObject aTmp( pMedium->GetName() ); + aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + } + + if ( aURL != pImp->aActualURL ) + // URL hat sich ge"andert + pImp->aActualURL = aURL; + + // gibt es noch eine weitere View? + sal_uInt16 nViews=0; + for ( SfxViewFrame *pView= GetFirst(pObjSh); + pView && nViews<2; + pView = GetNext(*pView,pObjSh) ) + if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && + !IsDowning_Impl()) + nViews++; + + // Titel des Fensters + String aTitle; + if ( nViews == 2 || pImp->nDocViewNo > 1 ) + // dann die Nummer dranh"angen + aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); + else + aTitle = pObjSh->UpdateTitle(); + + // Name des SbxObjects + String aSbxName = pObjSh->SfxShell::GetName(); + if ( IsVisible_Impl() ) + { + aSbxName += ':'; + aSbxName += String::CreateFromInt32(pImp->nDocViewNo); + } + + SetName( aSbxName ); + pImp->aFrameTitle = aTitle; + GetBindings().Invalidate( SID_FRAMETITLE ); + GetBindings().Invalidate( SID_CURRENT_URL ); ::rtl::OUString aProductName; ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; @@ -1017,200 +1025,7 @@ String SfxTopViewFrame::UpdateTitle() return aTitle; } -//-------------------------------------------------------------------- -void SfxTopViewFrame::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - if( IsDowning_Impl()) - return; - - // we know only SimpleHints - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_MODECHANGED: - case SFX_HINT_TITLECHANGED: - // when the document changes its title, change views too - UpdateTitle(); - break; - - case SFX_HINT_DEINITIALIZING: - // on all other changes force repaint - GetFrame()->DoClose(); - return; - } - } - - SfxViewFrame::Notify( rBC, rHint ); -} - -//-------------------------------------------------------------------- -sal_Bool SfxTopViewFrame::Close() -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - // Modaler Dialog oben ?? -// if ( pImp->GetModalDialog() ) -// return sal_False; - - // eigentliches Schlie\sen - if ( SfxViewFrame::Close() ) - { - if (SfxViewFrame::Current() == this) - SfxViewFrame::SetViewFrame(0); - - // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr - // vern"unftig verwenden - also besser still legen - GetDispatcher()->Lock(sal_True); - delete this; - - return sal_True; - } - - return sal_False; -} - -SfxTopViewFrame::SfxTopViewFrame -( - SfxFrame* pFrame, - SfxObjectShell* pObjShell, - sal_uInt16 nViewId -) - -/* [Beschreibung] - - Ctor des SfxTopViewFrame f"ur eine aus der Ressource. - Die 'nViewId' der zu erzeugenden kann angegeben werden - (default ist die zuerst registrierte SfxViewShell-Subklasse). -*/ - - : SfxViewFrame( *(new SfxBindings), pFrame, pObjShell, SFXFRAME_HASTITLE ) -{ - DBG_CTOR(SfxTopViewFrame, 0); - - pCloser = 0; - pImp = new SfxTopViewFrame_Impl; - -//(mba)/task if ( !pFrame->GetTask() ) - { - pImp->pWindow = new SfxTopViewWin_Impl( this, &pFrame->GetWindow() ); - pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); - SetWindow_Impl( pImp->pWindow ); - pFrame->SetOwnsBindings_Impl( sal_True ); - pFrame->CreateWorkWindow_Impl(); - } - - sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE; - if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - nType |= SFXFRAME_EXTERNAL; - GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType ); - - if ( GetFrame()->IsInPlace() ) - { - LockAdjustPosSizePixel(); - } - - if ( pObjShell && !SwitchToViewShell_Impl( nViewId ) ) - { - // TODO: better error handling? Under which conditions can this fail? - return; - } - - if ( GetFrame()->IsInPlace() ) - { - UnlockAdjustPosSizePixel(); - } - else if ( GetViewShell() && GetViewShell()->UseObjectSize() ) - { - // initiale Gr"o\se festlegen - // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow - // ber"ucksichtigen - LockAdjustPosSizePixel(); - ForceInnerResize_Impl( TRUE ); - - Window *pWindow = GetViewShell()->GetWindow(); - - // Da in den Applikationen bei der R"ucktransformation immer die - // Eckpunkte tranformiert werden und nicht die Size (um die Ecken - // alignen zu k"onnen), transformieren wir hier auch die Punkte, um - // m"oglichst wenig Rundungsfehler zu erhalten. -/* - Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(), - GetObjectShell()->GetMapUnit(), - pWindow->GetMapMode() ); -*/ - Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() ); - Size aSize = aRect.GetSize(); - GetViewShell()->GetWindow()->SetSizePixel( aSize ); - DoAdjustPosSizePixel(GetViewShell(), Point(), aSize ); - } -} - -//------------------------------------------------------------------------ -SfxTopViewFrame::~SfxTopViewFrame() -{ - DBG_DTOR(SfxTopViewFrame, 0); - - SetDowning_Impl(); - - if ( SfxViewFrame::Current() == this ) - SfxViewFrame::SetViewFrame(NULL); - - ReleaseObjectShell_Impl(); - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; - if ( GetFrame()->OwnsBindings_Impl() ) - // Die Bindings l"oscht der Frame! - KillDispatcher_Impl(); - - delete pImp->pWindow; - delete pImp; -} - -//------------------------------------------------------------------------ -sal_Bool SfxTopViewFrame::SetBorderPixelImpl( const SfxViewShell *pVSh, const SvBorder &rBorder ) -{ - if( SfxViewFrame::SetBorderPixelImpl( GetViewShell(), rBorder ) ) - { - if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() ) - { - Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); - if ( aSize.Width() && aSize.Height() ) - { - aSize.Width() += rBorder.Left() + rBorder.Right(); - aSize.Height() += rBorder.Top() + rBorder.Bottom(); - - Size aOldSize = GetWindow().GetOutputSizePixel(); - GetWindow().SetOutputSizePixel( aSize ); - Window* pParent = &GetWindow(); - while ( pParent->GetParent() ) - pParent = pParent->GetParent(); - Size aOuterSize = pParent->GetOutputSizePixel(); - aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); - aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); - pParent->SetOutputSizePixel( aOuterSize ); - } - } - else - { - Point aPoint; - Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); - aEditArea.Left() += rBorder.Left(); - aEditArea.Right() -= rBorder.Right(); - aEditArea.Top() += rBorder.Top(); - aEditArea.Bottom() -= rBorder.Bottom(); - pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); - } - return sal_True; - - } - return sal_False; -} - -void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq ) +void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) { // Wenn gerade die Shells ausgetauscht werden... if ( !GetObjectShell() || !GetViewShell() ) @@ -1304,10 +1119,9 @@ void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq ) // weitere Views auf dasselbe Doc? SfxObjectShell *pDocSh = GetObjectShell(); int bOther = sal_False; - for ( const SfxTopViewFrame *pFrame = - (SfxTopViewFrame *)SfxViewFrame::GetFirst( pDocSh, TYPE(SfxTopViewFrame) ); + for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); !bOther && pFrame; - pFrame = (SfxTopViewFrame *)SfxViewFrame::GetNext( *pFrame, pDocSh, TYPE(SfxTopViewFrame) ) ) + pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) bOther = (pFrame != this); // Doc braucht nur gefragt zu werden, wenn keine weitere View @@ -1339,7 +1153,7 @@ void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq ) rReq.Done(); } -void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet ) +void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) { SfxObjectShell *pDocSh = GetObjectShell(); @@ -1388,6 +1202,17 @@ void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet ) break; } + case SID_OBJECT: + if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) + { + uno::Any aAny; + aAny <<= GetViewShell()->GetVerbs(); + rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); + } + else + rSet.DisableItem( SID_OBJECT ); + break; + default: DBG_ERROR( "invalid message-id" ); } @@ -1396,14 +1221,14 @@ void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet ) } } -void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) +void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) { sal_uInt16 nSlotId = rRequest.GetSlot(); switch( nSlotId ) { case SID_BROWSE_FORWARD: case SID_BROWSE_BACKWARD: - OSL_ENSURE( false, "SfxTopViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); + OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); break; case SID_CREATELINK: { @@ -1430,7 +1255,7 @@ void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) rRequest.Done(); } -void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) +void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) { rItemSet.DisableItem( SID_BROWSE_FORWARD ); rItemSet.DisableItem( SID_BROWSE_BACKWARD ); @@ -1443,12 +1268,12 @@ void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) rItemSet.DisableItem( SID_CREATELINK ); } -void SfxTopViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) +void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) { GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); } -void SfxTopViewFrame::Activate( sal_Bool bMDI ) +void SfxViewFrame::Activate( sal_Bool bMDI ) { DBG_ASSERT(GetViewShell(), "Keine Shell"); if ( bMDI ) @@ -1456,7 +1281,7 @@ void SfxTopViewFrame::Activate( sal_Bool bMDI ) //(mba): hier evtl. wie in Beanframe NotifyEvent ?! } -void SfxTopViewFrame::Deactivate( sal_Bool bMDI ) +void SfxViewFrame::Deactivate( sal_Bool bMDI ) { DBG_ASSERT(GetViewShell(), "Keine Shell"); if ( bMDI ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 7c2cb939c375..fb657e8a0406 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -131,7 +131,7 @@ namespace css = ::com::sun::star; #include #include #include -#include +#include #include "viewimp.hxx" #include #include @@ -144,11 +144,14 @@ namespace css = ::com::sun::star; #include "macro.hxx" #include "minfitem.hxx" #include "../appl/app.hrc" +#include "impviewframe.hxx" + //------------------------------------------------------------------------- DBG_NAME(SfxViewFrame) #define SfxViewFrame #include "sfxslots.hxx" +#undef SfxViewFrame //------------------------------------------------------------------------- @@ -166,43 +169,6 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= -struct SfxViewFrame_Impl -{ - SvBorder aBorder; - Size aMargin; - Size aSize; - String aFrameTitle; - TypeId aLastType; - String aActualURL; - SfxFrame* pFrame; - svtools::AsynchronLink* pReloader; - //SfxInPlaceFrame* pIPFrame; - Window* pWindow; - SfxViewFrame* pActiveChild; - Window* pFocusWin; - sal_uInt16 nDocViewNo; - sal_uInt16 nCurViewId; - sal_Bool bResizeInToOut:1; - sal_Bool bDontOverwriteResizeInToOut:1; - sal_Bool bObjLocked:1; - sal_Bool bReloading:1; - sal_Bool bIsDowning:1; - sal_Bool bInCtor:1; - sal_Bool bModal:1; - sal_Bool bEnabled:1; - sal_Bool bWindowWasEnabled:1; - - SfxViewFrame_Impl() - : pReloader(0 ) - , bWindowWasEnabled(sal_True) - {} - - ~SfxViewFrame_Impl() - { - delete pReloader; - } -}; - //------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { @@ -618,7 +584,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) OSL_ENSURE( xFrame.is(), "SfxViewFrame::ExecReload_Impl: no XFrame?!" ); aViewFrames.push_back( ViewDescriptor( xFrame, pView->GetCurViewId() ) ); - pView = (SfxTopViewFrame*)GetNext( *pView, xOldObj, TYPE( SfxTopViewFrame ) ); + pView = GetNext( *pView, xOldObj ); } DELETEZ( xOldObj->Get_Impl()->pReloadTimer ); @@ -1128,104 +1094,6 @@ void SfxViewFrame::ReleaseObjectShell_Impl() GetDispatcher()->SetDisableFlags( 0 ); } -//------------------------------------------------------------------------- - -String SfxViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxMDIFrame gezwungen werden, sich sofort - den neuen Titel vom der zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxMDIFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxMDIFrame *pMDI = (SfxMDIFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxMDIFrame)); - pMDI; - pMDI = (SfxMDIFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxMDIFrame)); - { - pMDI->UpdateTitle(); - ... pMDI->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - SfxObjectShell *pObjSh = GetObjectShell(); - if ( !pObjSh ) - return String(); - -// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// // kein UpdateTitle mit Embedded-ObjectShell -// return String(); - - const SfxMedium *pMedium = pObjSh->GetMedium(); - String aURL; - GetFrame(); // -Wall required?? - if ( pObjSh->HasName() ) - { - INetURLObject aTmp( pMedium->GetName() ); - aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - } - - if ( aURL != pImp->aActualURL ) - // URL hat sich ge"andert - pImp->aActualURL = aURL; - - // gibt es noch eine weitere View? - sal_uInt16 nViews=0; - for ( SfxViewFrame *pView= GetFirst(pObjSh); - pView && nViews<2; - pView = GetNext(*pView,pObjSh) ) - if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && - !IsDowning_Impl()) - nViews++; - - // Titel des Fensters - String aTitle; - if ( nViews == 2 || pImp->nDocViewNo > 1 ) - // dann die Nummer dranh"angen - aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); - else - aTitle = pObjSh->UpdateTitle(); - - // Name des SbxObjects - String aSbxName = pObjSh->SfxShell::GetName(); - if ( IsVisible_Impl() ) - { - aSbxName += ':'; - aSbxName += String::CreateFromInt32(pImp->nDocViewNo); - } - - SetName( aSbxName ); - pImp->aFrameTitle = aTitle; - GetBindings().Invalidate( SID_FRAMETITLE ); - GetBindings().Invalidate( SID_CURRENT_URL ); - return aTitle; -} - - //-------------------------------------------------------------------- sal_Bool SfxViewFrame::Close() { @@ -1237,7 +1105,15 @@ sal_Bool SfxViewFrame::Close() // auch nicht mehr automatisch gespeichert werden! if ( GetViewShell() ) GetViewShell()->DiscardClients_Impl(); - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + + if (SfxViewFrame::Current() == this) + SfxViewFrame::SetViewFrame( NULL ); + + // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr + // vern"unftig verwenden - also besser still legen + GetDispatcher()->Lock(sal_True); + delete this; return sal_True; } @@ -1366,12 +1242,43 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) //------------------------------------------------------------------------ sal_Bool SfxViewFrame::SetBorderPixelImpl ( - const SfxViewShell* /*pSh*/, + const SfxViewShell* pVSh, const SvBorder& rBorder ) { pImp->aBorder = rBorder; + + if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() ) + { + Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); + if ( aSize.Width() && aSize.Height() ) + { + aSize.Width() += rBorder.Left() + rBorder.Right(); + aSize.Height() += rBorder.Top() + rBorder.Bottom(); + + Size aOldSize = GetWindow().GetOutputSizePixel(); + GetWindow().SetOutputSizePixel( aSize ); + Window* pParent = &GetWindow(); + while ( pParent->GetParent() ) + pParent = pParent->GetParent(); + Size aOuterSize = pParent->GetOutputSizePixel(); + aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); + aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); + pParent->SetOutputSizePixel( aOuterSize ); + } + } + else + { + Point aPoint; + Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); + aEditArea.Left() += rBorder.Left(); + aEditArea.Right() -= rBorder.Right(); + aEditArea.Top() += rBorder.Top(); + aEditArea.Bottom() -= rBorder.Bottom(); + pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); + } + return sal_True; } @@ -1389,15 +1296,22 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { {DBG_CHKTHIS(SfxViewFrame, 0);} - if ( !xObjSh.Is() ) + + if( IsDowning_Impl()) return; + // we know only SimpleHints if ( rHint.IsA(TYPE(SfxSimpleHint)) ) { switch( ( (SfxSimpleHint&) rHint ).GetId() ) { case SFX_HINT_MODECHANGED: { + UpdateTitle(); + + if ( !xObjSh.Is() ) + break; + // r/o Umschaltung? SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); @@ -1442,10 +1356,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_HINT_DYING: case SFX_HINT_DEINITIALIZING: // when the Object is being deleted, destroy the view too + GetFrame()->DoClose(); if ( xObjSh.Is() ) ReleaseObjectShell_Impl(); - else - GetFrame()->DoClose(); break; } @@ -1470,6 +1383,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_OPENDOC: case SFX_EVENT_CREATEDOC: { + if ( !xObjSh.Is() ) + break; + SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); @@ -1556,53 +1472,84 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) pImp->bInCtor = sal_False; } -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame( SfxObjectShell &rObjShell, SfxBindings &rBindings, - SfxFrame* pParent, sal_uInt32 nType ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); - - SetFrame_Impl( pParent ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( &rObjShell ); -} +SfxViewFrame::SfxViewFrame +( + SfxFrame* pFrame, + SfxObjectShell* pObjShell, + sal_uInt16 nViewId +) -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame(const SfxViewFrame &rCopy, SfxBindings &rBindings, - SfxFrame *pFrame ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); +/* [Beschreibung] - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( rCopy.GetFrameType() ); - Construct_Impl( rCopy.GetObjectShell() ); -} + Ctor des SfxViewFrame f"ur eine aus der Ressource. + Die 'nViewId' der zu erzeugenden kann angegeben werden + (default ist die zuerst registrierte SfxViewShell-Subklasse). +*/ -SfxViewFrame::SfxViewFrame( SfxBindings& rBindings, SfxFrame *pFrame, - SfxObjectShell *pDoc, sal_uInt32 nType ) : pImp( new SfxViewFrame_Impl ) , pDispatcher(0) - , pBindings(&rBindings) + , pBindings( new SfxBindings ) , nAdjustPosPixelLock( 0 ) { - DBG_CTOR(SfxViewFrame, 0); + DBG_CTOR( SfxViewFrame, NULL ); SetFrame_Impl( pFrame ); pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( pDoc); + GetFrame()->SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); + Construct_Impl( pObjShell ); + +//(mba)/task if ( !pFrame->GetTask() ) + { + pImp->pWindow = new SfxTopViewWin_Impl( this, pFrame->GetWindow() ); + pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); + pFrame->SetOwnsBindings_Impl( sal_True ); + pFrame->CreateWorkWindow_Impl(); + } + + sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE; + if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) + nType |= SFXFRAME_EXTERNAL; + GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType ); + + if ( GetFrame()->IsInPlace() ) + { + LockAdjustPosSizePixel(); + } + + if ( pObjShell && !SwitchToViewShell_Impl( nViewId ) ) + { + // TODO: better error handling? Under which conditions can this fail? + return; + } + + if ( GetFrame()->IsInPlace() ) + { + UnlockAdjustPosSizePixel(); + } + else if ( GetViewShell() && GetViewShell()->UseObjectSize() ) + { + // initiale Gr"o\se festlegen + // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow + // ber"ucksichtigen + LockAdjustPosSizePixel(); + ForceInnerResize_Impl( TRUE ); + + Window *pWindow = GetViewShell()->GetWindow(); + + // Da in den Applikationen bei der R"ucktransformation immer die + // Eckpunkte tranformiert werden und nicht die Size (um die Ecken + // alignen zu k"onnen), transformieren wir hier auch die Punkte, um + // m"oglichst wenig Rundungsfehler zu erhalten. +/* + Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(), + GetObjectShell()->GetMapUnit(), + pWindow->GetMapMode() ); +*/ + Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() ); + Size aSize = aRect.GetSize(); + GetViewShell()->GetWindow()->SetSizePixel( aSize ); + DoAdjustPosSizePixel(GetViewShell(), Point(), aSize ); + } } //------------------------------------------------------------------------ @@ -1610,6 +1557,19 @@ SfxViewFrame::~SfxViewFrame() { DBG_DTOR(SfxViewFrame, 0); + SetDowning_Impl(); + + if ( SfxViewFrame::Current() == this ) + SfxViewFrame::SetViewFrame( NULL ); + + ReleaseObjectShell_Impl(); + + if ( GetFrame()->OwnsBindings_Impl() ) + // Die Bindings l"oscht der Frame! + KillDispatcher_Impl(); + + delete pImp->pWindow; + if ( GetFrame() && GetFrame()->GetCurrentViewFrame() == this ) GetFrame()->SetCurrentViewFrame_Impl( NULL ); @@ -1653,12 +1613,11 @@ SfxViewFrame* SfxViewFrame::Current() } //-------------------------------------------------------------------- -sal_uInt16 SfxViewFrame::Count(TypeId aType) +sal_uInt16 SfxViewFrame::Count() /* [Beschreibung] - Liefert die Anzahl der sichtbaren -Instanzen vom Typ - 'aType' bzw. aller sichtbaren, falls 'aType==0' (default). + Liefert die Anzahl der sichtbaren -Instanzen. */ { @@ -1669,8 +1628,7 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) for ( sal_uInt16 i = 0; i < nCount; ++i ) { SfxViewFrame *pFrame = rFrames[i]; - if ( ( !aType || pFrame->IsA(aType) ) && - pFrame->IsVisible_Impl() ) + if ( pFrame->IsVisible_Impl() ) ++nFound; } return nFound; @@ -1681,7 +1639,6 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) SfxViewFrame* SfxViewFrame::GetFirst ( const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1692,9 +1649,9 @@ SfxViewFrame* SfxViewFrame::GetFirst for ( sal_uInt16 nPos = 0; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible_Impl() ) + ) return pFrame; } @@ -1707,7 +1664,6 @@ SfxViewFrame* SfxViewFrame::GetNext ( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1724,9 +1680,9 @@ SfxViewFrame* SfxViewFrame::GetNext for ( ++nPos; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible_Impl() ) + ) return pFrame; } return 0; @@ -2624,19 +2580,6 @@ void SfxViewFrame::StateView_Impl } } -//------------------------------------------------------------------------- -void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) - { - uno::Any aAny; - aAny <<= GetViewShell()->GetVerbs(); - rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); - } - else - rSet.DisableItem( SID_OBJECT ); -} - //------------------------------------------------------------------------- void SfxViewFrame::ToTop() { @@ -2676,13 +2619,6 @@ SfxViewFrame* SfxViewFrame::GetTopViewFrame() const return GetFrame()->GetTopFrame()->GetCurrentViewFrame(); } -//------------------------------------------------------------------------- - -void SfxViewFrame::SetWindow_Impl( Window *pWin ) -{ - pImp->pWindow = pWin; -} - Window& SfxViewFrame::GetWindow() const { return pImp->pWindow ? *pImp->pWindow : GetFrame()->GetWindow(); @@ -3122,7 +3058,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_WIN_FULLSCREEN: { SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), FALSE); - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame *pTop = GetTopViewFrame(); if ( pTop ) { WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); @@ -3273,7 +3209,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_WIN_FULLSCREEN: { - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame* pTop = GetTopViewFrame(); if ( pTop ) { WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 755859dcdcd7..50e71c3e3ce2 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -84,7 +84,7 @@ #include "view.hrc" #include "sfxlocal.hrc" #include -#include +#include #include "mailmodelapi.hxx" #include #include -- cgit v1.2.3 From f2f2581ce99ac5b7cc01a3d4e0692c6520642451 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] merged SfxTopViewFrame into SfxViewFrame SfxTopViewFrame was the only class deriving from the abstract class SfxViewFrame, so both can effectively be treated as one class. This change was done to make subsequent refactorings easier. --- sc/source/ui/docshell/docsh.cxx | 2 +- sc/source/ui/docshell/docsh4.cxx | 2 +- sc/source/ui/formdlg/formula.cxx | 4 ++-- sc/source/ui/vba/vbawindow.cxx | 42 ++++++++++++++++------------------------ sc/source/ui/view/tabvwsh3.cxx | 5 ++--- sc/source/ui/view/tabvwsh4.cxx | 6 ++---- 6 files changed, 25 insertions(+), 36 deletions(-) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index f7d1e2ccae2f..d65e157eb27f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2097,7 +2097,7 @@ USHORT __EXPORT ScDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing ) { if(SC_MOD()->GetCurRefDlgId()>0) { - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame) ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); if( pFrame ) { SfxViewShell* p = pFrame->GetViewShell(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 80b0c76a64be..0164b4e4049a 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2559,7 +2559,7 @@ ScTabViewShell* ScDocShell::GetBestViewShell( BOOL bOnlyVisible ) if( !pViewSh ) { // 1. ViewShell suchen - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame), bOnlyVisible ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this, bOnlyVisible ); if( pFrame ) { SfxViewShell* p = pFrame->GetViewShell(); diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 8d631a9f0609..4b3b1577a513 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -311,7 +311,7 @@ ScInputHandler* ScFormulaDlg::GetNextInputHandler(ScDocShell* pDocShell,PtrTabVi { ScInputHandler* pHdl=NULL; - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell, TYPE(SfxTopViewFrame) ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell ); while( pFrame && pHdl==NULL) { SfxViewShell* p = pFrame->GetViewShell(); @@ -321,7 +321,7 @@ ScInputHandler* ScFormulaDlg::GetNextInputHandler(ScDocShell* pDocShell,PtrTabVi pHdl=pViewSh->GetInputHandler(); if(ppViewSh!=NULL) *ppViewSh=pViewSh; } - pFrame = SfxViewFrame::GetNext(*pFrame,pDocShell, TYPE(SfxTopViewFrame) ); + pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell ); } diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index bc5b61a343e8..f784b23ba4c8 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -401,17 +401,13 @@ ScVbaWindow::getWindowState() throw (uno::RuntimeException) sal_Int32 nwindowState = xlNormal; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); - if ( pTop ) + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); + if ( pWork ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); - if ( pWork ) - { - if ( pWork -> IsMaximized()) - nwindowState = xlMaximized; - else if (pWork -> IsMinimized()) - nwindowState = xlMinimized; - } + if ( pWork -> IsMaximized()) + nwindowState = xlMaximized; + else if (pWork -> IsMinimized()) + nwindowState = xlMinimized; } return uno::makeAny( nwindowState ); } @@ -423,21 +419,17 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE _windowstate >>= nwindowState; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, pViewFrame -> GetTopViewFrame() ); - if ( pTop ) - { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); - if ( pWork ) - { - if ( nwindowState == xlMaximized) - pWork -> Maximize(); - else if (nwindowState == xlMinimized) - pWork -> Minimize(); - else if (nwindowState == xlNormal) - pWork -> Restore(); - else - throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() ); - } + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); + if ( pWork ) + { + if ( nwindowState == xlMaximized) + pWork -> Maximize(); + else if (nwindowState == xlMinimized) + pWork -> Minimize(); + else if (nwindowState == xlNormal) + pWork -> Restore(); + else + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Invalid Parameter" ) ), uno::Reference< uno::XInterface >() ); } } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 525ea1f14578..e9479259a01a 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -485,7 +485,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { if ( pDocSh->GetTitle() == aStrDocName ) { - pViewFrame = SfxViewFrame::GetFirst( pDocSh, TYPE(SfxTopViewFrame) ); + pViewFrame = SfxViewFrame::GetFirst( pDocSh ); bFound = ( NULL != pViewFrame ); } @@ -493,8 +493,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } if ( bFound ) - if ( pViewFrame->ISA(SfxTopViewFrame) ) - pViewFrame->GetFrame()->Appear(); + pViewFrame->GetFrame()->Appear(); rReq.Ignore();//XXX wird von SFX erledigt } diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index e34741ba4c6b..4972ce45ca1c 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -294,8 +294,7 @@ void ScTabViewShell::SetActive() #if 0 SfxViewFrame* pFrame = GetViewFrame(); - if ( pFrame->ISA(SfxTopViewFrame) ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame()->Appear(); SFX_APP()->SetViewFrame( pFrame ); // immer erst Appear, dann SetViewFrame (#29290#) #endif @@ -1385,8 +1384,7 @@ void ScTabViewShell::StartSimpleRefDialog( // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC. // Can't use GrabFocus here, because it needs to take effect immediately. - if ( pViewFrm->ISA(SfxTopViewFrame) ) - pViewFrm->GetFrame()->Appear(); + pViewFrm->GetFrame()->Appear(); } USHORT nId = ScSimpleRefDlgWrapper::GetChildWindowId(); -- cgit v1.2.3 From 69849b972d7ebdaa080a5bf331709b379aa79a79 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] forgot to remove some includes --- sw/inc/pch/precompiled_sw.hxx | 1 - sw/source/ui/uiview/pview.cxx | 1 - sw/source/ui/uiview/view2.cxx | 1 - 3 files changed, 3 deletions(-) diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 0a43d2c73d96..fac4fdbfe366 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -597,7 +597,6 @@ #include "sfx2/tabdlg.hxx" #include "sfx2/tbxctrl.hxx" #include "sfx2/templdlg.hxx" -#include "sfx2/topfrm.hxx" #include "sfx2/tplpitem.hxx" #include "sfx2/viewfac.hxx" #include "sfx2/viewfrm.hxx" diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 12cf21ede0ae..c29961b9897c 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 77c06f44c494..4aa00311c5bd 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -90,7 +90,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From 34c77ff57d30fa3ccf47b281837b10a75e64591d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] forgot to remove some includes --- sd/inc/pch/precompiled_sd.hxx | 1 - sd/source/core/drawdoc.cxx | 1 - sd/source/ui/docshell/docshell.cxx | 1 - sd/source/ui/framework/factories/FullScreenPane.cxx | 1 - sd/source/ui/slideshow/slideshow.cxx | 1 - sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 1 - sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 1 - sd/source/ui/view/drviewse.cxx | 1 - sd/source/ui/view/drviewsf.cxx | 1 - sd/source/ui/view/frmview.cxx | 1 - sd/source/ui/view/outlnvsh.cxx | 1 - sd/source/ui/view/presvish.cxx | 1 - 12 files changed, 12 deletions(-) diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index e3329a44af7e..2b9efb86055b 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -480,7 +480,6 @@ #include "sfx2/tabdlg.hxx" #include "sfx2/tbxctrl.hxx" #include "sfx2/templdlg.hxx" -#include "sfx2/topfrm.hxx" #include "sfx2/tplpitem.hxx" #include "sfx2/viewfac.hxx" #include "sfx2/viewfrm.hxx" diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index d5cd14a80b65..033baeb5edba 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -48,7 +48,6 @@ #include #endif #include -#include #include #include #include diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 9ef4825b1ef5..8b7ce2e12045 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -62,7 +62,6 @@ #ifndef _SO_CLSIDS_HXX #include #endif -#include #include #include diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index b6029400ff63..5cd7be3b0de4 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -35,7 +35,6 @@ #include "ViewShellBase.hxx" #include #include -#include #include #include #include diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index 30b91e5f2100..c50966f5d567 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -46,7 +46,6 @@ #include -#include #include #include diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index e5e9dd638da9..c401a9748249 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -85,7 +85,6 @@ #include #include #include -#include #include #include diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index c06aa89ac310..ce665e7fb088 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -80,7 +80,6 @@ #include #include -#include #include #include #include diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 0b3ecf1af6e7..7615fd435b54 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -69,7 +69,6 @@ #include #include #include -#include #include #include "DrawViewShell.hxx" diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 2b1b7518666c..b59ccfd4c26f 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -62,7 +62,6 @@ #include #include #include -#include #include #ifndef SD_FRAME_VIEW diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 43dc6dee639d..e4ccef3a0066 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -36,7 +36,6 @@ #ifndef _SVXIDS_HRC #include #endif -#include #include #include #include diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index d14f6ed9dc34..7287aea96d1d 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include diff --git a/sd/source/ui/view/presvish.cxx b/sd/source/ui/view/presvish.cxx index a9a2d9caac13..ca694b21a095 100644 --- a/sd/source/ui/view/presvish.cxx +++ b/sd/source/ui/view/presvish.cxx @@ -41,7 +41,6 @@ #include "optsitem.hxx" #include "sddll.hxx" #include -#include #ifndef _SFX_DISPATCH_HXX #include #endif -- cgit v1.2.3 From 7957366b221771c0fb40634f466b8c86071462cd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] forgot to remove some includes --- formula/source/ui/dlg/formula.cxx | 1 - sfx2/source/view/frmload.cxx | 1 - 2 files changed, 2 deletions(-) diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 37db1d2eb3cb..67863fadffea 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 09687006e3c2..64fa2fdb1289 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -45,7 +45,6 @@ #include "sfx2/sfx.hrc" #include "sfx2/sfxsids.hrc" #include "sfx2/sfxuno.hxx" -#include "sfx2/topfrm.hxx" #include "sfx2/viewfrm.hxx" /** === begin UNO includes === **/ -- cgit v1.2.3 From f75a050a0f7761062d16f4ed4ea270a21dfc9fc6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:04 +0100 Subject: [CWS autorecovery] forgot to remove some includes --- sc/source/ui/docshell/docsh.cxx | 1 - sc/source/ui/docshell/docsh4.cxx | 1 - sc/source/ui/formdlg/formula.cxx | 1 - sc/source/ui/miscdlgs/anyrefdg.cxx | 1 - sc/source/ui/miscdlgs/autofmt.cxx | 2 +- sc/source/ui/vba/vbawindow.cxx | 6 +++--- sc/source/ui/view/prevwsh.cxx | 3 +-- sc/source/ui/view/tabvwsh3.cxx | 1 - sc/source/ui/view/tabvwsh4.cxx | 5 +---- sc/source/ui/view/tabvwshd.cxx | 2 +- 10 files changed, 7 insertions(+), 16 deletions(-) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d65e157eb27f..3e6931184048 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 0164b4e4049a..0eeef27cfe51 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -56,7 +56,6 @@ using namespace ::com::sun::star; #include #include #include -#include #include #include #include diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 4b3b1577a513..3f44674d6012 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index befabb51a17c..1a3cf1f29dc1 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index b4fe1f83b220..6a2e719db276 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -47,10 +47,10 @@ #include #include #include -#include #include #include #include +#include #include #include "sc.hrc" diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index f784b23ba4c8..de1eadb7a86c 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include "unonames.hxx" using namespace ::com::sun::star; @@ -401,7 +401,7 @@ ScVbaWindow::getWindowState() throw (uno::RuntimeException) sal_Int32 nwindowState = xlNormal; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame()->GetSystemWindow(); if ( pWork ) { if ( pWork -> IsMaximized()) @@ -419,7 +419,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE _windowstate >>= nwindowState; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame()->GetSystemWindow(); if ( pWork ) { if ( nwindowState == xlMaximized) diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 360c05e2f84a..6c5bfbc66fa0 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -154,7 +153,7 @@ void ScPreviewShell::Construct( Window* pParent ) ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), + SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), pDocShell( (ScDocShell*)pViewFrame->GetObjectShell() ), nSourceDesignMode( SC_FORCEMODE_NONE ), pAccessibilityBroadcaster( NULL ) diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index e9479259a01a..62824f53759b 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 4972ce45ca1c..2db8f9a03f62 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -35,7 +35,6 @@ // INCLUDE --------------------------------------------------------------- -#include #include "scitems.hxx" #include @@ -1646,8 +1645,6 @@ FASTBOOL __EXPORT ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent ) //------------------------------------------------------------------ -// SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_DISABLE_ACCELS ), - #define __INIT_ScTabViewShell \ eCurOST(OST_NONE), \ nDrawSfxId(0), \ @@ -1915,7 +1912,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), + SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), ScDBFunc( &pViewFrame->GetWindow(), (ScDocShell&)*pViewFrame->GetObjectShell(), this ), __INIT_ScTabViewShell { diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index 80a81c586b6e..cd3915228463 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.3 From 1c6da69ba2bc437d826573c7909a220290a67311 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:05 +0100 Subject: [CWS autorecovery] removed some dead/unused stuff SID_BACKTOWEBTOP, some SFX_VIEW_* flags, some SFXFRAME_* flags, all BROWSE_* flags --- sw/source/ui/uiview/pview.cxx | 3 +-- sw/source/ui/uiview/srcview.cxx | 4 +--- sw/source/ui/uiview/view.cxx | 12 ++---------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index c29961b9897c..033c1fe27247 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -129,8 +129,7 @@ SFX_IMPL_INTERFACE(SwPagePreView, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX)) TYPEINIT1(SwPagePreView,SfxViewShell) -#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST|SFX_VIEW_OPTIMIZE_EACH| \ - SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS ) +#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS ) #define MIN_PREVIEW_ZOOM 25 #define MAX_PREVIEW_ZOOM 600 diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index d30e85c5ee71..c651baae1070 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -114,9 +114,7 @@ using ::rtl::OUString; using ::com::sun::star::util::SearchOptions; -#define SWSRCVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \ - SFX_VIEW_OBJECTSIZE_EMBEDDED| \ - SFX_VIEW_CAN_PRINT|\ +#define SWSRCVIEWFLAGS ( SFX_VIEW_CAN_PRINT|\ SFX_VIEW_NO_NEWWINDOW ) #define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL)) diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index a13f25d8933e..48bb6149fa3b 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -131,14 +131,9 @@ using ::rtl::OUStringBuffer; extern sal_Bool bNoInterrupt; // in mainwn.cxx -#define SWVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \ - SFX_VIEW_OBJECTSIZE_EMBEDDED| \ - SFX_VIEW_CAN_PRINT| \ +#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT| \ SFX_VIEW_HAS_PRINTOPTIONS) -//MA 06. Nov. 95: Each raus in Absprache mit MI wg. Bug 21523 -// SFX_VIEW_OPTIMIZE_EACH| - /*-------------------------------------------------------------------- Beschreibung: Statics --------------------------------------------------------------------*/ @@ -932,10 +927,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) if( SFX_CREATE_MODE_EMBEDDED != pDocSh->GetCreateMode() ) aBrwsBorder = GetMargin(); - if( _pFrame->GetFrameType() & SFXFRAME_INTERNAL ) - pWrtShell->SetFrameView( aBrwsBorder ); - else - pWrtShell->SetBrowseBorder( aBrwsBorder ); + pWrtShell->SetBrowseBorder( aBrwsBorder ); // Im CTOR duerfen keine Shell wechsel erfolgen, die muessen ueber // den Timer "zwischen gespeichert" werden. Sonst raeumt der SFX -- cgit v1.2.3 From 9f449bd35edc24fe8647ff4c48eb466d8f2e4b11 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:05 +0100 Subject: [CWS autorecovery] removed some dead/unused stuff SID_BACKTOWEBTOP, some SFX_VIEW_* flags, some SFXFRAME_* flags, all BROWSE_* flags --- sd/source/ui/app/menuportal_tmpl.src | 1 - sd/source/ui/view/ViewShellBase.cxx | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sd/source/ui/app/menuportal_tmpl.src b/sd/source/ui/app/menuportal_tmpl.src index 935b23b38016..b9311d0180df 100644 --- a/sd/source/ui/app/menuportal_tmpl.src +++ b/sd/source/ui/app/menuportal_tmpl.src @@ -71,7 +71,6 @@ Menu SD_MENU_PORTAL MI ( ITEM_FILE_PRINTDOC ) MI ( ITEM_FILE_SETUPPRINTER ) SEPARATOR - MI ( ITEM_FILE_BACKTOWEBTOP ) MI ( ITEM_FILE_LOGOUT ) }; }; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 26a39d01a21f..ac0102ca434a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -272,11 +272,7 @@ ViewShellBase::ViewShellBase ( SfxViewFrame* _pFrame, SfxViewShell*) : SfxViewShell (_pFrame, - SFX_VIEW_MAXIMIZE_FIRST - | SFX_VIEW_OPTIMIZE_EACH - | SFX_VIEW_DISABLE_ACCELS - | SFX_VIEW_OBJECTSIZE_EMBEDDED - | SFX_VIEW_CAN_PRINT + SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS), maMutex(), mpImpl(), -- cgit v1.2.3 From f1f8a59d49231984506a7b5a6e7f346616b47d56 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 12:56:05 +0100 Subject: [CWS autorecovery] removed some dead/unused stuff SID_BACKTOWEBTOP, some SFX_VIEW_* flags, some SFXFRAME_* flags, all BROWSE_* flags --- sfx2/inc/sfx2/frame.hxx | 18 +------- sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/inc/sfx2/viewfrm.hxx | 4 -- sfx2/inc/sfx2/viewsh.hxx | 18 -------- sfx2/sdi/frmslots.sdi | 5 --- sfx2/sdi/sfx.sdi | 25 ----------- sfx2/source/doc/objxtor.cxx | 2 +- sfx2/source/view/frame.cxx | 2 +- sfx2/source/view/impviewframe.hxx | 9 ++-- sfx2/source/view/topfrm.cxx | 10 +---- sfx2/source/view/viewfrm.cxx | 88 +++++---------------------------------- sfx2/source/view/viewimp.hxx | 2 - sfx2/source/view/viewsh.cxx | 29 +------------ svx/inc/globlmn_tmpl.hrc | 6 --- 14 files changed, 21 insertions(+), 199 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index f24ca488ea30..d0f7e2bc701c 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -97,19 +97,7 @@ class SfxFrameArr_Impl; DECLARE_LIST( TargetList, String* ) -#define SFXFRAME_INTERNAL 0x0001 -#define SFXFRAME_EXTERNAL 0x0002 -#define SFXFRAME_OWNSDOCUMENT 0x0004 -#define SFXFRAME_PLUGIN 0x0008 -#define SFXFRAME_HASTITLE 0x0010 -#define SFXFRAME_SERVER 0x0020 // Is es ein Frame, der in einem Container steckt ? - -#define BROWSE_NORMAL 0 -#define BROWSE_FORWARD 1 -#define BROWSE_BACKWARD 2 -#define NO_BROWSE 3 -#define BROWSE_FRAME 4 -#define BROWSE_MAX_MODE 10 +#define SFXFRAME_HASTITLE 0x0001 //========================================================================== // Ein SfxFrame ist eine Verwaltungsklasse f"ur Fenster und deren Inhalte. @@ -126,14 +114,10 @@ DECLARE_LIST( TargetList, String* ) class SfxFrameArr_Impl; struct SfxFramePickEntry_Impl; -class SfxUnoFrame; class SFX2_DLLPUBLIC SfxFrame { friend class SfxFrameIterator; friend class SfxTopWindow_Impl; -// friend struct SfxFramePickEntry_Impl; -// friend class SfxUnoFrame; -// friend class SfxViewFrame; /*HACK!*/ private: SfxFrame* pParentFrame; diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index f886077919d8..544cca4464a5 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -522,7 +522,7 @@ #define SID_LOGOUT (SID_SFX_START + 1652) #define SID_JUMPMARK (SID_SFX_START + 1654) #define SID_BROWSE (SID_SFX_START + 1658) -#define SID_BACKTOWEBTOP (SID_SFX_START + 1657) + // FREE (was: SID_BACKTOWEBTOP) #define SID_SEGMENTSIZE (SID_SFX_START + 1659) #define SID_VIEW_DATA_SOURCE_BROWSER (SID_SFX_START + 1660) #define SID_TOGGLE_MENUBAR (SID_SFX_START + 1661) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d95bcf9eb2d5..4eca86182da0 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -148,10 +148,6 @@ private: SAL_DLLPRIVATE void Construct_Impl( SfxObjectShell *pObjSh=NULL ); #endif -// SfxViewFrame( SfxBindings&, SfxFrame*, SfxObjectShell *pDoc, sal_uInt32 nType ); -// SfxViewFrame( SfxObjectShell&, SfxBindings&, SfxFrame* p = NULL, sal_uInt32 nType = NULL ); -// SfxViewFrame( const SfxViewFrame &, SfxBindings &, SfxFrame *pFrame ); - protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index 3d5681e7f468..b11a49efeb1f 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -97,24 +97,12 @@ enum SfxScrollingMode // @[SfxViewShell-Flags] -#define SFX_VIEW_MAXIMIZE_FIRST 0x0001 /* die erste View wird maximiert - dargestellt */ -#define SFX_VIEW_OPTIMIZE_EACH 0x0002 /* jede View wird in optimaler - Gr"o\se dargestellt */ -#define SFX_VIEW_DISABLE_ACCELS 0x0004 /* die Acceleratoren werden - disabled, solange diese - View den Focus hat */ -#define SFX_VIEW_OBJECTSIZE_EMBEDDED 0x0008 /* Views von embedded Objekten - werden in optimaler Gr"o\se - dargestellt */ #define SFX_VIEW_HAS_PRINTOPTIONS 0x0010 /* Options-Button und Options- Dialog im PrintDialog */ #define SFX_VIEW_CAN_PRINT 0x0020 /* enabled Printing ohne Printer erzeugen zu m"ussen */ #define SFX_VIEW_NO_SHOW 0x0040 /* Window der ViewShell darf nicht automatisch geshowed werden */ -#define SFX_VIEW_IMPLEMENTED_AS_FRAMESET 0x0080 /* Das Dokument ist als - Frameset implementiert*/ #define SFX_VIEW_NO_NEWWINDOW 0x0100 /* keine weitere View erlauben */ /* [Beschreibung] @@ -169,8 +157,6 @@ friend class SfxBaseController; SfxViewFrame* pFrame; SfxShell* pSubShell; Window* pWindow; - BOOL bMaximizeFirst; - BOOL bOptimizeEach; BOOL bNoNewWindow; protected: @@ -221,9 +207,6 @@ public: void VisAreaChanged(const Rectangle& rRect); // Verhaltens-Flags - BOOL IsMaximizeFirst() const { return bMaximizeFirst; } - BOOL IsOptimizeEach() const { return bOptimizeEach; } - HACK(inline) BOOL UseObjectSize() const; SfxScrollingMode GetScrollingMode() const; void SetScrollingMode( SfxScrollingMode eMode ); @@ -309,7 +292,6 @@ public: SAL_DLLPRIVATE void AddContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); SAL_DLLPRIVATE void RemoveContextMenuInterceptor_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::ui::XContextMenuInterceptor >& xInterceptor ); SAL_DLLPRIVATE FASTBOOL GlobalKeyInput_Impl( const KeyEvent &rKeyEvent ); - SAL_DLLPRIVATE BOOL IsImplementedAsFrameset_Impl() const; SAL_DLLPRIVATE void NewIPClient_Impl( SfxInPlaceClient *pIPClient ) { GetIPClientList_Impl(TRUE)->Insert(pIPClient); } diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 00165e55886b..050c36e9d7d4 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -410,11 +410,6 @@ interface TopWindow : BrowseWindow ExecMethod = Exec_Impl ; StateMethod = GetState_Impl ; ] - SID_BACKTOWEBTOP // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] SID_BROWSE_FORWARD // ole(no) api() [ ExecMethod = INetExecute_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index bf4561fe0d4c..efa2c0e23a92 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -561,31 +561,6 @@ SfxVoidItem Backspace SID_BACKSPACE GroupId = GID_EDIT; ] -//-------------------------------------------------------------------------- -SfxVoidItem BackToWebtop SID_BACKTOWEBTOP -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - //-------------------------------------------------------------------------- SfxVoidItem BasicBreak SID_BASICBREAK () diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 2adda6d209fd..6566122754d5 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -586,7 +586,7 @@ sal_uInt16 SfxObjectShell::PrepareClose // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen SfxViewFrame *pFrame = SfxObjectShell::Current() == this ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this ); - while ( pFrame && (pFrame->GetFrameType() & SFXFRAME_SERVER ) ) + while ( pFrame ) pFrame = SfxViewFrame::GetNext( *pFrame, this ); sal_Bool bClose = sal_False; diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index ca09048fe082..88bb9a62e805 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -536,7 +536,7 @@ void SfxFrame::GetTargetList( TargetList& rList ) const } SfxViewFrame* pView = GetCurrentViewFrame(); - if( pView && pView->GetViewShell() && !pView->GetViewShell()->IsImplementedAsFrameset_Impl() && pChildArr ) + if( pView && pView->GetViewShell() && pChildArr ) { sal_uInt16 nCount = pChildArr->Count(); for ( sal_uInt16 n=0; nGetViewShell()->UseObjectSize() ) - { - pViewFrame->UnlockAdjustPosSizePixel(); - pViewFrame->Resize(TRUE); - pViewFrame->ForceInnerResize_Impl( FALSE ); - pViewFrame->Resize(TRUE); - } - else - pViewFrame->Resize(TRUE); + pViewFrame->Resize(TRUE); } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index fb657e8a0406..a5a6d5eb8d0e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -855,14 +855,6 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) { SfxFrame* pFrame = GetTopFrame(); SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( pView && pView->GetViewShell() && - pView->GetViewShell()->IsImplementedAsFrameset_Impl() && - pView->GetViewShell()->GetInterface()->GetSlot( nWhich ) ) - { - // Hack f"ur Explorer: Reload wird an der ViewShell ausgef"uhrt - pView->GetViewShell()->GetSlotState( nWhich, 0, &rSet ); - break; - } if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) rSet.DisableItem(nWhich); @@ -1217,24 +1209,8 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) return; } - if ( GetViewShell()->UseObjectSize() ) - { - // Zun"achst die Gr"o\se des MDI-Fensters berechnen - - DoAdjustPosSizePixel( GetViewShell(), Point(), - GetViewShell()->GetWindow()->GetSizePixel() ); - - // Da nach einem InnerResize die Position des EditFensters und - // damit auch der Tools nocht stimmt, mu\s nun noch einmal von - // au\sen resized werden ! - - ForceOuterResize_Impl(sal_True); - } - DoAdjustPosSizePixel( (SfxViewShell *) GetViewShell(), Point(), GetWindow().GetOutputSizePixel() ); - if ( GetViewShell()->UseObjectSize() ) - ForceOuterResize_Impl(sal_False); } } } @@ -1420,7 +1396,6 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) //------------------------------------------------------------------------ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { - pImp->bInCtor = sal_True; pImp->bResizeInToOut = sal_True; pImp->bDontOverwriteResizeInToOut = sal_False; pImp->bObjLocked = sal_False; @@ -1469,7 +1444,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame *pThis = this; // wegen der kranken Array-Syntax SfxViewFrameArr_Impl &rViewArr = SFX_APP()->GetViewFrames_Impl(); rViewArr.C40_INSERT(SfxViewFrame, pThis, rViewArr.Count() ); - pImp->bInCtor = sal_False; } SfxViewFrame::SfxViewFrame @@ -1486,30 +1460,21 @@ SfxViewFrame::SfxViewFrame (default ist die zuerst registrierte SfxViewShell-Subklasse). */ - : pImp( new SfxViewFrame_Impl ) + : pImp( new SfxViewFrame_Impl( pFrame ) ) , pDispatcher(0) , pBindings( new SfxBindings ) , nAdjustPosPixelLock( 0 ) { DBG_CTOR( SfxViewFrame, NULL ); - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); + pFrame->SetCurrentViewFrame_Impl( this ); + pFrame->SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); Construct_Impl( pObjShell ); -//(mba)/task if ( !pFrame->GetTask() ) - { - pImp->pWindow = new SfxTopViewWin_Impl( this, pFrame->GetWindow() ); - pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); - pFrame->SetOwnsBindings_Impl( sal_True ); - pFrame->CreateWorkWindow_Impl(); - } - - sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE; - if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - nType |= SFXFRAME_EXTERNAL; - GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType ); + pImp->pWindow = new SfxTopViewWin_Impl( this, pFrame->GetWindow() ); + pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); + pFrame->SetOwnsBindings_Impl( sal_True ); + pFrame->CreateWorkWindow_Impl(); if ( GetFrame()->IsInPlace() ) { @@ -1526,30 +1491,6 @@ SfxViewFrame::SfxViewFrame { UnlockAdjustPosSizePixel(); } - else if ( GetViewShell() && GetViewShell()->UseObjectSize() ) - { - // initiale Gr"o\se festlegen - // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow - // ber"ucksichtigen - LockAdjustPosSizePixel(); - ForceInnerResize_Impl( TRUE ); - - Window *pWindow = GetViewShell()->GetWindow(); - - // Da in den Applikationen bei der R"ucktransformation immer die - // Eckpunkte tranformiert werden und nicht die Size (um die Ecken - // alignen zu k"onnen), transformieren wir hier auch die Punkte, um - // m"oglichst wenig Rundungsfehler zu erhalten. -/* - Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(), - GetObjectShell()->GetMapUnit(), - pWindow->GetMapMode() ); -*/ - Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() ); - Size aSize = aRect.GetSize(); - GetViewShell()->GetWindow()->SetSizePixel( aSize ); - DoAdjustPosSizePixel(GetViewShell(), Point(), aSize ); - } } //------------------------------------------------------------------------ @@ -1806,7 +1747,7 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) SfxShell::SetViewShell_Impl( pVSh ); // Hack: InPlaceMode - if ( pVSh && !pVSh->UseObjectSize() ) + if ( pVSh ) pImp->bResizeInToOut = sal_False; } @@ -1844,7 +1785,7 @@ void SfxViewFrame::DoAdjustPosSize( SfxViewShell *pSh, const Point rPos, const Size &rSize ) { DBG_CHKTHIS(SfxViewFrame, 0); - if( pSh && !nAdjustPosPixelLock && pSh->UseObjectSize()) + if( pSh && !nAdjustPosPixelLock ) { Window *pWindow = pSh->GetWindow(); Point aPos = pWindow->LogicToPixel(rPos); @@ -1927,7 +1868,7 @@ void SfxViewFrame::Show() LockObjectShell_Impl( sal_True ); // Doc-Shell Titel-Nummer anpassen, get unique view-no - if ( 0 == pImp->nDocViewNo && !(GetFrameType() & SFXFRAME_PLUGIN ) ) + if ( 0 == pImp->nDocViewNo ) { GetDocNumber_Impl(); UpdateTitle(); @@ -1958,8 +1899,6 @@ void SfxViewFrame::Show() //-------------------------------------------------------------------- sal_Bool SfxViewFrame::IsVisible_Impl() const { - //Window *pWin = pImp->bInCtor ? 0 : &GetWindow(); - //return GetFrame()->HasComponent() || pImp->bObjLocked || ( pWin && pWin->IsVisible() ); return pImp->bObjLocked; } @@ -2266,9 +2205,6 @@ void SfxViewFrame::ExecView_Impl { // Bei Mail etc. k"onnen die Frames nicht angesprochen werden SfxFrame *pParent = GetFrame()->GetParentFrame(); - if ( pParent && pParent->GetCurrentViewFrame()-> - GetViewShell()->IsImplementedAsFrameset_Impl() ) - break; SfxViewFrame *pRet = NULL; SFX_REQUEST_ARG( @@ -2669,11 +2605,7 @@ void SfxViewFrame::Resize( BOOL bForce ) } else { - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(TRUE); DoAdjustPosSizePixel( pShell, Point(), aSize ); - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(FALSE); } } } diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 97f86ee1f395..77c6f259734a 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -85,12 +85,10 @@ struct SfxViewShell_Impl Size aOptimalSize; Size aMargin; USHORT nPrinterLocks; - BOOL bUseObjectSize; BOOL bCanPrint; BOOL bHasPrintOptions; BOOL bPlugInsActive; BOOL bIsShowView; - BOOL bFrameSetImpl; BOOL bOwnsMenu; BOOL bGotOwnerShip; BOOL bGotFrameOwnerShip; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 50e71c3e3ce2..75ee988e29fd 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1255,8 +1255,6 @@ SfxViewShell::SfxViewShell ,pFrame(pViewFrame) ,pSubShell(0) ,pWindow(0) - ,bMaximizeFirst( 0 != (nFlags & SFX_VIEW_MAXIMIZE_FIRST) ) - ,bOptimizeEach(0 != (nFlags & SFX_VIEW_OPTIMIZE_EACH)) ,bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) ) { DBG_CTOR(SfxViewShell, 0); @@ -1266,11 +1264,7 @@ SfxViewShell::SfxViewShell pImp->bIsShowView = !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW)); - pImp->bUseObjectSize = FALSE; -// SFX_CREATE_MODE_EMBEDDED==pFrame->GetObjectShell()->GetCreateMode() && -// SFX_VIEW_OBJECTSIZE_EMBEDDED == (nFlags & SFX_VIEW_OBJECTSIZE_EMBEDDED); pImp->bCanPrint = SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT); - pImp->bFrameSetImpl = (nFlags & SFX_VIEW_IMPLEMENTED_AS_FRAMESET) != 0; pImp->bHasPrintOptions = SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS); pImp->bPlugInsActive = TRUE; @@ -1778,13 +1772,6 @@ void SfxViewShell::DisconnectAllClients() //-------------------------------------------------------------------- -BOOL SfxViewShell::UseObjectSize() const -{ - return pImp->bUseObjectSize; -} - -//-------------------------------------------------------------------- - void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const { } @@ -1794,14 +1781,7 @@ void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const void SfxViewShell::AdjustVisArea(const Rectangle& rRect) { DBG_ASSERT (pFrame, "Kein Frame?"); - if ( UseObjectSize() ) - { - Point aPos = rRect.TopLeft(); - Size aSize = GetObjectShell()->GetVisArea().GetSize(); - GetObjectShell()->SetVisArea( Rectangle(aPos, aSize) ); - } - else - GetObjectShell()->SetVisArea( rRect ); + GetObjectShell()->SetVisArea( rRect ); } //-------------------------------------------------------------------- @@ -1973,13 +1953,6 @@ SfxFrame* SfxViewShell::GetSmartSelf( SfxFrame* pSelf, SfxMedium& /*rMedium*/ ) return pSelf; } -//-------------------------------------------------------------------- - -BOOL SfxViewShell::IsImplementedAsFrameset_Impl( ) const -{ - return pImp->bFrameSetImpl; -} - //------------------------------------------------------------------------ void SfxViewShell::JumpToMark( const String& rMark ) diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index d40ca4de1876..07435b507caa 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -471,12 +471,6 @@ HelpID = SID_LOGOUT ; \ Text [ en-US ] = "Logout" ; \ -#define ITEM_FILE_BACKTOWEBTOP \ - Identifier = SID_BACKTOWEBTOP ; \ - Command = ".uno:BackToWebtop" ; \ - HelpID = SID_BACKTOWEBTOP ; \ - Text [ en-US ] = "Back to Webtop"; \ - #define ITEM_EDIT_UNDO \ Identifier = SID_UNDO ; \ Command = ".uno:UndoAction" ; \ -- cgit v1.2.3 From 67372d922ccfc1d8515115573c7143cbabcbb45f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 13:30:52 +0100 Subject: #i10000# --- sw/source/ui/uiview/view.cxx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 48bb6149fa3b..cb1e7799bd6c 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -998,13 +998,6 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() ); pWrtShell->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions()); - if( UseObjectSize() ) - { - //Damit der Sfx _rechtzeitig weiss_, wie gross die sheet::Border sind. - SvBorder aTmp; - CalcAndSetBorderPixel( aTmp, sal_True ); - } - if( pWrtShell->GetDoc()->IsUpdateExpFld() ) { SET_CURR_SHELL( pWrtShell ); -- cgit v1.2.3 From 2040e3a467a436ccf66df6b3431809c5c3ead775 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 13:31:01 +0100 Subject: #i10000# --- sd/source/ui/framework/factories/FullScreenPane.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index 5cd7be3b0de4..f6f9cb024ab9 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -35,6 +35,7 @@ #include "ViewShellBase.hxx" #include #include +#include #include #include #include -- cgit v1.2.3 From 6219e7fafa84c91d83c60e36c1cf619886d82345 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 13:33:40 +0100 Subject: #i10000# --- sfx2/source/view/impviewframe.hxx | 3 ++- sfx2/source/view/viewfrm.cxx | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index 4a363e32c96e..3afa2239c4bd 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -85,4 +85,5 @@ public: virtual void StateChanged( StateChangedType nStateChange ); }; -#endif SFX2_IMPVIEWFRAME_HXX +#endif // SFX2_IMPVIEWFRAME_HXX + diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a5a6d5eb8d0e..b9a3a8d2d4b0 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -854,7 +854,6 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) case SID_RELOAD: { SfxFrame* pFrame = GetTopFrame(); - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) rSet.DisableItem(nWhich); @@ -2204,8 +2203,6 @@ void SfxViewFrame::ExecView_Impl case SID_FILLFRAME: { // Bei Mail etc. k"onnen die Frames nicht angesprochen werden - SfxFrame *pParent = GetFrame()->GetParentFrame(); - SfxViewFrame *pRet = NULL; SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, SID_FILLFRAME, sal_False ); -- cgit v1.2.3 From 2df9a3a7f65ad84487e76cf6920cc76b9cd0e236 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 13:39:21 +0100 Subject: [CWS autorecovery] fixed yet another file which doesn't compile with debug (after the previous change) --- sd/source/ui/view/frmview.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index e4ccef3a0066..a27f648da6bf 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -56,6 +56,7 @@ #include "sdiocmpt.hxx" #include "framework/FrameworkHelper.hxx" #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -- cgit v1.2.3 From ebcd808b5990b237924fb5c67cdd0e92f4d4312f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 30 Nov 2009 17:25:18 +0100 Subject: #i10000# --- basctl/source/basicide/basidesh.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index e6b147cc46c8..381ddcec4ae3 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -107,7 +107,7 @@ SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) -#define IDE_VIEWSHELL_FLAGS SFX_VIEW_MAXIMIZE_FIRST|SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW +#define IDE_VIEWSHELL_FLAGS SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW // Hack for #101048 -- cgit v1.2.3 From 879ee6fe9ef72f04eb953a2e7280ad6e53e7ee55 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 30 Nov 2009 22:33:36 -0500 Subject: #i107338# Fixed incorrect parsing of cell ranges in R1C1 parser. --- sc/source/core/tool/address.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 259018e213ce..b5b61af9ef94 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -631,7 +631,9 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r, { const sal_Unicode* pTmp = NULL; String aExternDocName, aStartTabName, aEndTabName; - USHORT nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB2; + USHORT nFlags = SCA_VALID | SCA_VALID_TAB; + // Keep in mind that nFlags2 gets left-shifted by 4 bits before being merged. + USHORT nFlags2 = SCA_VALID_TAB; #if 0 { -- cgit v1.2.3 From df06781783d32a42a27e2f22af9b836d1be42996 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 30 Nov 2009 22:50:09 -0500 Subject: #i107339# more reliably determine in-line array size. --- sc/source/filter/excel/excform.cxx | 8 ++++---- sc/source/filter/excel/excform8.cxx | 19 +++++++++++++------ sc/source/filter/excel/frmbase.cxx | 6 ++++++ sc/source/filter/excel/impop.cxx | 16 ++++++++++++---- sc/source/filter/excel/xicontent.cxx | 14 ++++++++++---- sc/source/filter/excel/xiformula.cxx | 4 +++- sc/source/filter/excel/xiname.cxx | 8 ++++++-- sc/source/filter/inc/excform.hxx | 5 +++-- sc/source/filter/inc/formel.hxx | 11 ++++++++++- sc/source/filter/xcl97/XclImpChangeTrack.cxx | 5 +++-- 10 files changed, 70 insertions(+), 26 deletions(-) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 6d83f263d47b..323d97464cf7 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -136,7 +136,7 @@ void ImportExcel::Formula( const XclAddress& rXclPos, bConvert = TRUE; if( bConvert ) - eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); + eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, ExcelToSc::ConvertParam(), FT_CellFormula); ScFormulaCell* pZelle = NULL; @@ -201,7 +201,8 @@ void ExcelToSc::GetDummy( const ScTokenArray*& pErgebnis ) // if bAllowArrays is false stream seeks to first byte after // otherwise it will seek to the first byte after the additional content (eg // inline arrays) following -ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) +ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, + const ConvertParam& rParam, const FORMULA_TYPE eFT ) { RootData& rR = GetOldRoot(); BYTE nOp, nLen, nByte; @@ -472,11 +473,10 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x20: // Array Constant [317 268] aIn >> nByte >> nUINT16; aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 ); - if( bAllowArrays ) + if( rParam.mbAllowArrays ) { SCSIZE nC = nByte ? nByte : 256; SCSIZE nR = nUINT16; - aStack << aPool.StoreMatrix( nC, nR ); aExtensions.push_back( EXTENSION_ARRAY ); } diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 10fc15c633b6..f50528776e0b 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -95,9 +95,11 @@ bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLas } + // if bAllowArrays is false stream seeks to first byte after // otherwise it will seek to the first byte past additional content after -ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) +ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, + const ConvertParam& rParam, const FORMULA_TYPE eFT ) { BYTE nOp, nLen, nByte; UINT16 nUINT16; @@ -393,12 +395,17 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x20: // Array Constant [317 268] aIn >> nByte >> nUINT16; aIn.Ignore( 4 ); - if( bAllowArrays ) + if (rParam.mbAllowArrays) { - SCSIZE nC = nByte + 1; - SCSIZE nR = nUINT16 + 1; - - aStack << aPool.StoreMatrix( nC, nR ); + SCSIZE nC = rParam.mnArrayColSize; + SCSIZE nR = rParam.mnArrayRowSize; + if (!nC || !nR) + { + // Stored array size is invalid. Get that from the formula. + nC = nByte + 1; + nR = nUINT16 + 1; + } + aStack << aPool.StoreMatrix(nC, nR); aExtensions.push_back( EXTENSION_ARRAY ); } else diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index db50598d30b6..2b6ff13f6ee0 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -248,6 +248,12 @@ void ExcelConverterBase::Reset() aEingPos.Set( 0, 0, 0 ); } +ExcelConverterBase::ConvertParam::ConvertParam() : + mbAllowArrays(true), + mnArrayColSize(0), + mnArrayRowSize(0) +{ +} diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 9b868f4d3268..3f22579360eb 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -515,9 +515,12 @@ void ImportExcel::Array25( void ) // jetzt steht Lesemarke auf Formel, Laenge in nFormLen const ScTokenArray* pErgebnis; + pFormConv->Reset( ScAddress( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab() ) ); - pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = true; + pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula); DBG_ASSERT( pErgebnis, "*ImportExcel::Array25(): ScTokenArray ist NULL!" ); @@ -815,11 +818,12 @@ void ImportExcel::Shrfmla( void ) const ScTokenArray* pErgebnis; pFormConv->Reset(); - pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula ); + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = true; + pFormConv->Convert( pErgebnis, maStrm, nLenExpr, aParam, FT_SharedFormula ); DBG_ASSERT( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray ist NULL!" ); - pExcRoot->pShrfmlaBuff->Store( ScRange( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab(), static_cast(nLastCol), static_cast(nLastRow), @@ -987,10 +991,14 @@ void ImportExcel::Array34( void ) { // jetzt steht Lesemarke auf Formel, Laenge in nFormLen const ScTokenArray* pErgebnis; + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = true; + aParam.mnArrayColSize = nLastCol - nFirstCol + 1; + aParam.mnArrayRowSize = nLastRow - nFirstRow + 1; pFormConv->Reset( ScAddress( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab() ) ); - pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); + pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula); DBG_ASSERT( pErgebnis, "+ImportExcel::Array34(): ScTokenArray ist NULL!" ); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 7b5fb222a12b..a38bbe645dc4 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -616,12 +616,15 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) const ScAddress& rPos = maRanges.GetObject( 0 )->aStart; // assured above that maRanges is not empty ExcelToSc& rFmlaConv = GetOldFmlaConverter(); + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = false; + ::std::auto_ptr< ScTokenArray > xTokArr1; if( nFmlaSize1 > 0 ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset( rPos ); - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, aParam, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr1.reset( pTokArr->Clone() ); @@ -632,7 +635,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset( rPos ); - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, aParam, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) pTokArr2.reset( pTokArr->Clone() ); @@ -740,6 +743,9 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) String aErrorMessage( rStrm.ReadUniString() ); rStrm.SetNulSubstChar(); // back to default + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = false; + // formula(s) if( rStrm.GetRecLeft() > 8 ) { @@ -755,7 +761,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr1.reset( pTokArr->Clone() ); @@ -770,7 +776,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr2.reset( pTokArr->Clone() ); diff --git a/sc/source/filter/excel/xiformula.cxx b/sc/source/filter/excel/xiformula.cxx index f6b030aa8250..888d5cd579e5 100644 --- a/sc/source/filter/excel/xiformula.cxx +++ b/sc/source/filter/excel/xiformula.cxx @@ -97,7 +97,9 @@ const ScTokenArray* XclImpFmlaCompImpl::CreateFormula( aFmlaStrm.StartNextRecord(); const ScTokenArray* pArray = NULL; GetOldFmlaConverter().Reset(); - GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), true); + ExcelToSc::ConvertParam aParam; + aParam.mbAllowArrays = true; + GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), aParam); return pArray; } diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index 502e643b6c76..55664bbaba51 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -178,7 +178,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) : // --- name formula --- // JEG : double check this. It is clearly false for normal names // but some of the builtins (sheettitle?) might be able to handle arrays - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, false, FT_RangeName ); + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = false; + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName ); // --- auto or advanced filter --- if( (GetBiff() == EXC_BIFF8) && pTokArr && bBuiltIn ) @@ -206,7 +208,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) : else if( nFmlaSize > 0 ) { // regular defined name - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, true, FT_RangeName ); + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = true; + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName ); } // 4) *** create a defined name in the Calc document *** ------------------ diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx index 54cde7ab8a8b..5ca068d2ff45 100644 --- a/sc/source/filter/inc/excform.hxx +++ b/sc/source/filter/inc/excform.hxx @@ -62,7 +62,7 @@ public: ExcelToSc( const XclImpRoot& rRoot ); virtual ~ExcelToSc(); virtual ConvErr Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen, - bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ); + const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ); virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ); @@ -138,7 +138,8 @@ public: ExcelToSc8( const XclImpRoot& rRoot ); virtual ~ExcelToSc8(); - virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ); + virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, + const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ); virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ); diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx index 0961533731cb..65c3cec209c5 100644 --- a/sc/source/filter/inc/formel.hxx +++ b/sc/source/filter/inc/formel.hxx @@ -214,8 +214,17 @@ public: void Reset(); void Reset( const ScAddress& rEingPos ); + struct ConvertParam + { + bool mbAllowArrays; + SCSIZE mnArrayColSize; + SCSIZE mnArrayRowSize; + + ConvertParam(); + }; + virtual ConvErr Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen, - bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; + const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; }; diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 2f546e323179..4d9d20767ea6 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -210,11 +210,12 @@ void XclImpChangeTrack::ReadFormula( ScTokenArray*& rpTokenArray, const ScAddres // read the formula, 3D tab refs from extended data const ScTokenArray* pArray = NULL; aFmlConv.Reset( rPosition ); - BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false, FT_CellFormula) == ConvOK); // JEG : Check This + ExcelConverterBase::ConvertParam aParam; + aParam.mbAllowArrays = false; + BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, aParam, FT_CellFormula) == ConvOK); // JEG : Check This rpTokenArray = (bOK && pArray) ? new ScTokenArray( *pArray ) : NULL; pStrm->Ignore( 1 ); } - void XclImpChangeTrack::ReadCell( ScBaseCell*& rpCell, sal_uInt32& rFormat, -- cgit v1.2.3 From fd5a0682ef609f4abda9cbc1fc02b9c29b62727b Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 30 Nov 2009 22:53:37 -0500 Subject: #i107340# Correctly import xls's record containing sheet protection options. --- sc/source/filter/excel/xicontent.cxx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index a38bbe645dc4..61a72543bdd4 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1222,7 +1222,29 @@ void XclImpSheetProtectBuffer::ReadProtect( XclImpStream& rStrm, SCTAB nTab ) void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab ) { - rStrm.Ignore(19); + rStrm.Ignore(12); + + // feature type can be either 2 or 4. If 2, this record stores flag for + // enhanced protection, whereas if 4 it stores flag for smart tag. + sal_uInt16 nFeatureType; + rStrm >> nFeatureType; + if (nFeatureType != 2) + // We currently only support import of enhanced protection data. + return; + + rStrm.Ignore(1); // always 1 + + // The flag size specifies the size of bytes that follows that stores + // feature data. If -1 it depends on the feature type imported earlier. + // For enhanced protection data, the size is always 4. For the most xls + // documents out there this value is almost always -1. + sal_Int32 nFlagSize; + rStrm >> nFlagSize; + if (nFlagSize != -1) + return; + + // There are actually 4 bytes to read, but the upper 2 bytes currently + // don't store any bits. sal_uInt16 nOptions; rStrm >> nOptions; -- cgit v1.2.3 From b1bd8b95046187a87f70b3650083a276b6f8c4ad Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 30 Nov 2009 23:01:48 -0500 Subject: #i107342# Disable context menus on protected cells when 1) the sheet is protected, and 2) selection of protected cells is disallowed. Note that this is just an internal refactoring & will not affect Calc's current behavior. --- sc/source/ui/inc/gridwin.hxx | 2 +- sc/source/ui/inc/hdrcont.hxx | 2 +- sc/source/ui/view/gridwin.cxx | 30 +++++++++++++++++++++++++----- sc/source/ui/view/hdrcont.cxx | 41 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 8 deletions(-) diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 8b680daad6cb..bc616d1c4a65 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -259,7 +259,7 @@ private: void PasteSelection( const Point& rPosPixel ); - void SelectForContextMenu( const Point& rPosPixel ); + void SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, SCsROW nCellY ); void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects ); diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx index 561dc28e6fc0..50eb449634b1 100644 --- a/sc/source/ui/inc/hdrcont.hxx +++ b/sc/source/ui/inc/hdrcont.hxx @@ -80,7 +80,7 @@ private: long GetScrPos( SCCOLROW nEntryNo ); SCCOLROW GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder ); - + bool IsSelectionAllowed(SCCOLROW nPos) const; void ShowDragHelp(); void DoPaint( SCCOLROW nStart, SCCOLROW nEnd ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index de2b962f3272..fc0f97469969 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2694,9 +2694,32 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt ) if ( bMouse ) { + SCsCOL nCellX = -1; + SCsROW nCellY = -1; + pViewData->GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY); + ScDocument* pDoc = pViewData->GetDocument(); + SCTAB nTab = pViewData->GetTabNo(); + const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); + bool bSelectAllowed = true; + if ( pProtect && pProtect->isProtected() ) + { + // This sheet is protected. Check if a context menu is allowed on this cell. + bool bCellProtected = pDoc->HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HASATTR_PROTECTED); + bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); + bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); + + if (bCellProtected) + bSelectAllowed = bSelProtected; + else + bSelectAllowed = bSelUnprotected; + } + if (!bSelectAllowed) + // Selecting this cell is not allowed, neither is context menu. + return; + // #i18735# First select the item under the mouse pointer. // This can change the selection, and the view state (edit mode, etc). - SelectForContextMenu( aPosPixel ); + SelectForContextMenu( aPosPixel, nCellX, nCellY ); } BOOL bDone = FALSE; @@ -2791,15 +2814,12 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt ) } } -void ScGridWindow::SelectForContextMenu( const Point& rPosPixel ) +void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, SCsROW nCellY ) { // #i18735# if the click was outside of the current selection, // the cursor is moved or an object at the click position selected. // (see SwEditWin::SelectMenuPosition in Writer) - SCsCOL nCellX; - SCsROW nCellY; - pViewData->GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nCellX, nCellY ); ScTabView* pView = pViewData->GetView(); ScDrawView* pDrawView = pView->GetScDrawView(); diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 3ecacffd2d7b..b7760197a377 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -47,6 +47,7 @@ #include "scmod.hxx" // Optionen #include "inputopt.hxx" // Optionen #include "gridmerg.hxx" +#include "document.hxx" // ----------------------------------------------------------------------- @@ -655,6 +656,39 @@ SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, BOOL& rBorder ) return nHitNo; } +bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const +{ + ScTabViewShell* pViewSh = dynamic_cast(SfxViewShell::Current()); + if (!pViewSh) + return false; + + ScViewData* pViewData = pViewSh->GetViewData(); + USHORT nTab = pViewData->GetTabNo(); + ScDocument* pDoc = pViewData->GetDocument(); + const ScTableProtection* pProtect = pDoc->GetTabProtection(nTab); + bool bSelectAllowed = true; + if ( pProtect && pProtect->isProtected() ) + { + // This sheet is protected. Check if a context menu is allowed on this cell. + bool bCellsProtected = false; + if (bVertical) + // row header + bCellsProtected = pDoc->HasAttrib(0, nPos, nTab, MAXCOL, nPos, nTab, HASATTR_PROTECTED); + else + // column header + bCellsProtected = pDoc->HasAttrib(nPos, 0, nTab, nPos, MAXROW, nTab, HASATTR_PROTECTED); + + bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); + bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); + + if (bCellsProtected) + bSelectAllowed = bSelProtected; + else + bSelectAllowed = bSelUnprotected; + } + return bSelectAllowed; +} + void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) { if (IsDisabled()) @@ -665,6 +699,8 @@ void __EXPORT ScHeaderControl::MouseButtonDown( const MouseEvent& rMEvt ) BOOL bFound; SCCOLROW nHitNo = GetMousePos( rMEvt, bFound ); + if (!IsSelectionAllowed(nHitNo)) + return; if ( bFound && rMEvt.IsLeft() && ResizeAllowed() ) { @@ -848,8 +884,11 @@ void __EXPORT ScHeaderControl::Command( const CommandEvent& rCEvt ) MouseEvent aMEvt( rCEvt.GetMousePosPixel() ); BOOL bBorder; SCCOLROW nPos = GetMousePos( aMEvt, bBorder ); - USHORT nTab = pViewData->GetTabNo(); + if (!IsSelectionAllowed(nPos)) + // Selecting this cell is not allowed, neither is context menu. + return; + SCTAB nTab = pViewData->GetTabNo(); ScRange aNewRange; if ( bVertical ) aNewRange = ScRange( 0, sal::static_int_cast(nPos), nTab, -- cgit v1.2.3 From 957dccd072743e03971aa747f561d506eed1cf8a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 1 Dec 2009 09:11:00 +0100 Subject: #i10000# --- starmath/source/view.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 5492553e46fe..79171161c861 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -1811,7 +1811,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) SmViewShell::SmViewShell(SfxViewFrame *pFrame_, SfxViewShell *): - SfxViewShell(pFrame_, SFX_VIEW_DISABLE_ACCELS | SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_HAS_PRINTOPTIONS | SFX_VIEW_CAN_PRINT), + SfxViewShell(pFrame_, SFX_VIEW_HAS_PRINTOPTIONS | SFX_VIEW_CAN_PRINT), aGraphic(this), aGraphicController(aGraphic, SID_GAPHIC_SM, pFrame_->GetBindings()), pImpl( new SmViewShell_Impl ) -- cgit v1.2.3 From d0abf44546cbba2a77fbdad441f00dfc3eca6e3a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 2 Dec 2009 14:28:50 +0100 Subject: dba33e: #i102366# ColumnAliasInOrderBy now in properties as well --- connectivity/source/drivers/ado/ado.xcu | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu index 8a106c70283f..04ef77872366 100755 --- a/connectivity/source/drivers/ado/ado.xcu +++ b/connectivity/source/drivers/ado/ado.xcu @@ -157,6 +157,11 @@ 3
+ + + false + + -- cgit v1.2.3 From 70a30bdb2f4459ec5b7fea546433f274f69c5f47 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 2 Dec 2009 17:31:38 -0500 Subject: #i107339# Allow ScMatrix objects to be re-sizable. --- sc/inc/scmatrix.hxx | 7 +++++++ sc/source/core/tool/scmatrix.cxx | 13 ++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 7f3b5443d9d9..0c4abc067d70 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -106,6 +106,7 @@ class SC_DLLPUBLIC ScMatrix void ResetIsString(); void DeleteIsString(); void CreateMatrix( SCSIZE nC, SCSIZE nR); + void Clear(); // pStr may be NULL, bFlag MUST NOT be 0 void PutStringEntry( const String* pStr, BYTE bFlag, SCSIZE nIndex ); @@ -178,6 +179,12 @@ public: /** Clone the matrix. */ ScMatrix* Clone() const; + /** + * Resize the matrix to specified new dimension. Note that this operation + * clears all stored values. + */ + void Resize( SCSIZE nC, SCSIZE nR); + /** Clone the matrix and extend it to the new size. nNewCols and nNewRows MUST be at least of the size of the original matrix. */ ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows ) const; diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index ad7147ccb14d..5b2b304bdb72 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -65,12 +65,17 @@ void ScMatrix::CreateMatrix(SCSIZE nC, SCSIZE nR) // nur fuer ctor mnNonValue = 0; } -ScMatrix::~ScMatrix() +void ScMatrix::Clear() { DeleteIsString(); delete [] pMat; } +ScMatrix::~ScMatrix() +{ + Clear(); +} + ScMatrix* ScMatrix::Clone() const { ScMatrix* pScMat = new ScMatrix( nColCount, nRowCount); @@ -79,6 +84,12 @@ ScMatrix* ScMatrix::Clone() const return pScMat; } +void ScMatrix::Resize( SCSIZE nC, SCSIZE nR) +{ + Clear(); + CreateMatrix(nC, nR); +} + ScMatrix* ScMatrix::CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows ) const { ScMatrix* pScMat = new ScMatrix( nNewCols, nNewRows); -- cgit v1.2.3 From 3678f33c2aff09260f5bf9c7fd4ae2ba272e711c Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 2 Dec 2009 17:35:02 -0500 Subject: Defer defining of matrix size until the data are actually read. --- sc/source/filter/excel/excform.cxx | 5 ++--- sc/source/filter/excel/excform8.cxx | 12 +++--------- sc/source/filter/excel/tokstack.cxx | 5 ++--- sc/source/filter/inc/tokstack.hxx | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 323d97464cf7..42c9ac0ffe78 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -475,9 +475,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 ); if( rParam.mbAllowArrays ) { - SCSIZE nC = nByte ? nByte : 256; - SCSIZE nR = nUINT16; - aStack << aPool.StoreMatrix( nC, nR ); + aStack << aPool.StoreMatrix(); aExtensions.push_back( EXTENSION_ARRAY ); } else @@ -1895,6 +1893,7 @@ void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn ) if( NULL != pMatrix ) { + pMatrix->Resize(nCols, nRows); pMatrix->GetDimensions( nC, nR); if( nC != nCols || nR != nRows ) { diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index f50528776e0b..642cdeca9ffc 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -397,15 +397,9 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aIn.Ignore( 4 ); if (rParam.mbAllowArrays) { - SCSIZE nC = rParam.mnArrayColSize; - SCSIZE nR = rParam.mnArrayRowSize; - if (!nC || !nR) - { - // Stored array size is invalid. Get that from the formula. - nC = nByte + 1; - nR = nUINT16 + 1; - } - aStack << aPool.StoreMatrix(nC, nR); + SCSIZE nC = nByte + 1; + SCSIZE nR = nUINT16 + 1; + aStack << aPool.StoreMatrix(); aExtensions.push_back( EXTENSION_ARRAY ); } else diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx index 34c2b9284fed..fe7c3a9d6042 100644 --- a/sc/source/filter/excel/tokstack.cxx +++ b/sc/source/filter/excel/tokstack.cxx @@ -740,7 +740,7 @@ const TokenId TokenPool::StoreNlf( const ScSingleRefData& rTr ) return ( const TokenId ) nElementAkt; } -const TokenId TokenPool::StoreMatrix( SCSIZE nC, SCSIZE nR ) +const TokenId TokenPool::StoreMatrix() { ScMatrix* pM; @@ -753,8 +753,7 @@ const TokenId TokenPool::StoreMatrix( SCSIZE nC, SCSIZE nR ) pElement[ nElementAkt ] = nP_MatrixAkt; pType[ nElementAkt ] = T_Matrix; - pM = new ScMatrix( nC, nR ); - pM->FillDouble( 0., 0,0, nC-1, nR-1 ); + pM = new ScMatrix( 0, 0 ); pM->IncRef( ); ppP_Matrix[ nP_MatrixAkt ] = pM; diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx index 3a60b709d5bf..d99d17a4d8c6 100644 --- a/sc/source/filter/inc/tokstack.hxx +++ b/sc/source/filter/inc/tokstack.hxx @@ -210,7 +210,7 @@ class TokenPool const TokenId Store( const DefTokenId eId, const String& rName ); // 4 externals (e.g. AddIns, Makros...) const TokenId StoreNlf( const ScSingleRefData& rTr ); - const TokenId StoreMatrix( SCSIZE nC, SCSIZE nR ); + const TokenId StoreMatrix(); const TokenId StoreExtName( sal_uInt16 nFileId, const String& rName ); const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ); const TokenId StoreExtRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ); -- cgit v1.2.3 From c5b161da41863ace34d5a5ea5084c633c7710e2f Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 2 Dec 2009 17:46:44 -0500 Subject: Reverted my change involving ConvertParam struct passed to the Convert method. Since we are not storing array size before the formula tokens are parsed, we don't need this change anymore. --- sc/source/filter/excel/excform.cxx | 7 +++---- sc/source/filter/excel/excform8.cxx | 8 ++------ sc/source/filter/excel/frmbase.cxx | 6 ------ sc/source/filter/excel/impop.cxx | 16 ++++------------ sc/source/filter/excel/xicontent.cxx | 14 ++++---------- sc/source/filter/excel/xiformula.cxx | 4 +--- sc/source/filter/excel/xiname.cxx | 8 ++------ sc/source/filter/inc/excform.hxx | 5 ++--- sc/source/filter/inc/formel.hxx | 11 +---------- sc/source/filter/xcl97/XclImpChangeTrack.cxx | 5 ++--- 10 files changed, 21 insertions(+), 63 deletions(-) diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 42c9ac0ffe78..eff3644791d8 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -136,7 +136,7 @@ void ImportExcel::Formula( const XclAddress& rXclPos, bConvert = TRUE; if( bConvert ) - eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, ExcelToSc::ConvertParam(), FT_CellFormula); + eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); ScFormulaCell* pZelle = NULL; @@ -201,8 +201,7 @@ void ExcelToSc::GetDummy( const ScTokenArray*& pErgebnis ) // if bAllowArrays is false stream seeks to first byte after // otherwise it will seek to the first byte after the additional content (eg // inline arrays) following -ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, - const ConvertParam& rParam, const FORMULA_TYPE eFT ) +ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) { RootData& rR = GetOldRoot(); BYTE nOp, nLen, nByte; @@ -473,7 +472,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x20: // Array Constant [317 268] aIn >> nByte >> nUINT16; aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 ); - if( rParam.mbAllowArrays ) + if( bAllowArrays ) { aStack << aPool.StoreMatrix(); aExtensions.push_back( EXTENSION_ARRAY ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 642cdeca9ffc..3b5cecb3b39f 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -95,11 +95,9 @@ bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLas } - // if bAllowArrays is false stream seeks to first byte after // otherwise it will seek to the first byte past additional content after -ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, - const ConvertParam& rParam, const FORMULA_TYPE eFT ) +ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) { BYTE nOp, nLen, nByte; UINT16 nUINT16; @@ -395,10 +393,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x20: // Array Constant [317 268] aIn >> nByte >> nUINT16; aIn.Ignore( 4 ); - if (rParam.mbAllowArrays) + if( bAllowArrays ) { - SCSIZE nC = nByte + 1; - SCSIZE nR = nUINT16 + 1; aStack << aPool.StoreMatrix(); aExtensions.push_back( EXTENSION_ARRAY ); } diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index 2b6ff13f6ee0..db50598d30b6 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -248,12 +248,6 @@ void ExcelConverterBase::Reset() aEingPos.Set( 0, 0, 0 ); } -ExcelConverterBase::ConvertParam::ConvertParam() : - mbAllowArrays(true), - mnArrayColSize(0), - mnArrayRowSize(0) -{ -} diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 3f22579360eb..9b868f4d3268 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -515,12 +515,9 @@ void ImportExcel::Array25( void ) // jetzt steht Lesemarke auf Formel, Laenge in nFormLen const ScTokenArray* pErgebnis; - pFormConv->Reset( ScAddress( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab() ) ); - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = true; - pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula); + pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); DBG_ASSERT( pErgebnis, "*ImportExcel::Array25(): ScTokenArray ist NULL!" ); @@ -818,12 +815,11 @@ void ImportExcel::Shrfmla( void ) const ScTokenArray* pErgebnis; pFormConv->Reset(); - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = true; - pFormConv->Convert( pErgebnis, maStrm, nLenExpr, aParam, FT_SharedFormula ); + pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula ); DBG_ASSERT( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray ist NULL!" ); + pExcRoot->pShrfmlaBuff->Store( ScRange( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab(), static_cast(nLastCol), static_cast(nLastRow), @@ -991,14 +987,10 @@ void ImportExcel::Array34( void ) { // jetzt steht Lesemarke auf Formel, Laenge in nFormLen const ScTokenArray* pErgebnis; - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = true; - aParam.mnArrayColSize = nLastCol - nFirstCol + 1; - aParam.mnArrayRowSize = nLastRow - nFirstRow + 1; pFormConv->Reset( ScAddress( static_cast(nFirstCol), static_cast(nFirstRow), GetCurrScTab() ) ); - pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula); + pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); DBG_ASSERT( pErgebnis, "+ImportExcel::Array34(): ScTokenArray ist NULL!" ); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 61a72543bdd4..12552bc2e903 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -616,15 +616,12 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) const ScAddress& rPos = maRanges.GetObject( 0 )->aStart; // assured above that maRanges is not empty ExcelToSc& rFmlaConv = GetOldFmlaConverter(); - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = false; - ::std::auto_ptr< ScTokenArray > xTokArr1; if( nFmlaSize1 > 0 ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset( rPos ); - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr1.reset( pTokArr->Clone() ); @@ -635,7 +632,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset( rPos ); - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) pTokArr2.reset( pTokArr->Clone() ); @@ -743,9 +740,6 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) String aErrorMessage( rStrm.ReadUniString() ); rStrm.SetNulSubstChar(); // back to default - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = false; - // formula(s) if( rStrm.GetRecLeft() > 8 ) { @@ -761,7 +755,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr1.reset( pTokArr->Clone() ); @@ -776,7 +770,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm ) { const ScTokenArray* pTokArr = 0; rFmlaConv.Reset(); - rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName ); // formula converter owns pTokArr -> create a copy of the token array if( pTokArr ) xTokArr2.reset( pTokArr->Clone() ); diff --git a/sc/source/filter/excel/xiformula.cxx b/sc/source/filter/excel/xiformula.cxx index 888d5cd579e5..f6b030aa8250 100644 --- a/sc/source/filter/excel/xiformula.cxx +++ b/sc/source/filter/excel/xiformula.cxx @@ -97,9 +97,7 @@ const ScTokenArray* XclImpFmlaCompImpl::CreateFormula( aFmlaStrm.StartNextRecord(); const ScTokenArray* pArray = NULL; GetOldFmlaConverter().Reset(); - ExcelToSc::ConvertParam aParam; - aParam.mbAllowArrays = true; - GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), aParam); + GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), true); return pArray; } diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index 55664bbaba51..502e643b6c76 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -178,9 +178,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) : // --- name formula --- // JEG : double check this. It is clearly false for normal names // but some of the builtins (sheettitle?) might be able to handle arrays - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = false; - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, false, FT_RangeName ); // --- auto or advanced filter --- if( (GetBiff() == EXC_BIFF8) && pTokArr && bBuiltIn ) @@ -208,9 +206,7 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) : else if( nFmlaSize > 0 ) { // regular defined name - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = true; - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName ); + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, true, FT_RangeName ); } // 4) *** create a defined name in the Calc document *** ------------------ diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx index 5ca068d2ff45..54cde7ab8a8b 100644 --- a/sc/source/filter/inc/excform.hxx +++ b/sc/source/filter/inc/excform.hxx @@ -62,7 +62,7 @@ public: ExcelToSc( const XclImpRoot& rRoot ); virtual ~ExcelToSc(); virtual ConvErr Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen, - const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ); + bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ); virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ); @@ -138,8 +138,7 @@ public: ExcelToSc8( const XclImpRoot& rRoot ); virtual ~ExcelToSc8(); - virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, - const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ); + virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ); virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ); diff --git a/sc/source/filter/inc/formel.hxx b/sc/source/filter/inc/formel.hxx index 65c3cec209c5..0961533731cb 100644 --- a/sc/source/filter/inc/formel.hxx +++ b/sc/source/filter/inc/formel.hxx @@ -214,17 +214,8 @@ public: void Reset(); void Reset( const ScAddress& rEingPos ); - struct ConvertParam - { - bool mbAllowArrays; - SCSIZE mnArrayColSize; - SCSIZE mnArrayRowSize; - - ConvertParam(); - }; - virtual ConvErr Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen, - const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; + bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula ) = 0; }; diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 4d9d20767ea6..2f546e323179 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -210,12 +210,11 @@ void XclImpChangeTrack::ReadFormula( ScTokenArray*& rpTokenArray, const ScAddres // read the formula, 3D tab refs from extended data const ScTokenArray* pArray = NULL; aFmlConv.Reset( rPosition ); - ExcelConverterBase::ConvertParam aParam; - aParam.mbAllowArrays = false; - BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, aParam, FT_CellFormula) == ConvOK); // JEG : Check This + BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false, FT_CellFormula) == ConvOK); // JEG : Check This rpTokenArray = (bOK && pArray) ? new ScTokenArray( *pArray ) : NULL; pStrm->Ignore( 1 ); } + void XclImpChangeTrack::ReadCell( ScBaseCell*& rpCell, sal_uInt32& rFormat, -- cgit v1.2.3 -- cgit v1.2.3 From 83768b95e11f808be8515f778761961107fd55f9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:06 +0100 Subject: autorecovery: ConnectSfxFrame_Impl: show the view frame's window, if it is different from the frame's window (this code got lost in some of the previous stages, which killed impress' full-screen slide show) --- sfx2/source/view/sfxbasecontroller.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 6a609f15ca3f..8c5968efe399 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1370,6 +1370,10 @@ void SfxBaseController::ConnectSfxFrame_Impl( const bool i_bConnect ) if ( SfxViewFrame::Current() == pActFrame ) pActFrame->GetDispatcher()->Update_Impl( sal_True ); + + Window* pFrameWin = &pActFrame->GetWindow(); + if ( pFrameWin != &pActFrame->GetFrame()->GetWindow() ) + pFrameWin->Show(); } // invalidate slot corresponding to the view shell -- cgit v1.2.3 From 11e41fb8dde36b188c579fd440bfc32b3fc63673 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:45 +0100 Subject: [CWS autorecovery] SwitchToViewShell_Impl moved into the SfxFrame --- sfx2/inc/sfx2/frame.hxx | 4 +--- sfx2/inc/sfx2/viewfrm.hxx | 5 +++-- sfx2/source/view/frame.cxx | 12 +----------- sfx2/source/view/frmload.cxx | 3 +-- sfx2/source/view/impframe.hxx | 2 -- sfx2/source/view/topfrm.cxx | 38 +++++++++++++++----------------------- sfx2/source/view/viewfrm.cxx | 21 ++------------------- 7 files changed, 23 insertions(+), 62 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index d0f7e2bc701c..8367028b670c 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -209,8 +209,6 @@ public: SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); - SAL_DLLPRIVATE void SetItemSet_Impl( const SfxItemSet* pSet ); - SAL_DLLPRIVATE const SfxItemSet* GetItemSet_Impl(); SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet ); SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const; SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); @@ -224,7 +222,7 @@ public: SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc ); + SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 4eca86182da0..d120923bea23 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -152,14 +152,13 @@ protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); #ifndef _SFX_HXX - SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void KillDispatcher_Impl(); #endif virtual ~SfxViewFrame(); public: - SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL, USHORT nViewId = 0 ); + SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL ); TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) @@ -301,6 +300,8 @@ public: SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); //#endif private: SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 88bb9a62e805..2e8f3e1a8ab4 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -314,7 +314,7 @@ SfxViewFrame* SfxFrame::InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTarge { if ( bHidden ) rDoc.PutItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - rpTargetFrame->InsertDocument_Impl( rDoc ); + rpTargetFrame->InsertDocument_Impl( rDoc, *rDoc.GetMedium()->GetItemSet() ); pViewFrame = rpTargetFrame->GetCurrentViewFrame(); } else @@ -760,16 +760,6 @@ void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< : GetCurrentViewFrame()->GetBindings().SetRecorder_Impl( xRecorder ); } -void SfxFrame::SetItemSet_Impl( const SfxItemSet* pSet ) -{ - pImp->pSet = pSet; -} - -const SfxItemSet* SfxFrame::GetItemSet_Impl() -{ - return pImp->pSet; -} - void SfxFrame::Appear() { if ( GetCurrentViewFrame() ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 64fa2fdb1289..cde8265a1842 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -327,8 +327,7 @@ sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedVa { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - i_rTargetFrame.SetItemSet_Impl( &aSet ); - return i_rTargetFrame.InsertDocument_Impl( i_rDocument ); + return i_rTargetFrame.InsertDocument_Impl( i_rDocument, aSet ); } // -------------------------------------------------------------------------------------------------------------------- diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 46cf52fea19f..4f27f3aedc3b 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -71,7 +71,6 @@ public: sal_Bool bReleasingComponent : 1; sal_Bool bInPlace : 1; SfxFrame* pFrame; - const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; SvBorder aBorder; // formerly SfxTopFrame @@ -96,7 +95,6 @@ public: ,bReleasingComponent( sal_False ) ,bInPlace( sal_False ) ,pFrame( pAntiImplP ) - ,pSet( 0 ) ,pWorkWin( 0 ) ,pExternalWindow( NULL ) ,bHidden( false ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 4de9b44223a8..4bd01d3a2667 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -484,12 +484,11 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, */ } - pFrame->SetItemSet_Impl( pSet ); if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc ); + pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); if ( pWindow && !bHidden ) pWindow->Show(); } @@ -515,12 +514,11 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewI pFrame->SetFrameInterface_Impl( xFrame ); pFrame->pImp->bHidden = bHidden; - pFrame->SetItemSet_Impl( pSet ); if ( pDoc ) { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc ); + pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); } return pFrame; @@ -675,7 +673,7 @@ namespace bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) { _o_viewData.realloc(0); - _o_viewId = -1; + _o_viewId = 0; Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); Reference< XIndexAccess > xViewData; @@ -701,7 +699,7 @@ namespace } } -sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) +sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ) /* [Beschreibung] */ { @@ -719,19 +717,14 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) OSL_PRECOND( GetCurrentDocument() == NULL, "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - const SfxItemSet* pSet = GetItemSet_Impl(); - if ( !pSet ) - pSet = rDoc.GetMedium()->GetItemSet(); - SetItemSet_Impl( NULL ); - - SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size - SFX_ITEMSET_ARG( pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID - SFX_ITEMSET_ARG( pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom - SFX_ITEMSET_ARG( pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden - SFX_ITEMSET_ARG( pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data - SFX_ITEMSET_ARG( pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only - SFX_ITEMSET_ARG( pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) - SFX_ITEMSET_ARG( pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) + SFX_ITEMSET_ARG( &rSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size + SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID + SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom + SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden + SFX_ITEMSET_ARG( &rSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data + SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only + SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) + SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) // hidden? OSL_PRECOND( !pImp->bHidden, @@ -758,7 +751,6 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // if no view-related data exists in the set, then obtain the view data from the model if ( !pJumpItem && !pViewDataItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - nViewId = 0; if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); @@ -776,9 +768,9 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc, nViewId ); - if ( !pViewFrame->GetViewShell() ) - { + SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc ); + if ( !pViewFrame->SwitchToViewShell_Impl( nViewId ) ) + { // TODO: better error handling? Under which conditions can this fail? OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); pViewFrame->DoClose(); return sal_False; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b9a3a8d2d4b0..77b0840e349e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1448,8 +1448,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame::SfxViewFrame ( SfxFrame* pFrame, - SfxObjectShell* pObjShell, - sal_uInt16 nViewId + SfxObjectShell* pObjShell ) /* [Beschreibung] @@ -1474,22 +1473,6 @@ SfxViewFrame::SfxViewFrame pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); pFrame->SetOwnsBindings_Impl( sal_True ); pFrame->CreateWorkWindow_Impl(); - - if ( GetFrame()->IsInPlace() ) - { - LockAdjustPosSizePixel(); - } - - if ( pObjShell && !SwitchToViewShell_Impl( nViewId ) ) - { - // TODO: better error handling? Under which conditions can this fail? - return; - } - - if ( GetFrame()->IsInPlace() ) - { - UnlockAdjustPosSizePixel(); - } } //------------------------------------------------------------------------ @@ -2322,7 +2305,7 @@ void SfxViewFrame::ExecView_Impl pFrameItem->GetValue() >>= xFrame; SfxFrame* pFrame = SfxFrame::Create( xFrame ); pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument_Impl( *GetObjectShell() ); + pFrame->InsertDocument_Impl( *GetObjectShell(), *pMed->GetItemSet() ); if ( !bHidden ) xFrame->getContainerWindow()->setVisible( sal_True ); } -- cgit v1.2.3 From 5b4f0e7f834b27ddb0bdfece3786ced33c3917dd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:45 +0100 Subject: [CWS autorecovery] initial implementation of XModel2::createViewController --- sfx2/inc/sfx2/sfxbasecontroller.hxx | 150 +++++-------------------------- sfx2/inc/sfx2/viewsh.hxx | 2 + sfx2/source/doc/sfxbasemodel.cxx | 91 +++++++++++++++++-- sfx2/source/view/sfxbasecontroller.cxx | 159 +++++++-------------------------- sfx2/source/view/topfrm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 66 +++++++------- sfx2/source/view/viewsh.cxx | 19 ++++ 7 files changed, 195 insertions(+), 294 deletions(-) diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index 125b5af21908..e48ba8a5451b 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,7 +46,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -70,27 +71,16 @@ #define ANY ::com::sun::star::uno::Any #define SEQUENCE ::com::sun::star::uno::Sequence #define XDISPATCH ::com::sun::star::frame::XDispatch -#define XDISPATCHPROVIDER ::com::sun::star::frame::XDispatchProvider #define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor #define XMODEL ::com::sun::star::frame::XModel #define XFRAME ::com::sun::star::frame::XFrame -#define XCONTROLLER ::com::sun::star::frame::XController -#define XCONTROLLERBORDER ::com::sun::star::frame::XControllerBorder #define XEVENTLISTENER ::com::sun::star::lang::XEventListener #define MUTEX ::osl::Mutex #define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException #define UNOTYPE ::com::sun::star::uno::Type -#define OWEAKOBJECT ::cppu::OWeakObject -#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider #define UNOURL ::com::sun::star::util::URL #define OUSTRING ::rtl::OUString -#define XSTATUSINDICATORSUPPLIER ::com::sun::star::task::XStatusIndicatorSupplier -#define XCONTEXTMENUINTERCEPTION ::com::sun::star::ui::XContextMenuInterception #define XCONTEXTMENUINTERCEPTOR ::com::sun::star::ui::XContextMenuInterceptor -#define XUSERINPUTINTERCEPTION ::com::sun::star::awt::XUserInputInterception -#define XDISPATCHINFORMATIONPROVIDER ::com::sun::star::frame::XDispatchInformationProvider -#define XTITLE ::com::sun::star::frame::XTitle -#define XTITLECHANGEBROADCASTER ::com::sun::star::frame::XTitleChangeBroadcaster //________________________________________________________________________________________________________ // forwards @@ -98,6 +88,8 @@ struct IMPL_SfxBaseController_DataContainer ; // impl. struct to hold member of class SfxBaseController +class SfxViewFrame; + sal_Int16 MapGroupIDToCommandGroup( sal_Int16 nGroupID ); sal_Bool SupportsCommandGroup( sal_Int16 nCommandGroup ); sal_Int16 MapCommandGroupToGroupID( sal_Int16 nCommandGroup ); @@ -106,36 +98,19 @@ sal_Int16 MapCommandGroupToGroupID( sal_Int16 nCommandGroup ); // class declarations //________________________________________________________________________________________________________ -struct IMPL_SfxBaseController_MutexContainer -{ - MUTEX m_aMutex ; -} ; - -/**_______________________________________________________________________________________________________ - @short - - - @descr - - - @implements - - - @base - -*/ - -// Forward to impl-baseclass! -//class IMPL_SfxBaseController ; - -class SFX2_DLLPUBLIC SfxBaseController : public XTYPEPROVIDER - , public XCONTROLLER - , public XCONTROLLERBORDER - , public XDISPATCHPROVIDER - , public XSTATUSINDICATORSUPPLIER - , public XCONTEXTMENUINTERCEPTION - , public XUSERINPUTINTERCEPTION - , public XDISPATCHINFORMATIONPROVIDER - , public XTITLE - , public XTITLECHANGEBROADCASTER - , public IMPL_SfxBaseController_MutexContainer - , public OWEAKOBJECT +typedef ::cppu::WeakImplHelper9 < ::com::sun::star::frame::XController2 + , ::com::sun::star::frame::XControllerBorder + , ::com::sun::star::frame::XDispatchProvider + , ::com::sun::star::task::XStatusIndicatorSupplier + , ::com::sun::star::ui::XContextMenuInterception + , ::com::sun::star::awt::XUserInputInterception + , ::com::sun::star::frame::XDispatchInformationProvider + , ::com::sun::star::frame::XTitle + , ::com::sun::star::frame::XTitleChangeBroadcaster + > SfxBaseController_Base; + +class SFX2_DLLPUBLIC SfxBaseController :public SfxBaseController_Base + ,public ::cppu::BaseMutex { //________________________________________________________________________________________________________ // public methods @@ -180,93 +155,13 @@ public: SAL_DLLPRIVATE void ReleaseShell_Impl(); SAL_DLLPRIVATE void BorderWidthsChanged_Impl(); - //____________________________________________________________________________________________________ - // XInterface - //____________________________________________________________________________________________________ - - /**___________________________________________________________________________________________________ - @short give answer, if interface is supported - @descr The interfaces are searched by type. - - @seealso XInterface - - @param "rType" is the type of searched interface. - - @return Any information about found interface - - @onerror A RuntimeException is thrown. - */ - - virtual ANY SAL_CALL queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) ; - - /**___________________________________________________________________________________________________ - @short increment refcount - @descr - - - @seealso XInterface - @seealso release() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL acquire() throw() ; - - /**___________________________________________________________________________________________________ - @short decrement refcount - @descr - - - @seealso XInterface - @seealso acquire() - - @param - - - @return - - - @onerror A RuntimeException is thrown. - */ - - virtual void SAL_CALL release() throw() ; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ - // XTypeProvider + // XController2 //____________________________________________________________________________________________________ - - /**___________________________________________________________________________________________________ - @short get information about supported interfaces - @descr - - - @seealso XTypeProvider - - @param - - - @return Sequence of types of all supported interfaces - - @onerror A RuntimeException is thrown. - */ - - virtual SEQUENCE< UNOTYPE > SAL_CALL getTypes() throw( RUNTIMEEXCEPTION ) ; - - /**___________________________________________________________________________________________________ - @short get implementation id - @descr This ID is neccessary for UNO-caching. If there no ID, cache is disabled. - Another way, cache is enabled. - - @seealso XTypeProvider - - @param - - - @return ID as Sequence of byte - - @onerror A RuntimeException is thrown. - */ - - virtual SEQUENCE< sal_Int8 > SAL_CALL getImplementationId() throw( RUNTIMEEXCEPTION ) ; - - ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > SAL_CALL getStatusIndicator( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getComponentWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ // XController @@ -501,6 +396,7 @@ public: //#endif private: SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const bool i_bConnect ); + SAL_DLLPRIVATE SfxViewFrame* GetViewFrame_Impl() const; //________________________________________________________________________________________________________ // private variables diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index b11a49efeb1f..cb8508a91632 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -180,6 +180,8 @@ public: const TypeId* pType = 0, BOOL bOnlyVisible = TRUE ); static SfxViewShell* Current(); + static SfxViewShell* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController ); + // Ctoren/Dtoren Initialisierung TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWSH) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 0c2c6a54442f..df4fa2133480 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -102,6 +102,8 @@ // includes of my own project //________________________________________________________________________________________________________ +#include +#include "viewfac.hxx" #include #include #include @@ -141,6 +143,11 @@ static const ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAs namespace css = ::com::sun::star; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::lang::IllegalArgumentException; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. @@ -3914,29 +3921,99 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getCo css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewControllerNames() throw (css::uno::RuntimeException) { - return css::uno::Sequence< ::rtl::OUString >(); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( impl_isDisposed() ) + throw lang::DisposedException(); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); + + Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); + for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) + { + ::rtl::OUStringBuffer aViewName; + aViewName.appendAscii( "view" ); + aViewName.append( nViewNo ); + aViewNames[nViewNo] = aViewName.makeStringAndClear(); + } + return aViewNames; } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& /*Frame*/) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController( const css::uno::Reference< css::frame::XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + return createViewController( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "view0" ) ), Sequence< PropertyValue >(), i_rFrame ); + // TODO: extende the SfxViewFactory with support for speaking view names } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController(const ::rtl::OUString& /*ViewName*/, - const css::uno::Sequence< css::beans::PropertyValue >& /*Arguments*/, - const css::uno::Reference< css::frame::XFrame >& /*Frame */) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController( + const ::rtl::OUString& i_rViewName, const Sequence< PropertyValue >& i_rArguments, const Reference< XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( impl_isDisposed() ) + throw lang::DisposedException(); + + // number of view to create + if ( i_rViewName.indexOfAsciiL( "view", 4 ) != 0 ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + const USHORT nViewId = (USHORT)i_rViewName.copy( 4 ).toInt32(); + + SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + sal_Int32 nViewNo = -1; + for ( nViewNo = 0; nViewNo < rDocumentFactory.GetViewFactoryCount(); ++nViewNo ) + if ( rDocumentFactory.GetViewFactory( nViewNo ).GetOrdinal() == nViewId ) + break; + if ( nViewNo >= rDocumentFactory.GetViewFactoryCount() ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + // determine previous shell (used in some special cases) + ::comphelper::NamedValueCollection aCreationArgs( i_rArguments ); + Reference< XController > xPreviousController = aCreationArgs.getOrDefault( "PreviousView", Reference< XController >() ); + SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); + OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), + "SfxBaseModel::createViewController: invalid old controller!" ); + + // determine the ViewFrame belonging to the given XFrame + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); + pViewFrame; + pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) + ) + { + if ( pViewFrame->GetFrame()->GetFrameInterface() == i_rFrame ) + break; + } + if ( !pViewFrame ) + // TODO: Effectively, this means that only our dedicated SFX-Loader can load documents into an arbitrary + // XFrame, since it will (directly or indirectly) create the Sfx(View)Frame which we need here. + // We should evaluate whether (after the re-factoring) it is possible/feasible to allow for an arbitrary + // XFrame here, by creating the necessary Sfx(View)Frame ourself. Finally, this is what a "view factory" + // is about ... + throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid frame" ) ), *this, 3 ); + + // delegate to SFX' view factory + SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( nViewNo ); + SfxViewShell* pViewShell = rViewFactory.CreateInstance( pViewFrame, pOldViewShell ); + ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); + + // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also + pViewFrame->GetDispatcher()->SetDisableFlags( 0 ); + pViewFrame->SetViewShell_Impl( pViewShell ); + + // ensure a default controller, if the view shell did not provide an own implementation + if ( !pViewShell->GetController().is() ) + pViewShell->SetController( new SfxBaseController( pViewShell ) ); + + return Reference< XController2 >( pViewShell->GetController(), UNO_QUERY_THROW ); } //============================================================================= diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 8c5968efe399..388cca5145f8 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -113,6 +114,13 @@ #define TIMEOUT_START_RESCHEDULE 10L /* 10th s */ using namespace ::com::sun::star; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::lang::DisposedException; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XDispatchProvider; namespace css = ::com::sun::star; struct GroupIDToCommandGroup @@ -224,7 +232,7 @@ void reschedule() class SfxStatusIndicator : public ::cppu::WeakImplHelper2< ::com::sun::star::task::XStatusIndicator, ::com::sun::star::lang::XEventListener > { friend class SfxBaseController; - ::com::sun::star::uno::Reference < XCONTROLLER > xOwner; + ::com::sun::star::uno::Reference < XController > xOwner; ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xProgress; SfxWorkWindow* pWorkWindow; sal_Int32 _nRange; @@ -517,8 +525,7 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::disposing( const EVENTOBJEC //________________________________________________________________________________________________________ DBG_NAME(sfx2_SfxBaseController) SfxBaseController::SfxBaseController( SfxViewShell* pViewShell ) - : IMPL_SfxBaseController_MutexContainer ( ) - , m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) + : m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) { DBG_CTOR(sfx2_SfxBaseController,NULL); m_pData->m_pViewShell->SetController( this ); @@ -535,138 +542,40 @@ SfxBaseController::~SfxBaseController() } //________________________________________________________________________________________________________ -// SfxBaseController -> XInterface +// SfxBaseController -> XController2 //________________________________________________________________________________________________________ -ANY SAL_CALL SfxBaseController::queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - ANY aReturn( ::cppu::queryInterface( rType , - static_cast< XTYPEPROVIDER* > ( this ) , - static_cast< XCOMPONENT* > ( this ) , - static_cast< XCONTROLLER* > ( this ) , - static_cast< XCONTROLLERBORDER* > ( this ) , - static_cast< XUSERINPUTINTERCEPTION* > ( this ) , - static_cast< XSTATUSINDICATORSUPPLIER* > ( this ) , - static_cast< XCONTEXTMENUINTERCEPTION* > ( this ) , - static_cast< XDISPATCHPROVIDER* > ( this ), - static_cast< XTITLE* > ( this ), - static_cast< XTITLECHANGEBROADCASTER* > ( this ), - static_cast< XDISPATCHINFORMATIONPROVIDER* > ( this ) ) ) ; - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return OWeakObject::queryInterface( rType ) ; - } -} -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ - -void SAL_CALL SfxBaseController::acquire() throw() +Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (RuntimeException) { - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire() ; -} - -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ - -void SAL_CALL SfxBaseController::release() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell ) + throw DisposedException(); - // Forward to baseclass - OWeakObject::release() ; + return Reference< XWindow >( GetViewFrame_Impl()->GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< UNOTYPE > SAL_CALL SfxBaseController::getTypes() throw( RUNTIMEEXCEPTION ) +::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) { - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTYPECOLLECTION* pTypeCollection = NULL ; - - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTYPECOLLECTION aTypeCollection( ::getCppuType(( const REFERENCE< XTYPEPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLERBORDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XSTATUSINDICATORSUPPLIER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTEXTMENUINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XUSERINPUTINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLE >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLECHANGEBROADCASTER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHINFORMATIONPROVIDER >*)NULL ) ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell ) + throw DisposedException(); - return pTypeCollection->getTypes() ; + ::rtl::OUStringBuffer sViewName; + sViewName.appendAscii( "view" ); + sViewName.append( sal_Int32( GetViewFrame_Impl()->GetCurViewId() ) ); + return sViewName.makeStringAndClear(); } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< sal_Int8 > SAL_CALL SfxBaseController::getImplementationId() throw( RUNTIMEEXCEPTION ) +SfxViewFrame* SfxBaseController::GetViewFrame_Impl() const { - // Create one Id for all instances of this class. - // Use ethernet address to do this! (sal_True) - - // Optimize this method - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pID is NULL - for the second call pID is different from NULL! - static OIMPLEMENTATIONID* pID = NULL ; - - if ( pID == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; - - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pID == NULL ) - { - // Create a new static ID ... - static OIMPLEMENTATIONID aID( sal_False ) ; - // ... and set his address to static pointer! - pID = &aID ; - } - } - - return pID->getImplementationId() ; + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + return pActFrame; } //________________________________________________________________________________________________________ -// SfxBaseController -> XController +// SfxBaseController -> XController2 -> XController //________________________________________________________________________________________________________ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame ) throw( ::com::sun::star::uno::RuntimeException ) @@ -856,7 +765,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU if ( xFrame.is() ) xFrame->setName( sTargetFrameName ); - REFERENCE < XDISPATCHPROVIDER > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); + Reference< XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) return xProv->queryDispatch( aURL, sTargetFrameName, ::com::sun::star::frame::FrameSearchFlag::SELF ); } @@ -1089,11 +998,11 @@ void SfxBaseController::BorderWidthsChanged_Impl() void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - REFERENCE < XCONTROLLER > xTmp( this ); + Reference< XController > xTmp( this ); m_pData->m_bDisposing = sal_True ; EVENTOBJECT aEventObject; - aEventObject.Source = (XCONTROLLER*)this ; + aEventObject.Source = *this ; m_pData->m_aListenerContainer.disposeAndClear( aEventObject ) ; if ( m_pData->m_pController && m_pData->m_pController->getFrame().is() ) @@ -1110,7 +1019,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( pFrame ) { EVENTOBJECT aObject; - aObject.Source = (OWEAKOBJECT*)this ; + aObject.Source = *this ; SfxObjectShell* pDoc = pFrame->GetObjectShell() ; SfxViewFrame *pView = SfxViewFrame::GetFirst(pDoc); diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 4bd01d3a2667..76b6b12346ad 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -792,7 +792,7 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); // Before CWS autorecovery, there was code which postponed setting the ViewData/Mark to a later time - // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since loads this method + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method // here is never called before the load process finished. if ( pViewDataItem ) { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 77b0840e349e..6867f90b3603 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -66,7 +66,7 @@ #include #include #include -#include +#include #include #include #include @@ -1328,12 +1328,15 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } - case SFX_HINT_DYING: case SFX_HINT_DEINITIALIZING: - // when the Object is being deleted, destroy the view too GetFrame()->DoClose(); + break; + case SFX_HINT_DYING: + // when the Object is being deleted, destroy the view too if ( xObjSh.Is() ) ReleaseObjectShell_Impl(); + else + GetFrame()->DoClose(); break; } @@ -2019,43 +2022,37 @@ SfxViewShell* SfxViewFrame::LoadNewView_Impl( const USHORT i_nNewViewNo, SfxView OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewView_Impl: not allowed to be called with an exsiting view shell!" ); OSL_PRECOND( GetObjectShell() != NULL, "SfxViewFrame::LoadNewView_Impl: no document -> no loading!" ); - // our UNO doc - const Reference < XModel > xModel( GetObjectShell()->GetModel(), UNO_QUERY_THROW ); + const Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); + const Reference < XModel2 > xModel( GetObjectShell()->GetModel(), UNO_QUERY_THROW ); - // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - // >>> to be moved into a UNO view factory implementation - SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const USHORT nViewId = GetObjectShell()->GetFactory().GetViewFactory( i_nNewViewNo ).GetOrdinal(); + ::rtl::OUStringBuffer sViewName; + sViewName.appendAscii( "view" ); + sViewName.append( sal_Int32( nViewId ) ); + // TODO: extende the SfxViewFactory with support for speaking view names - // remember ViewID - pImp->nCurViewId = rDocumentFactory.GetViewFactory( i_nNewViewNo ).GetOrdinal(); - // TODO: shouldn't this be done in success case only? + // let the model create a new controller + ::comphelper::NamedValueCollection aViewCreationArgs; + if ( i_pOldShell != NULL ) + aViewCreationArgs.put( "PreviousView", i_pOldShell->GetController() ); - SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( i_nNewViewNo ); + const Reference< XController2 > xController( xModel->createViewController( + sViewName.makeStringAndClear(), + aViewCreationArgs.getPropertyValues(), + xFrame + ) ); + SfxViewShell* pViewShell = SfxViewShell::Get( xController.get() ); + ENSURE_OR_THROW( pViewShell, "invalid controller returned by view factory" ); - SfxViewShell* pViewShell = rViewFactory.CreateInstance( this, i_pOldShell ); - ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); - - // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also - GetDispatcher()->SetDisableFlags( 0 ); - SetViewShell_Impl( pViewShell ); - - // ensure a default controller, if the view shell did not provide an own implementation - if ( !pViewShell->GetController().is() ) - pViewShell->SetController( new SfxBaseController( pViewShell ) ); - - // <<< to be moved into a UNO view factory implementation - // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + // remember ViewID + pImp->nCurViewId = nViewId; // introduce model/view/controller to each other - Reference < XWindow > xWindow( GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY ); - Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); - Reference < XController > xController( pViewShell->GetController() ); - - xController->attachModel( xModel ); - xModel->connectController( xController ); - xFrame->setComponent( xWindow, xController ); + xController->attachModel( xModel.get() ); + xModel->connectController( xController.get() ); + xFrame->setComponent( xController->getComponentWindow(), xController.get() ); xController->attachFrame( xFrame ); - xModel->setCurrentController( xController ); + xModel->setCurrentController( xController.get() ); return pViewShell; } @@ -2141,7 +2138,8 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl { // the SfxCode is not able to cope with exceptions thrown while creating views // the code will crash in the stack unwinding procedure, so we shouldn't let exceptions go through here - DBG_ERROR("Exception in SwitchToViewShell_Impl - urgent issue. Please contact development!"); + DBG_UNHANDLED_EXCEPTION(); + return sal_False; } DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 75ee988e29fd..48cd21452699 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1360,6 +1360,25 @@ SfxViewShell* SfxViewShell::Current() //-------------------------------------------------------------------- +SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) +{ + if ( !i_rController.is() ) + return NULL; + + SfxViewShell* pViewShell = NULL; + for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( NULL, FALSE ); + pViewShell; + pViewShell = SfxViewShell::GetNext( *pViewShell, NULL, FALSE ) + ) + { + if ( pViewShell->GetController() == i_rController ) + return pViewShell; + } + return NULL; +} + +//-------------------------------------------------------------------- + SdrView* SfxViewShell::GetDrawView() const /* [Beschreibung] -- cgit v1.2.3 From 6732980b94b87b23d7565ac04847ef70bf58d565 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:45 +0100 Subject: [CWS autorecovery] somewhat separated the 'switch view shell on SFX level' from the 'load new document on UNO level' case --- sfx2/inc/sfx2/sfxbasemodel.hxx | 3 + sfx2/inc/sfx2/viewfrm.hxx | 19 ++++-- sfx2/source/doc/sfxbasemodel.cxx | 61 +++++++++++++----- sfx2/source/view/frmload.cxx | 10 +-- sfx2/source/view/impframe.hxx | 7 --- sfx2/source/view/topfrm.cxx | 11 ++-- sfx2/source/view/viewfrm.cxx | 130 ++++++++++++++++++++++++++++----------- 7 files changed, 166 insertions(+), 75 deletions(-) diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 6ef67b6a009a..b3b542715ab6 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -200,6 +200,7 @@ class SfxPrinter; class SfxViewShell; class SfxObjectShell ; class SfxEventHint; +class SfxViewFrame; struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel //________________________________________________________________________________________________________ @@ -1521,6 +1522,8 @@ private: SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper (); + SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) const; + //________________________________________________________________________________________________________ // private variables and methods //________________________________________________________________________________________________________ diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d120923bea23..2db001023cdc 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -41,6 +41,7 @@ #include #include #include +#include class SfxMacro; class SvBorder; @@ -164,9 +165,8 @@ public: SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) static void SetViewFrame( SfxViewFrame* ); - static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, - USHORT nViewId=0, - BOOL bHidden=FALSE ); + static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); + static SfxViewFrame* Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* Current(); static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); @@ -301,11 +301,20 @@ public: SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); - SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); + SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); + //#endif private: - SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ); + SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); + SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > + LoadDocument_Impl( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rArgs, + const USHORT i_nViewId + ); }; //-------------------------------------------------------------------- diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index df4fa2133480..62c96bf498f7 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3947,7 +3947,46 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef css::uno::Exception ) { return createViewController( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "view0" ) ), Sequence< PropertyValue >(), i_rFrame ); - // TODO: extende the SfxViewFactory with support for speaking view names + // TODO: extend the SfxViewFactory with support for speaking view names +} + +//============================================================================= +SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) const +{ + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); + pViewFrame; + pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) + ) + { + if ( pViewFrame->GetFrame()->GetFrameInterface() == i_rFrame ) + break; + } + if ( !pViewFrame ) + { + // no view frame, yet, but perhaps a mere frame? + SfxFrame* pFrame = NULL; + for ( pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( ( pFrame->GetFrameInterface() == i_rFrame ) + && ( pFrame->GetCurrentViewFrame() == NULL ) + // TODO: this condition is somewhat hacky, as it relies on the fact that this is (usually) + // the SfxFrame which is, up the stack, within its InsertDocument_Impl call. + // Before the refactoring is finally done, this is to be removed. + ) + break; + } + if ( !pFrame ) + { + pFrame = SfxFrame::Create( i_rFrame ); + ENSURE_OR_THROW( pFrame, "no SfxFrame created for the XFrame" ); + } + pViewFrame = new SfxViewFrame( pFrame, GetObjectShell() ); + } + return pViewFrame; } //============================================================================= @@ -3983,22 +4022,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie "SfxBaseModel::createViewController: invalid old controller!" ); // determine the ViewFrame belonging to the given XFrame - SfxViewFrame* pViewFrame = NULL; - for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); - pViewFrame; - pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) - ) - { - if ( pViewFrame->GetFrame()->GetFrameInterface() == i_rFrame ) - break; - } - if ( !pViewFrame ) - // TODO: Effectively, this means that only our dedicated SFX-Loader can load documents into an arbitrary - // XFrame, since it will (directly or indirectly) create the Sfx(View)Frame which we need here. - // We should evaluate whether (after the re-factoring) it is possible/feasible to allow for an arbitrary - // XFrame here, by creating the necessary Sfx(View)Frame ourself. Finally, this is what a "view factory" - // is about ... - throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid frame" ) ), *this, 3 ); + SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); // delegate to SFX' view factory SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( nViewNo ); @@ -4009,6 +4033,9 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie pViewFrame->GetDispatcher()->SetDisableFlags( 0 ); pViewFrame->SetViewShell_Impl( pViewShell ); + // remember ViewID + pViewFrame->SetCurViewId_Impl( rViewFactory.GetOrdinal() ); + // ensure a default controller, if the view shell did not provide an own implementation if ( !pViewShell->GetController().is() ) pViewShell->SetController( new SfxBaseController( pViewShell ) ); diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index cde8265a1842..a8c6e9ae5f03 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -565,11 +565,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // the latter. } - // create a frame - SfxFrame* pTargetFrame = SfxFrame::Create( _rTargetFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); - wFrame = pTargetFrame; - // get the SfxObjectShell (still needed at the moment) SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); @@ -584,6 +579,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // code at the very end of this method cares for closing the XModel, which should also close the // ObjectShell. + // create a frame + SfxFrame* pTargetFrame = SfxFrame::Create( _rTargetFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + wFrame = pTargetFrame; + // insert the document into the frame if ( !impl_plugDocIntoFrame( aDescriptor, *pTargetFrame, *xDoc ) ) throw RuntimeException(); diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 4f27f3aedc3b..e710b9f44167 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -56,14 +56,10 @@ class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase { public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; - String aFrameIdName; sal_uInt32 nType; - sal_uInt32 nHistoryPos; SfxViewFrame* pCurrentViewFrame; SfxFrameDescriptor* pDescr; - sal_uInt16 nFrameId; sal_uInt16 nLocks; - sal_Bool bCloseOnUnlock : 1; sal_Bool bClosing : 1; sal_Bool bPrepClosing : 1; sal_Bool bInCancelTransfers : 1; @@ -82,12 +78,9 @@ public: SfxFrame_Impl( SfxFrame* pAntiImplP ) :SvCompatWeakBase( pAntiImplP ) ,nType( 0L ) - ,nHistoryPos( 0 ) ,pCurrentViewFrame( NULL ) ,pDescr( NULL ) - ,nFrameId( 0 ) ,nLocks( 0 ) - ,bCloseOnUnlock( sal_False ) ,bClosing(sal_False) ,bPrepClosing(sal_False) ,bInCancelTransfers( sal_False ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 76b6b12346ad..30c94384b3ca 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -34,6 +34,7 @@ #endif #include +#include #include #include #include @@ -768,13 +769,11 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc ); - if ( !pViewFrame->SwitchToViewShell_Impl( nViewId ) ) - { // TODO: better error handling? Under which conditions can this fail? - OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); - pViewFrame->DoClose(); + SfxViewFrame* pViewFrame = SfxViewFrame::Create( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); + OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); + if ( !pViewFrame ) + // TODO: better error handling? Under which conditions can this fail? return sal_False; - } if ( nPluginMode == 1 ) { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6867f90b3603..1f14a3a9b0ec 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -102,6 +102,7 @@ using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using ::com::sun::star::awt::XWindow; +using ::com::sun::star::beans::PropertyValue; namespace css = ::com::sun::star; #ifndef GCC @@ -2017,44 +2018,93 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const } //-------------------------------------------------------------------- -SfxViewShell* SfxViewFrame::LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ) +Reference< XController2 > SfxViewFrame::LoadDocument_Impl( + const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rArgs, + const USHORT i_nViewId ) { - OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewView_Impl: not allowed to be called with an exsiting view shell!" ); - OSL_PRECOND( GetObjectShell() != NULL, "SfxViewFrame::LoadNewView_Impl: no document -> no loading!" ); - - const Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); - const Reference < XModel2 > xModel( GetObjectShell()->GetModel(), UNO_QUERY_THROW ); + ENSURE_OR_THROW( i_rFrame.is(), "illegal frame" ); + const Reference < XModel2 > xModel( i_rDoc.GetModel(), UNO_QUERY_THROW ); - const USHORT nViewId = GetObjectShell()->GetFactory().GetViewFactory( i_nNewViewNo ).GetOrdinal(); ::rtl::OUStringBuffer sViewName; sViewName.appendAscii( "view" ); - sViewName.append( sal_Int32( nViewId ) ); - // TODO: extende the SfxViewFactory with support for speaking view names + sViewName.append( sal_Int32( i_nViewId ) ); + // TODO: extend the SfxViewFactory with support for speaking view names // let the model create a new controller + const Reference< XController2 > xController( xModel->createViewController( + sViewName.makeStringAndClear(), + i_rArgs, + i_rFrame + ), UNO_SET_THROW ); + + // introduce model/view/controller to each other + xController->attachModel( xModel.get() ); + xModel->connectController( xController.get() ); + i_rFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( i_rFrame ); + xModel->setCurrentController( xController.get() ); + + return xController; +} + +//-------------------------------------------------------------------- +SfxViewShell* SfxViewFrame::LoadNewView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ) +{ + ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); + OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewView_Impl: not allowed to be called with an exsiting view shell!" ); + ::comphelper::NamedValueCollection aViewCreationArgs; if ( i_pOldShell != NULL ) aViewCreationArgs.put( "PreviousView", i_pOldShell->GetController() ); - const Reference< XController2 > xController( xModel->createViewController( - sViewName.makeStringAndClear(), + const Reference< XController2 > xController = LoadDocument_Impl( + *GetObjectShell(), + GetFrame()->GetFrameInterface(), aViewCreationArgs.getPropertyValues(), - xFrame - ) ); + i_nViewId + ); + SfxViewShell* pViewShell = SfxViewShell::Get( xController.get() ); ENSURE_OR_THROW( pViewShell, "invalid controller returned by view factory" ); + return pViewShell; +} - // remember ViewID - pImp->nCurViewId = nViewId; +//-------------------------------------------------------------------- - // introduce model/view/controller to each other - xController->attachModel( xModel.get() ); - xModel->connectController( xController.get() ); - xFrame->setComponent( xController->getComponentWindow(), xController.get() ); - xController->attachFrame( xFrame ); - xModel->setCurrentController( xController.get() ); +SfxViewFrame* SfxViewFrame::Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + bool bSuccess = false; + SfxViewFrame* pViewFrame = NULL; + try + { + Reference< XController2 > xController = LoadDocument_Impl( + i_rDoc, i_rFrame.GetFrameInterface(), Sequence< PropertyValue >(), i_nViewId ); + ENSURE_OR_THROW( xController.is(), "invalid controller returned by LoadDocument_Impl" ); + // this is expected to throw in case of a failure ... - return pViewShell; + if ( xController.is() ) + { + for ( pViewFrame = SfxViewFrame::GetFirst( &i_rDoc, FALSE ); + pViewFrame; + pViewFrame = SfxViewFrame::GetNext( *pViewFrame, &i_rDoc, FALSE ) + ) + { + if ( pViewFrame->GetViewShell()->GetController() == xController ) + break; + } + if ( !pViewFrame ) + { + OSL_ENSURE( false, "SfxViewFrame::Create: wrong controller implementation!" ); + Reference< XComponent > xComponent( xController, UNO_QUERY_THROW ); + xComponent->dispose(); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return pViewFrame; } //-------------------------------------------------------------------- @@ -2099,13 +2149,9 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl { try { - ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - - GetBindings().ENTERREGISTRATIONS(); - LockAdjustPosSizePixel(); - // if we already have a view shell, remove it SfxViewShell* pOldSh = GetViewShell(); + OSL_PRECOND( pOldSh, "SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" ); if ( pOldSh ) { // ask wether it can be closed @@ -2120,10 +2166,13 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl SetViewShell_Impl( NULL ); } + GetBindings().ENTERREGISTRATIONS(); + LockAdjustPosSizePixel(); + // create and load new ViewShell SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); - const sal_uInt16 nNewNo = ( bIsIndex || !nViewIdOrNo ) ? nViewIdOrNo : rDocFact.GetViewNo_Impl( nViewIdOrNo, 0 ); - SfxViewShell* pNewSh = LoadNewView_Impl( nNewNo, pOldSh ); + const sal_uInt16 nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; + SfxViewShell* pNewSh = LoadNewView_Impl( nViewId, pOldSh ); // allow resize events to be processed UnlockAdjustPosSizePixel(); @@ -2146,6 +2195,12 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl return sal_True; } +//------------------------------------------------------------------------- +void SfxViewFrame::SetCurViewId_Impl( const USHORT i_nID ) +{ + pImp->nCurViewId = i_nID; +} + //------------------------------------------------------------------------- sal_uInt16 SfxViewFrame::GetCurViewId() const { @@ -2224,10 +2279,14 @@ void SfxViewFrame::ExecView_Impl case SID_VIEWSHELL: { const SfxPoolItem *pItem = 0; - if ( rReq.GetArgs() && - SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) ) - rReq.SetReturnValue( SfxBoolItem(0, SwitchToViewShell_Impl( - (sal_uInt16)((const SfxUInt16Item*) pItem)->GetValue()) )); + if ( rReq.GetArgs() + && SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) + ) + { + const sal_uInt16 nViewId = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); + BOOL bSuccess = SwitchToViewShell_Impl( nViewId ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); + } break; } @@ -2237,8 +2296,9 @@ void SfxViewFrame::ExecView_Impl case SID_VIEWSHELL3: case SID_VIEWSHELL4: { - rReq.SetReturnValue( SfxBoolItem(0, - SwitchToViewShell_Impl( rReq.GetSlot() - SID_VIEWSHELL0, sal_True ) ) ); + const sal_uInt16 nViewNo = rReq.GetSlot() - SID_VIEWSHELL0; + BOOL bSuccess = SwitchToViewShell_Impl( nViewNo, sal_True ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); break; } -- cgit v1.2.3 From fced3ee2d69e83a72d813037bbf6bbeb0ebeb6bd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:45 +0100 Subject: [CWS autorecovery] replace InsertDocument_Impl calls with UNO component loading --- sfx2/inc/sfx2/frame.hxx | 2 +- sfx2/source/view/frmload.cxx | 7 +-- sfx2/source/view/topfrm.cxx | 108 ++++++++++++++++++++----------------------- 3 files changed, 56 insertions(+), 61 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 8367028b670c..ee710e43f6d2 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -141,7 +141,7 @@ public: static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); static SfxFrame* Create( SfxObjectShell* pDoc = NULL, USHORT nViewId = NULL, bool bHidden = false, const SfxItemSet* pSet = NULL); - static SfxFrame* Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewId = 0, bool bHidden = false, const SfxItemSet* pSet = NULL ); + static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); SvCompatWeakHdl* GetHdl(); Window& GetWindow() const; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index a8c6e9ae5f03..542495d61b44 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -470,9 +470,9 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA if ( !aDescriptor.has( "Referer" ) ) aDescriptor.put( "Referer", ::rtl::OUString() ); - // TODO: is this needed? finally, when loading is successfull, then ther should be no need for this item, + // TODO: is this needed? finally, when loading is successfull, then there should be no need for this item, // as the document can always obtain its frame. In particular, there might be situations where this frame - // is access, but already disposed: Imagine the user loading a document, opening a second view on it, and + // is accessed, but already disposed: Imagine the user loading a document, opening a second view on it, and // then closing the first view/frame. aDescriptor.put( "Frame", _rTargetFrame ); @@ -570,7 +570,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); // if the document is created hidden, prevent it being deleted until it is shown or disposed - impl_lockHiddenDocument( *xDoc, aDescriptor ); + if ( !bExternalModel ) + impl_lockHiddenDocument( *xDoc, aDescriptor ); // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 30c94384b3ca..0c7a0e059c28 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +111,9 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; +using ::com::sun::star::frame::XComponentLoader; //------------------------------------------------------------------------ @@ -447,44 +452,6 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, pFrame->pImp->bHidden = bHidden; Window* pWindow = pFrame->GetTopWindow_Impl(); - if ( pWindow && pDoc ) - { - ::rtl::OUString aDocServiceName( pDoc->GetFactory().GetDocumentServiceName() ); - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - String aTitle = pDoc->GetTitle( SFX_TITLE_DETECT ); - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifndef PRODUCT - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - /* AS_TITLE - pWindow->SetText( aTitle ); - */ - - /* AS_ICON - if( pWindow->GetType() == WINDOW_WORKWINDOW ) - { - SvtModuleOptions::EFactory eFactory; - if( SvtModuleOptions::ClassifyFactoryByName( aDocServiceName, eFactory ) ) - { - WorkWindow* pWorkWindow = (WorkWindow*)pWindow; - pWorkWindow->SetIcon( (sal_uInt16) SvtModuleOptions().GetFactoryIcon( eFactory ) ); - } - } - */ - } - if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) { if ( nViewId ) @@ -497,29 +464,58 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, return pFrame; } -SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewId, bool bHidden, const SfxItemSet* pSet ) +SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) { - Reference < ::com::sun::star::lang::XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - Reference < XFramesSupplier > xDesktop ( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - Reference < XFrame > xFrame( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), UNO_QUERY ); + SfxFrame* pFrame = NULL; + try + { + // create and initialize new top level frame for this window + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); - uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY ); - xFrame->initialize( xWin.get() ); - if ( xDesktop.is() ) + Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); + xFrame->initialize( xWin.get() ); xDesktop->getFrames()->append( xFrame ); - if ( xWin.is() && xWin->isActive() ) - xFrame->activate(); + if ( xWin->isActive() ) + xFrame->activate(); - SfxFrame* pFrame = new SfxFrame( rWindow, false ); - pFrame->SetFrameInterface_Impl( xFrame ); - pFrame->pImp->bHidden = bHidden; + // create load arguments + Sequence< PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs ); - if ( pDoc ) - { + ::comphelper::NamedValueCollection aArgs( aLoadArgs ); + aArgs.put( "Model", rDoc.GetModel() ); + aArgs.put( "Hidden", bHidden ); if ( nViewId ) - pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); + aArgs.put( "ViewId", nViewId ); + + aLoadArgs = aArgs.getPropertyValues(); + + // load the doc into that frame + Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( + rDoc.GetModel()->getURL(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), + 0, + aLoadArgs + ); + + for ( pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == xFrame ) + break; + } + + OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } return pFrame; @@ -728,9 +724,7 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) // hidden? - OSL_PRECOND( !pImp->bHidden, - "SfxFrame::InsertDocument_Impl: quite unexpected ... the below logic might not work in all cases here ..." ); - pImp->bHidden = pHidItem ? pHidItem->GetValue() : false; + pImp->bHidden = pHidItem ? pHidItem->GetValue() : pImp->bHidden; // plugin mode const USHORT nPluginMode = pPluginMode ? pPluginMode->GetValue() : 0; -- cgit v1.2.3 From c57d9805dc7e0e2568f6ed078610782c92fd43d0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 09:29:45 +0100 Subject: [CWS autorecovery] replace InsertDocument_Impl calls with UNO component loading --- sd/source/ui/slideshow/slideshow.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index c50966f5d567..b348a5e866ba 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -1201,7 +1201,7 @@ void SlideShow::StartFullscreenPresentation( ) // The new frame is created hidden. To make it visible and activate the // new view shell--a prerequisite to process slot calls and initialize // its panes--a GrabFocus() has to be called later on. - SfxFrame* pNewFrame = SfxFrame::Create( mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true ); + SfxFrame* pNewFrame = SfxFrame::Create( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true ); pNewFrame->SetPresentationMode(TRUE); mpFullScreenViewShellBase = static_cast(pNewFrame->GetCurrentViewFrame()->GetViewShell()); -- cgit v1.2.3 From 91a0cf61d880c140e0619026d51e374ea522a286 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 13:51:54 +0100 Subject: autorecovery: migrated the Window/NewWindow functionality to UNO => one less client of InsertDocument_Impl --- sfx2/inc/sfx2/frame.hxx | 4 +- sfx2/inc/sfx2/viewfrm.hxx | 2 +- sfx2/source/view/frmload.cxx | 6 -- sfx2/source/view/impframe.hxx | 4 +- sfx2/source/view/topfrm.cxx | 143 +++++++++++++++++++++++++----------------- sfx2/source/view/viewfrm.cxx | 133 ++++++++++++++++++--------------------- 6 files changed, 150 insertions(+), 142 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index ee710e43f6d2..7bede9fe6e30 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -134,13 +134,13 @@ protected: //#endif SfxFrame( ); // not implemented - SAL_DLLPRIVATE SfxFrame( Window& i_rExternalWindow, bool bHidden ); + SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden ); public: TYPEINFO(); static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); - static SfxFrame* Create( SfxObjectShell* pDoc = NULL, USHORT nViewId = NULL, bool bHidden = false, const SfxItemSet* pSet = NULL); + static SfxFrame* Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ); static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); SvCompatWeakHdl* GetHdl(); diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 2db001023cdc..fef8518344e1 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -312,7 +312,7 @@ private: LoadDocument_Impl( const SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rArgs, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rViewFactoryArgs, const USHORT i_nViewId ); }; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 542495d61b44..4208e68cfc13 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -482,12 +482,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA bool bInitNewModel = bIsFactoryURL; if ( bIsFactoryURL ) { - OSL_ENSURE( !aDescriptor.has( "Model" ), "SfxFrameLoader_Impl::load: sure you know what you're doing?" ); - // Before the loader refactoring, the model would have won over the URL, that is, the model would have been - // loaded into a newly created frame. /me thinks this doesn't make sense at all, also, it made the code - // in this method more complex. So, the order was changed, now the factory URL wins over the Model. - // If somebody *rightfully* passes both of them, we might need to re-consider the behavior. - const ::rtl::OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 ); // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 USHORT nSlotParam = impl_findSlotParam( sFactory ); diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index e710b9f44167..9ccb9b9762bf 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -70,7 +70,7 @@ public: SfxWorkWindow* pWorkWin; SvBorder aBorder; // formerly SfxTopFrame - Window* pExternalWindow; + Window* pExternalContainerWindow; bool bHidden; bool bLockResize; bool bMenuBarOn; @@ -89,7 +89,7 @@ public: ,bInPlace( sal_False ) ,pFrame( pAntiImplP ) ,pWorkWin( 0 ) - ,pExternalWindow( NULL ) + ,pExternalContainerWindow( NULL ) ,bHidden( false ) ,bLockResize( false ) ,bMenuBarOn( true ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 0c7a0e059c28..6a87d965443c 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -143,7 +143,7 @@ class SfxTopWindow_Impl : public Window public: SfxFrame* pFrame; - SfxTopWindow_Impl( SfxFrame* pF, Window& i_rExternalWindow ); + SfxTopWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ); ~SfxTopWindow_Impl( ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); @@ -156,8 +156,8 @@ public: DECL_LINK( CloserHdl, void* ); }; -SfxTopWindow_Impl::SfxTopWindow_Impl( SfxFrame* pF, Window& i_rExternalWindow ) - : Window( &i_rExternalWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) +SfxTopWindow_Impl::SfxTopWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ) + : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) , pFrame( pF ) { } @@ -354,29 +354,67 @@ static String _getTabString() return result; } -SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, const SfxItemSet* pSet ) +namespace { - Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - SfxFrame *pFrame = NULL; - BOOL bNewView = FALSE; - if ( pSet ) + Reference< XFrame > lcl_findStartModuleFrame() { - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_OPEN_NEW_VIEW, sal_False ); - bNewView = pItem && pItem->GetValue(); + try + { + Reference < XFramesSupplier > xSupplier( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW ); + Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); + + Reference< XModuleManager > xCheck( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.ModuleManager" ) ), UNO_QUERY_THROW ); + + sal_Int32 nCount = xContainer->getCount(); + for ( sal_Int32 i=0; i xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); + ::rtl::OUString sModule = xCheck->identify( xFrame ); + if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) + return xFrame; + } + catch( const UnknownModuleException& ) + { + // silence + } + catch(const Exception&) + { + // re-throw, caught below + throw; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; } +} + +SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ) +{ + if ( nViewId ) + rDoc.GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + if ( bHidden ) + rDoc.GetMedium()->GetItemSet()->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - if ( pDoc && !bHidden && !bNewView ) + Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + SfxFrame* pFrame = NULL; + + if ( !bHidden ) { URL aTargetURL; - aTargetURL.Complete = pDoc->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); + aTargetURL.Complete = rDoc.GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); BOOL bIsBasic = FALSE; if ( !aTargetURL.Complete.getLength() ) { - String sFactory = String::CreateFromAscii(pDoc->GetFactory().GetShortName()); - bIsBasic = (sFactory.CompareIgnoreCaseToAscii("sbasic")==COMPARE_EQUAL); - - if (!bIsBasic) + String sFactory = String::CreateFromAscii( rDoc.GetFactory().GetShortName() ); + bIsBasic = ( sFactory.CompareIgnoreCaseToAscii("sbasic") == COMPARE_EQUAL ); + if ( !bIsBasic ) { String aURL = String::CreateFromAscii("private:factory/"); aURL += sFactory; @@ -384,47 +422,27 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, } } - if (bIsBasic) + if ( bIsBasic ) { - Reference < XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); - if (xSupplier.is()) - { - Reference < XIndexAccess > xContainer(xSupplier->getFrames(), UNO_QUERY); - if (xContainer.is()) - { - Reference< ::com::sun::star::frame::XModuleManager > xCheck(::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" )), UNO_QUERY); - sal_Int32 nCount = xContainer->getCount(); - for (sal_Int32 i=0; i xFrame; - if (!(xContainer->getByIndex(i) >>= xFrame) || !xFrame.is()) - continue; - ::rtl::OUString sModule = xCheck->identify(xFrame); - if (sModule.equalsAscii("com.sun.star.frame.StartModule")) - { - pFrame = Create(xFrame); - break; - } - } - catch(const Exception&) {} - } - } - } + // for the Basic IDE, we need to manually find the start module (if present), since the below code + // of dispatching the model into a "_default" frame will not work here. + // (TODO: Why doesn't it? If it would, we could spare the extra code here.) + Reference< XFrame > xFrame( lcl_findStartModuleFrame() ); + if ( xFrame.is() ) + pFrame = Create( xFrame ); } else { Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); xTrans->parseStrict( aTargetURL ); - Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xDesktop, UNO_QUERY ); - Reference < ::com::sun::star::frame::XDispatch > xDisp; + Reference < XDispatchProvider > xProv( xDesktop, UNO_QUERY ); + Reference < XDispatch > xDisp; if ( xProv.is() ) { - Sequence < ::com::sun::star::beans::PropertyValue > aSeq(1); + Sequence < PropertyValue > aSeq(1); aSeq[0].Name = ::rtl::OUString::createFromAscii("Model"); - aSeq[0].Value <<= pDoc->GetModel(); + aSeq[0].Value <<= rDoc.GetModel(); ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii("_default") ); xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 ); if ( xDisp.is() ) @@ -435,12 +453,15 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, for( USHORT nPos = rArr.Count(); nPos--; ) { SfxFrame *pF = rArr[ nPos ]; - if ( pF->GetCurrentDocument() == pDoc ) + if ( pF->GetCurrentDocument() == &rDoc ) { pFrame = pF; break; } } + OSL_ENSURE( pFrame, "SfxFrame::Create: loading the doc via a dispatcher failed, it seems!" ); + if ( pFrame ) + return pFrame; } } @@ -452,11 +473,9 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, pFrame->pImp->bHidden = bHidden; Window* pWindow = pFrame->GetTopWindow_Impl(); - if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) + if ( &rDoc != pFrame->GetCurrentDocument() ) { - if ( nViewId ) - pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); + pFrame->InsertDocument_Impl( rDoc, *rDoc.GetMedium()->GetItemSet() ); if ( pWindow && !bHidden ) pWindow->Show(); } @@ -533,7 +552,7 @@ SfxFrame* SfxFrame::Create( Reference < XFrame > xFrame ) return pFrame; } -SfxFrame::SfxFrame( Window& i_rExternalWindow, bool i_bHidden ) +SfxFrame::SfxFrame( Window& i_rContainerWindow, bool i_bHidden ) :pParentFrame( NULL ) ,pChildArr( NULL ) ,pImp( NULL ) @@ -543,9 +562,15 @@ SfxFrame::SfxFrame( Window& i_rExternalWindow, bool i_bHidden ) pImp->bHidden = i_bHidden; InsertTopFrame_Impl( this ); - pImp->pExternalWindow = &i_rExternalWindow; + pImp->pExternalContainerWindow = &i_rContainerWindow; + + pWindow = new SfxTopWindow_Impl( this, i_rContainerWindow ); - pWindow = new SfxTopWindow_Impl( this, i_rExternalWindow ); + // always show pWindow, which is the ComponentWindow of the XFrame we live in + // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame + // is not done at level of the container window, not at SFX level. Thus, the component window can + // always be visible. + pWindow->Show(); } void SfxFrame::SetPresentationMode( BOOL bSet ) @@ -579,8 +604,8 @@ SystemWindow* SfxFrame::GetSystemWindow() const SystemWindow* SfxFrame::GetTopWindow_Impl() const { - if ( pImp->pExternalWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pExternalWindow; + if ( pImp->pExternalContainerWindow->IsSystemWindow() ) + return (SystemWindow*) pImp->pExternalContainerWindow; else return NULL; } @@ -642,10 +667,10 @@ BOOL SfxFrame::IsMenuBarOn_Impl() const void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const { - Window *pWin = pImp->pExternalWindow; + Window *pWin = pImp->pExternalContainerWindow; // Groesse setzen - const Size aAppWindow( pImp->pExternalWindow->GetDesktopRectPixel().GetSize() ); + const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); Point aPos( rWinArea.TopLeft() ); Size aSz( rWinArea.GetSize() ); if ( aSz.Width() && aSz.Height() ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1f14a3a9b0ec..769ad589df8c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -82,6 +82,7 @@ #include #include #include +#include #include #include @@ -2019,7 +2020,7 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const //-------------------------------------------------------------------- Reference< XController2 > SfxViewFrame::LoadDocument_Impl( - const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rArgs, + const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rViewFactoryArgs, const USHORT i_nViewId ) { ENSURE_OR_THROW( i_rFrame.is(), "illegal frame" ); @@ -2033,7 +2034,7 @@ Reference< XController2 > SfxViewFrame::LoadDocument_Impl( // let the model create a new controller const Reference< XController2 > xController( xModel->createViewController( sViewName.makeStringAndClear(), - i_rArgs, + i_rViewFactoryArgs, i_rFrame ), UNO_SET_THROW ); @@ -2305,75 +2306,71 @@ void SfxViewFrame::ExecView_Impl case SID_NEWWINDOW: { // Hack. demnaechst virtuelle Funktion - if ( !GetViewShell()->NewWindowAllowed() && !GetObjectShell()->HasName() ) + if ( !GetViewShell()->NewWindowAllowed() ) + { + OSL_ENSURE( false, "You should have disabled the 'Window/New Window' slot!" ); return; + } // ViewData bei FrameSets rekursiv holen GetFrame()->GetViewData_Impl(); - SfxMedium *pMed = GetObjectShell()->GetMedium(); + SfxMedium* pMed = GetObjectShell()->GetMedium(); + + // obtain user data String aUserData; GetViewShell()->WriteUserData( aUserData, sal_True ); - if ( !GetViewShell()->NewWindowAllowed() ) + pMed->GetItemSet()->Put( SfxStringItem( SID_USER_DATA, aUserData ) ); + + // do not open the new window hidden + pMed->GetItemSet()->ClearItem( SID_HIDDEN ); + + // the view ID (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); + const USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : GetCurViewId(); + + Reference < XFrame > xFrame; + // the frame (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); + if ( pFrameItem ) + pFrameItem->GetValue() >>= xFrame; + + bool bOwnFrame = false; + bool bSuccess = false; + try { - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - SfxFrame *pFrame = NULL; - Reference < XFrame > xFrame; - if ( pFrameItem ) + if ( !xFrame.is() ) { - pFrameItem->GetValue() >>= xFrame; - pFrame = SfxFrame::Create( xFrame ); + // if no frame was given, default-create one + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; + } + + LoadDocument_Impl( *GetObjectShell(), xFrame, Sequence< PropertyValue >(), nViewId ); + bSuccess = true; + + if ( bOwnFrame ) + { + // ensure the frame/windows is visible + Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xContainerWindow->setVisible( sal_True ); } - else - pFrame = SfxFrame::Create(); - - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - aSet.Put( *pHiddenItem ); - - SFX_ITEMSET_ARG( pMed->GetItemSet(), pRefererItem, SfxStringItem, SID_REFERER, sal_False ); - SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private:user" ) ); - if ( !pRefererItem ) - pRefererItem = &aReferer; - - aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); - aSet.Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - aSet.Put( SfxUInt16Item( SID_VIEW_ID, GetCurViewId() ) ); - aSet.Put( *pRefererItem ); - if( pMed->GetFilter() ) - aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName()) ); - aSet.Put( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - if ( xFrame.is() ) - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); - else - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); } - else + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( !bSuccess && bOwnFrame ) { - pMed->GetItemSet()->Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - - BOOL bHidden = FALSE; - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - bHidden = pHiddenItem->GetValue(); - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - if ( pFrameItem ) + try { - Reference < XFrame > xFrame; - pFrameItem->GetValue() >>= xFrame; - SfxFrame* pFrame = SfxFrame::Create( xFrame ); - pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument_Impl( *GetObjectShell(), *pMed->GetItemSet() ); - if ( !bHidden ) - xFrame->getContainerWindow()->setVisible( sal_True ); + xFrame->dispose(); } - else + catch( const Exception& ) { - SfxAllItemSet aSet( GetPool() ); - aSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, TRUE ) ); - SfxFrame* pFrame = SfxFrame::Create( GetObjectShell(), GetCurViewId(), bHidden, &aSet ); - if ( bHidden ) - pFrame->GetCurrentViewFrame()->LockObjectShell_Impl( TRUE ); + DBG_UNHANDLED_EXCEPTION(); } } @@ -2540,13 +2537,10 @@ void SfxViewFrame::StateView_Impl case SID_NEWWINDOW: { - if ( !GetViewShell()->NewWindowAllowed() /* && !pDocSh->HasName() */ ) - rSet.DisableItem( nWhich ); - else - { - if (impl_maxOpenDocCountReached()) - rSet.DisableItem( nWhich ); - } + if ( !GetViewShell()->NewWindowAllowed() + || impl_maxOpenDocCountReached() + ) + rSet.DisableItem( nWhich ); break; } } @@ -3424,14 +3418,9 @@ void SfxViewFrame::UpdateDocument_Impl() SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nViewId, sal_Bool bHidden ) { - SfxItemSet *pSet = rDoc.GetMedium()->GetItemSet(); - if ( nViewId ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( bHidden ) - pSet->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - - SfxFrame *pFrame = SfxFrame::Create( &rDoc, 0, bHidden ); - return pFrame->GetCurrentViewFrame(); + SfxFrame* pFrame = SfxFrame::Create( rDoc, nViewId, bHidden ); + OSL_ENSURE( pFrame, "SfxViewFrame::CreateViewFrame: failed!" ); + return pFrame ? pFrame->GetCurrentViewFrame() : NULL; } void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) -- cgit v1.2.3 From d607c7e0c92d30212f2c4d2bd637fe636abfb8f8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 14:16:22 +0100 Subject: autorecovery: SID_USER_DATA is effectively dead --- sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/source/view/frame.cxx | 3 --- sfx2/source/view/topfrm.cxx | 13 ++----------- sfx2/source/view/viewfrm.cxx | 6 ------ 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 544cca4464a5..f83d67043330 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -582,7 +582,7 @@ #define SID_VIEW_ZOOM_MODE (SID_SFX_START + 521) #define SID_VIEW_POS_SIZE (SID_SFX_START + 522) #define SID_VIEW_ID (SID_SFX_START + 523) -#define SID_USER_DATA (SID_SFX_START + 524) + // FREE, was SID_USER_DATA #define SID_VIEW_DATA (SID_SFX_START + 1582) #define SID_SILENT (SID_SFX_START + 528) #define SID_HIDDEN (SID_SFX_START + 534) diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 2e8f3e1a8ab4..c7ab6567cce5 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -404,10 +404,7 @@ void SfxFrame::GetViewData_Impl() sal_Bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY; GetDescriptor()->SetReadOnly( bReadOnly ); - String aUserData; - pViewFrame->GetViewShell()->WriteUserData( aUserData, sal_True ); SfxItemSet *pSet = GetDescriptor()->GetArgs(); - pSet->Put( SfxStringItem( SID_USER_DATA, aUserData )); sal_Bool bGetViewData = sal_False; if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SFX_ITEM_SET ) { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 6a87d965443c..9774df27a8e2 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -743,7 +743,6 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden - SFX_ITEMSET_ARG( &rSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) @@ -769,16 +768,12 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& bool bReadUserData = false; // if no view-related data exists in the set, then obtain the view data from the model - if ( !pJumpItem && !pViewDataItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - - // clear the user data item in the medium - we'll use aUserData below - pMediumSet->ClearItem( SID_USER_DATA ); pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - bClearPosSizeZoom = bReadUserData = true; } } @@ -812,11 +807,7 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& // Before CWS autorecovery, there was code which postponed setting the ViewData/Mark to a later time // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method // here is never called before the load process finished. - if ( pViewDataItem ) - { - pViewFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); - } - else if( pJumpItem ) + if( pJumpItem ) { pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 769ad589df8c..66c7b147dacb 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -609,7 +609,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { pNewSet = new SfxAllItemSet( *pMedium->GetItemSet() ); pNewSet->ClearItem( SID_VIEW_ID ); - pNewSet->ClearItem( SID_USER_DATA ); pNewSet->ClearItem( SID_STREAM ); pNewSet->ClearItem( SID_INPUTSTREAM ); pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pMedium->GetFilter()->GetName() ) ); @@ -2316,11 +2315,6 @@ void SfxViewFrame::ExecView_Impl GetFrame()->GetViewData_Impl(); SfxMedium* pMed = GetObjectShell()->GetMedium(); - // obtain user data - String aUserData; - GetViewShell()->WriteUserData( aUserData, sal_True ); - pMed->GetItemSet()->Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - // do not open the new window hidden pMed->GetItemSet()->ClearItem( SID_HIDDEN ); -- cgit v1.2.3 From aa1297f149c3acca2295e63d8c3739d01ce9a6e1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 15:14:26 +0100 Subject: autorecovery: oops, broke the PrepareClose with a change some while ago. Fixed. --- sfx2/source/doc/objxtor.cxx | 103 +++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 6566122754d5..0951457bc380 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -586,73 +586,68 @@ sal_uInt16 SfxObjectShell::PrepareClose // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen SfxViewFrame *pFrame = SfxObjectShell::Current() == this ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this ); - while ( pFrame ) - pFrame = SfxViewFrame::GetNext( *pFrame, this ); sal_Bool bClose = sal_False; - if ( bUI && IsModified() ) + if ( bUI && IsModified() && pFrame ) { - if ( pFrame ) + // minimierte restoren + SfxFrame* pTop = pFrame->GetTopFrame(); + SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); + pFrame->GetFrame()->Appear(); + + // fragen, ob gespeichert werden soll + short nRet = RET_YES; + //TODO/CLEANUP + //brauchen wir UI=2 noch? + //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) { - // minimierte restoren - SfxFrame* pTop = pFrame->GetTopFrame(); - SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); - pFrame->GetFrame()->Appear(); - - // fragen, ob gespeichert werden soll - short nRet = RET_YES; - //TODO/CLEANUP - //brauchen wir UI=2 noch? - //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) + //initiate help agent to inform about "print modifies the document" + SvtPrintWarningOptions aPrintOptions; + if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && + HasName() && getDocProperties()->getPrintDate().Month > 0) { - //initiate help agent to inform about "print modifies the document" - SvtPrintWarningOptions aPrintOptions; - if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && - HasName() && getDocProperties()->getPrintDate().Month > 0) - { - SfxHelp::OpenHelpAgent(pFirst->GetFrame(), HID_CLOSE_WARNING); - } - const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); - const ::rtl::OUString sTitle = xTitle->getTitle (); - nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + SfxHelp::OpenHelpAgent(pFirst->GetFrame(), HID_CLOSE_WARNING); } - /*HACK for plugin::destroy()*/ + const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); + const ::rtl::OUString sTitle = xTitle->getTitle (); + nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + } + /*HACK for plugin::destroy()*/ - if ( RET_YES == nRet ) + if ( RET_YES == nRet ) + { + // per Dispatcher speichern + const SfxPoolItem *pPoolItem; + if ( IsSaveVersionOnClose() ) { - // per Dispatcher speichern - const SfxPoolItem *pPoolItem; - if ( IsSaveVersionOnClose() ) - { - SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - else - { - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - - if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) - return sal_False; - else - bClose = sal_True; + SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } - else if ( RET_CANCEL == nRet ) - // abgebrochen - return sal_False; - else if ( RET_NEWTASK == nRet ) + else { - return RET_NEWTASK; + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } + + if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) + return sal_False; else - { - // Bei Nein nicht noch Informationlost bClose = sal_True; - } + } + else if ( RET_CANCEL == nRet ) + // abgebrochen + return sal_False; + else if ( RET_NEWTASK == nRet ) + { + return RET_NEWTASK; + } + else + { + // Bei Nein nicht noch Informationlost + bClose = sal_True; } } -- cgit v1.2.3 From 23abd10356bb469ee2c2219e4b76da6a05a6f0f1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 15:14:42 +0100 Subject: autorecovery: SID_NEWWINDOW now also uses the UNO loader, instead of LoadDocument_Impl, since the latter is to be removed later during this refactoring --- sfx2/inc/sfx2/viewfrm.hxx | 32 ++++++++++++++++++++++++++++++- sfx2/source/view/viewfrm.cxx | 45 ++++++++++++++++++++++++++++++-------------- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index fef8518344e1..cfd39746ba84 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -306,7 +306,6 @@ public: //#endif private: SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); - SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > LoadDocument_Impl( @@ -315,6 +314,37 @@ private: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rViewFactoryArgs, const USHORT i_nViewId ); + + /** loads a new view of our document into our frame + + This method completely bypasses the UNO loader mechanism, it exchanges the current view on SFX level. Use + it for quick inplace view switches only. + */ + SAL_DLLPRIVATE SfxViewShell* LoadNewSfxView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. Don't + use this method if you want to plug the document into the frame on SFX level only. In such a case, use + LoadNewSfxView_Impl instead. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into + @param i_rLoadArgs + the arguments to pass to the component loader. If this sequence is empty, then the current arguments of the + model will be obtained, and passed to the loader. This ensures that any arguments in the model will be preserved, + instead of being reset. + @param i_nViewId + the ID of the view to create + */ + SAL_DLLPRIVATE static void LoadViewIntoFrame_Impl( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, + const USHORT i_nViewId + ); }; //-------------------------------------------------------------------- diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 66c7b147dacb..a0d0426ff092 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -767,16 +767,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { try { - ::comphelper::NamedValueCollection aTransformLoadArgs( aLoadArgs ); - Reference< XModel > xDocument( xNewObj->GetModel(), UNO_SET_THROW ); - aTransformLoadArgs.put( "Model", xDocument ); - while ( !aViewFrames.empty() ) { - aTransformLoadArgs.put( "ViewId", aViewFrames.front().second ); - Reference< XComponentLoader > xLoader( aViewFrames.front().first, UNO_QUERY_THROW ); - xLoader->loadComponentFromURL( xDocument->getURL(), ::rtl::OUString::createFromAscii( "_self" ), 0, - aTransformLoadArgs.getPropertyValues() ); + LoadViewIntoFrame_Impl( *xNewObj, aViewFrames.front().first, aLoadArgs, aViewFrames.front().second ); aViewFrames.pop_front(); } } @@ -2048,10 +2041,34 @@ Reference< XController2 > SfxViewFrame::LoadDocument_Impl( } //-------------------------------------------------------------------- -SfxViewShell* SfxViewFrame::LoadNewView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ) +void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId ) +{ + Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW ); + + ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() ); + aTransformLoadArgs.put( "Model", xDocument ); + aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); + + ::rtl::OUString sURL( xDocument->getURL() ); + if ( !sURL.getLength() ) + { + ::rtl::OUStringBuffer aURLComposer; + aURLComposer.appendAscii( "private:factory/" ); + aURLComposer.appendAscii( i_rDoc.GetFactory().GetShortName() ); + sURL = aURLComposer.makeStringAndClear(); + } + + Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, + aTransformLoadArgs.getPropertyValues() ); +} + +//-------------------------------------------------------------------- +SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ) { ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewView_Impl: not allowed to be called with an exsiting view shell!" ); + OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewSfxView_Impl: not allowed to be called with an exsiting view shell!" ); ::comphelper::NamedValueCollection aViewCreationArgs; if ( i_pOldShell != NULL ) @@ -2162,7 +2179,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl // remove sub shells from Dispatcher before switching to new ViewShell PopShellAndSubShells_Impl( *pOldSh ); - // reset view shell, that's a precondition for the LoadNewView_Impl below + // reset view shell, that's a precondition for the LoadNewSfxView_Impl below SetViewShell_Impl( NULL ); } @@ -2172,7 +2189,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl // create and load new ViewShell SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); const sal_uInt16 nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; - SfxViewShell* pNewSh = LoadNewView_Impl( nViewId, pOldSh ); + SfxViewShell* pNewSh = LoadNewSfxView_Impl( nViewId, pOldSh ); // allow resize events to be processed UnlockAdjustPosSizePixel(); @@ -2341,12 +2358,12 @@ void SfxViewFrame::ExecView_Impl bOwnFrame = true; } - LoadDocument_Impl( *GetObjectShell(), xFrame, Sequence< PropertyValue >(), nViewId ); + LoadViewIntoFrame_Impl( *GetObjectShell(), xFrame, Sequence< PropertyValue >(), nViewId ); bSuccess = true; if ( bOwnFrame ) { - // ensure the frame/windows is visible + // ensure the frame/window is visible Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); xContainerWindow->setVisible( sal_True ); } -- cgit v1.2.3 From 7522c1c55099f2eff10b0d2489c30424051b18b8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 10:11:06 +0100 Subject: autorecovery: another client of InsertDocument_Impl died ... SfxFrame::InsertDocument has been replaced with SfxViewFrame::LoadDocument, which now uses the UNO loader to load the existing document into a frame, instead of going the direct (non-UNO-, pure-SFX-) way --- sfx2/inc/frmload.hxx | 4 ++ sfx2/inc/sfx2/frame.hxx | 2 - sfx2/inc/sfx2/viewfrm.hxx | 30 +++++++++ sfx2/source/view/frame.cxx | 20 ------ sfx2/source/view/frmload.cxx | 36 ++++++++-- sfx2/source/view/topfrm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 153 +++++++++++++++++++++++++++++-------------- 7 files changed, 171 insertions(+), 76 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index faace37d1388..4c677994cda6 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -137,6 +137,10 @@ private: const ::com::sun::star::uno::Any& i_rCaughtError, const ::comphelper::NamedValueCollection& i_rDescriptor ) const; + + SfxFrame* impl_getOrCreateEmptySfxFrame( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame + ) const; }; #endif diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 7bede9fe6e30..095feca0e26c 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -158,8 +158,6 @@ public: static SfxFrame* GetFirst(); static SfxFrame* GetNext( SfxFrame& ); - static SfxViewFrame* - InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTargetFrame, const USHORT nViewId = 0, const bool bHidden = false ); const SfxPoolItem* LoadDocumentSynchron( SfxItemSet& aSet ); SfxBroadcaster& GetBroadcaster() const; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index cfd39746ba84..6d816164f39e 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -168,11 +168,16 @@ public: static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); static SfxViewFrame* Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); + static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* Current(); static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); static SfxViewFrame* GetNext( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); static USHORT Count(); + static SfxViewFrame* Get( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController>& i_rController, const SfxObjectShell* i_pDoc = NULL ); + void DoActivate(BOOL bMDI, SfxViewFrame *pOld=NULL); void DoDeactivate(BOOL bMDI, SfxViewFrame *pOld=NULL); @@ -338,6 +343,8 @@ private: instead of being reset. @param i_nViewId the ID of the view to create + @throws Exception + if something goes wrong. The caller is responsible for handling this. */ SAL_DLLPRIVATE static void LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, @@ -345,6 +352,29 @@ private: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, const USHORT i_nViewId ); + + /** loads the given existing document into the given frame + + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. Don't + use this method if you want to plug the document into the frame on SFX level only. In such a case, use + LoadNewSfxView_Impl instead. + + If no frame is given, a blank top level frame is created. + + If anything fails during the process, as much as possible is cleaned up. + + @param i_rDoc + the document to load + @param i_rFrame + the frame to load the document into. Might be , in which case a new frame is created. + @param i_nViewId + the ID of the view to create + */ + SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow( + const SfxObjectShell& i_rDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const USHORT i_nViewId + ); }; //-------------------------------------------------------------------- diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index c7ab6567cce5..8d582e6e432a 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -306,26 +306,6 @@ sal_uInt16 SfxFrame::GetChildFrameCount() const return pChildArr ? pChildArr->Count() : 0; } -SfxViewFrame* SfxFrame::InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTargetFrame, const USHORT nViewId, const bool bHidden ) -{ - SfxViewFrame* pViewFrame = NULL; - - if ( rpTargetFrame ) - { - if ( bHidden ) - rDoc.PutItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - rpTargetFrame->InsertDocument_Impl( rDoc, *rDoc.GetMedium()->GetItemSet() ); - pViewFrame = rpTargetFrame->GetCurrentViewFrame(); - } - else - { - pViewFrame = SfxViewFrame::CreateViewFrame( rDoc, nViewId, bHidden ); - if( pViewFrame ) - rpTargetFrame = pViewFrame->GetFrame(); - } - return pViewFrame; -} - void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { if( !pImp->bInCancelTransfers ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 4208e68cfc13..f62ff590cdc3 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -246,11 +246,38 @@ namespace } } +// -------------------------------------------------------------------------------------------------------------------- +SfxFrame* SfxFrameLoader_Impl::impl_getOrCreateEmptySfxFrame( const Reference< XFrame >& i_rFrame ) const +{ + for ( SfxFrame* pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == i_rFrame ) + { + if ( ( pFrame->GetCurrentViewFrame() != NULL ) + || ( pFrame->GetCurrentDocument() != NULL ) + ) + // an empty SfxFrame was requested, so we can't use this instance. + // Note that it is perfectly letgitimate that during loading into an XFrame which already contains + // a document, there exist two SfxFrame instances bound to this XFrame - the old one, which will be + // destroyed later, and the new one, which we're going to create + continue; + + return pFrame; + } + } + + SfxFrame* pFrame = SfxFrame::Create( i_rFrame ); + ENSURE_OR_THROW( pFrame, "could not create an SfxFrame" ); + return pFrame; +} + // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame ) { - SfxFrame* pTargetFrame = SfxFrame::Create( i_rxFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( i_rxFrame ); SfxFrameWeak wFrame = pTargetFrame; SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); @@ -550,7 +577,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA else { // tell the doc its load args. - xModel->attachResource( aDescriptor.getOrDefault( "URL", ::rtl::OUString() ), aDescriptor.getPropertyValues() ); + xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) @@ -575,8 +602,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // ObjectShell. // create a frame - SfxFrame* pTargetFrame = SfxFrame::Create( _rTargetFrame ); - ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); wFrame = pTargetFrame; // insert the document into the frame diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 9774df27a8e2..2c61428b823c 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -429,7 +429,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, const USHORT nViewId, const bo // (TODO: Why doesn't it? If it would, we could spare the extra code here.) Reference< XFrame > xFrame( lcl_findStartModuleFrame() ); if ( xFrame.is() ) - pFrame = Create( xFrame ); + pFrame = SfxFrame::Create( xFrame ); } else { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a0d0426ff092..1f395bfd887c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2040,6 +2040,56 @@ Reference< XController2 > SfxViewFrame::LoadDocument_Impl( return xController; } +//-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const USHORT i_nViewId ) +{ + Reference< XFrame > xFrame( i_rFrame ); + bool bOwnFrame = false; + bool bSuccess = false; + try + { + if ( !xFrame.is() ) + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; + } + + LoadViewIntoFrame_Impl( i_rDoc, xFrame, Sequence< PropertyValue >(), i_nViewId ); + bSuccess = true; + + if ( bOwnFrame ) + { + // ensure the frame/window is visible + Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xContainerWindow->setVisible( sal_True ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( bSuccess ) + return SfxViewFrame::Get( xFrame->getController(), &i_rDoc ); + + if ( bOwnFrame ) + { + try + { + xFrame->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + return NULL; +} + //-------------------------------------------------------------------- void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId ) @@ -2088,6 +2138,58 @@ SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const USHORT i_nViewId, SfxView //-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId ) +{ + Reference< XFrame > xFrame; + if ( i_pTargetFrame ) + xFrame = i_pTargetFrame->GetFrameInterface(); + + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, xFrame, i_nViewId ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) +{ + return LoadDocument( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc ) +{ + if ( !i_rController.is() ) + return NULL; + + const SfxObjectShell* pDoc = i_pDoc; + if ( !pDoc ) + { + Reference< XModel > xDocument( i_rController->getModel() ); + for ( pDoc = SfxObjectShell::GetFirst( 0, false ); + pDoc; + pDoc = SfxObjectShell::GetNext( *pDoc, 0, false ) + ) + { + if ( pDoc->GetModel() == xDocument ) + break; + } + } + + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( pDoc, FALSE ); + pViewFrame; + pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDoc, FALSE ) + ) + { + if ( pViewFrame->GetViewShell()->GetController() == i_rController ) + break; + } + + return pViewFrame; +} + +//-------------------------------------------------------------------- + SfxViewFrame* SfxViewFrame::Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) { bool bSuccess = false; @@ -2097,18 +2199,11 @@ SfxViewFrame* SfxViewFrame::Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, Reference< XController2 > xController = LoadDocument_Impl( i_rDoc, i_rFrame.GetFrameInterface(), Sequence< PropertyValue >(), i_nViewId ); ENSURE_OR_THROW( xController.is(), "invalid controller returned by LoadDocument_Impl" ); - // this is expected to throw in case of a failure ... + // LoadDocument_Impl is expected to throw in case of a failure ... if ( xController.is() ) { - for ( pViewFrame = SfxViewFrame::GetFirst( &i_rDoc, FALSE ); - pViewFrame; - pViewFrame = SfxViewFrame::GetNext( *pViewFrame, &i_rDoc, FALSE ) - ) - { - if ( pViewFrame->GetViewShell()->GetController() == xController ) - break; - } + pViewFrame = SfxViewFrame::Get( xController.get(), &i_rDoc ); if ( !pViewFrame ) { OSL_ENSURE( false, "SfxViewFrame::Create: wrong controller implementation!" ); @@ -2345,45 +2440,7 @@ void SfxViewFrame::ExecView_Impl if ( pFrameItem ) pFrameItem->GetValue() >>= xFrame; - bool bOwnFrame = false; - bool bSuccess = false; - try - { - if ( !xFrame.is() ) - { - // if no frame was given, default-create one - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); - bOwnFrame = true; - } - - LoadViewIntoFrame_Impl( *GetObjectShell(), xFrame, Sequence< PropertyValue >(), nViewId ); - bSuccess = true; - - if ( bOwnFrame ) - { - // ensure the frame/window is visible - Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); - xContainerWindow->setVisible( sal_True ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - if ( !bSuccess && bOwnFrame ) - { - try - { - xFrame->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } + LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId ); rReq.Done(); break; -- cgit v1.2.3 From 9d2d7e247db83c9f48272929edd3d5d5c22a1f11 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 10:11:06 +0100 Subject: autorecovery: another client of InsertDocument_Impl died ... SfxFrame::InsertDocument has been replaced with SfxViewFrame::LoadDocument, which now uses the UNO loader to load the existing document into a frame, instead of going the direct (non-UNO-, pure-SFX-) way --- sw/source/ui/app/apphdl.cxx | 13 +++---------- sw/source/ui/app/applab.cxx | 10 ++-------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 840b765b9a72..21a13cfd3320 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -958,16 +958,9 @@ void NewXForms( SfxRequest& rReq ) // initialize XForms static_cast( &xDocSh )->GetDoc()->initXForms( true ); - // put document into frame - const SfxItemSet* pArgs = rReq.GetArgs(); - DBG_ASSERT( pArgs, "no arguments in SfxRequest"); - if( pArgs != NULL ) - { - const SfxPoolItem* pFrameItem = NULL; - pArgs->GetItemState( SID_DOCFRAME, FALSE, &pFrameItem ); - SfxFrame* pFrame = pFrameItem ? dynamic_cast< const SfxFrameItem& >( *pFrameItem ).GetFrame() : NULL; - SfxFrame::InsertDocument( *xDocSh, pFrame ); - } + // load document into frame + SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + SfxViewFrame::LoadDocument( *xDocSh, pFrameItem ); // set return value rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) ); diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 7e04e982d039..1f9f0b8dbfd9 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -237,14 +237,8 @@ static sal_uInt16 nBCTitleNo = 0; pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); } - const SfxItemSet *pArgs = rReq.GetArgs(); - DBG_ASSERT( pArgs, "no arguments in SfxRequest"); - const SfxPoolItem* pFrameItem = 0; - if(pArgs) - pArgs->GetItemState(SID_DOCFRAME, FALSE, &pFrameItem); - - SfxFrame* pFrame = pFrameItem ? dynamic_cast< const SfxFrameItem& >( *pFrameItem ).GetFrame() : NULL; - SfxViewFrame* pViewFrame = SfxFrame::InsertDocument( *xDocSh, pFrame, 0, true ); + SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *xDocSh, pFrameItem ); SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. -- cgit v1.2.3 From 528158b5ba4d0ef24db7a567ba493842928e082b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 10:11:06 +0100 Subject: autorecovery: another client of InsertDocument_Impl died ... SfxFrame::InsertDocument has been replaced with SfxViewFrame::LoadDocument, which now uses the UNO loader to load the existing document into a frame, instead of going the direct (non-UNO-, pure-SFX-) way --- sd/source/ui/app/sdmod1.cxx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 8f27f8cadf59..308bc7fc04e0 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -305,8 +305,7 @@ void SdModule::OutlineToImpress (SfxRequest& rRequest) } SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - SfxFrame* pFrame = pFrmItem ? pFrmItem->GetFrame() : NULL; - SfxFrame::InsertDocument( *pDocSh, pFrame, ::sd::OUTLINE_FACTORY_ID ); + SfxViewFrame::LoadDocument( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); @@ -550,8 +549,9 @@ SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, SfxFrame* p } else if( pDocShell ) { - pFrame = pTargetFrame; - SfxFrame::InsertDocument( *pDocShell, pFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *pDocShell, pTargetFrame ); + OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); + pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } return pFrame; @@ -680,9 +680,9 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxObjectShell* pShell = xShell; if( pShell ) { - pFrame = pTargetFrame; - pViewFrame = SfxFrame::InsertDocument( *pShell, pFrame ); + pViewFrame = SfxViewFrame::LoadDocument( *pShell, pTargetFrame ); DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); + pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; if(bNewDocDirect && !bStartWithTemplate) { @@ -785,8 +785,9 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTarge pDoc->StopWorkStartupDelay(); } - pFrame = pTargetFrame; - SfxFrame::InsertDocument( *pNewDocSh, pFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *pNewDocSh, pTargetFrame ); + OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); + pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } return pFrame; -- cgit v1.2.3 From aafbcb76ec238c947a304a71e44ac1e856136ca3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 12:17:03 +0100 Subject: autorecovery: open the Basic IDE via SFX' document loader --- sfx2/inc/sfx2/frame.hxx | 1 + sfx2/source/appl/appserv.cxx | 65 ++++++++++++++++++++++++++++++++++---------- sfx2/source/view/topfrm.cxx | 22 ++++++++++++--- 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 095feca0e26c..3f096c9388e4 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -140,6 +140,7 @@ public: TYPEINFO(); static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); + static SfxFrame* CreateBlank(); static SfxFrame* Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ); static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 268fdcdf386a..a93769bc1f0d 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -98,6 +98,7 @@ #include #include "about.hxx" +#include "frmload.hxx" #include "referers.hxx" #include #include @@ -822,6 +823,24 @@ namespace } return _pFallback; } + + const ::rtl::OUString& lcl_getBasicIDEServiceName() + { + static const ::rtl::OUString s_sBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); + return s_sBasicName; + } + + SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell* i_pBasicIDE ) + { + SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE ); + while ( pView ) + { + if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == lcl_getBasicIDEServiceName() ) + break; + pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE ); + } + return pView; + } } void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) @@ -902,22 +921,40 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_BASICIDE_APPEAR: { - SfxViewFrame* pView = SfxViewFrame::GetFirst(); - ::rtl::OUString aBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); - while ( pView ) - { - if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == aBasicName ) - break; - pView = SfxViewFrame::GetNext( *pView ); - } - + SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); if ( !pView ) { - SfxObjectShell* pDocShell = SfxObjectShell::CreateObject( aBasicName ); - pDocShell->DoInitNew( 0 ); - pDocShell->SetModified( FALSE ); - pView = SfxViewFrame::CreateViewFrame( *pDocShell, 0 ); - pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); + SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( lcl_getBasicIDEServiceName() ); + pBasicIDE->DoInitNew( 0 ); + pBasicIDE->SetModified( FALSE ); + try + { + // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL + // (which could be done via SfxViewFrame::LoadDocument) is not feasible here, since the Basic IDE + // does not really play nice with the framework's concept. For instance, it is a "singleton document", + // which conflicts, at the latest, with the framework's concept of loading into _blank frames. + // So, since we know that our frame loader can handle it, we skip the generic framework loader + // mechanism, and the type detection (which doesn't know about the Basic IDE). + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent( + SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW ); + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "Model", pBasicIDE->GetModel() ); + aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); + + SfxFrame* pFrame = SfxFrame::CreateBlank(); + ENSURE_OR_THROW( pFrame, "could not create a blank SfxFrame" ); + + xLoader->load( aLoadArgs.getPropertyValues(), pFrame->GetFrameInterface() ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + pView = lcl_getBasicIDEViewFrame( pBasicIDE ); + if ( pView ) + pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); } if ( pView ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 2c61428b823c..a9cdf3441508 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -394,6 +394,23 @@ namespace } } +SfxFrame* SfxFrame::CreateBlank() +{ + SfxFrame* pFrame = NULL; + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); + pFrame = Create( xFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return pFrame; +} + SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ) { if ( nViewId ) @@ -466,10 +483,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, const USHORT nViewId, const bo } if ( !pFrame ) - { - Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); - pFrame = Create( xFrame ); - } + pFrame = SfxFrame::CreateBlank(); pFrame->pImp->bHidden = bHidden; Window* pWindow = pFrame->GetTopWindow_Impl(); -- cgit v1.2.3 From 3faf9628e68cdfe16f32be7ff02d66ed7637626b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 21:29:53 +0100 Subject: autorecovery: replace some calls to SfxViewFrame::CreateViewFrame with calls to the (newly introduced) SfxViewFrame::LoadHiddenDocument This way, we got rid of some more clients of InsertDocument_Impl. Final goal is to remove SfxViewFrame::CreateViewFrame completely, so the UNO loader is the only (indirect) client of InsertDocument_Impl. --- sfx2/inc/sfx2/viewfrm.hxx | 7 +++++-- sfx2/source/view/frmload.cxx | 24 +++++++++++++++--------- sfx2/source/view/topfrm.cxx | 7 ++++--- sfx2/source/view/viewfrm.cxx | 31 +++++++++++++++++++++++-------- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 6d816164f39e..c738da419baf 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -168,6 +168,7 @@ public: static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); static SfxViewFrame* Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); + static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); @@ -350,7 +351,8 @@ private: const SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, - const USHORT i_nViewId + const USHORT i_nViewId, + const bool i_bHidden ); /** loads the given existing document into the given frame @@ -373,7 +375,8 @@ private: SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, - const USHORT i_nViewId + const USHORT i_nViewId, + const bool i_bHidden ); }; diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index f62ff590cdc3..fae80950d925 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -291,12 +291,19 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const { const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); - if ( bHidden ) - { - i_rDocument.RestoreNoDelete(); - i_rDocument.OwnerLock( TRUE ); - i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; - } + if ( !bHidden ) + return; + + const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument ); + if ( pExistingViewFrame ) + return; + + // the document is to be loaded hidden, and it is not yet displayed in any other frame + // To prevent it from being closed when the loader returns, increase its OwnerLock + // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader) + i_rDocument.RestoreNoDelete(); + i_rDocument.OwnerLock( TRUE ); + i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; } // -------------------------------------------------------------------------------------------------------------------- @@ -590,9 +597,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); - // if the document is created hidden, prevent it being deleted until it is shown or disposed - if ( !bExternalModel ) - impl_lockHiddenDocument( *xDoc, aDescriptor ); + // if the document is created hidden, prevent it from being deleted until it is shown or disposed + impl_lockHiddenDocument( *xDoc, aDescriptor ); // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index a9cdf3441508..93f79a49208f 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -816,11 +816,12 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } - OSL_ENSURE( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT, + OSL_ENSURE( ( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT ) + || ( pJumpItem == NULL ), "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); - // Before CWS autorecovery, there was code which postponed setting the ViewData/Mark to a later time + // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method - // here is never called before the load process finished. + // here is never called before the load process finished. At least not with a jump item != NULL. if( pJumpItem ) { pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1f395bfd887c..269237d596cd 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -769,7 +769,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { while ( !aViewFrames.empty() ) { - LoadViewIntoFrame_Impl( *xNewObj, aViewFrames.front().first, aLoadArgs, aViewFrames.front().second ); + LoadViewIntoFrame_Impl( *xNewObj, aViewFrames.front().first, aLoadArgs, aViewFrames.front().second, false ); aViewFrames.pop_front(); } } @@ -2042,8 +2042,12 @@ Reference< XController2 > SfxViewFrame::LoadDocument_Impl( //-------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, - const USHORT i_nViewId ) + const USHORT i_nViewId, const bool i_bHidden ) { + OSL_PRECOND( !i_bHidden || !i_rFrame.is(), + "SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow: loading *hidden* into an *existing* frame is not supported!" ); + // Care for this frame's visibility yourself, please + Reference< XFrame > xFrame( i_rFrame ); bool bOwnFrame = false; bool bSuccess = false; @@ -2057,10 +2061,10 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell bOwnFrame = true; } - LoadViewIntoFrame_Impl( i_rDoc, xFrame, Sequence< PropertyValue >(), i_nViewId ); + LoadViewIntoFrame_Impl( i_rDoc, xFrame, Sequence< PropertyValue >(), i_nViewId, i_bHidden ); bSuccess = true; - if ( bOwnFrame ) + if ( bOwnFrame && !i_bHidden ) { // ensure the frame/window is visible Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); @@ -2092,13 +2096,17 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell //-------------------------------------------------------------------- void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, - const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId ) + const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId, + const bool i_bHidden ) { Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW ); ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() ); aTransformLoadArgs.put( "Model", xDocument ); - aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); + if ( i_nViewId ) + aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); + if ( i_bHidden ) + aTransformLoadArgs.put( "Hidden", i_bHidden ); ::rtl::OUString sURL( xDocument->getURL() ); if ( !sURL.getLength() ) @@ -2138,13 +2146,20 @@ SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const USHORT i_nViewId, SfxView //-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true ); +} + +//-------------------------------------------------------------------- + SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId ) { Reference< XFrame > xFrame; if ( i_pTargetFrame ) xFrame = i_pTargetFrame->GetFrameInterface(); - return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, xFrame, i_nViewId ); + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, xFrame, i_nViewId, false ); } //-------------------------------------------------------------------- @@ -2440,7 +2455,7 @@ void SfxViewFrame::ExecView_Impl if ( pFrameItem ) pFrameItem->GetValue() >>= xFrame; - LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId ); + LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId, false ); rReq.Done(); break; -- cgit v1.2.3 From 6550b83b1761a5d7cc71660c53439f550c463359 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 21:29:53 +0100 Subject: autorecovery: replace some calls to SfxViewFrame::CreateViewFrame with calls to the (newly introduced) SfxViewFrame::LoadHiddenDocument This way, we got rid of some more clients of InsertDocument_Impl. Final goal is to remove SfxViewFrame::CreateViewFrame completely, so the UNO loader is the only (indirect) client of InsertDocument_Impl. --- sw/source/core/doc/docglbl.cxx | 4 ++-- sw/source/filter/html/htmlform.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 113319494e03..67b2163be449 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -326,7 +326,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, pDoc->GetSpzFrmFmts()->Count() ) { /* SfxViewFrame* pFrame = */ - SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); } xDocSh->DoSaveAs( *pTmpMed ); xDocSh->DoSaveCompleted( pTmpMed ); @@ -672,7 +672,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) pDoc->GetSpzFrmFmts()->Count() ) { /* SfxViewFrame* pFrame = */ - SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); } xDocSh->DoSaveAs( *pTmpMed ); xDocSh->DoSaveCompleted( pTmpMed ); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index dd93a4e60b92..a954cc6134ab 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -732,7 +732,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha bRemoveHidden = ( pHiddenItem == NULL || !pHiddenItem->GetValue() ); } - pTempViewFrame = SfxViewFrame::CreateViewFrame( *pDocSh, 0, sal_True ); + pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, 0 ); CallStartAction(); pDoc->GetEditShell( &pVSh ); } -- cgit v1.2.3 From 138bd998de6b436286c62f103ca43bf4a6249024 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 21:45:24 +0100 Subject: autorecovery: SfxViewFrame::Create => SfxViewFrame::Create_Impl (this is a module-private method, really) --- sfx2/inc/sfx2/viewfrm.hxx | 2 +- sfx2/source/view/topfrm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index c738da419baf..5b0d342aff78 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -166,7 +166,6 @@ public: static void SetViewFrame( SfxViewFrame* ); static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); - static SfxViewFrame* Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); @@ -308,6 +307,7 @@ public: SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); + SAL_DLLPRIVATE static SfxViewFrame* Create_Impl( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); //#endif private: diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 93f79a49208f..bbcd03c08837 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -797,7 +797,7 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - SfxViewFrame* pViewFrame = SfxViewFrame::Create( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); + SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); if ( !pViewFrame ) // TODO: better error handling? Under which conditions can this fail? diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 269237d596cd..18a5fe7a25d4 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2205,7 +2205,7 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +SfxViewFrame* SfxViewFrame::Create_Impl( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) { bool bSuccess = false; SfxViewFrame* pViewFrame = NULL; @@ -2221,7 +2221,7 @@ SfxViewFrame* SfxViewFrame::Create( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, pViewFrame = SfxViewFrame::Get( xController.get(), &i_rDoc ); if ( !pViewFrame ) { - OSL_ENSURE( false, "SfxViewFrame::Create: wrong controller implementation!" ); + OSL_ENSURE( false, "SfxViewFrame::Create_Impl: wrong controller implementation!" ); Reference< XComponent > xComponent( xController, UNO_QUERY_THROW ); xComponent->dispose(); } -- cgit v1.2.3 From 0247f43171fb87df8035762f618e342a38f29779 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 22:09:14 +0100 Subject: autorecovery: rename SfxViewFrame's LoadDocument to LoadDocumentIntoFrame, and introduce a new LoadDocument, which does not take any frame-like argument. Makes writing code easier (and more explicit) for clients which do not have a frame, but want to load non-hidden. --- sfx2/inc/sfx2/viewfrm.hxx | 5 +++-- sfx2/source/appl/appserv.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 13 ++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 5b0d342aff78..9ea1c3761fa1 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -168,8 +168,9 @@ public: static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); - static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); - static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); static SfxViewFrame* Current(); static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index a93769bc1f0d..a5dc0df6ffe1 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -930,7 +930,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) try { // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL - // (which could be done via SfxViewFrame::LoadDocument) is not feasible here, since the Basic IDE + // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE // does not really play nice with the framework's concept. For instance, it is a "singleton document", // which conflicts, at the latest, with the framework's concept of loading into _blank frames. // So, since we know that our frame loader can handle it, we skip the generic framework loader diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 18a5fe7a25d4..ffde5338c2d7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2153,7 +2153,14 @@ SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const US //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId ) +SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId ) { Reference< XFrame > xFrame; if ( i_pTargetFrame ) @@ -2164,9 +2171,9 @@ SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrame //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) { - return LoadDocument( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId ); + return LoadDocumentIntoFrame( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId ); } //-------------------------------------------------------------------- -- cgit v1.2.3 From 65d3f97332dec72637177a0b15932b979067569e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 22:09:14 +0100 Subject: autorecovery: rename SfxViewFrame's LoadDocument to LoadDocumentIntoFrame, and introduce a new LoadDocument, which does not take any frame-like argument. Makes writing code easier (and more explicit) for clients which do not have a frame, but want to load non-hidden. --- sw/source/ui/app/apphdl.cxx | 2 +- sw/source/ui/app/applab.cxx | 2 +- sw/source/ui/app/docsh2.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 21a13cfd3320..8b1d64cf3f5d 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -960,7 +960,7 @@ void NewXForms( SfxRequest& rReq ) // load document into frame SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); - SfxViewFrame::LoadDocument( *xDocSh, pFrameItem ); + SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); // set return value rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) ); diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 1f9f0b8dbfd9..3af0fe9369e1 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -238,7 +238,7 @@ static sal_uInt16 nBCTitleNo = 0; } SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *xDocSh, pFrameItem ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 46d2ee5006a3..8d62d65d0b12 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1061,7 +1061,7 @@ void SwDocShell::Execute(SfxRequest& rReq) else { // Neues Dokument erzeugen. - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0 ); + SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 ); SwView *pCurrView = (SwView*) pFrame->GetViewShell(); // Dokumenttitel setzen -- cgit v1.2.3 From 72858030d75068948b8bf1f663bcb41f493b9bf3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 4 Dec 2009 22:09:14 +0100 Subject: autorecovery: rename SfxViewFrame's LoadDocument to LoadDocumentIntoFrame, and introduce a new LoadDocument, which does not take any frame-like argument. Makes writing code easier (and more explicit) for clients which do not have a frame, but want to load non-hidden. --- sd/source/ui/app/sdmod1.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 308bc7fc04e0..36901f7208c1 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -305,7 +305,7 @@ void SdModule::OutlineToImpress (SfxRequest& rRequest) } SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - SfxViewFrame::LoadDocument( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); + SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID ); ::sd::ViewShell* pViewSh = pDocSh->GetViewShell(); @@ -549,7 +549,7 @@ SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, SfxFrame* p } else if( pDocShell ) { - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *pDocShell, pTargetFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, pTargetFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } @@ -680,7 +680,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxObjectShell* pShell = xShell; if( pShell ) { - pViewFrame = SfxViewFrame::LoadDocument( *pShell, pTargetFrame ); + pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, pTargetFrame ); DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; @@ -785,7 +785,7 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTarge pDoc->StopWorkStartupDelay(); } - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocument( *pNewDocSh, pTargetFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, pTargetFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } -- cgit v1.2.3 From fc01d8a544527bcd50b1e77140fc0f084afd414d Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Sat, 5 Dec 2009 11:07:21 -0500 Subject: kohei04: #i107458# Removed hard-coded range separators. Previously, range separators were hard-coded for each address convention. But in the new code the separators are independent of address conventions or grammars. This code was one of the left-overs of the previous implementation. --- sc/inc/rangelst.hxx | 4 ++-- sc/source/core/tool/rangelst.cxx | 31 +++++++------------------------ sc/source/ui/drawfunc/fuins2.cxx | 3 ++- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index e2ceba32b2f1..f68e9174705e 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -58,10 +58,10 @@ public: USHORT Parse( const String&, ScDocument* = NULL, USHORT nMask = SCA_VALID, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, - char cDelimiter = 0 ); + sal_Unicode cDelimiter = 0 ); void Format( String&, USHORT nFlags = 0, ScDocument* = NULL, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, - char cDelimiter = 0 ) const; + sal_Unicode cDelimiter = 0 ) const; void Join( const ScRange&, BOOL bIsInList = FALSE ); BOOL UpdateReference( UpdateRefMode, ScDocument*, const ScRange& rWhere, diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 775b0207be59..096cbb6d58de 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -44,7 +44,7 @@ #include "document.hxx" #include "refupdat.hxx" #include "rechead.hxx" - +#include "compiler.hxx" // === ScRangeList ==================================================== @@ -61,32 +61,14 @@ void ScRangeList::RemoveAll() Clear(); } -static void defaultDelimiter( char& cDelimiter, formula::FormulaGrammar::AddressConvention eConv) -{ - if( cDelimiter == 0) - { - switch( eConv ) - { - default : - case formula::FormulaGrammar::CONV_OOO : - cDelimiter = ';'; - break; - - case formula::FormulaGrammar::CONV_XL_A1 : - case formula::FormulaGrammar::CONV_XL_R1C1 : - cDelimiter = ','; - break; - } - } -} - USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask, formula::FormulaGrammar::AddressConvention eConv, - char cDelimiter ) + sal_Unicode cDelimiter ) { if ( rStr.Len() ) { - defaultDelimiter( cDelimiter, eConv); + if (!cDelimiter) + cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); nMask |= SCA_VALID; // falls das jemand vergessen sollte USHORT nResult = (USHORT)~0; // alle Bits setzen @@ -126,11 +108,12 @@ USHORT ScRangeList::Parse( const String& rStr, ScDocument* pDoc, USHORT nMask, void ScRangeList::Format( String& rStr, USHORT nFlags, ScDocument* pDoc, formula::FormulaGrammar::AddressConvention eConv, - char cDelimiter ) const + sal_Unicode cDelimiter ) const { rStr.Erase(); - defaultDelimiter( cDelimiter, eConv); + if (!cDelimiter) + cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); ULONG nCnt = Count(); for ( ULONG nIdx = 0; nIdx < nCnt; nIdx++ ) diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 93abbd48c9e7..6d45c177b0d3 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -529,7 +529,8 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* ScRangeList aRanges; aMultiMark.FillRangeListWithMarks( &aRanges, FALSE ); String aStr; - aRanges.Format( aStr, SCR_ABS_3D, pViewSh->GetViewData()->GetDocument() ); + ScDocument* pDocument = pViewSh->GetViewData()->GetDocument(); + aRanges.Format( aStr, SCR_ABS_3D, pDocument, pDocument->GetAddressConvention() ); aRangeString = aStr; // get "total" range for positioning -- cgit v1.2.3 From 1d69c476cd36100a17c7e17aa9a160aacea0824b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Dec 2009 09:43:09 +0100 Subject: #i10000# --- sfx2/source/view/viewsh.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 48cd21452699..28e875c6619b 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1365,7 +1365,6 @@ SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) if ( !i_rController.is() ) return NULL; - SfxViewShell* pViewShell = NULL; for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( NULL, FALSE ); pViewShell; pViewShell = SfxViewShell::GetNext( *pViewShell, NULL, FALSE ) -- cgit v1.2.3 From aaf2245bfdd659634c42ccf4b68f984b7abd67df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Dec 2009 10:36:00 +0100 Subject: #i10000# --- sfx2/source/view/topfrm.cxx | 2 +- sfx2/source/view/viewfrm.cxx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index bbcd03c08837..cb364a419ccc 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -34,7 +34,7 @@ #endif #include -#include +#include "viewfac.hxx" #include #include #include diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ffde5338c2d7..47d249f175ce 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2214,7 +2214,6 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c SfxViewFrame* SfxViewFrame::Create_Impl( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) { - bool bSuccess = false; SfxViewFrame* pViewFrame = NULL; try { -- cgit v1.2.3 From af5a953044c7e6a1080d70724029bd8162ec6dbd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Dec 2009 13:42:47 +0100 Subject: autorecovery: oops, this test code was not intended to be committed --- sfx2/source/view/viewprn.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index eb6836c00deb..c944264dd20c 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -440,10 +440,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) return; } - int provokeCrash = 0; - int dummy = 1 / provokeCrash; - (void)dummy; - const USHORT nId = rReq.GetSlot(); switch( nId ) { -- cgit v1.2.3 From 2a55dd7ed275480560f1fc95c34d82027d1c6dc1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Dec 2009 14:33:16 +0100 Subject: autorecovery: when re-connecting in a suspend call, do not push the shells, again (they're not yet popped) --- sfx2/inc/sfx2/sfxbasecontroller.hxx | 8 +++++++- sfx2/source/view/sfxbasecontroller.cxx | 31 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index e48ba8a5451b..47445acc6690 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -395,7 +395,13 @@ public: SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper (); //#endif private: - SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const bool i_bConnect ); + enum ConnectSfxFrame + { + E_CONNECT, + E_DISCONNECT, + E_RECONNECT + }; + SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ); SAL_DLLPRIVATE SfxViewFrame* GetViewFrame_Impl() const; //________________________________________________________________________________________________________ diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 388cca5145f8..3fddeb98ae4b 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -602,7 +602,7 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame if ( m_pData->m_pViewShell ) { - ConnectSfxFrame_Impl( true ); + ConnectSfxFrame_Impl( E_CONNECT ); } } } @@ -663,7 +663,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: BOOL bRet = bOther || pDocShell->PrepareClose(); if ( bRet ) { - ConnectSfxFrame_Impl( false ); + ConnectSfxFrame_Impl( E_DISCONNECT ); m_pData->m_bSuspendState = sal_True; } @@ -676,7 +676,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: if ( m_pData->m_pViewShell ) { - ConnectSfxFrame_Impl( true ); + ConnectSfxFrame_Impl( E_RECONNECT ); } m_pData->m_bSuspendState = sal_False; @@ -1255,23 +1255,30 @@ BOOL SfxBaseController::HasMouseClickListeners_Impl() return m_pData->m_aUserInputInterception.hasMouseClickListeners(); } -void SfxBaseController::ConnectSfxFrame_Impl( const bool i_bConnect ) +void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) { ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + const bool bConnect = ( i_eConnect != E_DISCONNECT ); + // disable window and dispatcher - pActFrame->Enable( i_bConnect ); - pActFrame->GetDispatcher()->Lock( !i_bConnect ); + pActFrame->Enable( bConnect ); + pActFrame->GetDispatcher()->Lock( !bConnect ); - if ( i_bConnect ) + if ( bConnect ) { - pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); - if ( m_pData->m_pViewShell->GetSubShell() ) - pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); - m_pData->m_pViewShell->PushSubShells_Impl(); - pActFrame->GetDispatcher()->Flush(); + // upon DISCONNECT, we did *not* pop the shells from the stack (this is done elsewhere), so upon + // RECONNECT, we're not allowed to push them + if ( i_eConnect != E_RECONNECT ) + { + pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); + if ( m_pData->m_pViewShell->GetSubShell() ) + pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); + m_pData->m_pViewShell->PushSubShells_Impl(); + pActFrame->GetDispatcher()->Flush(); + } Window* pEditWin = m_pData->m_pViewShell->GetWindow(); if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() ) -- cgit v1.2.3 From 450e9828544de8988c3bec93850029bfa8df2e1f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 7 Dec 2009 14:44:27 +0100 Subject: autorecovery: also implement XInteractionHandler2, if our delegator supports it --- .../interaction/preventduplicateinteraction.hxx | 28 ++++++++- .../interaction/preventduplicateinteraction.cxx | 73 ++++++++++++++++++++++ 2 files changed, 99 insertions(+), 2 deletions(-) diff --git a/framework/inc/interaction/preventduplicateinteraction.hxx b/framework/inc/interaction/preventduplicateinteraction.hxx index 2b43ab02fcdc..e069d3e4c146 100644 --- a/framework/inc/interaction/preventduplicateinteraction.hxx +++ b/framework/inc/interaction/preventduplicateinteraction.hxx @@ -40,7 +40,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ -#include +#include #include #include @@ -86,7 +86,7 @@ struct ThreadHelpBase2 }; class PreventDuplicateInteraction : private ThreadHelpBase2 - ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler > + ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 > { //_____________________________________ // structs, types etcp. @@ -158,6 +158,30 @@ class PreventDuplicateInteraction : private ThreadHelpBase2 virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) throw(css::uno::RuntimeException); + //_________________________________ + /** + @interface XInteractionHandler2 + @short called from outside to handle a problem + @descr We filter the incoming interactions. some of them + will be forwarded to the generic UI interaction handler. + So we must not implement it twice. Some other ones + will be aborted only. + + @threadsafe yes + */ + virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest ) + throw (::com::sun::star::uno::RuntimeException); + + //_________________________________ + /** + @interface XInterface + @short called to query another interface of the component + @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too. + + @threadsafe yes + */ + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); //_____________________________________ // c++ interface public: diff --git a/framework/source/interaction/preventduplicateinteraction.cxx b/framework/source/interaction/preventduplicateinteraction.cxx index 4e30da90e25b..e005bdf7d627 100644 --- a/framework/source/interaction/preventduplicateinteraction.cxx +++ b/framework/source/interaction/preventduplicateinteraction.cxx @@ -111,6 +111,20 @@ void PreventDuplicateInteraction::useDefaultUUIHandler() // <- SAFE } +//_________________________________________________________________________________________________________________ +css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::uno::Type& aType ) + throw (css::uno::RuntimeException) +{ + if ( aType.equals( XInteractionHandler2::static_type() ) ) + { + ::osl::ResettableMutexGuard aLock(m_aLock); + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + if ( !xHandler.is() ) + return css::uno::Any(); + } + return ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 >::queryInterface( aType ); +} + //_________________________________________________________________________________________________________________ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest) @@ -169,6 +183,65 @@ void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css //_________________________________________________________________________________________________________________ +::sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) + throw (css::uno::RuntimeException) +{ + css::uno::Any aRequest = xRequest->getRequest(); + sal_Bool bHandleIt = sal_True; + + // SAFE -> + ::osl::ResettableMutexGuard aLock(m_aLock); + + InteractionList::iterator pIt; + for ( pIt = m_lInteractionRules.begin(); + pIt != m_lInteractionRules.end() ; + ++pIt ) + { + InteractionInfo& rInfo = *pIt; + + if (aRequest.isExtractableTo(rInfo.m_aInteraction)) + { + ++rInfo.m_nCallCount; + rInfo.m_xRequest = xRequest; + bHandleIt = (rInfo.m_nCallCount <= rInfo.m_nMaxCount); + break; + } + } + + css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY ); + OSL_ENSURE( xHandler.is() || !m_xHandler.is(), + "PreventDuplicateInteraction::handleInteractionRequest: inconsistency!" ); + + aLock.clear(); + // <- SAFE + + if ( + (bHandleIt ) && + (xHandler.is()) + ) + { + return xHandler->handleInteractionRequest(xRequest); + } + else + { + const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations(); + sal_Int32 c = lContinuations.getLength(); + sal_Int32 i = 0; + for (i=0; i xAbort(lContinuations[i], css::uno::UNO_QUERY); + if (xAbort.is()) + { + xAbort->select(); + break; + } + } + } + return false; +} + +//_________________________________________________________________________________________________________________ + void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo) { // SAFE -> -- cgit v1.2.3 From 271be244a0f85264d3bd5c5f2820aa7c9b299881 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 8 Dec 2009 08:16:52 +0100 Subject: dba33e: if database is read only start with READ_ONLY concurrency --- dbaccess/source/core/api/RowSet.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 461929f68141..8675ebaf0a07 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1679,7 +1679,11 @@ void ORowSet::setStatementResultSetType( const Reference< XPropertySet >& _rxSta { ResultSetType::SCROLL_INSENSITIVE, ResultSetConcurrency::READ_ONLY }, { ResultSetType::FORWARD_ONLY, ResultSetConcurrency::READ_ONLY } }; - for ( sal_Int32 i=0; i<5; ++i ) + sal_Int32 i=0; + if ( m_xActiveConnection->getMetaData()->isReadOnly() ) + i = 2; // if the database is read-only we only should use read-only concurrency + + for ( ; i<5; ++i ) { nResultSetType = nCharacteristics[i][0]; nResultSetConcurrency = nCharacteristics[i][1]; -- cgit v1.2.3 From 3e659f82dedbb5ddeb2814ce5267445234f7e7fd Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 8 Dec 2009 19:04:39 +0100 Subject: aw079: #i107360# numerical precision --- basegfx/inc/basegfx/numeric/ftools.hxx | 2 +- .../inc/basegfx/polygon/b2dpolygoncutandtouch.hxx | 8 + basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx | 94 +++ basegfx/inc/basegfx/tuple/b2dtuple.hxx | 10 +- basegfx/inc/basegfx/tuple/b2i64tuple.hxx | 2 +- basegfx/inc/basegfx/tuple/b2ituple.hxx | 2 +- basegfx/inc/basegfx/tuple/b3dtuple.hxx | 10 +- basegfx/inc/basegfx/tuple/b3i64tuple.hxx | 2 +- basegfx/inc/basegfx/tuple/b3ituple.hxx | 2 +- basegfx/prj/d.lst | 1 + basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 90 +++ basegfx/source/polygon/b2dtrapezoid.cxx | 895 +++++++++++++++++++++ basegfx/source/polygon/makefile.mk | 1 + 13 files changed, 1106 insertions(+), 13 deletions(-) create mode 100644 basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx create mode 100644 basegfx/source/polygon/b2dtrapezoid.cxx diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx index 5003ede0c4cf..e20464d92816 100644 --- a/basegfx/inc/basegfx/numeric/ftools.hxx +++ b/basegfx/inc/basegfx/numeric/ftools.hxx @@ -178,7 +178,7 @@ namespace basegfx static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) { - return (fabs(rfValA) - fabs(rfValB) <= rfSmallValue); + return (fabs(rfValA - rfValB) <= rfSmallValue); } static bool less(const double& rfValA, const double& rfValB) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx index aa4682a665cd..12adcb7cc551 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygoncutandtouch.hxx @@ -68,6 +68,14 @@ namespace basegfx B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask); B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rMask); + // look for self-intersections in given polygon and add extra points there. Result will have no + // intersections on an edge + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate); + + // add points at all self-intersections of single polygons (depends on bSelfIntersections) + // and at polygon-polygon intersections + B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true); + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx new file mode 100644 index 000000000000..20bc1c79d390 --- /dev/null +++ b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dpolygontriangulator.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BGFX_POLYGON_B2DTRAPEZOID_HXX +#define _BGFX_POLYGON_B2DTRAPEZOID_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + // class to hold a single trapezoid + class B2DTrapezoid + { + private: + // geometry data + double mfTopXLeft; + double mfTopXRight; + double mfTopY; + double mfBottomXLeft; + double mfBottomXRight; + double mfBottomY; + + public: + // constructor + B2DTrapezoid( + const double& rfTopXLeft, + const double& rfTopXRight, + const double& rfTopY, + const double& rfBottomXLeft, + const double& rfBottomXRight, + const double& rfBottomY); + + // data read access + const double& getTopXLeft() const { return mfTopXLeft; } + const double& getTopXRight() const { return mfTopXRight; } + const double& getTopY() const { return mfTopY; } + const double& getBottomXLeft() const { return mfBottomXLeft; } + const double& getBottomXRight() const { return mfBottomXRight; } + const double& getBottomY() const { return mfBottomY; } + + // convenience method to get content as Polygon + B2DPolygon getB2DPolygon() const; + }; + + typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector; + +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + // convert SourcePolyPolygon to trapezoids + B2DTrapezoidVector trapezoidSubdivide(const B2DPolyPolygon& rSourcePolyPolygon); + + } // end of namespace tools +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +#endif /* _BGFX_POLYGON_B2DTRAPEZOID_HXX */ diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index 7c4c1d585d2c..cb6adbda2d9e 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx @@ -158,15 +158,17 @@ namespace basegfx bool equal(const B2DTuple& rTup) const { return ( - fTools::equal(mfX, rTup.mfX) && - fTools::equal(mfY, rTup.mfY)); + this == &rTup || + (fTools::equal(mfX, rTup.mfX) && + fTools::equal(mfY, rTup.mfY))); } bool equal(const B2DTuple& rTup, const double& rfSmallValue) const { return ( - fTools::equal(mfX, rTup.mfX, rfSmallValue) && - fTools::equal(mfY, rTup.mfY, rfSmallValue)); + this == &rTup || + (fTools::equal(mfX, rTup.mfX, rfSmallValue) && + fTools::equal(mfY, rTup.mfY, rfSmallValue))); } // operators diff --git a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx b/basegfx/inc/basegfx/tuple/b2i64tuple.hxx index 627feb9f7875..b6fe0e886c10 100644 --- a/basegfx/inc/basegfx/tuple/b2i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2i64tuple.hxx @@ -185,7 +185,7 @@ namespace basegfx bool operator==( const B2I64Tuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } bool operator!=( const B2I64Tuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b2ituple.hxx b/basegfx/inc/basegfx/tuple/b2ituple.hxx index bee473e88837..4b8b19ad767a 100644 --- a/basegfx/inc/basegfx/tuple/b2ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b2ituple.hxx @@ -184,7 +184,7 @@ namespace basegfx bool operator==( const B2ITuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY); } bool operator!=( const B2ITuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx index 04711aae017f..369693be3c3f 100644 --- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx @@ -182,17 +182,19 @@ namespace basegfx bool equal(const B3DTuple& rTup) const { return ( - ::basegfx::fTools::equal(mfX, rTup.mfX) && + this == &rTup || + (::basegfx::fTools::equal(mfX, rTup.mfX) && ::basegfx::fTools::equal(mfY, rTup.mfY) && - ::basegfx::fTools::equal(mfZ, rTup.mfZ)); + ::basegfx::fTools::equal(mfZ, rTup.mfZ))); } bool equal(const B3DTuple& rTup, const double& rfSmallValue) const { return ( - ::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && + this == &rTup || + (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) && - ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue)); + ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue))); } // operators diff --git a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx b/basegfx/inc/basegfx/tuple/b3i64tuple.hxx index 3791cbd63480..8f8001ba8d48 100644 --- a/basegfx/inc/basegfx/tuple/b3i64tuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3i64tuple.hxx @@ -215,7 +215,7 @@ namespace basegfx bool operator==( const B3I64Tuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } bool operator!=( const B3I64Tuple& rTup ) const diff --git a/basegfx/inc/basegfx/tuple/b3ituple.hxx b/basegfx/inc/basegfx/tuple/b3ituple.hxx index 33432122913b..33800766f78f 100644 --- a/basegfx/inc/basegfx/tuple/b3ituple.hxx +++ b/basegfx/inc/basegfx/tuple/b3ituple.hxx @@ -215,7 +215,7 @@ namespace basegfx bool operator==( const B3ITuple& rTup ) const { - return rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ; + return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ); } bool operator!=( const B3ITuple& rTup ) const diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index a58cd33e4f9c..68ab880eef62 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -73,6 +73,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\polygon ..\inc\basegfx\polygon\b2dpolygontriangulator.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolygontriangulator.hxx ..\inc\basegfx\polygon\b2dpolygoncutandtouch.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolygoncutandtouch.hxx ..\inc\basegfx\polygon\b2dpolypolygoncutter.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dpolypolygoncutter.hxx +..\inc\basegfx\polygon\b2dtrapezoid.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b2dtrapezoid.hxx ..\inc\basegfx\polygon\b3dpolygon.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolygon.hxx ..\inc\basegfx\polygon\b3dpolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolypolygon.hxx ..\inc\basegfx\polygon\b3dpolygontools.hxx %_DEST%\inc%_EXT%\basegfx\polygon\b3dpolygontools.hxx diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index da6ff8904725..ebc0ad418f4b 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -1202,6 +1202,96 @@ namespace basegfx return aRetval; } + B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate) + { + if(rCandidate.count()) + { + temporaryPointVector aTempPoints; + + findCuts(rCandidate, aTempPoints); + + return mergeTemporaryPointsAndPolygon(rCandidate, aTempPoints); + } + else + { + return rCandidate; + } + } + + B2DPolyPolygon addPointsAtCuts(const B2DPolyPolygon& rCandidate, bool bSelfIntersections) + { + const sal_uInt32 nCount(rCandidate.count()); + + if(nCount) + { + B2DPolyPolygon aRetval; + + if(1 == nCount) + { + if(bSelfIntersections) + { + // remove self intersections + aRetval.append(addPointsAtCuts(rCandidate.getB2DPolygon(0))); + } + else + { + // copy source + aRetval = rCandidate; + } + } + else + { + // first solve self cuts for all contained single polygons + temporaryPolygonData *pTempData = new temporaryPolygonData[nCount]; + sal_uInt32 a, b; + + for(a = 0; a < nCount; a++) + { + if(bSelfIntersections) + { + // use polygons with solved self intersections + pTempData[a].setPolygon(addPointsAtCuts(rCandidate.getB2DPolygon(a))); + } + else + { + // copy given polygons + pTempData[a].setPolygon(rCandidate.getB2DPolygon(a)); + } + } + + // now cuts and touches between the polygons + for(a = 0; a < nCount; a++) + { + for(b = 0; b < nCount; b++) + { + if(a < b) + { + // look for cuts, compare each edge polygon to following ones + if(pTempData[a].getRange().overlaps(pTempData[b].getRange())) + { + findCuts(pTempData[a].getPolygon(), pTempData[b].getPolygon(), pTempData[a].getTemporaryPointVector(), pTempData[b].getTemporaryPointVector()); + } + } + } + } + + // consolidate the result + for(a = 0L; a < nCount; a++) + { + aRetval.append(mergeTemporaryPointsAndPolygon(pTempData[a].getPolygon(), pTempData[a].getTemporaryPointVector())); + } + + delete[] pTempData; + } + + return aRetval; + } + else + { + return rCandidate; + } + } + //////////////////////////////////////////////////////////////////////////////// } // end of namespace tools diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx new file mode 100644 index 000000000000..e935545e0b05 --- /dev/null +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -0,0 +1,895 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: b2dpolygontriangulator.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_basegfx.hxx" +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace trapezoidhelper + { + ////////////////////////////////////////////////////////////////////////////// + + class TrDeSimpleEdge + { + protected: + const B2DPoint* mpStart; + const B2DPoint* mpEnd; + + public: + TrDeSimpleEdge( + const B2DPoint* pStart, + const B2DPoint* pEnd) + : mpStart(pStart), + mpEnd(pEnd) + { + } + + // data read access + const B2DPoint& getStart() const { return *mpStart; } + const B2DPoint& getEnd() const { return *mpEnd; } + }; + + ////////////////////////////////////////////////////////////////////////////// + // define vector of simple edges + typedef ::std::vector< TrDeSimpleEdge > TrDeSimpleEdges; + + ////////////////////////////////////////////////////////////////////////////// + + class TrDeEdgeEntry : public TrDeSimpleEdge + { + private: + sal_uInt32 mnSortValue; + + public: + // convenience data read access + double getDeltaX() const { return mpEnd->getX() - mpStart->getX(); } + double getDeltaY() const { return mpEnd->getY() - mpStart->getY(); } + + // convenience data read access + sal_uInt32 getSortValue() const + { + if(0 != mnSortValue) + return mnSortValue; + + // get radiant; has to be in the range ]0.0 .. pi[, thus scale to full + // sal_uInt32 range for maximum precision + const double fRadiant(atan2(getDeltaY(), getDeltaX()) * (SAL_MAX_UINT32 / F_PI)); + + // convert to sal_uInt32 value + const_cast< TrDeEdgeEntry* >(this)->mnSortValue = sal_uInt32(fRadiant); + + return mnSortValue; + } + + // constructor + TrDeEdgeEntry( + const B2DPoint* pStart, + const B2DPoint* pEnd, + sal_uInt32 nSortValue) + : TrDeSimpleEdge(pStart, pEnd), + mnSortValue(nSortValue) + { + // no horizontal edges allowed, all neeed to traverse vertivally + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + + // data write access + void setStart( const B2DPoint* pNewStart) + { + if(mpStart != pNewStart) + { + mpStart = pNewStart; + + // no horizontal edges allowed, all neeed to traverse vertivally + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + } + + void setEnd( const B2DPoint* pNewEnd) + { + if(mpEnd != pNewEnd) + { + mpEnd = pNewEnd; + + // no horizontal edges allowed, all neeed to traverse vertivally + OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); + } + } + + // operator for sort support + bool operator<(const TrDeEdgeEntry& rComp) const + { + if(fTools::equal(getStart().getY(), rComp.getStart().getY(), fTools::getSmallValue())) + { + if(fTools::equal(getStart().getX(), rComp.getStart().getX(), fTools::getSmallValue())) + { + // when start points are equal, use the direction the edge is pointing + // to. That value is derived from atan2 in the range ]0.0 .. pi[ and scaled + // to sal_uint32 range for best precision. 0 means no angle, while SAL_MAX_UINT32 + // means pi. Thus, the higher the value, the more left the edge resides. + return (getSortValue() > rComp.getSortValue()); + } + else + { + return fTools::less(getStart().getX(), rComp.getStart().getX()); + } + } + else + { + return fTools::less(getStart().getY(), rComp.getStart().getY()); + } + } + + }; + + ////////////////////////////////////////////////////////////////////////////// + // define double linked list of edges (for fast random insert) + typedef ::std::list< TrDeEdgeEntry > TrDeEdgeEntries; + + } // end of anonymous namespace +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace trapezoidhelper + { + class TrapezoidSubdivider + { + private: + sal_uInt32 mnEdgeEntryCount; + TrDeEdgeEntries maTrDeEdgeEntries; + ::std::vector< B2DPoint > maPoints; + ::std::vector< B2DPoint* > maNewPoints; + + void addEdgeSorted( + TrDeEdgeEntries::iterator aCurrent, + const TrDeEdgeEntry& rNewEdge) + { + // Loop while new entry is bigger, use operator< + while(aCurrent != maTrDeEdgeEntries.end() && (*aCurrent) < rNewEdge) + { + aCurrent++; + } + + // Insert before first which is smaller or equal or at end + maTrDeEdgeEntries.insert(aCurrent, rNewEdge); + mnEdgeEntryCount++; + } + + bool splitEdgeAtGivenPoint( + TrDeEdgeEntries::reference aEdge, + const B2DPoint& rCutPoint, + TrDeEdgeEntries::iterator aCurrent) + { + if(aEdge.getStart().equal(rCutPoint, fTools::getSmallValue())) + { + return false; + } + + if(aEdge.getEnd().equal(rCutPoint, fTools::getSmallValue())) + { + return false; + } + + const double fOldDeltaYStart(rCutPoint.getY() - aEdge.getStart().getY()); + + if(fTools::lessOrEqual(fOldDeltaYStart, 0.0)) + { + // do not split: the resulting edge would be horizontal + // correct it to new start point + aEdge.setStart(&rCutPoint); + return false; + } + + const double fNewDeltaYStart(aEdge.getEnd().getY() - rCutPoint.getY()); + + if(fTools::lessOrEqual(fNewDeltaYStart, 0.0)) + { + // do not split: the resulting edge would be horizontal + aEdge.setEnd(&rCutPoint); + return false; + } + + // Create new entry + const TrDeEdgeEntry aNewEdge( + &rCutPoint, + &aEdge.getEnd(), + aEdge.getSortValue()); + + // Correct old entry + aEdge.setEnd(&rCutPoint); + + // Insert sorted (to avoid new sort) + addEdgeSorted(aCurrent, aNewEdge); + + return true; + } + + bool testAndCorrectEdgeIntersection( + TrDeEdgeEntries::reference aEdgeA, + TrDeEdgeEntries::reference aEdgeB, + TrDeEdgeEntries::iterator aCurrent) + { + // Exclude simple cases: same start or end point + if(aEdgeA.getStart().equal(aEdgeB.getStart(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getStart().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getEnd().equal(aEdgeB.getStart(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeA.getEnd().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + // Exclude simple cases: one of the edges has no length anymore + if(aEdgeA.getStart().equal(aEdgeA.getEnd(), fTools::getSmallValue())) + { + return false; + } + + if(aEdgeB.getStart().equal(aEdgeB.getEnd(), fTools::getSmallValue())) + { + return false; + } + + // now check if one point is on the other edge + const B2DVector aDeltaB(aEdgeB.getDeltaX(), aEdgeB.getDeltaY()); + + if(tools::isPointOnEdge(aEdgeA.getStart(), aEdgeB.getStart(), aDeltaB)) + { + return splitEdgeAtGivenPoint(aEdgeB, aEdgeA.getStart(), aCurrent); + } + + if(tools::isPointOnEdge(aEdgeA.getEnd(), aEdgeB.getStart(), aDeltaB)) + { + return splitEdgeAtGivenPoint(aEdgeB, aEdgeA.getEnd(), aCurrent); + } + + const B2DVector aDeltaA(aEdgeA.getDeltaX(), aEdgeA.getDeltaY()); + + if(tools::isPointOnEdge(aEdgeB.getStart(), aEdgeA.getStart(), aDeltaA)) + { + return splitEdgeAtGivenPoint(aEdgeA, aEdgeB.getStart(), aCurrent); + } + + if(tools::isPointOnEdge(aEdgeB.getEnd(), aEdgeA.getStart(), aDeltaA)) + { + return splitEdgeAtGivenPoint(aEdgeA, aEdgeB.getEnd(), aCurrent); + } + + // check for cut inside edges + double fCutA(0.0); + double fCutB(0.0); + + if(tools::findCut( + aEdgeA.getStart(), aDeltaA, + aEdgeB.getStart(), aDeltaB, + CUTFLAG_LINE, + &fCutA, + &fCutB)) + { + const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY()); + const double fSimpleLengthB(aDeltaB.getX() + aDeltaB.getY()); + const bool bAIsLonger(fSimpleLengthA > fSimpleLengthB); + B2DPoint* pNewPoint = bAIsLonger + ? new B2DPoint(aEdgeA.getStart() + (fCutA * aDeltaA)) + : new B2DPoint(aEdgeB.getStart() + (fCutB * aDeltaB)); + bool bRetval(false); + + bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent); + bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent); + + if(bRetval) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + + return bRetval; + } + + return false; + } + + B2DPoint getCutPointForGivenY( + const TrDeEdgeEntry& rEdge, + double fGivenY) + { + // Calculate cut point locally (do not use interpolate) since it is numerically + // necessary to guarantee the new, equal Y-coordinate + const double fFactor((fGivenY - rEdge.getStart().getY()) / rEdge.getDeltaY()); + const double fDeltaXNew(fFactor * rEdge.getDeltaX()); + + return B2DPoint(rEdge.getStart().getX() + fDeltaXNew, fGivenY); + } + + void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges) + { + if(rTrDeSimpleEdges.size() && maTrDeEdgeEntries.size()) + { + // there were horizontal edges. These can be excluded, but + // cuts with other edges need to be solved and added + sal_uInt32 a(0); + + for(a = 0; a < rTrDeSimpleEdges.size(); a++) + { + // get horizontal edge as candidate; prepare it's range and fixed Y + const TrDeSimpleEdge& rHorEdge = rTrDeSimpleEdges[a]; + const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX()); + const double fFixedY(rHorEdge.getStart().getY()); + + // loop over edges + TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin()); + + do + { + // get compare edge + TrDeEdgeEntries::reference aCompare(*aCurrent++); + + if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY)) + { + // edge starts below horizontal edge, continue + continue; + } + + if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY)) + { + // edge ends above horizontal edge, continue + continue; + } + + // vertical overlap, get horizontal range + const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); + + if(aRange.overlaps(aCompareRange)) + { + // possible cut, get cut point + const B2DPoint aSplit(getCutPointForGivenY(aCompare, fFixedY)); + + if(fTools::more(aSplit.getX(), aRange.getMinimum()) + && fTools::less(aSplit.getX(), aRange.getMaximum())) + { + // cut is in XRange of horizontal edge, potenitally needed cut + B2DPoint* pNewPoint = new B2DPoint(aSplit); + + if(splitEdgeAtGivenPoint(aCompare, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + } + while(aCurrent != maTrDeEdgeEntries.end() + && fTools::less(aCurrent->getStart().getY(), fFixedY)); + } + } + } + + public: + TrapezoidSubdivider( + const B2DPolyPolygon& rSourcePolyPolygon) + : mnEdgeEntryCount(0), + maTrDeEdgeEntries(), + maPoints(), + maNewPoints() + { + const sal_uInt32 nPolygonCount(rSourcePolyPolygon.count()); + TrDeSimpleEdges aTrDeSimpleEdges; + sal_uInt32 a(0), b(0); + sal_uInt32 nAllPointCount(0); + + for(a = 0; a < nPolygonCount; a++) + { + const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + nAllPointCount += nCount; + } + } + + if(nAllPointCount) + { + maPoints.reserve(nAllPointCount); + sal_uInt32 nStartIndex(0); + + for(a = 0; a < nPolygonCount; a++) + { + const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + for(b = 0; b < nCount; b++) + { + maPoints.push_back(aPolygonCandidate.getB2DPoint(b)); + } + } + } + + // moved the edge construction to a 3rd loop; doing it in the 2nd loop is + // possible, but requires q working vector::reserve() implementation, else + // the vector will be reallocated and the pointers will be wrong + for(a = 0; a < nPolygonCount; a++) + { + const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nCount(aPolygonCandidate.count()); + + if(nCount > 2) + { + B2DPoint* pPrev(&maPoints[maPoints.size() - 1]); + + for(b = 0; b < nCount; b++) + { + B2DPoint* pCurr(&maPoints[nStartIndex++]); + + if(fTools::equal(pPrev->getY(), pCurr->getY(), fTools::getSmallValue())) + { + // horizontal edge, check for single point + if(!fTools::equal(pPrev->getX(), pCurr->getX(), fTools::getSmallValue())) + { + // X-order not needed, just add + aTrDeSimpleEdges.push_back(TrDeSimpleEdge(pPrev, pCurr)); + + const double fMiddle((pPrev->getY() + pCurr->getY()) * 0.5); + pPrev->setY(fMiddle); + pCurr->setY(fMiddle); + } + } + else + { + // vertical edge, add with positive Y-direction + if(pPrev->getY() < pCurr->getY()) + { + maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0)); + } + else + { + maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pCurr, pPrev, 0)); + } + + mnEdgeEntryCount++; + } + + pPrev = pCurr; + } + } + } + } + + if(maTrDeEdgeEntries.size()) + { + maTrDeEdgeEntries.sort(); + + solveHorizontalEdges(aTrDeSimpleEdges); + } + } + + ~TrapezoidSubdivider() + { + const sal_uInt32 nCount(maNewPoints.size()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + delete maNewPoints[a]; + } + } + + B2DTrapezoidVector Subdivide() + { + B2DTrapezoidVector aRetval; + B1DRange aLeftRange; + B1DRange aRightRange; + + if(!maTrDeEdgeEntries.empty()) + { + // measuring shows that the relation between edges and created trapezoids is + // mostly in the 1.0 range, thus reserve as much trapezoids as edges exist. Do + // not use maTrDeEdgeEntries.size() since that may be a non-constant time + // operation for Lists. Instead, use mnEdgeEntryCount which will contain the + // roughly counted adds to the List + aRetval.reserve(mnEdgeEntryCount); + } + + while(!maTrDeEdgeEntries.empty()) + { + // Prepare current operator and get first edge + TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin()); + TrDeEdgeEntries::reference aLeft(*aCurrent++); + + if(aCurrent == maTrDeEdgeEntries.end()) + { + // Should not happen: No 2nd edge; consume the single edge + // and start next loop + maTrDeEdgeEntries.pop_front(); + continue; + } + + // get second edge + TrDeEdgeEntries::reference aRight(*aCurrent++); + + if(!fTools::equal(aLeft.getStart().getY(), aRight.getStart().getY(), fTools::getSmallValue())) + { + // Should not happen: We have a 2nd edge, but YStart is on another + // line; consume the single edge and start next loop + maTrDeEdgeEntries.pop_front(); + continue; + } + + // aLeft and aRight build a thought trapezoid now. They have a common + // start line (same Y for start points). Potentially, one of the edges + // is longer than the other. It is only needed to look at the shorter + // length which build the potential traezoid. To do so, get the end points + // locally and adapt the evtl. longer one + B2DPoint aLeftEnd(aLeft.getEnd()); + B2DPoint aRightEnd(aRight.getEnd()); + + // check if end points are on the same line. If yes, no adaption + // needs to be prepared + const bool bEndOnSameLine(fTools::equal(aLeftEnd.getY(), aRightEnd.getY(), fTools::getSmallValue())); + bool bLeftIsLonger(false); + + if(!bEndOnSameLine) + { + // check which edge is longer and correct accordingly + bLeftIsLonger = fTools::more(aLeftEnd.getY(), aRightEnd.getY()); + + if(bLeftIsLonger) + { + aLeftEnd = getCutPointForGivenY(aLeft, aRightEnd.getY()); + } + else + { + aRightEnd = getCutPointForGivenY(aRight, aLeftEnd.getY()); + } + } + + // check for same start and end points + const bool bSameStartPoint(aLeft.getStart().equal(aRight.getStart(), fTools::getSmallValue())); + const bool bSameEndPoint(aLeftEnd.equal(aRightEnd, fTools::getSmallValue())); + + // check the simple case that the edges form a 'blind' edge + if(bSameStartPoint && bSameEndPoint) + { + // correct the longer edge if prepared + if(!bEndOnSameLine) + { + if(bLeftIsLonger) + { + B2DPoint* pNewPoint = new B2DPoint(aLeftEnd); + + if(splitEdgeAtGivenPoint(aLeft, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + else + { + B2DPoint* pNewPoint = new B2DPoint(aRightEnd); + + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + + // consume both edges and start next run + maTrDeEdgeEntries.pop_front(); + maTrDeEdgeEntries.pop_front(); + + continue; + } + + // check if the edges self-intersect. This can only happen when + // start and end point are different + bool bRangesSet(false); + + if(!(bSameStartPoint || bSameEndPoint)) + { + // get XRanges of edges + aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); + aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); + bRangesSet = true; + + // use fast range test first + if(aLeftRange.overlaps(aRightRange)) + { + // real cut test and correction. If corrected, + // start new run + if(testAndCorrectEdgeIntersection(aLeft, aRight, aCurrent)) + { + continue; + } + } + } + + // now we need to check if there are intersections with other edges + // or if other edges start inside the candidate trapezoid + if(aCurrent != maTrDeEdgeEntries.end() + && fTools::less(aCurrent->getStart().getY(), aLeftEnd.getY())) + { + // get XRanges of edges + if(!bRangesSet) + { + aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); + aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); + bRangesSet = true; + } + + // build full XRange for fast check + B1DRange aAllRange(aLeftRange); + aAllRange.expand(aRightRange); + + // prepare loop iterator; aCurrent needs to stay unchanged for + // eventual insertions of new EdgeNodes. Also prepare stop flag + TrDeEdgeEntries::iterator aLoop(aCurrent); + bool bDone(false); + + do + { + // get compare edge and it's XRange + TrDeEdgeEntries::reference aCompare(*aLoop++); + + // avoid edges using the same start point as one of + // the edges. These can neither have their start point + // in the thought edge nor cut with one of the edges + if(aCompare.getStart().equal(aRight.getStart(), fTools::getSmallValue())) + { + continue; + } + + // get compare XRange + const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); + + // use fast range test + if(aAllRange.overlaps(aCompareRange)) + { + // check for start point inside thought trapezoid + if(fTools::more(aCompare.getStart().getY(), aLeft.getStart().getY())) + { + // calculate the two possible split points at compare's Y + const B2DPoint aSplitLeft(getCutPointForGivenY(aLeft, aCompare.getStart().getY())); + const B2DPoint aSplitRight(getCutPointForGivenY(aRight, aCompare.getStart().getY())); + + // check for start point of aCompare being inside thought + // trapezoid + if(aCompare.getStart().getX() >= aSplitLeft.getX() && + aCompare.getStart().getX() <= aSplitRight.getX()) + { + // is inside, correct and restart loop + B2DPoint* pNewLeft = new B2DPoint(aSplitLeft); + + if(splitEdgeAtGivenPoint(aLeft, *pNewLeft, aCurrent)) + { + maNewPoints.push_back(pNewLeft); + } + else + { + delete pNewLeft; + } + + B2DPoint* pNewRight = new B2DPoint(aSplitRight); + + if(splitEdgeAtGivenPoint(aRight, *pNewRight, aCurrent)) + { + maNewPoints.push_back(pNewRight); + } + else + { + delete pNewRight; + } + + bDone = true; + } + } + + if(!bDone && aLeftRange.overlaps(aCompareRange)) + { + // test for concrete cut of compare edge with left edge + bDone = testAndCorrectEdgeIntersection(aLeft, aCompare, aCurrent); + } + + if(!bDone && aRightRange.overlaps(aCompareRange)) + { + // test for concrete cut of compare edge with Right edge + bDone = testAndCorrectEdgeIntersection(aRight, aCompare, aCurrent); + } + } + } + while(!bDone + && aLoop != maTrDeEdgeEntries.end() + && fTools::less(aLoop->getStart().getY(), aLeftEnd.getY())); + + if(bDone) + { + // something needed to be changed; start next loop + continue; + } + } + + // when we get here, the intended trapezoid can be used. It needs to + // be corrected, eventually (if prepared); but this is no reason not to + // use it in the same loop iteration + if(!bEndOnSameLine) + { + if(bLeftIsLonger) + { + B2DPoint* pNewPoint = new B2DPoint(aLeftEnd); + + if(splitEdgeAtGivenPoint(aLeft, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + else + { + B2DPoint* pNewPoint = new B2DPoint(aRightEnd); + + if(splitEdgeAtGivenPoint(aRight, *pNewPoint, aCurrent)) + { + maNewPoints.push_back(pNewPoint); + } + else + { + delete pNewPoint; + } + } + } + + // the two edges start at the same Y, they use the same DeltaY, they + // do not cut themselves and not any other edge in range. Create a + // B2DTrapezoid and consume both edges + aRetval.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeftEnd.getX(), + aRightEnd.getX(), + aLeftEnd.getY())); + + maTrDeEdgeEntries.pop_front(); + maTrDeEdgeEntries.pop_front(); + } + + return aRetval; + } + }; + } // end of anonymous namespace +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + B2DTrapezoid::B2DTrapezoid( + const double& rfTopXLeft, + const double& rfTopXRight, + const double& rfTopY, + const double& rfBottomXLeft, + const double& rfBottomXRight, + const double& rfBottomY) + : + mfTopXLeft(rfTopXLeft), + mfTopXRight(rfTopXRight), + mfTopY(rfTopY), + mfBottomXLeft(rfBottomXLeft), + mfBottomXRight(rfBottomXRight), + mfBottomY(rfBottomY) + { + if(rfTopXLeft > rfTopXRight) + { + std::swap(mfTopXLeft, mfTopXRight); + } + + if(rfBottomXLeft > rfBottomXRight) + { + std::swap(mfBottomXLeft, mfBottomXRight); + } + } + + B2DPolygon B2DTrapezoid::getB2DPolygon() const + { + B2DPolygon aRetval; + + aRetval.append(B2DPoint(getTopXLeft(), getTopY())); + aRetval.append(B2DPoint(getTopXRight(), getTopY())); + aRetval.append(B2DPoint(getBottomXRight(), getBottomY())); + aRetval.append(B2DPoint(getBottomXLeft(), getBottomY())); + aRetval.setClosed(true); + + return aRetval; + } +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + // convert SourcePolyPolygon to trapezoids + B2DTrapezoidVector trapezoidSubdivide(const B2DPolyPolygon& rSourcePolyPolygon) + { + B2DPolyPolygon aSource(rSourcePolyPolygon); + + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + + trapezoidhelper::TrapezoidSubdivider aTrapezoidSubdivider(aSource); + return aTrapezoidSubdivider.Subdivide(); + } + } // end of namespace tools +} // end of namespace basegfx + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/basegfx/source/polygon/makefile.mk b/basegfx/source/polygon/makefile.mk index b2da44250e66..8d203e9e6a79 100644 --- a/basegfx/source/polygon/makefile.mk +++ b/basegfx/source/polygon/makefile.mk @@ -55,6 +55,7 @@ SLOFILES= \ $(SLO)$/b2dpolygonclipper.obj \ $(SLO)$/b2dpolygontriangulator.obj \ $(SLO)$/b2dpolygoncutandtouch.obj \ + $(SLO)$/b2dtrapezoid.obj \ $(SLO)$/b3dpolygon.obj \ $(SLO)$/b3dpolygontools.obj \ $(SLO)$/b3dpolypolygon.obj \ -- cgit v1.2.3 From 8eeb1400c138e4e1b35c017b228fd358a34d55ed Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 8 Dec 2009 19:05:15 +0100 Subject: aw079: #i107360# test code for trapezoid decomposer --- drawinglayer/source/processor2d/vclprocessor2d.cxx | 84 +++++++++++++--------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index ede5aee730cf..2866bb292e58 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -77,6 +77,7 @@ // for test, can be removed again #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -666,51 +667,70 @@ namespace drawinglayer basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); - mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // when AA is on and this filled polygons are the result of stroked line geometry, - // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aPolygonColor)); - const sal_uInt32 nCount(aLocalPolyPolygon.count()); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + aLocalPolyPolygon = basegfx::tools::clipPolyPolygonOnRange( + aLocalPolyPolygon, rDiscreteViewport, true, false); - for(sal_uInt32 a(0); a < nCount; a++) + if(aLocalPolyPolygon.count()) { - mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); - } - } + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); - static bool bTestPolygonClipping(false); - if(bTestPolygonClipping) - { - static bool bInside(true); - static bool bFilled(false); - static bool bLine(false); + // trapezoidize + const basegfx::B2DTrapezoidVector aB2DTrapezoidVector(basegfx::tools::trapezoidSubdivide( + aLocalPolyPolygon)); - basegfx::B2DRange aRange(aLocalPolyPolygon.getB2DRange()); - aRange.grow(aRange.getWidth() * -0.1); + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); - if(bFilled) - { - basegfx::B2DPolyPolygon aFilledClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, false)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); - mpOutputDevice->SetFillColor(Color(aRand)); - mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawPolyPolygon(aFilledClipped); + if(nCount) + { + basegfx::BColor aInvPolygonColor(aPolygonColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } } + } + else + { + mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); - if(bLine) + if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) { - basegfx::B2DPolyPolygon aLineClipped(basegfx::tools::clipPolyPolygonOnRange(aLocalPolyPolygon, aRange, bInside, true)); - basegfx::BColor aRand(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0); + // when AA is on and this filled polygons are the result of stroked line geometry, + // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(Color(aRand)); + mpOutputDevice->SetLineColor(Color(aPolygonColor)); + const sal_uInt32 nCount(aLocalPolyPolygon.count()); - for(sal_uInt32 a(0); a < aLineClipped.count(); a++) + for(sal_uInt32 a(0); a < nCount; a++) { - mpOutputDevice->DrawPolyLine(aLineClipped.getB2DPolygon(a), 0.0); + mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); } } } -- cgit v1.2.3 From 33bfbf7debee613fa83d8a450226aecb5f9c672f Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 8 Dec 2009 19:09:16 +0100 Subject: aw079: #i107346# flag for WrongSpell in SdrTextAttribute --- svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 5 ++++- svx/source/sdr/attribute/sdrtextattribute.cxx | 13 +++++++++---- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 10 +++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index 1759eb18d319..f672086ea5cd 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -81,6 +81,7 @@ namespace drawinglayer unsigned mbScroll : 1; unsigned mbInEditMode : 1; unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; public: SdrTextAttribute( @@ -99,7 +100,8 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight); + bool bFixedCellHeight, + bool bWrongSpell); ~SdrTextAttribute(); // copy constructor and assigment operator @@ -119,6 +121,7 @@ namespace drawinglayer bool isScroll() const { return mbScroll; } bool isInEditMode() const { return mbInEditMode; } bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index ae6204d15bef..3afc03d1600d 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -65,7 +65,8 @@ namespace drawinglayer bool bBlink, bool bScroll, bool bInEditMode, - bool bFixedCellHeight) + bool bFixedCellHeight, + bool bWrongSpell) : mpSdrText(&rSdrText), maOutlinerParaObject(rOutlinerParaObject), mpSdrFormTextAttribute(0), @@ -82,7 +83,8 @@ namespace drawinglayer mbBlink(bBlink), mbScroll(bScroll), mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight) + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) { if(XFT_NONE != eFormTextStyle) { @@ -123,7 +125,8 @@ namespace drawinglayer mbBlink(rCandidate.isBlink()), mbScroll(rCandidate.isScroll()), mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()) + mbFixedCellHeight(rCandidate.isFixedCellHeight()), + mbWrongSpell(rCandidate.isWrongSpell()) { if(rCandidate.getSdrFormTextAttribute()) { @@ -164,6 +167,7 @@ namespace drawinglayer mbScroll = rCandidate.isScroll(); mbInEditMode = rCandidate.isInEditMode(); mbFixedCellHeight = rCandidate.isFixedCellHeight(); + mbWrongSpell = rCandidate.isWrongSpell(); return *this; } @@ -197,7 +201,8 @@ namespace drawinglayer && isBlink() == rCandidate.isBlink() && isScroll() == rCandidate.isScroll() && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight()); + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 4e57166b4723..f778cccdee40 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -77,6 +77,9 @@ #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -523,6 +526,10 @@ namespace drawinglayer const SdrFitToSizeType eFit(rTextObj.GetFitToSize()); const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind()); + // #i107346# + const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); + const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); + pRetval = new attribute::SdrTextAttribute( rText, aOutlinerParaObject, @@ -539,7 +546,8 @@ namespace drawinglayer SDRTEXTANI_BLINK == eAniKind, SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind, bInEditMode, - ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); + ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(), + bWrongSpell); } return pRetval; -- cgit v1.2.3 From 330620b17d6785b9f1f7d3646e3958bc7fbdd1eb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 10:11:48 +0100 Subject: autorecovery: substituted some more usages of SfxViewFrame::CreateViewFrame with their new equivalents --- sw/source/ui/app/appenv.cxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 14 +++++++------- sw/source/ui/dbui/mmoutputpage.cxx | 4 ++-- sw/source/ui/misc/glshell.cxx | 2 +- sw/source/ui/uno/unomailmerge.cxx | 2 +- sw/source/ui/uno/unotxdoc.cxx | 4 ++-- sw/source/ui/uno/unotxvw.cxx | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 7f3acf375b35..2ee6fb9e7db8 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -210,7 +210,7 @@ static USHORT nTitleNo = 0; // Neues Dokument erzeugen (kein Show!) SfxObjectShellRef xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); - pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); pNewView = (SwView*) pFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. pSh = pNewView->GetWrtShellPtr(); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 603af1c31111..9ed35bf00e6a 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1327,7 +1327,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // create a target docshell to put the merged document into xTargetDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD ); xTargetDocShell->DoInitNew( 0 ); - SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE ); + SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); SwView* pTargetView = static_cast( pTargetFrame->GetViewShell() ); @@ -1447,7 +1447,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, if (xWorkDocSh->DoLoad(pWorkMed)) { //create a view frame for the document - SfxViewFrame* pWorkFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE ); + SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 ); //request the layout calculation SwWrtShell& rWorkShell = static_cast< SwView* >(pWorkFrame->GetViewShell())->GetWrtShell(); @@ -2892,7 +2892,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh, pWorkMed->SetFilter( pSfxFlt ); if( xWorkDocSh->DoLoad(pWorkMed) ) { - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 ); SwView *pView = (SwView*) pFrame->GetViewShell(); pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird. //set the current DBMgr @@ -3183,7 +3183,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, // create a target docshell to put the merged document into SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTargetDocShell->DoInitNew( 0 ); - SfxViewFrame* pTargetFrame = SfxViewFrame::CreateViewFrame( *xTargetDocShell, 0, TRUE ); + SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); //the created window has to be located at the same position as the source window Window& rTargetWindow = pTargetFrame->GetFrame()->GetWindow(); @@ -3244,7 +3244,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, xWorkDocSh->DoInitNew(); } //create a ViewFrame - SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() ); + SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() ); SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird. @@ -3255,8 +3255,8 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, pWorkDoc->EmbedAllLinks(); if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds()) rWorkShell.Undo(); - // #i69485# lock fields to prevent access to the result set while calculating layout - rWorkShell.LockExpFlds(); + // #i69485# lock fields to prevent access to the result set while calculating layout + rWorkShell.LockExpFlds(); // create a layout rWorkShell.CalcLayout(); rWorkShell.UnlockExpFlds(); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index eb1f75d57979..cf13e0911546 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -858,7 +858,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) //now extract a document from the target document SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); - SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE ); + SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); // pTempFrame->GetFrame()->Appear(); SwView* pTempView = static_cast( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); @@ -1244,7 +1244,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) //now extract a document from the target document SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); - SfxViewFrame* pTempFrame = SfxViewFrame::CreateViewFrame( *xTempDocShell, 0, TRUE ); + SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); // pTempFrame->GetFrame()->Appear(); SwView* pTempView = static_cast( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index a79e67eec31c..e82abfe2788e 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -309,7 +309,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS } // Dokumenttitel setzen - SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, nViewId, !bShow ); + SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId ); String aDocTitle(SW_RES( STR_GLOSSARY )); aDocTitle += ' '; aDocTitle += sLongName; diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 44c5d011fe75..7268679301b7 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -429,7 +429,7 @@ SwXMailMerge::SwXMailMerge() : SwDocShell *pDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD ); xDocSh = pDocShell; xDocSh->DoInitNew( 0 ); - SfxViewFrame *pFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); SwView *pView = (SwView*) pFrame->GetViewShell(); pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird. diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 1336e01e55f4..7a6dafbfc2d2 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -1194,7 +1194,7 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption ::vos::OGuard aGuard(Application::GetSolarMutex()); if(IsValid()) { - SfxViewFrame* pFrame = SfxViewFrame::CreateViewFrame( *pDocShell, 7, sal_True ); + SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 ); SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SFX_CALLMODE_SYNCHRON, pDocShell->GetDoc()->GetAttrPool()); aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, sal_True)); @@ -2619,7 +2619,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if( !pWrtShell ) { //create a hidden view to be able to export as PDF also in print preview - m_pHiddenViewFrame = SfxViewFrame::CreateViewFrame( *pRenderDocShell, 2, TRUE ); + m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 ); SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell(); pWrtShell = pSwView->GetWrtShellPtr(); } diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index 6197bb489d61..15551b62b962 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -930,7 +930,7 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); pOldSh->FillPrtDoc(pDocSh->GetDoc(), pPrt); - SfxViewFrame* pDocFrame = SfxViewFrame::CreateViewFrame( *xDocSh, 0, TRUE ); + SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); SwView* pDocView = (SwView*) pDocFrame->GetViewShell(); pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird. SwWrtShell* pSh = pDocView->GetWrtShellPtr(); -- cgit v1.2.3 From 0fc267ad5739641063c1bcf3d93c2fcfa48b5966 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 10:12:26 +0100 Subject: autorecovery: SfxViewFrame::CreateViewFrame does not have any clients anymore - removed --- sfx2/inc/sfx2/viewfrm.hxx | 1 - sfx2/source/view/viewfrm.cxx | 7 ------- 2 files changed, 8 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 9ea1c3761fa1..80c98792e097 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -165,7 +165,6 @@ public: SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) static void SetViewFrame( SfxViewFrame* ); - static SfxViewFrame* CreateViewFrame( SfxObjectShell& rDoc, USHORT nViewId=0, BOOL bHidden = FALSE ); static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 47d249f175ce..1d4f88b87ebc 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3505,13 +3505,6 @@ void SfxViewFrame::UpdateDocument_Impl() pDoc->UpdateFromTemplate_Impl(); } -SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nViewId, sal_Bool bHidden ) -{ - SfxFrame* pFrame = SfxFrame::Create( rDoc, nViewId, bHidden ); - OSL_ENSURE( pFrame, "SfxViewFrame::CreateViewFrame: failed!" ); - return pFrame ? pFrame->GetCurrentViewFrame() : NULL; -} - void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) { SFX_APP()->SetViewFrame_Impl( pFrame ); -- cgit v1.2.3 From 55ef444a354e519139e402be89686a743454907b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 10:27:30 +0100 Subject: autorecovery: removed a (now unused) flavour of SfxFrame::Create --- sfx2/inc/sfx2/frame.hxx | 1 - sfx2/source/view/topfrm.cxx | 86 --------------------------------------------- 2 files changed, 87 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 3f096c9388e4..ce6e67134bcc 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -141,7 +141,6 @@ public: static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); static SfxFrame* CreateBlank(); - static SfxFrame* Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ); static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); SvCompatWeakHdl* GetHdl(); diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index cb364a419ccc..d650aa9494ab 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -411,92 +411,6 @@ SfxFrame* SfxFrame::CreateBlank() return pFrame; } -SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, const USHORT nViewId, const bool bHidden ) -{ - if ( nViewId ) - rDoc.GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( bHidden ) - rDoc.GetMedium()->GetItemSet()->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - - Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - SfxFrame* pFrame = NULL; - - if ( !bHidden ) - { - URL aTargetURL; - aTargetURL.Complete = rDoc.GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); - - BOOL bIsBasic = FALSE; - if ( !aTargetURL.Complete.getLength() ) - { - String sFactory = String::CreateFromAscii( rDoc.GetFactory().GetShortName() ); - bIsBasic = ( sFactory.CompareIgnoreCaseToAscii("sbasic") == COMPARE_EQUAL ); - if ( !bIsBasic ) - { - String aURL = String::CreateFromAscii("private:factory/"); - aURL += sFactory; - aTargetURL.Complete = aURL; - } - } - - if ( bIsBasic ) - { - // for the Basic IDE, we need to manually find the start module (if present), since the below code - // of dispatching the model into a "_default" frame will not work here. - // (TODO: Why doesn't it? If it would, we could spare the extra code here.) - Reference< XFrame > xFrame( lcl_findStartModuleFrame() ); - if ( xFrame.is() ) - pFrame = SfxFrame::Create( xFrame ); - } - else - { - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); - xTrans->parseStrict( aTargetURL ); - - Reference < XDispatchProvider > xProv( xDesktop, UNO_QUERY ); - Reference < XDispatch > xDisp; - if ( xProv.is() ) - { - Sequence < PropertyValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("Model"); - aSeq[0].Value <<= rDoc.GetModel(); - ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii("_default") ); - xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 ); - if ( xDisp.is() ) - xDisp->dispatch( aTargetURL, aSeq ); - } - - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxFrame *pF = rArr[ nPos ]; - if ( pF->GetCurrentDocument() == &rDoc ) - { - pFrame = pF; - break; - } - } - OSL_ENSURE( pFrame, "SfxFrame::Create: loading the doc via a dispatcher failed, it seems!" ); - if ( pFrame ) - return pFrame; - } - } - - if ( !pFrame ) - pFrame = SfxFrame::CreateBlank(); - - pFrame->pImp->bHidden = bHidden; - Window* pWindow = pFrame->GetTopWindow_Impl(); - if ( &rDoc != pFrame->GetCurrentDocument() ) - { - pFrame->InsertDocument_Impl( rDoc, *rDoc.GetMedium()->GetItemSet() ); - if ( pWindow && !bHidden ) - pWindow->Show(); - } - - return pFrame; -} - SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) { SfxFrame* pFrame = NULL; -- cgit v1.2.3 From a0cdd12b48baf1ac71e7930519519abeb0ecf871 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 11:12:09 +0100 Subject: autorecovery: split topfrm.cxx into viewfrm2.cxx and frame2.cxx, cleaned up some includes, removed some relict 'Top' in impl-class names --- sfx2/inc/sfx2/frame.hxx | 4 +- sfx2/source/view/frame2.cxx | 661 ++++++++++++++++++++ sfx2/source/view/impviewframe.hxx | 9 +- sfx2/source/view/makefile.mk | 5 +- sfx2/source/view/topfrm.cxx | 1212 ------------------------------------- sfx2/source/view/viewfrm.cxx | 2 +- sfx2/source/view/viewfrm2.cxx | 536 ++++++++++++++++ 7 files changed, 1209 insertions(+), 1220 deletions(-) create mode 100644 sfx2/source/view/frame2.cxx delete mode 100644 sfx2/source/view/topfrm.cxx create mode 100644 sfx2/source/view/viewfrm2.cxx diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index ce6e67134bcc..164b94174346 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -117,7 +117,7 @@ struct SfxFramePickEntry_Impl; class SFX2_DLLPUBLIC SfxFrame { friend class SfxFrameIterator; - friend class SfxTopWindow_Impl; + friend class SfxFrameWindow_Impl; private: SfxFrame* pParentFrame; @@ -129,9 +129,7 @@ protected: sal_Bool Close(); virtual ~SfxFrame(); -//#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void RemoveChildFrame_Impl( SfxFrame* ); -//#endif SfxFrame( ); // not implemented SAL_DLLPRIVATE SfxFrame( Window& i_rContainerWindow, bool bHidden ); diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx new file mode 100644 index 000000000000..d035ecb5dcc6 --- /dev/null +++ b/sfx2/source/view/frame2.cxx @@ -0,0 +1,661 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: topfrm.cxx,v $ + * $Revision: 1.97 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impframe.hxx" +#include "objshimp.hxx" +#include "sfxhelp.hxx" +#include "viewfac.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/event.hxx" +#include "sfx2/objface.hxx" +#include "sfx2/request.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; +using ::com::sun::star::frame::XComponentLoader; + +//------------------------------------------------------------------------ + +class SfxFrameWindow_Impl : public Window +{ +public: + SfxFrame* pFrame; + + SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ); + ~SfxFrameWindow_Impl( ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rEvt ); + virtual void Resize(); + virtual void GetFocus(); + void DoResize(); + DECL_LINK( CloserHdl, void* ); +}; + +SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ) + : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) + , pFrame( pF ) +{ +} + +SfxFrameWindow_Impl::~SfxFrameWindow_Impl( ) +{ +} + +void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->DataChanged_Impl( rDCEvt ); +} + +long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt ) +{ + if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) + return sal_False; + + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( !pView || !pView->GetObjectShell() ) + return Window::Notify( rNEvt ); + + if ( rNEvt.GetType() == EVENT_GETFOCUS ) + { + if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) + { + DBG_TRACE("SfxFrame: GotFocus"); + pView->MakeActive_Impl( FALSE ); + } + + // TODO/LATER: do we still need this code? + Window* pWindow = rNEvt.GetWindow(); + ULONG nHelpId = 0; + while ( !nHelpId && pWindow ) + { + nHelpId = pWindow->GetHelpId(); + pWindow = pWindow->GetParent(); + } + + if ( nHelpId ) + SfxHelp::OpenHelpAgent( pFrame, nHelpId ); + + // if focus was on an external window, the clipboard content might have been changed + pView->GetBindings().Invalidate( SID_PASTE ); + pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); + return sal_True; + } + else if( rNEvt.GetType() == EVENT_KEYINPUT ) + { + if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) + return TRUE; + } + else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) + { + pView->SetModalMode( sal_True ); + return sal_True; + } + else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) + { + //EnableInput( sal_True, sal_True ); + pView->SetModalMode( sal_False ); + return sal_True; + } + + return Window::Notify( rNEvt ); +} + +long SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt ) +{ + USHORT nType = rNEvt.GetType(); + if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) + { + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell ) + if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) + if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + + if ( nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); + Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->EndAutoShow_Impl( aPos ); + } + + return Window::PreNotify( rNEvt ); +} + +void SfxFrameWindow_Impl::GetFocus() +{ + if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) + pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); +} + +void SfxFrameWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + DoResize(); +} + +void SfxFrameWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + pFrame->pImp->bHidden = FALSE; + if ( pFrame->IsInPlace() ) + // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the + // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that + // the resize event never is sent to the component + SetSizePixel( GetParent()->GetOutputSizePixel() ); + + DoResize(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( pView ) + pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); + } + + Window::StateChanged( nStateChange ); +} + +void SfxFrameWindow_Impl::DoResize() +{ + if ( !pFrame->pImp->bLockResize ) + pFrame->Resize(); +} + +SfxFrame* SfxFrame::CreateBlank() +{ + SfxFrame* pFrame = NULL; + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); + pFrame = Create( xFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return pFrame; +} + +SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) +{ + SfxFrame* pFrame = NULL; + try + { + // create and initialize new top level frame for this window + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); + + Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); + xFrame->initialize( xWin.get() ); + xDesktop->getFrames()->append( xFrame ); + + if ( xWin->isActive() ) + xFrame->activate(); + + // create load arguments + Sequence< PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs ); + + ::comphelper::NamedValueCollection aArgs( aLoadArgs ); + aArgs.put( "Model", rDoc.GetModel() ); + aArgs.put( "Hidden", bHidden ); + if ( nViewId ) + aArgs.put( "ViewId", nViewId ); + + aLoadArgs = aArgs.getPropertyValues(); + + // load the doc into that frame + Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( + rDoc.GetModel()->getURL(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), + 0, + aLoadArgs + ); + + for ( pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == xFrame ) + break; + } + + OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return pFrame; +} + +SfxFrame* SfxFrame::Create( Reference < XFrame > xFrame ) +{ + // create a new TopFrame to an external XFrame object ( wrap controller ) + ENSURE_OR_THROW( xFrame.is(), "NULL frame not allowed" ); + Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); + + SfxFrame* pFrame = new SfxFrame( *pWindow, false ); + pFrame->SetFrameInterface_Impl( xFrame ); + return pFrame; +} + +SfxFrame::SfxFrame( Window& i_rContainerWindow, bool i_bHidden ) + :pParentFrame( NULL ) + ,pChildArr( NULL ) + ,pImp( NULL ) + ,pWindow( NULL ) +{ + Construct_Impl(); + + pImp->bHidden = i_bHidden; + InsertTopFrame_Impl( this ); + pImp->pExternalContainerWindow = &i_rContainerWindow; + + pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow ); + + // always show pWindow, which is the ComponentWindow of the XFrame we live in + // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame + // is not done at level of the container window, not at SFX level. Thus, the component window can + // always be visible. + pWindow->Show(); +} + +void SfxFrame::SetPresentationMode( BOOL bSet ) +{ + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode + + SetMenuBarOn_Impl( !bSet ); + if ( GetWorkWindow_Impl() ) + GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); +} + +SystemWindow* SfxFrame::GetSystemWindow() const +{ + return GetTopWindow_Impl(); +} + +SystemWindow* SfxFrame::GetTopWindow_Impl() const +{ + if ( pImp->pExternalContainerWindow->IsSystemWindow() ) + return (SystemWindow*) pImp->pExternalContainerWindow; + else + return NULL; +} + +Window& SfxFrame::GetWindow() const +{ + return *pWindow; +} + +sal_Bool SfxFrame::Close() +{ + delete this; + return sal_True; +} + +void SfxFrame::LockResize_Impl( BOOL bLock ) +{ + pImp->bLockResize = bLock; +} + +IMPL_LINK( SfxFrameWindow_Impl, CloserHdl, void*, EMPTYARG ) +{ + if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) + return 0L; + + if ( pFrame ) + pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); + return 0L; +} + +void SfxFrame::SetMenuBarOn_Impl( BOOL bOn ) +{ + pImp->bMenuBarOn = bOn; + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + { + rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); + + if ( bOn ) + xLayoutManager->showElement( aMenuBarURL ); + else + xLayoutManager->hideElement( aMenuBarURL ); + } +} + +BOOL SfxFrame::IsMenuBarOn_Impl() const +{ + return pImp->bMenuBarOn; +} + +void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const +{ + Window *pWin = pImp->pExternalContainerWindow; + + // Groesse setzen + const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); + Point aPos( rWinArea.TopLeft() ); + Size aSz( rWinArea.GetSize() ); + if ( aSz.Width() && aSz.Height() ) + { + aPos.X() = Min(aPos.X(), + long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); + aPos.Y() = Min(aPos.Y(), + long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); + if ( aPos.X() + aSz.Width() < + aAppWindow.Width() + aSz.Width() / 2 && + aPos.Y() + aSz.Height() < + aAppWindow.Height() + aSz.Height() / 2 ) + { + pWin->SetPosPixel( aPos ); + pWin->SetOutputSizePixel( aSz ); + } + } +} + +namespace +{ + bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) + { + _o_viewData.realloc(0); + _o_viewId = 0; + + Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); + + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + return false; + + // obtain the ViewID from the view data + _o_viewId = 0; + if ( xViewData->getByIndex( 0 ) >>= _o_viewData ) + { + ::comphelper::NamedValueCollection aNamedUserData( _o_viewData ); + ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( sViewId.getLength() ) + { + sViewId = sViewId.copy( 4 ); // format is like in "view3" + _o_viewId = USHORT( sViewId.toInt32() ); + } + } + return true; + } +} + +sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ) +/* [Beschreibung] + */ +{ + OSL_PRECOND( rDoc.GetMedium(), "SfxFrame::InsertDocument_Impl: no medium -> no view!"); + if ( !rDoc.GetMedium() ) + return sal_False; + + OSL_PRECOND( GetCurrentViewFrame() == NULL, + "SfxObjectShell::InsertDocument_Impl: no support (anymore) for loading into a non-empty frame!" ); + // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays + // done in higher layers, namely in the framework. + if ( GetCurrentViewFrame() != NULL ) + return sal_False; + + OSL_PRECOND( GetCurrentDocument() == NULL, + "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); + + SFX_ITEMSET_ARG( &rSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size + SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID + SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom + SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden + SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only + SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) + SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) + + // hidden? + pImp->bHidden = pHidItem ? pHidItem->GetValue() : pImp->bHidden; + + // plugin mode + const USHORT nPluginMode = pPluginMode ? pPluginMode->GetValue() : 0; + + // view only? + if ( pEditItem && pEditItem->GetValue() ) + SetMenuBarOn_Impl( FALSE ); + + // view ID + USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; + + if( !pImp->bHidden ) + rDoc.OwnerLock( sal_True ); + + Sequence< PropertyValue > aUserData; + bool bClearPosSizeZoom = false; + bool bReadUserData = false; + + // if no view-related data exists in the set, then obtain the view data from the model + if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + { + if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) + { + SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); + pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); + bClearPosSizeZoom = bReadUserData = true; + } + } + + UpdateDescriptor( &rDoc ); + + if ( nPluginMode && ( nPluginMode != 2 ) ) + SetInPlace_Impl( TRUE ); + + SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); + OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); + if ( !pViewFrame ) + // TODO: better error handling? Under which conditions can this fail? + return sal_False; + + if ( nPluginMode == 1 ) + { + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups(TRUE); + + // MBA: layoutmanager of inplace frame starts locked and invisible + GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + GetWorkWindow_Impl()->Lock_Impl( TRUE ); + + GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + OSL_ENSURE( ( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT ) + || ( pJumpItem == NULL ), + "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); + // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method + // here is never called before the load process finished. At least not with a jump item != NULL. + if( pJumpItem ) + { + pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); + } + + // Position und Groesse setzen + if ( pAreaItem ) + PositionWindow_Impl( pAreaItem->GetValue() ); + + if ( !pImp->bHidden ) + { + if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) + pViewFrame->GetDispatcher()->HideUI( TRUE ); + else + pViewFrame->GetDispatcher()->HideUI( FALSE ); + + if ( IsInPlace() ) + pViewFrame->LockAdjustPosSizePixel(); + + if ( ( nPluginMode == 3 ) ) + GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); + + if ( !IsInPlace() ) + pViewFrame->GetDispatcher()->Update_Impl(); + pViewFrame->Show(); + GetWindow().Show(); + if ( !IsInPlace() || ( nPluginMode == 3 ) ) + pViewFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); + rDoc.OwnerLock( sal_False ); + + if ( IsInPlace() ) + { + pViewFrame->UnlockAdjustPosSizePixel(); + // force resize for OLE server to fix layout problems of writer and math + // see i53651 + if ( nPluginMode == 3 ) + pViewFrame->Resize(TRUE); + } + } + else + { + DBG_ASSERT( !IsInPlace() && !pPluginMode, "Special modes not compatible with hidden mode!" ); + GetWindow().Show(); + } + + // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! + pViewFrame->UpdateTitle(); + + if ( !IsInPlace() ) + { + pViewFrame->Resize(TRUE); + } + + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); + + if ( bClearPosSizeZoom ) + { + SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); + pMediumSet->ClearItem( SID_VIEW_POS_SIZE ); + pMediumSet->ClearItem( SID_WIN_POSSIZE ); + pMediumSet->ClearItem( SID_VIEW_ZOOM_MODE ); + } + + if ( bReadUserData ) + { + // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE + // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet + if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) + { + pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); + } + } + + return GetCurrentDocument() == &rDoc; +} + diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index 3afa2239c4bd..32a7bfbe23b9 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -26,6 +26,11 @@ #ifndef SFX2_IMPVIEWFRAME_HXX #define SFX2_IMPVIEWFRAME_HXX +#include "sfx2/viewfrm.hxx" + +#include +#include + struct SfxViewFrame_Impl { SvBorder aBorder; @@ -67,13 +72,13 @@ struct SfxViewFrame_Impl } }; -class SfxTopViewWin_Impl : public Window +class SfxFrameViewWindow_Impl : public Window { BOOL bActive; SfxViewFrame* pFrame; public: - SfxTopViewWin_Impl( SfxViewFrame* p, Window& rParent, WinBits nBits=0 ) : + SfxFrameViewWindow_Impl( SfxViewFrame* p, Window& rParent, WinBits nBits=0 ) : Window( &rParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), bActive( FALSE ), pFrame( p ) diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk index 3ab9d5d7e242..a240ea8705bd 100644 --- a/sfx2/source/view/makefile.mk +++ b/sfx2/source/view/makefile.mk @@ -49,17 +49,18 @@ SRC1FILES = \ view.src SLOFILES = \ - $(SLO)$/ipclient.obj \ + $(SLO)$/ipclient.obj \ $(SLO)$/viewsh.obj \ $(SLO)$/frmload.obj \ $(SLO)$/frame.obj \ + $(SLO)$/frame2.obj \ $(SLO)$/printer.obj \ $(SLO)$/prnmon.obj \ $(SLO)$/viewprn.obj \ $(SLO)$/viewfac.obj \ $(SLO)$/orgmgr.obj \ $(SLO)$/viewfrm.obj \ - $(SLO)$/topfrm.obj \ + $(SLO)$/viewfrm2.obj \ $(SLO)$/sfxbasecontroller.obj \ $(SLO)$/userinputinterception.obj diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx deleted file mode 100644 index d650aa9494ab..000000000000 --- a/sfx2/source/view/topfrm.cxx +++ /dev/null @@ -1,1212 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: topfrm.cxx,v $ - * $Revision: 1.97 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - -#include -#include "viewfac.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef _TOOLKIT_UNOHLP_HXX -#include -#endif -#ifndef _UNO_COM_SUN_STAR_AWT_POSSIZE_HPP_ -#include -#endif -#include -#ifndef _COM_SUN_STAR_CONTAINER_XPROPERTYSET_HPP_ -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// wg. pTopFrames -#include "appdata.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "objshimp.hxx" -#include "workwin.hxx" -#include "sfxtypes.hxx" -#include "splitwin.hxx" -#include "arrdecl.hxx" -#include "sfxhelp.hxx" -#include -#include -#include "statcach.hxx" -#include -#include "impframe.hxx" -#include "impviewframe.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::beans; -using ::com::sun::star::document::XViewDataSupplier; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::lang::XComponent; -using ::com::sun::star::frame::XComponentLoader; - -//------------------------------------------------------------------------ - -#include -static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) -{ - uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); - ::rtl::OUString sVar; - if ( !xMM.is() ) - return sVar; - - try - { - ::comphelper::SequenceAsHashMap aAnalyzer( xMM->getByName(sDocService) ); - sVar = aAnalyzer.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("ooSetupFactoryUIName"), ::rtl::OUString() ); - } - catch( uno::Exception& ) - { - sVar = ::rtl::OUString(); - } - - return sVar; -} - -class SfxTopWindow_Impl : public Window -{ -public: - SfxFrame* pFrame; - - SfxTopWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ); - ~SfxTopWindow_Impl( ); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual long Notify( NotifyEvent& rEvt ); - virtual void Resize(); - virtual void GetFocus(); - void DoResize(); - DECL_LINK( CloserHdl, void* ); -}; - -SfxTopWindow_Impl::SfxTopWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ) - : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) - , pFrame( pF ) -{ -} - -SfxTopWindow_Impl::~SfxTopWindow_Impl( ) -{ -} - -void SfxTopWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->DataChanged_Impl( rDCEvt ); -} - -long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt ) -{ - if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) - return sal_False; - - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( !pView || !pView->GetObjectShell() ) - return Window::Notify( rNEvt ); - - if ( rNEvt.GetType() == EVENT_GETFOCUS ) - { - if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) - { - DBG_TRACE("SfxFrame: GotFocus"); - pView->MakeActive_Impl( FALSE ); - } - - // TODO/LATER: do we still need this code? - Window* pWindow = rNEvt.GetWindow(); - ULONG nHelpId = 0; - while ( !nHelpId && pWindow ) - { - nHelpId = pWindow->GetHelpId(); - pWindow = pWindow->GetParent(); - } - - if ( nHelpId ) - SfxHelp::OpenHelpAgent( pFrame, nHelpId ); - - // if focus was on an external window, the clipboard content might have been changed - pView->GetBindings().Invalidate( SID_PASTE ); - pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); - return sal_True; - } - else if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) - return TRUE; - } - else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) - { - pView->SetModalMode( sal_True ); - return sal_True; - } - else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) - { - //EnableInput( sal_True, sal_True ); - pView->SetModalMode( sal_False ); - return sal_True; - } - - return Window::Notify( rNEvt ); -} - -long SfxTopWindow_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - USHORT nType = rNEvt.GetType(); - if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) - { - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell ) - if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) - if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - - if ( nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); - Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->EndAutoShow_Impl( aPos ); - } - - return Window::PreNotify( rNEvt ); -} - -void SfxTopWindow_Impl::GetFocus() -{ - if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) - pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); -} - -void SfxTopWindow_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - DoResize(); -} - -void SfxTopWindow_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - pFrame->pImp->bHidden = FALSE; - if ( pFrame->IsInPlace() ) - // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the - // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that - // the resize event never is sent to the component - SetSizePixel( GetParent()->GetOutputSizePixel() ); - - DoResize(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( pView ) - pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); - } - - Window::StateChanged( nStateChange ); -} - -void SfxTopWindow_Impl::DoResize() -{ - if ( !pFrame->pImp->bLockResize ) - pFrame->Resize(); -} - -//-------------------------------------------------------------------- -void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - SfxObjectShell* pDoc = pFrame->GetObjectShell(); - if ( pDoc && !pFrame->IsVisible_Impl() ) - pFrame->Show(); - - pFrame->Resize(); - } - else - Window::StateChanged( nStateChange ); -} - -void SfxTopViewWin_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - pFrame->Resize(); -} - -class SfxTopViewFrame_Impl -{ -public: - - SfxTopViewFrame_Impl() - {} -}; - -static String _getTabString() -{ - String result; - - Reference < XMaterialHolder > xHolder( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); - if (xHolder.is()) - { - rtl::OUString aTabString; - Sequence< NamedValue > sMaterial; - if (xHolder->getMaterial() >>= sMaterial) { - for (int i=0; i < sMaterial.getLength(); i++) { - if ((sMaterial[i].Name.equalsAscii("title")) && - (sMaterial[i].Value >>= aTabString)) - { - result += ' '; - result += String(aTabString); - } - } - } - } - return result; -} - -namespace -{ - Reference< XFrame > lcl_findStartModuleFrame() - { - try - { - Reference < XFramesSupplier > xSupplier( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW ); - Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); - - Reference< XModuleManager > xCheck( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.ModuleManager" ) ), UNO_QUERY_THROW ); - - sal_Int32 nCount = xContainer->getCount(); - for ( sal_Int32 i=0; i xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); - ::rtl::OUString sModule = xCheck->identify( xFrame ); - if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) - return xFrame; - } - catch( const UnknownModuleException& ) - { - // silence - } - catch(const Exception&) - { - // re-throw, caught below - throw; - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return NULL; - } -} - -SfxFrame* SfxFrame::CreateBlank() -{ - SfxFrame* pFrame = NULL; - try - { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); - pFrame = Create( xFrame ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return pFrame; -} - -SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) -{ - SfxFrame* pFrame = NULL; - try - { - // create and initialize new top level frame for this window - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); - - Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); - xFrame->initialize( xWin.get() ); - xDesktop->getFrames()->append( xFrame ); - - if ( xWin->isActive() ) - xFrame->activate(); - - // create load arguments - Sequence< PropertyValue > aLoadArgs; - TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs ); - - ::comphelper::NamedValueCollection aArgs( aLoadArgs ); - aArgs.put( "Model", rDoc.GetModel() ); - aArgs.put( "Hidden", bHidden ); - if ( nViewId ) - aArgs.put( "ViewId", nViewId ); - - aLoadArgs = aArgs.getPropertyValues(); - - // load the doc into that frame - Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); - xLoader->loadComponentFromURL( - rDoc.GetModel()->getURL(), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), - 0, - aLoadArgs - ); - - for ( pFrame = SfxFrame::GetFirst(); - pFrame; - pFrame = SfxFrame::GetNext( *pFrame ) - ) - { - if ( pFrame->GetFrameInterface() == xFrame ) - break; - } - - OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return pFrame; -} - -SfxFrame* SfxFrame::Create( Reference < XFrame > xFrame ) -{ - // create a new TopFrame to an external XFrame object ( wrap controller ) - ENSURE_OR_THROW( xFrame.is(), "NULL frame not allowed" ); - Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); - - SfxFrame* pFrame = new SfxFrame( *pWindow, false ); - pFrame->SetFrameInterface_Impl( xFrame ); - return pFrame; -} - -SfxFrame::SfxFrame( Window& i_rContainerWindow, bool i_bHidden ) - :pParentFrame( NULL ) - ,pChildArr( NULL ) - ,pImp( NULL ) - ,pWindow( NULL ) -{ - Construct_Impl(); - - pImp->bHidden = i_bHidden; - InsertTopFrame_Impl( this ); - pImp->pExternalContainerWindow = &i_rContainerWindow; - - pWindow = new SfxTopWindow_Impl( this, i_rContainerWindow ); - - // always show pWindow, which is the ComponentWindow of the XFrame we live in - // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame - // is not done at level of the container window, not at SFX level. Thus, the component window can - // always be visible. - pWindow->Show(); -} - -void SfxFrame::SetPresentationMode( BOOL bSet ) -{ - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode - - SetMenuBarOn_Impl( !bSet ); - if ( GetWorkWindow_Impl() ) - GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); -} - -SystemWindow* SfxFrame::GetSystemWindow() const -{ - return GetTopWindow_Impl(); -} - -SystemWindow* SfxFrame::GetTopWindow_Impl() const -{ - if ( pImp->pExternalContainerWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pExternalContainerWindow; - else - return NULL; -} - -Window& SfxFrame::GetWindow() const -{ - return *pWindow; -} - -sal_Bool SfxFrame::Close() -{ - delete this; - return sal_True; -} - -void SfxFrame::LockResize_Impl( BOOL bLock ) -{ - pImp->bLockResize = bLock; -} - -IMPL_LINK( SfxTopWindow_Impl, CloserHdl, void*, EMPTYARG ) -{ - if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) - return 0L; - - if ( pFrame ) - pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); - return 0L; -} - -void SfxFrame::SetMenuBarOn_Impl( BOOL bOn ) -{ - pImp->bMenuBarOn = bOn; - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - { - rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); - - if ( bOn ) - xLayoutManager->showElement( aMenuBarURL ); - else - xLayoutManager->hideElement( aMenuBarURL ); - } -} - -BOOL SfxFrame::IsMenuBarOn_Impl() const -{ - return pImp->bMenuBarOn; -} - -void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const -{ - Window *pWin = pImp->pExternalContainerWindow; - - // Groesse setzen - const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); - Point aPos( rWinArea.TopLeft() ); - Size aSz( rWinArea.GetSize() ); - if ( aSz.Width() && aSz.Height() ) - { - aPos.X() = Min(aPos.X(), - long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); - aPos.Y() = Min(aPos.Y(), - long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); - if ( aPos.X() + aSz.Width() < - aAppWindow.Width() + aSz.Width() / 2 && - aPos.Y() + aSz.Height() < - aAppWindow.Height() + aSz.Height() / 2 ) - { - pWin->SetPosPixel( aPos ); - pWin->SetOutputSizePixel( aSz ); - } - } -} - -namespace -{ - bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) - { - _o_viewData.realloc(0); - _o_viewId = 0; - - Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); - - if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) - return false; - - // obtain the ViewID from the view data - _o_viewId = 0; - if ( xViewData->getByIndex( 0 ) >>= _o_viewData ) - { - ::comphelper::NamedValueCollection aNamedUserData( _o_viewData ); - ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( sViewId.getLength() ) - { - sViewId = sViewId.copy( 4 ); // format is like in "view3" - _o_viewId = USHORT( sViewId.toInt32() ); - } - } - return true; - } -} - -sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ) -/* [Beschreibung] - */ -{ - OSL_PRECOND( rDoc.GetMedium(), "SfxFrame::InsertDocument_Impl: no medium -> no view!"); - if ( !rDoc.GetMedium() ) - return sal_False; - - OSL_PRECOND( GetCurrentViewFrame() == NULL, - "SfxObjectShell::InsertDocument_Impl: no support (anymore) for loading into a non-empty frame!" ); - // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays - // done in higher layers, namely in the framework. - if ( GetCurrentViewFrame() != NULL ) - return sal_False; - - OSL_PRECOND( GetCurrentDocument() == NULL, - "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - - SFX_ITEMSET_ARG( &rSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size - SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID - SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom - SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden - SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only - SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) - SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) - - // hidden? - pImp->bHidden = pHidItem ? pHidItem->GetValue() : pImp->bHidden; - - // plugin mode - const USHORT nPluginMode = pPluginMode ? pPluginMode->GetValue() : 0; - - // view only? - if ( pEditItem && pEditItem->GetValue() ) - SetMenuBarOn_Impl( FALSE ); - - // view ID - USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; - - if( !pImp->bHidden ) - rDoc.OwnerLock( sal_True ); - - Sequence< PropertyValue > aUserData; - bool bClearPosSizeZoom = false; - bool bReadUserData = false; - - // if no view-related data exists in the set, then obtain the view data from the model - if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) - { - if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) - { - SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - bClearPosSizeZoom = bReadUserData = true; - } - } - - UpdateDescriptor( &rDoc ); - - if ( nPluginMode && ( nPluginMode != 2 ) ) - SetInPlace_Impl( TRUE ); - - SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); - OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); - if ( !pViewFrame ) - // TODO: better error handling? Under which conditions can this fail? - return sal_False; - - if ( nPluginMode == 1 ) - { - pViewFrame->ForceOuterResize_Impl( FALSE ); - pViewFrame->GetBindings().HidePopups(TRUE); - - // MBA: layoutmanager of inplace frame starts locked and invisible - GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - GetWorkWindow_Impl()->Lock_Impl( TRUE ); - - GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - - OSL_ENSURE( ( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT ) - || ( pJumpItem == NULL ), - "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); - // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time - // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method - // here is never called before the load process finished. At least not with a jump item != NULL. - if( pJumpItem ) - { - pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); - } - - // Position und Groesse setzen - if ( pAreaItem ) - PositionWindow_Impl( pAreaItem->GetValue() ); - - if ( !pImp->bHidden ) - { - if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) - pViewFrame->GetDispatcher()->HideUI( TRUE ); - else - pViewFrame->GetDispatcher()->HideUI( FALSE ); - - if ( IsInPlace() ) - pViewFrame->LockAdjustPosSizePixel(); - - if ( ( nPluginMode == 3 ) ) - GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); - - if ( !IsInPlace() ) - pViewFrame->GetDispatcher()->Update_Impl(); - pViewFrame->Show(); - GetWindow().Show(); - if ( !IsInPlace() || ( nPluginMode == 3 ) ) - pViewFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); - rDoc.OwnerLock( sal_False ); - - if ( IsInPlace() ) - { - pViewFrame->UnlockAdjustPosSizePixel(); - // force resize for OLE server to fix layout problems of writer and math - // see i53651 - if ( nPluginMode == 3 ) - pViewFrame->Resize(TRUE); - } - } - else - { - DBG_ASSERT( !IsInPlace() && !pPluginMode, "Special modes not compatible with hidden mode!" ); - GetWindow().Show(); - } - - // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! - pViewFrame->UpdateTitle(); - - if ( !IsInPlace() ) - { - pViewFrame->Resize(TRUE); - } - - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); - - if ( bClearPosSizeZoom ) - { - SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - pMediumSet->ClearItem( SID_VIEW_POS_SIZE ); - pMediumSet->ClearItem( SID_WIN_POSSIZE ); - pMediumSet->ClearItem( SID_VIEW_ZOOM_MODE ); - } - - if ( bReadUserData ) - { - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) - { - pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); - } - } - - return GetCurrentDocument() == &rDoc; -} - - -//======================================================================== - -long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg ) -{ - ((SfxViewFrame*)pArg)->GetFrame()->DoClose(); - return 0; -} - -//-------------------------------------------------------------------- -String SfxViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort - den neuen Titel vom der zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxViewFrame *pTop = SfxViewFrame::GetFirst( this ); - pTop; - pTop = SfxViewFrame::GetNext( this ); - { - pTop->UpdateTitle(); - ... pTop->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - DBG_CHKTHIS(SfxViewFrame, 0); - - const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); - pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); - - SfxObjectShell *pObjSh = GetObjectShell(); - if ( !pObjSh ) - return String(); - -// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// // kein UpdateTitle mit Embedded-ObjectShell -// return String(); - - const SfxMedium *pMedium = pObjSh->GetMedium(); - String aURL; - GetFrame(); // -Wall required?? - if ( pObjSh->HasName() ) - { - INetURLObject aTmp( pMedium->GetName() ); - aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - } - - if ( aURL != pImp->aActualURL ) - // URL hat sich ge"andert - pImp->aActualURL = aURL; - - // gibt es noch eine weitere View? - sal_uInt16 nViews=0; - for ( SfxViewFrame *pView= GetFirst(pObjSh); - pView && nViews<2; - pView = GetNext(*pView,pObjSh) ) - if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && - !IsDowning_Impl()) - nViews++; - - // Titel des Fensters - String aTitle; - if ( nViews == 2 || pImp->nDocViewNo > 1 ) - // dann die Nummer dranh"angen - aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); - else - aTitle = pObjSh->UpdateTitle(); - - // Name des SbxObjects - String aSbxName = pObjSh->SfxShell::GetName(); - if ( IsVisible_Impl() ) - { - aSbxName += ':'; - aSbxName += String::CreateFromInt32(pImp->nDocViewNo); - } - - SetName( aSbxName ); - pImp->aFrameTitle = aTitle; - GetBindings().Invalidate( SID_FRAMETITLE ); - GetBindings().Invalidate( SID_CURRENT_URL ); - - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifndef PRODUCT - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - GetBindings().Invalidate( SID_NEWDOCDIRECT ); - - /* AS_TITLE - Window* pWindow = GetFrame()->GetTopWindow_Impl(); - if ( pWindow && pWindow->GetText() != aTitle ) - pWindow->SetText( aTitle ); - */ - return aTitle; -} - -void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) -{ - // Wenn gerade die Shells ausgetauscht werden... - if ( !GetObjectShell() || !GetViewShell() ) - return; - - switch ( rReq.GetSlot() ) - { - case SID_SHOWPOPUPS : - { - SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); - BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; - SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); - USHORT nId = pIdItem ? pIdItem->GetValue() : 0; - - // ausfuehren - SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl(); - if ( bShow ) - { - // Zuerst die Floats auch anzeigbar machen - pWorkWin->MakeChildsVisible_Impl( bShow ); - GetDispatcher()->Update_Impl( TRUE ); - - // Dann anzeigen - GetBindings().HidePopups( !bShow ); - } - else - { - // Alles hiden - SfxBindings *pBind = &GetBindings(); - while ( pBind ) - { - pBind->HidePopupCtrls_Impl( !bShow ); - pBind = pBind->GetSubBindings_Impl(); - } - - pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); - pWorkWin->MakeChildsVisible_Impl( bShow ); - } - - Invalidate( rReq.GetSlot() ); - rReq.Done(); - break; - } - - case SID_ACTIVATE: - { - MakeActive_Impl( TRUE ); - rReq.SetReturnValue( SfxObjectItem( 0, this ) ); - break; - } - - case SID_WIN_POSSIZE: - break; - - case SID_NEWDOCDIRECT : - { - SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); - String aFactName; - if ( pFactoryItem ) - aFactName = pFactoryItem->GetValue(); - else if ( pImp->aFactoryName.Len() ) - aFactName = pImp->aFactoryName; - else - { - DBG_ERROR("Missing argument!"); - break; - } - - SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); - String aFact = String::CreateFromAscii("private:factory/"); - aFact += aFactName; - aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); - aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) ); - SFX_APP()->ExecuteSlot( aReq ); - const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); - if ( pItem ) - rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); - break; - } - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - break; - - if ( GetViewShell()->PrepareClose() ) - { - // weitere Views auf dasselbe Doc? - SfxObjectShell *pDocSh = GetObjectShell(); - int bOther = sal_False; - for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); - !bOther && pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) - bOther = (pFrame != this); - - // Doc braucht nur gefragt zu werden, wenn keine weitere View - sal_Bool bClosed = sal_False; - sal_Bool bUI = TRUE; - if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) - { - if ( !bOther ) - pDocSh->SetModified( FALSE ); - rReq.Done(); // unbedingt vor Close() rufen! - bClosed = sal_False; - try - { - xTask->close(sal_True); - bClosed = sal_True; - } - catch( CloseVetoException& ) - { - bClosed = sal_False; - } - } - - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); - } - return; - } - } - - rReq.Done(); -} - -void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - SfxObjectShell *pDocSh = GetObjectShell(); - - if ( !pDocSh ) - return; - - const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set ohne Bereich"); - while ( *pRanges ) - { - for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) - { - switch(nWhich) - { - case SID_NEWDOCDIRECT : - { - if ( pImp->aFactoryName.Len() ) - { - String aFact = String::CreateFromAscii("private:factory/"); - aFact += pImp->aFactoryName; - rSet.Put( SfxStringItem( nWhich, aFact ) ); - } - break; - } - - case SID_NEWWINDOW: - rSet.DisableItem(nWhich); - break; - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - rSet.DisableItem(nWhich); - break; - } - - case SID_SHOWPOPUPS : - break; - - case SID_WIN_POSSIZE: - { - rSet.Put( SfxRectangleItem( nWhich, Rectangle( - GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) ); - break; - } - - case SID_OBJECT: - if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) - { - uno::Any aAny; - aAny <<= GetViewShell()->GetVerbs(); - rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); - } - else - rSet.DisableItem( SID_OBJECT ); - break; - - default: - DBG_ERROR( "invalid message-id" ); - } - } - ++pRanges; - } -} - -void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) -{ - sal_uInt16 nSlotId = rRequest.GetSlot(); - switch( nSlotId ) - { - case SID_BROWSE_FORWARD: - case SID_BROWSE_BACKWARD: - OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); - break; - case SID_CREATELINK: - { -/*! (pb) we need new implementation to create a link -*/ - break; - } - case SID_FOCUSURLBOX: - { - SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); - if( pCache ) - { - SfxControllerItem* pCtrl = pCache->GetItemLink(); - while( pCtrl ) - { - pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); - pCtrl = pCtrl->GetItemLink(); - } - } - } - } - - // Recording - rRequest.Done(); -} - -void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) -{ - rItemSet.DisableItem( SID_BROWSE_FORWARD ); - rItemSet.DisableItem( SID_BROWSE_BACKWARD ); - - // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen - SfxObjectShell *pDocSh = GetObjectShell(); - sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); - sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; - if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) - rItemSet.DisableItem( SID_CREATELINK ); -} - -void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) -{ - GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); -} - -void SfxViewFrame::Activate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_True; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} - -void SfxViewFrame::Deactivate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_False; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1d4f88b87ebc..a1855f061c78 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1466,7 +1466,7 @@ SfxViewFrame::SfxViewFrame pFrame->SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); Construct_Impl( pObjShell ); - pImp->pWindow = new SfxTopViewWin_Impl( this, pFrame->GetWindow() ); + pImp->pWindow = new SfxFrameViewWindow_Impl( this, pFrame->GetWindow() ); pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); pFrame->SetOwnsBindings_Impl( sal_True ); pFrame->CreateWorkWindow_Impl(); diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx new file mode 100644 index 000000000000..882c24b44ee1 --- /dev/null +++ b/sfx2/source/view/viewfrm2.cxx @@ -0,0 +1,536 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: topfrm.cxx,v $ + * $Revision: 1.97 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impviewframe.hxx" +#include "statcach.hxx" +#include "viewfac.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/ctrlitem.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/objitem.hxx" +#include "sfx2/objsh.hxx" +#include "sfx2/request.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; + +//------------------------------------------------------------------------ + +static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) +{ + uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); + ::rtl::OUString sVar; + if ( !xMM.is() ) + return sVar; + + try + { + ::comphelper::NamedValueCollection aAnalyzer( xMM->getByName( sDocService ) ); + sVar = aAnalyzer.getOrDefault( "ooSetupFactoryUIName", ::rtl::OUString() ); + } + catch( uno::Exception& ) + { + sVar = ::rtl::OUString(); + } + + return sVar; +} + +//-------------------------------------------------------------------- +void SfxFrameViewWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + SfxObjectShell* pDoc = pFrame->GetObjectShell(); + if ( pDoc && !pFrame->IsVisible_Impl() ) + pFrame->Show(); + + pFrame->Resize(); + } + else + Window::StateChanged( nStateChange ); +} + +void SfxFrameViewWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + pFrame->Resize(); +} + +static String _getTabString() +{ + String result; + + Reference < XMaterialHolder > xHolder( + ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); + if (xHolder.is()) + { + rtl::OUString aTabString; + Sequence< NamedValue > sMaterial; + if (xHolder->getMaterial() >>= sMaterial) { + for (int i=0; i < sMaterial.getLength(); i++) { + if ((sMaterial[i].Name.equalsAscii("title")) && + (sMaterial[i].Value >>= aTabString)) + { + result += ' '; + result += String(aTabString); + } + } + } + } + return result; +} + +//======================================================================== + +//-------------------------------------------------------------------- +String SfxViewFrame::UpdateTitle() + +/* [Beschreibung] + + Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort + den neuen Titel vom der zu besorgen. + + [Anmerkung] + + Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener + zuh"ort und dort auf den SFX_HINT_TITLECHANGED reagieren + m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) + jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung + nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. + + + [Beispiel] + + void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) + { + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + switch( ( (SfxSimpleHint&) rHint ).GetId() ) + { + case SFX_HINT_TITLECHANGED: + for ( SfxViewFrame *pTop = SfxViewFrame::GetFirst( this ); + pTop; + pTop = SfxViewFrame::GetNext( this ); + { + pTop->UpdateTitle(); + ... pTop->GetName() ... + } + break; + ... + } + } + } +*/ + +{ + DBG_CHKTHIS(SfxViewFrame, 0); + + const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); + pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); + + SfxObjectShell *pObjSh = GetObjectShell(); + if ( !pObjSh ) + return String(); + +// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +// // kein UpdateTitle mit Embedded-ObjectShell +// return String(); + + const SfxMedium *pMedium = pObjSh->GetMedium(); + String aURL; + GetFrame(); // -Wall required?? + if ( pObjSh->HasName() ) + { + INetURLObject aTmp( pMedium->GetName() ); + aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + } + + if ( aURL != pImp->aActualURL ) + // URL hat sich ge"andert + pImp->aActualURL = aURL; + + // gibt es noch eine weitere View? + sal_uInt16 nViews=0; + for ( SfxViewFrame *pView= GetFirst(pObjSh); + pView && nViews<2; + pView = GetNext(*pView,pObjSh) ) + if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && + !IsDowning_Impl()) + nViews++; + + // Titel des Fensters + String aTitle; + if ( nViews == 2 || pImp->nDocViewNo > 1 ) + // dann die Nummer dranh"angen + aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); + else + aTitle = pObjSh->UpdateTitle(); + + // Name des SbxObjects + String aSbxName = pObjSh->SfxShell::GetName(); + if ( IsVisible_Impl() ) + { + aSbxName += ':'; + aSbxName += String::CreateFromInt32(pImp->nDocViewNo); + } + + SetName( aSbxName ); + pImp->aFrameTitle = aTitle; + GetBindings().Invalidate( SID_FRAMETITLE ); + GetBindings().Invalidate( SID_CURRENT_URL ); + + ::rtl::OUString aProductName; + ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; + + aTitle += String::CreateFromAscii( " - " ); + aTitle += String(aProductName); + aTitle += ' '; + ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); + aTitle += String( GetModuleName_Impl( aDocServiceName ) ); +#ifndef PRODUCT + ::rtl::OUString aDefault; + aTitle += DEFINE_CONST_UNICODE(" ["); + String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); + aTitle += aVerId; + aTitle += ']'; +#endif + + // append TAB string if available + aTitle += _getTabString(); + + GetBindings().Invalidate( SID_NEWDOCDIRECT ); + + /* AS_TITLE + Window* pWindow = GetFrame()->GetTopWindow_Impl(); + if ( pWindow && pWindow->GetText() != aTitle ) + pWindow->SetText( aTitle ); + */ + return aTitle; +} + +void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) +{ + // Wenn gerade die Shells ausgetauscht werden... + if ( !GetObjectShell() || !GetViewShell() ) + return; + + switch ( rReq.GetSlot() ) + { + case SID_SHOWPOPUPS : + { + SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); + BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; + SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); + USHORT nId = pIdItem ? pIdItem->GetValue() : 0; + + // ausfuehren + SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl(); + if ( bShow ) + { + // Zuerst die Floats auch anzeigbar machen + pWorkWin->MakeChildsVisible_Impl( bShow ); + GetDispatcher()->Update_Impl( TRUE ); + + // Dann anzeigen + GetBindings().HidePopups( !bShow ); + } + else + { + // Alles hiden + SfxBindings *pBind = &GetBindings(); + while ( pBind ) + { + pBind->HidePopupCtrls_Impl( !bShow ); + pBind = pBind->GetSubBindings_Impl(); + } + + pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); + pWorkWin->MakeChildsVisible_Impl( bShow ); + } + + Invalidate( rReq.GetSlot() ); + rReq.Done(); + break; + } + + case SID_ACTIVATE: + { + MakeActive_Impl( TRUE ); + rReq.SetReturnValue( SfxObjectItem( 0, this ) ); + break; + } + + case SID_WIN_POSSIZE: + break; + + case SID_NEWDOCDIRECT : + { + SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); + String aFactName; + if ( pFactoryItem ) + aFactName = pFactoryItem->GetValue(); + else if ( pImp->aFactoryName.Len() ) + aFactName = pImp->aFactoryName; + else + { + DBG_ERROR("Missing argument!"); + break; + } + + SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); + String aFact = String::CreateFromAscii("private:factory/"); + aFact += aFactName; + aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); + aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); + aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) ); + SFX_APP()->ExecuteSlot( aReq ); + const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); + if ( pItem ) + rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); + break; + } + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + break; + + if ( GetViewShell()->PrepareClose() ) + { + // weitere Views auf dasselbe Doc? + SfxObjectShell *pDocSh = GetObjectShell(); + int bOther = sal_False; + for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); + !bOther && pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) + bOther = (pFrame != this); + + // Doc braucht nur gefragt zu werden, wenn keine weitere View + sal_Bool bClosed = sal_False; + sal_Bool bUI = TRUE; + if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) + { + if ( !bOther ) + pDocSh->SetModified( FALSE ); + rReq.Done(); // unbedingt vor Close() rufen! + bClosed = sal_False; + try + { + xTask->close(sal_True); + bClosed = sal_True; + } + catch( CloseVetoException& ) + { + bClosed = sal_False; + } + } + + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); + } + return; + } + } + + rReq.Done(); +} + +void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) +{ + SfxObjectShell *pDocSh = GetObjectShell(); + + if ( !pDocSh ) + return; + + const sal_uInt16 *pRanges = rSet.GetRanges(); + DBG_ASSERT(pRanges, "Set ohne Bereich"); + while ( *pRanges ) + { + for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) + { + switch(nWhich) + { + case SID_NEWDOCDIRECT : + { + if ( pImp->aFactoryName.Len() ) + { + String aFact = String::CreateFromAscii("private:factory/"); + aFact += pImp->aFactoryName; + rSet.Put( SfxStringItem( nWhich, aFact ) ); + } + break; + } + + case SID_NEWWINDOW: + rSet.DisableItem(nWhich); + break; + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + rSet.DisableItem(nWhich); + break; + } + + case SID_SHOWPOPUPS : + break; + + case SID_WIN_POSSIZE: + { + rSet.Put( SfxRectangleItem( nWhich, Rectangle( + GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) ); + break; + } + + case SID_OBJECT: + if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) + { + uno::Any aAny; + aAny <<= GetViewShell()->GetVerbs(); + rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); + } + else + rSet.DisableItem( SID_OBJECT ); + break; + + default: + DBG_ERROR( "invalid message-id" ); + } + } + ++pRanges; + } +} + +void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) +{ + sal_uInt16 nSlotId = rRequest.GetSlot(); + switch( nSlotId ) + { + case SID_BROWSE_FORWARD: + case SID_BROWSE_BACKWARD: + OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); + break; + case SID_CREATELINK: + { +/*! (pb) we need new implementation to create a link +*/ + break; + } + case SID_FOCUSURLBOX: + { + SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); + if( pCache ) + { + SfxControllerItem* pCtrl = pCache->GetItemLink(); + while( pCtrl ) + { + pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); + pCtrl = pCtrl->GetItemLink(); + } + } + } + } + + // Recording + rRequest.Done(); +} + +void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) +{ + rItemSet.DisableItem( SID_BROWSE_FORWARD ); + rItemSet.DisableItem( SID_BROWSE_BACKWARD ); + + // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen + SfxObjectShell *pDocSh = GetObjectShell(); + sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); + sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; + if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) + rItemSet.DisableItem( SID_CREATELINK ); +} + +void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) +{ + GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); +} + +void SfxViewFrame::Activate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_True; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} + +void SfxViewFrame::Deactivate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_False; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} -- cgit v1.2.3 From d8c02057bd821b073e0d8f94186d562783ab2d68 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 11:33:24 +0100 Subject: autorecovery: removed some unused members of SfxObjectShell_Impl --- sfx2/source/doc/objserv.cxx | 21 ++++----------------- sfx2/source/doc/objxtor.cxx | 25 ++----------------------- sfx2/source/inc/objshimp.hxx | 24 +----------------------- sfx2/source/view/viewfrm.cxx | 3 --- 4 files changed, 7 insertions(+), 66 deletions(-) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index e80ab038c26b..38883f44b12c 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -428,28 +428,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // collect data for dialog String aURL, aTitle; - if ( HasName() && !pImp->aNewName.Len() ) + if ( HasName() ) { aURL = GetMedium()->GetName(); aTitle = GetTitle(); } else { - if ( !pImp->aNewName.Len() ) - { - aURL = DEFINE_CONST_UNICODE( "private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - // aTitle = String( SfxResId( STR_NONAME ) ); - } - else - { - aURL = DEFINE_CONST_UNICODE( "[private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - aURL += DEFINE_CONST_UNICODE( "]" ); - INetURLObject aURLObj( pImp->aNewName ); - aURL += String(aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI )); - // aTitle = aURLObj.GetBase(); - } + aURL = DEFINE_CONST_UNICODE( "private:factory/" ); + aURL += String::CreateFromAscii( GetFactory().GetShortName() ); aTitle = GetTitle(); } @@ -1191,7 +1178,7 @@ void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet) case SID_CLOSING: { - rSet.Put( SfxBoolItem( SID_CLOSING, Get_Impl()->bInCloseEvent ) ); + rSet.Put( SfxBoolItem( SID_CLOSING, false ) ); break; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 0951457bc380..831ea5f64d5e 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -189,8 +189,6 @@ TYPEINIT1(SfxObjectShell, SfxShell); //-------------------------------------------------------------------- SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) :mpObjectContainer(0) - ,pAccMgr(0) - ,pCfgMgr( 0) ,pBasicManager( new SfxBasicManagerHolder ) ,rDocShell( _rDocShell ) ,aMacroMode( *this ) @@ -199,10 +197,8 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,nVisualDocumentNumber( USHRT_MAX) ,nDocumentSignatureState( SIGNATURESTATE_UNKNOWN ) ,nScriptingSignatureState( SIGNATURESTATE_UNKNOWN ) - ,bTemplateConfig( sal_False) ,bInList( sal_False) ,bClosing( sal_False) - ,bSetInPlaceObj( sal_False) ,bIsSaving( sal_False) ,bPasswd( sal_False) ,bIsTmp( sal_False) @@ -213,11 +209,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bInPrepareClose( sal_False ) ,bPreparedForClose( sal_False ) ,bWaitingForPicklist( sal_False ) - ,bModuleSearched( sal_False ) - ,bIsHelpObjSh( sal_False ) - ,bForbidCaching( sal_False ) ,bForbidReload( sal_False ) - ,bSupportsEventMacros( sal_True ) ,bBasicInitialized( sal_False ) ,bIsPrintJobCancelable( sal_True ) ,bOwnsStorage( sal_True ) @@ -236,30 +228,24 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bAllowShareControlFileClean( sal_True ) ,lErr(ERRCODE_NONE) ,nEventId ( 0) - ,bDoNotTouchDocInfo( sal_False ) ,pReloadTimer ( 0) ,pMarkData( 0 ) ,nLoadedFlags ( SFX_LOADED_MAINDOCUMENT ) ,nFlagsInProgress( 0 ) - ,bInFrame( sal_False ) ,bModalMode( sal_False ) ,bRunningMacro( sal_False ) ,bReloadAvailable( sal_False ) ,nAutoLoadLocks( 0 ) ,pModule( 0 ) - ,pFrame( 0 ) - ,pTbxConfig( 0 ) ,eFlags( SFXOBJECTSHELL_UNDEFINED ) ,bReadOnlyUI( sal_False ) ,bHiddenLockedByAPI( sal_False ) - ,bInCloseEvent( sal_False ) ,nStyleFilter( 0 ) ,bDisposing( sal_False ) ,m_bEnableSetModified( sal_True ) ,m_bIsModified( sal_False ) ,m_nMapUnit( MAP_100TH_MM ) ,m_bCreateTempStor( sal_False ) - ,m_xDocInfoListener() ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) { @@ -341,10 +327,6 @@ SfxObjectShell::~SfxObjectShell() SfxObjectShell::Close(); pImp->xModel = NULL; -// DELETEX(pImp->pEventConfig); -// DELETEX(pImp->pTbxConfig); -// DELETEX(pImp->pAccMgr); -// DELETEX(pImp->pCfgMgr); DELETEX(pImp->pReloadTimer ); SfxApplication *pSfxApp = SFX_APP(); @@ -881,12 +863,9 @@ void SfxObjectShell::SetModel( SfxBaseModel* pModel ) { OSL_ENSURE( !pImp->xModel.is() || pModel == NULL, "Model already set!" ); pImp->xModel = pModel; - if ( pModel ) { + if ( pModel ) + { pModel->addCloseListener( new SfxModelListener_Impl(this) ); - //pImp->m_xDocInfoListener = new SfxDocInfoListener_Impl(*this); - //uno::Reference xMB( - // pModel->getDocumentProperties(), uno::UNO_QUERY_THROW); - //xMB->addModifyListener(pImp->m_xDocInfoListener); } } diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index be19b263115e..5fbfd1f1716b 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -65,8 +65,6 @@ class SfxBasicManagerHolder; struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess { ::comphelper::EmbeddedObjectContainer* mpObjectContainer; - SfxAcceleratorManager* pAccMgr; - SfxConfigManager* pCfgMgr; SfxBasicManagerHolder* pBasicManager; SfxObjectShell& rDocShell; @@ -84,10 +82,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_uInt16 nVisualDocumentNumber; sal_Int16 nDocumentSignatureState; sal_Int16 nScriptingSignatureState; - sal_Bool bTemplateConfig:1, - bInList:1, // ob per First/Next erreichbar + sal_Bool bInList:1, // ob per First/Next erreichbar bClosing:1, // sal_True w"aehrend Close(), um Benachrichtigungs-Rekursionen zu verhindern - bSetInPlaceObj:1, // sal_True, falls bereits versucht wurde pInPlaceObject zu casten bIsSaving:1, bPasswd:1, bIsTmp:1, @@ -98,11 +94,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bInPrepareClose : 1, bPreparedForClose : 1, bWaitingForPicklist : 1,// Muss noch in die Pickliste - bModuleSearched : 1, - bIsHelpObjSh : 1, - bForbidCaching : 1, bForbidReload : 1, - bSupportsEventMacros: 1, bBasicInitialized :1, bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! bOwnsStorage:1, @@ -120,34 +112,23 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess m_bSharedXMLFlag:1, // whether the flag should be stored in xml file m_bAllowShareControlFileClean:1; // whether the flag should be stored in xml file - String aNewName; // Der Name, unter dem das Doc gespeichert - // werden soll IndexBitSet aBitSet; sal_uInt32 lErr; sal_uInt16 nEventId; // falls vor Activate noch ein // Open/Create gesendet werden mu/s - sal_Bool bDoNotTouchDocInfo; - AutoReloadTimer_Impl *pReloadTimer; MarkData_Impl* pMarkData; sal_uInt16 nLoadedFlags; sal_uInt16 nFlagsInProgress; - String aMark; - Size aViewSize; // wird leider vom Writer beim - sal_Bool bInFrame; // HTML-Import gebraucht sal_Bool bModalMode; sal_Bool bRunningMacro; sal_Bool bReloadAvailable; sal_uInt16 nAutoLoadLocks; SfxModule* pModule; - SfxFrame* pFrame; - SfxToolBoxConfig* pTbxConfig; SfxObjectShellFlags eFlags; - String aBaseURL; sal_Bool bReadOnlyUI; SvRefBaseRef xHeaderAttributes; sal_Bool bHiddenLockedByAPI; - sal_Bool bInCloseEvent; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel; sal_uInt16 nStyleFilter; sal_Bool bDisposing; @@ -161,9 +142,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bCreateTempStor; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xDocStorage; - ::com::sun::star::uno::Reference< - ::com::sun::star::util::XModifyListener > m_xDocInfoListener; - sal_Bool m_bIsInit; ::rtl::OUString m_aSharedFileURL; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index a1855f061c78..8d1cfeb0a740 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -677,9 +677,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False); SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False); - if( !pURLItem || pURLItem->GetValue() == xOldObj->GetMedium()->GetName() ) - xOldObj->Get_Impl()->bForbidCaching = sal_True; - sal_Bool bHasStorage = pMedium->HasStorage_Impl(); if( bHandsOff ) { -- cgit v1.2.3 From 8e928726e9ecef5a56c459df2c45764f32a73ec7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 12:29:14 +0100 Subject: autorecovery: streamlined InsertDocument_Impl, as preparation for moving its content into XModel2::createViewController or XController2::attachFrame or ... --- sfx2/inc/frmload.hxx | 10 +++---- sfx2/inc/sfx2/frame.hxx | 3 ++- sfx2/inc/sfx2/sfxsids.hrc | 4 +-- sfx2/source/appl/appdde.cxx | 5 +--- sfx2/source/appl/appuno.cxx | 8 ------ sfx2/source/doc/sfxbasemodel.cxx | 5 ++++ sfx2/source/view/frame2.cxx | 56 +++++++++++++++------------------------- sfx2/source/view/frmload.cxx | 33 +++++++++++------------ 8 files changed, 50 insertions(+), 74 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 4c677994cda6..7a1ecb9ce86a 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -122,12 +122,6 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument ) const; - sal_Bool impl_plugDocIntoFrame( - const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxFrame& i_rTargetFrame, - SfxObjectShell& i_rDocument - ) const; - void impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor @@ -141,6 +135,10 @@ private: SfxFrame* impl_getOrCreateEmptySfxFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) const; + + void impl_removeLoaderArguments( + ::comphelper::NamedValueCollection& io_rDescriptor + ); }; #endif diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 164b94174346..a19968002209 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -71,6 +71,7 @@ namespace com #include #include #include +#include class SvBorder; class SfxWorkWindow; @@ -218,7 +219,7 @@ public: SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ); + SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index f83d67043330..64161e96d043 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -579,8 +579,8 @@ #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) -#define SID_VIEW_ZOOM_MODE (SID_SFX_START + 521) -#define SID_VIEW_POS_SIZE (SID_SFX_START + 522) + // FREE, was SID_VIEW_ZOOM_MODE + // FREE, was SID_VIEW_POS_SIZE #define SID_VIEW_ID (SID_SFX_START + 523) // FREE, was SID_USER_DATA #define SID_VIEW_DATA (SID_SFX_START + 1582) diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 0fe1bb32162c..e21208fc43be 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -597,16 +597,13 @@ BOOL ImplDdeService::MakeTopic( const String& rNm ) SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, TRUE); // SfxBoolItem aHidden(SID_HIDDEN, TRUE); - // minimiert! - SfxUInt16Item aViewStat( SID_VIEW_ZOOM_MODE, 0 ); - SfxRectangleItem aRectItem( SID_VIEW_POS_SIZE, Rectangle() ); SfxBoolItem aSilent(SID_SILENT, TRUE); SfxDispatcher* pDispatcher = SFX_APP()->GetDispatcher_Impl(); const SfxPoolItem* pRet = pDispatcher->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, &aName, &aNewView, - &aViewStat,&aRectItem/*aHidden*/, + /*aHidden,*/ &aSilent, 0L ); if( pRet && pRet->ISA( SfxViewFrameItem ) && diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 1a1991a59e56..a47bb6b33454 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1020,8 +1020,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_WIN_POSSIZE ) == SFX_ITEM_SET ) nAdditional++; - // if ( rSet.GetItemState( SID_VIEW_POS_SIZE ) == SFX_ITEM_SET ) - // nAdditional++; if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET ) @@ -1521,12 +1519,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - SFX_ITEMSET_ARG( &rSet, pRectItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - if ( pRectItem ) - { - DBG_ERROR("PosSizeItem not supported yet!"); - } - if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sCharacterSet; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 62c96bf498f7..08ab2c257d69 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -4040,6 +4040,11 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie if ( !pViewShell->GetController().is() ) pViewShell->SetController( new SfxBaseController( pViewShell ) ); + // some initial view settings, coming from our most recent attachResource call + ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); + if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) + pViewFrame->GetFrame()->SetMenuBarOn_Impl( FALSE ); + return Reference< XController2 >( pViewShell->GetController(), UNO_QUERY_THROW ); } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index d035ecb5dcc6..6c11f22ab4f9 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -467,7 +467,7 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const namespace { - bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) + bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, sal_Int16& _o_viewId ) { _o_viewData.realloc(0); _o_viewId = 0; @@ -481,7 +481,6 @@ namespace return false; // obtain the ViewID from the view data - _o_viewId = 0; if ( xViewData->getByIndex( 0 ) >>= _o_viewData ) { ::comphelper::NamedValueCollection aNamedUserData( _o_viewData ); @@ -489,14 +488,14 @@ namespace if ( sViewId.getLength() ) { sViewId = sViewId.copy( 4 ); // format is like in "view3" - _o_viewId = USHORT( sViewId.toInt32() ); + _o_viewId = sal_Int16( sViewId.toInt32() ); } } return true; } } -sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ) +sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs ) /* [Beschreibung] */ { @@ -514,42 +513,35 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& OSL_PRECOND( GetCurrentDocument() == NULL, "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - SFX_ITEMSET_ARG( &rSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size - SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID - SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom - SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden - SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only - SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) - SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) + // view ID + sal_Int16 nViewId = 0; + const bool bHasViewId = i_rArgs.get_ensureType( "ViewId", nViewId ); - // hidden? - pImp->bHidden = pHidItem ? pHidItem->GetValue() : pImp->bHidden; + // jump mark + ::rtl::OUString sJumpMark; + const bool bHasJumpMark = i_rArgs.get_ensureType( "JumpMark", sJumpMark ); // plugin mode - const USHORT nPluginMode = pPluginMode ? pPluginMode->GetValue() : 0; - - // view only? - if ( pEditItem && pEditItem->GetValue() ) - SetMenuBarOn_Impl( FALSE ); - - // view ID - USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : 0; + sal_Int16 nPluginMode = 0; + const bool bHasPluginMode = i_rArgs.get_ensureType( "PluginMode", nPluginMode ); + // hidden? + pImp->bHidden = i_rArgs.getOrDefault( "Hidden", pImp->bHidden ); if( !pImp->bHidden ) rDoc.OwnerLock( sal_True ); Sequence< PropertyValue > aUserData; - bool bClearPosSizeZoom = false; + bool bClearWinPosSizeItem = false; bool bReadUserData = false; // if no view-related data exists in the set, then obtain the view data from the model - if ( !pJumpItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) + if ( !bHasJumpMark && !bHasPluginMode && !bHasViewId ) { if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - bClearPosSizeZoom = bReadUserData = true; + bClearWinPosSizeItem = bReadUserData = true; } } @@ -578,20 +570,16 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& } OSL_ENSURE( ( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT ) - || ( pJumpItem == NULL ), + || ( !bHasJumpMark ), "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method // here is never called before the load process finished. At least not with a jump item != NULL. - if( pJumpItem ) + if( bHasJumpMark ) { - pViewFrame->GetViewShell()->JumpToMark( pJumpItem->GetValue() ); + pViewFrame->GetViewShell()->JumpToMark( sJumpMark ); } - // Position und Groesse setzen - if ( pAreaItem ) - PositionWindow_Impl( pAreaItem->GetValue() ); - if ( !pImp->bHidden ) { if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) @@ -624,7 +612,7 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& } else { - DBG_ASSERT( !IsInPlace() && !pPluginMode, "Special modes not compatible with hidden mode!" ); + DBG_ASSERT( !IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); GetWindow().Show(); } @@ -638,12 +626,10 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); - if ( bClearPosSizeZoom ) + if ( bClearWinPosSizeItem ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - pMediumSet->ClearItem( SID_VIEW_POS_SIZE ); pMediumSet->ClearItem( SID_WIN_POSSIZE ); - pMediumSet->ClearItem( SID_VIEW_ZOOM_MODE ); } if ( bReadUserData ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index fae80950d925..83321f3e98ac 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -355,15 +355,6 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti } } -// -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedValueCollection& i_rDescriptor, - SfxFrame& i_rTargetFrame, SfxObjectShell& i_rDocument ) const -{ - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - return i_rTargetFrame.InsertDocument_Impl( i_rDocument, aSet ); -} - // -------------------------------------------------------------------------------------------------------------------- SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel >& i_rxDocument ) const { @@ -468,11 +459,11 @@ void SfxFrameLoader_Impl::impl_handleCaughtError_nothrow( const Any& i_rCaughtEr ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); pRequest->addContinuation( pApprove.get() ); - const Reference< XInteractionHandler2 > xHandler( xInteraction, UNO_QUERY_THROW ); + const Reference< XInteractionHandler2 > xHandler( xInteraction, UNO_QUERY ); #if OSL_DEBUG_LEVEL > 0 const sal_Bool bHandled = #endif - xHandler->handleInteractionRequest( pRequest.get() ); + xHandler.is() && xHandler->handleInteractionRequest( pRequest.get() ); #if OSL_DEBUG_LEVEL > 0 if ( !bHandled ) @@ -487,6 +478,14 @@ void SfxFrameLoader_Impl::impl_handleCaughtError_nothrow( const Any& i_rCaughtEr } } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + // remove the arguments which are for the loader only, and not for a call to attachResource + io_rDescriptor.remove( "StatusIndicator" ); + io_rDescriptor.remove( "Model" ); +} + // -------------------------------------------------------------------------------------------------------------------- sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, const Reference< XFrame >& _rTargetFrame ) @@ -571,10 +570,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA { xLoadable->initNew(); - ::comphelper::NamedValueCollection aArgs( aDescriptor ); - aArgs.remove( "StatusIndicator" ); // TODO: why this? - - xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); + impl_removeLoaderArguments( aDescriptor ); + xModel->attachResource( ::rtl::OUString(), aDescriptor.getPropertyValues() ); } else { @@ -583,7 +580,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } else { - // tell the doc its load args. + // tell the doc its (current) load args. xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could @@ -611,8 +608,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); wFrame = pTargetFrame; - // insert the document into the frame - if ( !impl_plugDocIntoFrame( aDescriptor, *pTargetFrame, *xDoc ) ) + // plug the document into the frame + if ( !pTargetFrame->InsertDocument_Impl( *xDoc, aDescriptor ) ) throw RuntimeException(); if ( !bExternalModel ) -- cgit v1.2.3 From b65cac5336385cc2637bc835fcce745fd5fe7cb0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 9 Dec 2009 12:48:52 +0100 Subject: autorecovery: removed SID_WIN_POSSIZE There were two places which wrote this item (one being the TransformParameters in appuno.cxx, one a GetState method at the view frame), and both had different opinions whether this item should be an SfxStringItem or an SfxRectangleItem. Also, there seemed to be no code at all which evaluated this item. --- sfx2/inc/sfx2/sfxsids.hrc | 2 +- sfx2/sdi/frmslots.sdi | 5 ----- sfx2/sdi/sfx.sdi | 27 --------------------------- sfx2/source/appl/appbas.cxx | 5 ----- sfx2/source/appl/appuno.cxx | 18 ------------------ sfx2/source/view/frame2.cxx | 23 +++++------------------ sfx2/source/view/viewfrm2.cxx | 10 ---------- 7 files changed, 6 insertions(+), 84 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 64161e96d043..c6d4771d97d5 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -733,7 +733,7 @@ #define SID_WIN_MINIMIZED (SID_SFX_START + 625) #define SID_WIN_MAXIMIZED (SID_SFX_START + 626) #define SID_WIN_FULLSCREEN (SID_SFX_START + 627) -#define SID_WIN_POSSIZE (SID_SFX_START + 628) + // FREE, was SID_WIN_POSSIZE #define SID_WIN_VISIBLE (SID_SFX_START + 629) #define SID_VIEWSHELL0 (SID_SFX_START + 630) diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 050c36e9d7d4..0b7ba4ea29c3 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -400,11 +400,6 @@ interface TopWindow : BrowseWindow [ StateMethod = StateView_Impl ; ] - SID_WIN_POSSIZE // ole(no) api(final/play/rec) - [ - ExecMethod = Exec_Impl ; - StateMethod = GetState_Impl ; - ] SID_CLOSEWIN // ole(no) api(final/play/rec) [ ExecMethod = Exec_Impl ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index efa2c0e23a92..7caf442758b1 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -399,33 +399,6 @@ SfxVoidItem AddWatch SID_BASICIDE_ADDWATCH GroupId = GID_MACRO; ] -//-------------------------------------------------------------------------- -SfxRectangleItem Area SID_WIN_POSSIZE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - //-------------------------------------------------------------------------- SfxStringItem Author SID_DOCINFO_AUTHOR diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 042ab05318b5..bb7d2eddbbbd 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -425,11 +425,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) break; } - case SID_WIN_POSSIZE: - { - break; - } - case SID_INTERACTIVEMODE: { break; diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index a47bb6b33454..4d2a1f234ba6 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -181,7 +181,6 @@ static const String sMacroExecMode = String::CreateFromAscii( "Macr static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); static const String sMinimized = String::CreateFromAscii( "Minimized" ); static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sWindowState = String::CreateFromAscii( "WindowState" ); static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); @@ -741,14 +740,6 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName == sWindowState ) - { - ::rtl::OUString sVal; - sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); - DBG_ASSERT( bOK, "invalid type or value for WindowState" ); - if (bOK) - rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); - } else if ( aName == sTemplateName ) { ::rtl::OUString sVal; @@ -1018,8 +1009,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET ) nAdditional++; - if ( rSet.GetItemState( SID_WIN_POSSIZE ) == SFX_ITEM_SET ) - nAdditional++; if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET ) @@ -1175,8 +1164,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_CONTENTTYPE ) continue; - if ( nId == SID_WIN_POSSIZE ) - continue; if ( nId == SID_TEMPLATE_NAME ) continue; if ( nId == SID_TEMPLATE_REGIONNAME ) @@ -1498,11 +1485,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = sMediaType; pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = sWindowState; - pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); - } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sTemplateName; diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 6c11f22ab4f9..4c9f8bc912fb 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -530,18 +530,14 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper if( !pImp->bHidden ) rDoc.OwnerLock( sal_True ); - Sequence< PropertyValue > aUserData; - bool bClearWinPosSizeItem = false; - bool bReadUserData = false; - // if no view-related data exists in the set, then obtain the view data from the model + Sequence< PropertyValue > aUserData; if ( !bHasJumpMark && !bHasPluginMode && !bHasViewId ) { if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - bClearWinPosSizeItem = bReadUserData = true; } } @@ -626,20 +622,11 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); - if ( bClearWinPosSizeItem ) - { - SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - pMediumSet->ClearItem( SID_WIN_POSSIZE ); - } - - if ( bReadUserData ) + // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE + // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet + if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) { - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) - { - pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); - } + pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); } return GetCurrentDocument() == &rDoc; diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 882c24b44ee1..c7452978d564 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -323,9 +323,6 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) break; } - case SID_WIN_POSSIZE: - break; - case SID_NEWDOCDIRECT : { SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); @@ -441,13 +438,6 @@ void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) case SID_SHOWPOPUPS : break; - case SID_WIN_POSSIZE: - { - rSet.Put( SfxRectangleItem( nWhich, Rectangle( - GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) ); - break; - } - case SID_OBJECT: if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) { -- cgit v1.2.3 From 98e1ea0d79ca2db635662a3aacc6788f8a5c0df1 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Wed, 9 Dec 2009 19:34:40 +0100 Subject: #i71568# #i108349# Fixed copyright header. --- store/source/stordata.hxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 4610bac425fd..882ffa1d0109 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stordata.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORDATA_HXX_ -#define _STORE_STORDATA_HXX_ "$Revision: 1.6.8.2 $" +#define _STORE_STORDATA_HXX_ #include "sal/types.h" #include "sal/macros.h" -- cgit v1.2.3 From 66050b87257f26bb78134f8d40410360ff4bd384 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 12:41:09 +0100 Subject: autorecovery: moved some code from SfxFrame::InsertDocument_Impl to where the view is actually created (or connected) --- sfx2/inc/frmload.hxx | 5 ++ sfx2/inc/sfx2/frame.hxx | 1 + sfx2/source/control/dispatch.cxx | 1 + sfx2/source/doc/objmisc.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 16 ++++ sfx2/source/view/frame2.cxx | 133 ++------------------------------- sfx2/source/view/frmload.cxx | 44 +++++++++++ sfx2/source/view/sfxbasecontroller.cxx | 126 +++++++++++++++++++++++++++---- 8 files changed, 187 insertions(+), 141 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 7a1ecb9ce86a..2203c9d5dca9 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -139,6 +139,11 @@ private: void impl_removeLoaderArguments( ::comphelper::NamedValueCollection& io_rDescriptor ); + + void impl_determineViewID_nothrow( + const SfxObjectShell& i_rDocument, + ::comphelper::NamedValueCollection& io_rDescriptor + ); }; #endif diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index a19968002209..69a2a0238937 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -225,6 +225,7 @@ public: SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; SAL_DLLPRIVATE SystemWindow* GetTopWindow_Impl() const; SAL_DLLPRIVATE void PositionWindow_Impl( const Rectangle& rWinArea ) const; + SAL_DLLPRIVATE bool IsMarkedHidden_Impl() const; //#endif private: SAL_DLLPRIVATE void Construct_Impl(); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index a2697c4fe947..4684eb5e5182 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -530,6 +530,7 @@ void SfxDispatcher::Pop else aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) &rShell ); aMsg += bDelete ? ") with delete" : ")"; + if ( bUntil ) aMsg += " (up to)"; DbgTrace( aMsg.GetBuffer() ); #endif diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 0648767fa549..ce0de006829c 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1552,7 +1552,7 @@ void SfxObjectShell::PositionView_Impl() sal_Bool SfxObjectShell::IsLoading() const /* [Beschreibung ] - Wurde bereits FinishedLoading aufgerufeb? */ + Has FinishedLoading been called? */ { return !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ); } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 08ab2c257d69..cfdb39819324 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -104,6 +104,7 @@ #include #include "viewfac.hxx" +#include "workwin.hxx" #include #include #include @@ -4045,6 +4046,21 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) pViewFrame->GetFrame()->SetMenuBarOn_Impl( FALSE ); + const sal_Int16 nPluginMode = aDocumentLoadArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + if ( nPluginMode == 1 ) + { + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups( TRUE ); + + SfxFrame* pFrame = pViewFrame->GetFrame(); + // MBA: layoutmanager of inplace frame starts locked and invisible + pFrame->GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + pFrame->GetWorkWindow_Impl()->Lock_Impl( TRUE ); + + pFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + return Reference< XController2 >( pViewShell->GetController(), UNO_QUERY_THROW ); } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 4c9f8bc912fb..90332a27536b 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -48,8 +48,6 @@ #include #include -#include -#include #include #include #include @@ -72,7 +70,6 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::lang::XComponent; using ::com::sun::star::frame::XComponentLoader; @@ -465,36 +462,6 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const } } -namespace -{ - bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, sal_Int16& _o_viewId ) - { - _o_viewData.realloc(0); - _o_viewId = 0; - - Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData = xViewDataSupplier->getViewData(); - - if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) - return false; - - // obtain the ViewID from the view data - if ( xViewData->getByIndex( 0 ) >>= _o_viewData ) - { - ::comphelper::NamedValueCollection aNamedUserData( _o_viewData ); - ::rtl::OUString sViewId = aNamedUserData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( sViewId.getLength() ) - { - sViewId = sViewId.copy( 4 ); // format is like in "view3" - _o_viewId = sal_Int16( sViewId.toInt32() ); - } - } - return true; - } -} - sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs ) /* [Beschreibung] */ @@ -514,12 +481,10 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); // view ID - sal_Int16 nViewId = 0; - const bool bHasViewId = i_rArgs.get_ensureType( "ViewId", nViewId ); + sal_Int16 nViewId = i_rArgs.getOrDefault( "ViewId", sal_Int16( 0 ) ); // jump mark - ::rtl::OUString sJumpMark; - const bool bHasJumpMark = i_rArgs.get_ensureType( "JumpMark", sJumpMark ); + const bool bHasJumpMark = i_rArgs.has( "JumpMark" ); // plugin mode sal_Int16 nPluginMode = 0; @@ -527,19 +492,6 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper // hidden? pImp->bHidden = i_rArgs.getOrDefault( "Hidden", pImp->bHidden ); - if( !pImp->bHidden ) - rDoc.OwnerLock( sal_True ); - - // if no view-related data exists in the set, then obtain the view data from the model - Sequence< PropertyValue > aUserData; - if ( !bHasJumpMark && !bHasPluginMode && !bHasViewId ) - { - if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) - { - SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); - pMediumSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - } - } UpdateDescriptor( &rDoc ); @@ -552,83 +504,10 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper // TODO: better error handling? Under which conditions can this fail? return sal_False; - if ( nPluginMode == 1 ) - { - pViewFrame->ForceOuterResize_Impl( FALSE ); - pViewFrame->GetBindings().HidePopups(TRUE); - - // MBA: layoutmanager of inplace frame starts locked and invisible - GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - GetWorkWindow_Impl()->Lock_Impl( TRUE ); - - GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - - OSL_ENSURE( ( ( rDoc.Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) == SFX_LOADED_MAINDOCUMENT ) - || ( !bHasJumpMark ), - "SfxFrame::InsertDocument_Impl: so this code wasn't dead?" ); - // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time - // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method - // here is never called before the load process finished. At least not with a jump item != NULL. - if( bHasJumpMark ) - { - pViewFrame->GetViewShell()->JumpToMark( sJumpMark ); - } - - if ( !pImp->bHidden ) - { - if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) - pViewFrame->GetDispatcher()->HideUI( TRUE ); - else - pViewFrame->GetDispatcher()->HideUI( FALSE ); - - if ( IsInPlace() ) - pViewFrame->LockAdjustPosSizePixel(); - - if ( ( nPluginMode == 3 ) ) - GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); - - if ( !IsInPlace() ) - pViewFrame->GetDispatcher()->Update_Impl(); - pViewFrame->Show(); - GetWindow().Show(); - if ( !IsInPlace() || ( nPluginMode == 3 ) ) - pViewFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); - rDoc.OwnerLock( sal_False ); - - if ( IsInPlace() ) - { - pViewFrame->UnlockAdjustPosSizePixel(); - // force resize for OLE server to fix layout problems of writer and math - // see i53651 - if ( nPluginMode == 3 ) - pViewFrame->Resize(TRUE); - } - } - else - { - DBG_ASSERT( !IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); - GetWindow().Show(); - } - - // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! - pViewFrame->UpdateTitle(); - - if ( !IsInPlace() ) - { - pViewFrame->Resize(TRUE); - } - - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), &rDoc ) ); - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pViewFrame && pViewFrame->GetViewShell() && aUserData.getLength() ) - { - pViewFrame->GetViewShell()->ReadUserDataSequence( aUserData, TRUE ); - } - return GetCurrentDocument() == &rDoc; } +bool SfxFrame::IsMarkedHidden_Impl() const +{ + return pImp->bHidden; +} diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 83321f3e98ac..8cfe536b6d17 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -54,6 +54,8 @@ #include #include #include +#include +#include /** === end UNO includes === **/ #include @@ -98,6 +100,8 @@ using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::makeAny; using ::com::sun::star::util::XCloseable; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; /** === end UNO using === **/ SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) @@ -486,6 +490,43 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo io_rDescriptor.remove( "Model" ); } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_determineViewID_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + if ( io_rDescriptor.has( "ViewId" ) ) + // nothing to do + return; + + try + { + Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData.set( xViewDataSupplier->getViewData() ); + + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + // no view data stored together with the model + return; + + // obtain the ViewID from the view data + Sequence< PropertyValue > aViewData; + if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) ) + return; + + ::comphelper::NamedValueCollection aNamedViewData( aViewData ); + ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( !sViewId.getLength() ) + return; + + sViewId = sViewId.copy( 4 ); // format is like in "view3" + io_rDescriptor.put( "ViewId", sal_Int16( sViewId.toInt32() ) ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + // -------------------------------------------------------------------------------------------------------------------- sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, const Reference< XFrame >& _rTargetFrame ) @@ -608,6 +649,9 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); wFrame = pTargetFrame; + // ensure the ID of the to-be-created view is in the descriptor, if possible + impl_determineViewID_nothrow( *xDoc, aDescriptor ); + // plug the document into the frame if ( !pTargetFrame->InsertDocument_Impl( *xDoc, aDescriptor ) ) throw RuntimeException(); diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 3fddeb98ae4b..1f4b9c37a9d2 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -121,6 +123,12 @@ using ::com::sun::star::lang::DisposedException; using ::com::sun::star::awt::XWindow; using ::com::sun::star::frame::XController; using ::com::sun::star::frame::XDispatchProvider; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Exception; namespace css = ::com::sun::star; struct GroupIDToCommandGroup @@ -603,6 +611,10 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame if ( m_pData->m_pViewShell ) { ConnectSfxFrame_Impl( E_CONNECT ); + + // attaching the frame to the controller is the last step in the creation of a new view, so notify this + SfxEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell() ); + SFX_APP()->NotifyEvent( aHint ); } } } @@ -1258,14 +1270,14 @@ BOOL SfxBaseController::HasMouseClickListeners_Impl() void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) { ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); - ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pViewFrame, "a view shell without a view frame is pretty pathological" ); const bool bConnect = ( i_eConnect != E_DISCONNECT ); // disable window and dispatcher - pActFrame->Enable( bConnect ); - pActFrame->GetDispatcher()->Lock( !bConnect ); + pViewFrame->Enable( bConnect ); + pViewFrame->GetDispatcher()->Lock( !bConnect ); if ( bConnect ) { @@ -1273,30 +1285,118 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) // RECONNECT, we're not allowed to push them if ( i_eConnect != E_RECONNECT ) { - pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); if ( m_pData->m_pViewShell->GetSubShell() ) - pActFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); m_pData->m_pViewShell->PushSubShells_Impl(); - pActFrame->GetDispatcher()->Flush(); + pViewFrame->GetDispatcher()->Flush(); } Window* pEditWin = m_pData->m_pViewShell->GetWindow(); if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() ) pEditWin->Show(); - if ( SfxViewFrame::Current() == pActFrame ) - pActFrame->GetDispatcher()->Update_Impl( sal_True ); + if ( SfxViewFrame::Current() == pViewFrame ) + pViewFrame->GetDispatcher()->Update_Impl( sal_True ); - Window* pFrameWin = &pActFrame->GetWindow(); - if ( pFrameWin != &pActFrame->GetFrame()->GetWindow() ) + Window* pFrameWin = &pViewFrame->GetWindow(); + if ( pFrameWin != &pViewFrame->GetFrame()->GetWindow() ) pFrameWin->Show(); + + if ( i_eConnect == E_CONNECT ) + { + ::comphelper::NamedValueCollection aDocumentArgs( getModel()->getArgs() ); + + const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + const bool bHasPluginMode = ( nPluginMode != 0 ); + + SfxFrame* pFrame = pViewFrame->GetFrame(); + SfxObjectShell& rDoc = *m_pData->m_pViewShell->GetObjectShell(); + if ( !pFrame->IsMarkedHidden_Impl() ) + { + if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) + pViewFrame->GetDispatcher()->HideUI( TRUE ); + else + pViewFrame->GetDispatcher()->HideUI( FALSE ); + + if ( pFrame->IsInPlace() ) + pViewFrame->LockAdjustPosSizePixel(); + + if ( nPluginMode == 3 ) + pFrame->GetWorkWindow_Impl()->SetInternalDockingAllowed( FALSE ); + + if ( !pFrame->IsInPlace() ) + pViewFrame->GetDispatcher()->Update_Impl(); + pViewFrame->Show(); + pFrame->GetWindow().Show(); + if ( !pFrame->IsInPlace() || ( nPluginMode == 3 ) ) + pViewFrame->MakeActive_Impl( pFrame->GetFrameInterface()->isActive() ); + + if ( pFrame->IsInPlace() ) + { + pViewFrame->UnlockAdjustPosSizePixel(); + // force resize for OLE server to fix layout problems of writer and math + // see i53651 + if ( nPluginMode == 3 ) + pViewFrame->Resize( TRUE ); + } + } + else + { + DBG_ASSERT( !pFrame->IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); + pFrame->GetWindow().Show(); + } + + // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! + pViewFrame->UpdateTitle(); + + if ( !pFrame->IsInPlace() ) + pViewFrame->Resize( TRUE ); + + // if there's a JumpMark given, then, well, jump to it + const ::rtl::OUString sJumpMark = aDocumentArgs.getOrDefault( "JumpMark", ::rtl::OUString() ); + const bool bHasJumpMark = ( sJumpMark.getLength() > 0 ); + OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) + || ( !sJumpMark.getLength() ), + "SfxBaseController::ConnectSfxFrame_Impl: so this code wasn't dead?" ); + // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method + // here is never called before the load process finished. At least not with a non-empty jump mark + if ( sJumpMark.getLength() ) + m_pData->m_pViewShell->JumpToMark( sJumpMark ); + + // if no plugin mode and no jump mark was supplied, check whether the document itself can provide view data, and + // if so, forward it to the view/shell. + if ( !bHasPluginMode && !bHasJumpMark ) + { + try + { + Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); + if ( xViewData.is() && xViewData->getCount() > 0 ) + { + Sequence< PropertyValue > aViewData; + if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) ) + { + m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } } // invalidate slot corresponding to the view shell - const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pActFrame->GetCurViewId(), USHRT_MAX ); + const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pViewFrame->GetCurViewId(), USHRT_MAX ); DBG_ASSERT( nViewNo != USHRT_MAX, "view shell id not found" ); if ( nViewNo != USHRT_MAX ) - pActFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 ); + pViewFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 ); } //============================================================================= -- cgit v1.2.3 From 9fb19fd9f062adc0bb778258c5e65d57ff794e09 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 12:41:28 +0100 Subject: autorecovery: when doing a loadComponentFromURL with an existing model, ensure this also works for unsaved documents --- sfx2/inc/sfx2/docfac.hxx | 1 + sfx2/source/doc/docfac.cxx | 8 ++++++++ sfx2/source/view/frame2.cxx | 6 +++++- sfx2/source/view/viewfrm.cxx | 7 +------ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index 52e6c5e579a7..117cc2ef69ba 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -85,6 +85,7 @@ public: const SvGlobalName& GetClassId() const; SfxObjectShellFlags GetFlags() { return nFlags; } const char* GetShortName() const { return pShortName; } + String GetFactoryURL() const; // shortcut for "private:factory/GetShortName()" String GetFactoryName() const { return String::CreateFromAscii( pShortName ); } String GetModuleName() const; void SetDocumentTypeNameResource( const ResId& rId ); diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 0a4150604d27..dd8b6ea3dd67 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -287,6 +287,14 @@ const SvGlobalName& SfxObjectFactory::GetClassId() const return pImpl->aClassName; } +String SfxObjectFactory::GetFactoryURL() const +{ + ::rtl::OUStringBuffer aURLComposer; + aURLComposer.appendAscii( "private:factory/" ); + aURLComposer.appendAscii( GetShortName() ); + return aURLComposer.makeStringAndClear(); +} + String SfxObjectFactory::GetModuleName() const { static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 90332a27536b..5373c1cd20b7 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -285,9 +285,13 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewI aLoadArgs = aArgs.getPropertyValues(); // load the doc into that frame + ::rtl::OUString sLoaderURL( rDoc.GetModel()->getURL() ); + if ( sLoaderURL.getLength() == 0 ) + sLoaderURL = rDoc.GetFactory().GetFactoryURL(); + Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( - rDoc.GetModel()->getURL(), + sLoaderURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), 0, aLoadArgs diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 8d1cfeb0a740..e26db5bb6f67 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2107,12 +2107,7 @@ void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const R ::rtl::OUString sURL( xDocument->getURL() ); if ( !sURL.getLength() ) - { - ::rtl::OUStringBuffer aURLComposer; - aURLComposer.appendAscii( "private:factory/" ); - aURLComposer.appendAscii( i_rDoc.GetFactory().GetShortName() ); - sURL = aURLComposer.makeStringAndClear(); - } + sURL = i_rDoc.GetFactory().GetFactoryURL(); Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, -- cgit v1.2.3 From e0a675a1176ca73bc681ca89654a13d9856b1717 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 12:41:41 +0100 Subject: autorecovery: Basic IDE now again loads in the start module frame, if applicable --- sfx2/source/appl/appserv.cxx | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index a5dc0df6ffe1..02cb82963930 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -95,6 +95,7 @@ #include #include +#include #include #include "about.hxx" @@ -841,6 +842,42 @@ namespace } return pView; } + Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext ) + { + try + { + Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); + + Reference< XModuleManager > xCheck( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + + sal_Int32 nCount = xContainer->getCount(); + for ( sal_Int32 i=0; i xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); + ::rtl::OUString sModule = xCheck->identify( xFrame ); + if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) + return xFrame; + } + catch( const UnknownModuleException& ) + { + // silence + } + catch(const Exception&) + { + // re-throw, caught below + throw; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } } void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) @@ -942,8 +979,9 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) aLoadArgs.put( "Model", pBasicIDE->GetModel() ); aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); - SfxFrame* pFrame = SfxFrame::CreateBlank(); - ENSURE_OR_THROW( pFrame, "could not create a blank SfxFrame" ); + Reference< XFrame > xStartModuleFrame( lcl_findStartModuleFrame( aContext ) ); + SfxFrame* pFrame = xStartModuleFrame.is() ? SfxFrame::Create( xStartModuleFrame ) : SfxFrame::CreateBlank(); + ENSURE_OR_THROW( pFrame, "could not create a SfxFrame to load the Basic IDE into!" ); xLoader->load( aLoadArgs.getPropertyValues(), pFrame->GetFrameInterface() ); } -- cgit v1.2.3 From 54cf384db65016c68e21da62a427e383f8d180f8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 13:20:56 +0100 Subject: autorecovery: guard the creation of the SfxViewShell in Enter/LeaveRegistration --- sfx2/source/doc/sfxbasemodel.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index cfdb39819324..d3ac8ce66e93 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -4024,10 +4024,13 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie // determine the ViewFrame belonging to the given XFrame SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); + OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); // delegate to SFX' view factory SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( nViewNo ); + pViewFrame->GetBindings().ENTERREGISTRATIONS(); SfxViewShell* pViewShell = rViewFactory.CreateInstance( pViewFrame, pOldViewShell ); + pViewFrame->GetBindings().LEAVEREGISTRATIONS(); ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also -- cgit v1.2.3 From 807112dbfe64a5f287ed332549b8b8ea1f43b59f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 15:36:53 +0100 Subject: autorecovery: step 1 of final roll up of calling hierarchy --- sfx2/inc/frmload.hxx | 2 +- sfx2/inc/sfx2/frame.hxx | 2 +- sfx2/source/view/frame2.cxx | 43 ++++------------------------ sfx2/source/view/frmload.cxx | 67 ++++++++++++++++++++++++++------------------ 4 files changed, 47 insertions(+), 67 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 2203c9d5dca9..b2a59df1018c 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -140,7 +140,7 @@ private: ::comphelper::NamedValueCollection& io_rDescriptor ); - void impl_determineViewID_nothrow( + sal_Int16 impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor ); diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 69a2a0238937..a57feb7a8461 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -219,7 +219,7 @@ public: SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs ); + SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 5373c1cd20b7..d9aa7f6e3890 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -34,7 +34,6 @@ #include "impframe.hxx" #include "objshimp.hxx" #include "sfxhelp.hxx" -#include "viewfac.hxx" #include "workwin.hxx" #include "sfx2/app.hxx" @@ -466,49 +465,19 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const } } -sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs ) -/* [Beschreibung] - */ +void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs ) { - OSL_PRECOND( rDoc.GetMedium(), "SfxFrame::InsertDocument_Impl: no medium -> no view!"); - if ( !rDoc.GetMedium() ) - return sal_False; - - OSL_PRECOND( GetCurrentViewFrame() == NULL, - "SfxObjectShell::InsertDocument_Impl: no support (anymore) for loading into a non-empty frame!" ); - // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays - // done in higher layers, namely in the framework. - if ( GetCurrentViewFrame() != NULL ) - return sal_False; - - OSL_PRECOND( GetCurrentDocument() == NULL, - "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - - // view ID - sal_Int16 nViewId = i_rArgs.getOrDefault( "ViewId", sal_Int16( 0 ) ); - - // jump mark - const bool bHasJumpMark = i_rArgs.has( "JumpMark" ); - - // plugin mode - sal_Int16 nPluginMode = 0; - const bool bHasPluginMode = i_rArgs.get_ensureType( "PluginMode", nPluginMode ); - // hidden? + OSL_ENSURE( !pImp->bHidden, "when does this happen?" ); pImp->bHidden = i_rArgs.getOrDefault( "Hidden", pImp->bHidden ); - UpdateDescriptor( &rDoc ); + // update our descriptor + UpdateDescriptor( &i_rDoc ); + // plugin mode + sal_Int16 nPluginMode = i_rArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - - SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() ); - OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); - if ( !pViewFrame ) - // TODO: better error handling? Under which conditions can this fail? - return sal_False; - - return GetCurrentDocument() == &rDoc; } bool SfxFrame::IsMarkedHidden_Impl() const diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 8cfe536b6d17..55bbe6514420 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -33,6 +33,7 @@ #include "frmload.hxx" #include "objshimp.hxx" +#include "viewfac.hxx" #include "sfx2/app.hxx" #include "sfx2/dispatch.hxx" #include "sfx2/docfac.hxx" @@ -491,40 +492,46 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo } // -------------------------------------------------------------------------------------------------------------------- -void SfxFrameLoader_Impl::impl_determineViewID_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor ) +sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor ) { - if ( io_rDescriptor.has( "ViewId" ) ) - // nothing to do - return; - + sal_Int16 nViewId = io_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ); try { - Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY ); - Reference< XIndexAccess > xViewData; - if ( xViewDataSupplier.is() ) - xViewData.set( xViewDataSupplier->getViewData() ); - - if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) - // no view data stored together with the model - return; - - // obtain the ViewID from the view data - Sequence< PropertyValue > aViewData; - if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) ) - return; - - ::comphelper::NamedValueCollection aNamedViewData( aViewData ); - ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() ); - if ( !sViewId.getLength() ) - return; - - sViewId = sViewId.copy( 4 ); // format is like in "view3" - io_rDescriptor.put( "ViewId", sal_Int16( sViewId.toInt32() ) ); + if ( nViewId == 0 ) do + { + Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData.set( xViewDataSupplier->getViewData() ); + + if ( !xViewData.is() || ( xViewData->getCount() == 0 ) ) + // no view data stored together with the model + break; + + // obtain the ViewID from the view data + Sequence< PropertyValue > aViewData; + if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) ) + break; + + ::comphelper::NamedValueCollection aNamedViewData( aViewData ); + ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() ); + if ( !sViewId.getLength() ) + break; + + sViewId = sViewId.copy( 4 ); // format is like in "view3" + nViewId = sal_Int16( sViewId.toInt32() ); + io_rDescriptor.put( "ViewId", nViewId ); + } + while ( false ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + + if ( nViewId == 0 ) + nViewId = i_rDocument.GetFactory().GetViewFactory( 0 ).GetOrdinal(); + return nViewId; } // -------------------------------------------------------------------------------------------------------------------- @@ -649,11 +656,15 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); wFrame = pTargetFrame; + // prepare it + pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor ); + // ensure the ID of the to-be-created view is in the descriptor, if possible - impl_determineViewID_nothrow( *xDoc, aDescriptor ); + sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); // plug the document into the frame - if ( !pTargetFrame->InsertDocument_Impl( *xDoc, aDescriptor ) ) + SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *pTargetFrame, *xDoc, nViewId ); + if ( !pViewFrame ) throw RuntimeException(); if ( !bExternalModel ) -- cgit v1.2.3 From b0b2b403d0bdda9544a2d4b920367c410ed1680f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 10 Dec 2009 15:36:53 +0100 Subject: autorecovery: step 2 of final roll up of calling hierarchy --- sfx2/inc/sfx2/docfac.hxx | 5 +++- sfx2/inc/sfx2/viewfrm.hxx | 15 +++++------ sfx2/inc/viewfac.hxx | 3 +++ sfx2/source/doc/docfac.cxx | 17 +++++++++++- sfx2/source/doc/sfxbasemodel.cxx | 26 +++++------------- sfx2/source/view/frmload.cxx | 21 ++++++++++----- sfx2/source/view/sfxbasecontroller.cxx | 16 ++++++++---- sfx2/source/view/viewfac.cxx | 12 ++++++--- sfx2/source/view/viewfrm.cxx | 48 +++++----------------------------- 9 files changed, 77 insertions(+), 86 deletions(-) diff --git a/sfx2/inc/sfx2/docfac.hxx b/sfx2/inc/sfx2/docfac.hxx index 117cc2ef69ba..21ba8f1b3108 100644 --- a/sfx2/inc/sfx2/docfac.hxx +++ b/sfx2/inc/sfx2/docfac.hxx @@ -97,6 +97,9 @@ public: USHORT GetViewFactoryCount() const; SfxViewFactory& GetViewFactory(USHORT i = 0) const; + /// returns the view factory whose GetViewName delivers the requested logical name + SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const; + // Filter const SfxFilter* GetTemplateFilter() const; static String GetStandardTemplate( const String& rServiceName ); @@ -110,7 +113,7 @@ public: //#if 0 // _SOLAR__PRIVATE SAL_DLLPRIVATE void SetModule_Impl( SfxModule* ); SAL_DLLPRIVATE static void UpdateFilterContainers_Impl(); - SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ); + SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const; //#endif private: diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 80c98792e097..9afbdc1d1e21 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -307,26 +307,25 @@ public: SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); - SAL_DLLPRIVATE static SfxViewFrame* Create_Impl( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ); - -//#endif -private: - SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); - SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > LoadDocument_Impl( const SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rViewFactoryArgs, - const USHORT i_nViewId + const ::rtl::OUString& i_rViewName ); +//#endif +private: + SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); + SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); + /** loads a new view of our document into our frame This method completely bypasses the UNO loader mechanism, it exchanges the current view on SFX level. Use it for quick inplace view switches only. */ - SAL_DLLPRIVATE SfxViewShell* LoadNewSfxView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ); + SAL_DLLPRIVATE SfxViewShell* LoadNewSfxView_Impl( const ::rtl::OUString& i_rViewName, SfxViewShell* i_pOldShell ); /** loads the given existing document into the given frame diff --git a/sfx2/inc/viewfac.hxx b/sfx2/inc/viewfac.hxx index 24b4a860f0b0..f8342c9715d2 100644 --- a/sfx2/inc/viewfac.hxx +++ b/sfx2/inc/viewfac.hxx @@ -59,6 +59,9 @@ public: { return String( aDescription ); } USHORT GetOrdinal() const { return nOrd; } + /// returns an API-compatible view name. For the moment, this is "view" with an appended ordinal/ID + String GetViewName() const; + private: SfxViewCtor fnCreate; SfxViewInit fnInit; diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index dd8b6ea3dd67..51d50eec1062 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -322,7 +322,7 @@ String SfxObjectFactory::GetModuleName() const } -sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) +sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const { for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo ) { @@ -332,3 +332,18 @@ sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const s } return i_nFallback; } + +SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rViewName ) const +{ + SfxViewFactory* pViewFactory = NULL; + for ( USHORT nViewNo = 0; + nViewNo < GetViewFactoryCount(); + ++nViewNo + ) + { + SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) ); + if ( rViewFac.GetViewName() == i_rViewName ) + return &rViewFac; + } + return NULL; +} diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index d3ac8ce66e93..3da4816408d6 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3931,12 +3931,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewCon Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) - { - ::rtl::OUStringBuffer aViewName; - aViewName.appendAscii( "view" ); - aViewName.append( nViewNo ); - aViewNames[nViewNo] = aViewName.makeStringAndClear(); - } + aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName(); return aViewNames; } @@ -4002,17 +3997,9 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie if ( impl_isDisposed() ) throw lang::DisposedException(); - // number of view to create - if ( i_rViewName.indexOfAsciiL( "view", 4 ) != 0 ) - throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - const USHORT nViewId = (USHORT)i_rViewName.copy( 4 ).toInt32(); - - SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); - sal_Int32 nViewNo = -1; - for ( nViewNo = 0; nViewNo < rDocumentFactory.GetViewFactoryCount(); ++nViewNo ) - if ( rDocumentFactory.GetViewFactory( nViewNo ).GetOrdinal() == nViewId ) - break; - if ( nViewNo >= rDocumentFactory.GetViewFactoryCount() ) + // find the proper SFX view factory + SfxViewFactory* pViewFactory = GetObjectShell()->GetFactory().GetViewFactoryByViewName( i_rViewName ); + if ( !pViewFactory ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); // determine previous shell (used in some special cases) @@ -4027,9 +4014,8 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); // delegate to SFX' view factory - SfxViewFactory& rViewFactory = rDocumentFactory.GetViewFactory( nViewNo ); pViewFrame->GetBindings().ENTERREGISTRATIONS(); - SfxViewShell* pViewShell = rViewFactory.CreateInstance( pViewFrame, pOldViewShell ); + SfxViewShell* pViewShell = pViewFactory->CreateInstance( pViewFrame, pOldViewShell ); pViewFrame->GetBindings().LEAVEREGISTRATIONS(); ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); @@ -4038,7 +4024,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie pViewFrame->SetViewShell_Impl( pViewShell ); // remember ViewID - pViewFrame->SetCurViewId_Impl( rViewFactory.GetOrdinal() ); + pViewFrame->SetCurViewId_Impl( pViewFactory->GetOrdinal() ); // ensure a default controller, if the view shell did not provide an own implementation if ( !pViewShell->GetController().is() ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 55bbe6514420..318643bfb370 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -103,6 +103,7 @@ using ::com::sun::star::uno::makeAny; using ::com::sun::star::util::XCloseable; using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::frame::XController2; /** === end UNO using === **/ SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) @@ -518,9 +519,12 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO if ( !sViewId.getLength() ) break; - sViewId = sViewId.copy( 4 ); // format is like in "view3" - nViewId = sal_Int16( sViewId.toInt32() ); - io_rDescriptor.put( "ViewId", nViewId ); + // somewhat weird convention here ... in the view data, the ViewId is a string, effectively describing + // a view name. In the document load descriptor, the ViewId is in fact the numeric ID. + + SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId ); + if ( pViewFactory ) + io_rDescriptor.put( "ViewId", sal_Int16( pViewFactory->GetOrdinal() ) ); } while ( false ); } @@ -660,12 +664,15 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor ); // ensure the ID of the to-be-created view is in the descriptor, if possible - sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); + const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); + const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); // plug the document into the frame - SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *pTargetFrame, *xDoc, nViewId ); - if ( !pViewFrame ) - throw RuntimeException(); + Reference< XController2 > xController = SfxViewFrame::LoadDocument_Impl( + *xDoc, pTargetFrame->GetFrameInterface(), Sequence< PropertyValue >(), sViewName ); + ENSURE_OR_THROW( xController.is(), "invalid controller" ); + // this is expected to throw in case of a failure ... if ( !bExternalModel ) { diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 1f4b9c37a9d2..8db30fa0bc19 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -95,6 +95,7 @@ #include #include +#include "viewfac.hxx" #define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper #define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper @@ -565,13 +566,18 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run ::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !m_pData->m_pViewShell ) + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) throw DisposedException(); - ::rtl::OUStringBuffer sViewName; - sViewName.appendAscii( "view" ); - sViewName.append( sal_Int32( GetViewFrame_Impl()->GetCurViewId() ) ); - return sViewName.makeStringAndClear(); + const SfxObjectFactory& rDocFac( m_pData->m_pViewShell->GetObjectShell()->GetFactory() ); + sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl()->GetCurViewId(), rDocFac.GetViewFactoryCount() ); + OSL_ENSURE( nViewNo < rDocFac.GetViewFactoryCount(), "SfxBaseController::getViewControllerName: view ID not found in view factories!" ); + + ::rtl::OUString sViewName; + if ( nViewNo < rDocFac.GetViewFactoryCount() ) + sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName(); + + return sViewName; } SfxViewFrame* SfxBaseController::GetViewFrame_Impl() const diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index 2eff45e0501d..00e26579aea4 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -32,10 +32,8 @@ #include "precompiled_sfx2.hxx" // INCLUDE --------------------------------------------------------------- -#ifndef GCC -#endif - #include +#include #include "viewfac.hxx" // STATIC DATA ----------------------------------------------------------- @@ -54,6 +52,14 @@ void SfxViewFactory::InitFactory() (*fnInit)(); } +String SfxViewFactory::GetViewName() const +{ + ::rtl::OUStringBuffer aViewName; + aViewName.appendAscii( "view" ); + aViewName.append( GetOrdinal() ); + return aViewName.makeStringAndClear(); +} + // CTOR / DTOR ----------------------------------------------------------- SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e26db5bb6f67..7ca134ae0931 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2010,19 +2010,14 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const //-------------------------------------------------------------------- Reference< XController2 > SfxViewFrame::LoadDocument_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rViewFactoryArgs, - const USHORT i_nViewId ) + const ::rtl::OUString& i_rViewName ) { ENSURE_OR_THROW( i_rFrame.is(), "illegal frame" ); const Reference < XModel2 > xModel( i_rDoc.GetModel(), UNO_QUERY_THROW ); - ::rtl::OUStringBuffer sViewName; - sViewName.appendAscii( "view" ); - sViewName.append( sal_Int32( i_nViewId ) ); - // TODO: extend the SfxViewFactory with support for speaking view names - // let the model create a new controller const Reference< XController2 > xController( xModel->createViewController( - sViewName.makeStringAndClear(), + i_rViewName, i_rViewFactoryArgs, i_rFrame ), UNO_SET_THROW ); @@ -2115,7 +2110,7 @@ void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const R } //-------------------------------------------------------------------- -SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const USHORT i_nViewId, SfxViewShell* i_pOldShell ) +SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const ::rtl::OUString& i_rViewName , SfxViewShell* i_pOldShell ) { ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewSfxView_Impl: not allowed to be called with an exsiting view shell!" ); @@ -2128,7 +2123,7 @@ SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const USHORT i_nViewId, SfxView *GetObjectShell(), GetFrame()->GetFrameInterface(), aViewCreationArgs.getPropertyValues(), - i_nViewId + i_rViewName ); SfxViewShell* pViewShell = SfxViewShell::Get( xController.get() ); @@ -2204,36 +2199,6 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::Create_Impl( SfxFrame& i_rFrame, SfxObjectShell& i_rDoc, const USHORT i_nViewId ) -{ - SfxViewFrame* pViewFrame = NULL; - try - { - Reference< XController2 > xController = LoadDocument_Impl( - i_rDoc, i_rFrame.GetFrameInterface(), Sequence< PropertyValue >(), i_nViewId ); - ENSURE_OR_THROW( xController.is(), "invalid controller returned by LoadDocument_Impl" ); - // LoadDocument_Impl is expected to throw in case of a failure ... - - if ( xController.is() ) - { - pViewFrame = SfxViewFrame::Get( xController.get(), &i_rDoc ); - if ( !pViewFrame ) - { - OSL_ENSURE( false, "SfxViewFrame::Create_Impl: wrong controller implementation!" ); - Reference< XComponent > xComponent( xController, UNO_QUERY_THROW ); - xComponent->dispose(); - } - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return pViewFrame; -} - -//-------------------------------------------------------------------- - sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( sal_uInt16 nViewIdOrNo, /* > 0 @@ -2296,8 +2261,9 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl // create and load new ViewShell SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); - const sal_uInt16 nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; - SfxViewShell* pNewSh = LoadNewSfxView_Impl( nViewId, pOldSh ); + const sal_Int16 nViewNo = ( bIsIndex || !nViewIdOrNo ) ? nViewIdOrNo : rDocFact.GetViewNo_Impl( nViewIdOrNo, 0 ); + const ::rtl::OUString sViewName( rDocFact.GetViewFactory( nViewNo ).GetViewName() ); + SfxViewShell* pNewSh = LoadNewSfxView_Impl( sViewName, pOldSh ); // allow resize events to be processed UnlockAdjustPosSizePixel(); -- cgit v1.2.3 From 9ea766490e45eb6ec4f542bf147c1f310ffa5daf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 10:40:12 +0100 Subject: dba33e: removed wrong assertion (thanks to dtardon for the investigations and the fix) --- svtools/source/dialogs/wizardmachine.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index c436256a31c4..510cdba8c39b 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -93,7 +93,6 @@ namespace svt void OWizardPage::updateDialogTravelUI() { OWizardMachine* pWizardMachine = dynamic_cast< OWizardMachine* >( GetParent() ); - OSL_ENSURE( pWizardMachine, "OWizardPage::updateDialogTravelUI: where am I?" ); if ( pWizardMachine ) pWizardMachine->updateTravelUI(); } -- cgit v1.2.3 From 75c9a9a651d14ffd5e9756eebefacce6bc8fea67 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 10:43:27 +0100 Subject: dba33e: #i107327#: remove unused method (thanks to cmc) --- connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx | 6 ------ connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx | 1 - 2 files changed, 7 deletions(-) diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx index 74583bc41c18..7039e3fe797a 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -33,12 +33,6 @@ #include #include -ini_Section * IniParser::getSection(OUString const & secName) -{ - if (mAllSection.find(secName) != mAllSection.end()) - return &mAllSection[secName]; - return NULL; -} IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ) { OUString iniUrl; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx index 47777fdc12bf..0c97f081645e 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx @@ -75,7 +75,6 @@ class IniParser IniSectionMap mAllSection; public: IniSectionMap * getAllSection(){return &mAllSection;}; - ini_Section * getSection(OUString const & secName); IniParser(OUString const & rIniName) throw(com::sun::star::io::IOException ); #if OSL_DEBUG_LEVEL > 0 void Dump(); -- cgit v1.2.3 From 78e16138e84c0bbcf30695c007ea55e81bbbdad7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 11:28:14 +0100 Subject: autorecovery: made JumpMark a argument of the to-be-created view. For this purpose, the loader moves this argument from the loader args to the args which are later passed to XModel2.createViewController, and the Controller implementation retrieves it from there. (In this course, XController2.getCreationArguments has been introduced, and implemented in the two known XController2 implementations in the code base.) --- sfx2/inc/frmload.hxx | 5 ++++ sfx2/inc/sfx2/sfxbasecontroller.hxx | 4 ++- sfx2/inc/sfx2/viewsh.hxx | 2 ++ sfx2/source/doc/sfxbasemodel.cxx | 7 ++++++ sfx2/source/view/frmload.cxx | 32 ++++++++++++++++++++--- sfx2/source/view/sfxbasecontroller.cxx | 46 +++++++++++++++++++++++++--------- sfx2/source/view/viewsh.cxx | 5 ++++ 7 files changed, 84 insertions(+), 17 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index b2a59df1018c..5fd13c1bf088 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -142,6 +142,11 @@ private: sal_Int16 impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, + const ::comphelper::NamedValueCollection& i_rDescriptor + ); + + ::comphelper::NamedValueCollection + impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ); }; diff --git a/sfx2/inc/sfx2/sfxbasecontroller.hxx b/sfx2/inc/sfx2/sfxbasecontroller.hxx index 47445acc6690..6b9caea3c22c 100644 --- a/sfx2/inc/sfx2/sfxbasecontroller.hxx +++ b/sfx2/inc/sfx2/sfxbasecontroller.hxx @@ -162,6 +162,7 @@ public: //____________________________________________________________________________________________________ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getComponentWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCreationArguments() throw (::com::sun::star::uno::RuntimeException); //____________________________________________________________________________________________________ // XController @@ -392,6 +393,7 @@ public: SAL_DLLPRIVATE BOOL HandleEvent_Impl( NotifyEvent& rEvent ); SAL_DLLPRIVATE BOOL HasKeyListeners_Impl(); SAL_DLLPRIVATE BOOL HasMouseClickListeners_Impl(); + SAL_DLLPRIVATE void SetCreationArguments_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rCreationArgs ); SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper (); //#endif private: @@ -402,7 +404,7 @@ private: E_RECONNECT }; SAL_DLLPRIVATE void ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ); - SAL_DLLPRIVATE SfxViewFrame* GetViewFrame_Impl() const; + SAL_DLLPRIVATE SfxViewFrame& GetViewFrame_Impl() const; //________________________________________________________________________________________________________ // private variables diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx index cb8508a91632..45b75bfe4683 100644 --- a/sfx2/inc/sfx2/viewsh.hxx +++ b/sfx2/inc/sfx2/viewsh.hxx @@ -311,6 +311,8 @@ public: SAL_DLLPRIVATE BOOL HasKeyListeners_Impl(); SAL_DLLPRIVATE BOOL HasMouseClickListeners_Impl(); + SAL_DLLPRIVATE SfxBaseController* GetBaseController_Impl() const; + // Shell Interface SAL_DLLPRIVATE void ExecPrint_Impl(SfxRequest &); SAL_DLLPRIVATE void ExecMisc_Impl(SfxRequest &); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 3da4816408d6..cec28b6eb4f2 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -4008,6 +4008,8 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), "SfxBaseModel::createViewController: invalid old controller!" ); + // now that we used that arg, remove it, so the controller will not remember it below + aCreationArgs.remove( "PreviousView" ); // determine the ViewFrame belonging to the given XFrame SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); @@ -4030,6 +4032,11 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie if ( !pViewShell->GetController().is() ) pViewShell->SetController( new SfxBaseController( pViewShell ) ); + // pass the creation arguments to the controller + SfxBaseController* pBaseController = pViewShell->GetBaseController_Impl(); + ENSURE_OR_THROW( pBaseController, "invalid controller implementation!" ); + pBaseController->SetCreationArguments_Impl( aCreationArgs.getPropertyValues() ); + // some initial view settings, coming from our most recent attachResource call ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 318643bfb370..5737398fa78d 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -493,9 +493,28 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo } // -------------------------------------------------------------------------------------------------------------------- -sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor ) +::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) { - sal_Int16 nViewId = io_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ); + const sal_Char* pKnownViewArgs[] = { + "JumpMark" + }; + + ::comphelper::NamedValueCollection aViewArgs; + for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i ) + { + if ( io_rDescriptor.has( pKnownViewArgs[i] ) ) + { + aViewArgs.put( pKnownViewArgs[i], io_rDescriptor.get( pKnownViewArgs[i] ) ); + io_rDescriptor.remove( pKnownViewArgs[i] ); + } + } + return aViewArgs; +} + +// -------------------------------------------------------------------------------------------------------------------- +sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) +{ + sal_Int16 nViewId = i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ); try { if ( nViewId == 0 ) do @@ -524,7 +543,7 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId ); if ( pViewFactory ) - io_rDescriptor.put( "ViewId", sal_Int16( pViewFactory->GetOrdinal() ) ); + nViewId = sal_Int16( pViewFactory->GetOrdinal() ); } while ( false ); } @@ -668,9 +687,14 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + // extract view releant arguments from the loader args + ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); + // TODO: this should probably be done before the content of aDescriptor is actually passed to the + // XModel, i.e. before its load/initNew is called. + // plug the document into the frame Reference< XController2 > xController = SfxViewFrame::LoadDocument_Impl( - *xDoc, pTargetFrame->GetFrameInterface(), Sequence< PropertyValue >(), sViewName ); + *xDoc, pTargetFrame->GetFrameInterface(), aViewCreationArgs.getPropertyValues(), sViewName ); ENSURE_OR_THROW( xController.is(), "invalid controller" ); // this is expected to throw in case of a failure ... diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 8db30fa0bc19..5deec8bb0dd1 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -130,6 +130,11 @@ using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Exception; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XFrameActionListener; +using ::com::sun::star::util::XCloseListener; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::frame::XTitle; namespace css = ::com::sun::star; struct GroupIDToCommandGroup @@ -448,18 +453,19 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::notifyClosing( const E struct IMPL_SfxBaseController_DataContainer { - REFERENCE < XFRAME > m_xFrame; - REFERENCE < XFRAMEACTIONLISTENER > m_xListener ; - REFERENCE < XCLOSELISTENER > m_xCloseListener ; + Reference< XFrame > m_xFrame ; + Reference< XFrameActionListener > m_xListener ; + Reference< XCloseListener > m_xCloseListener ; ::sfx2::UserInputInterception m_aUserInputInterception; OMULTITYPEINTERFACECONTAINERHELPER m_aListenerContainer ; - OINTERFACECONTAINERHELPER m_aInterceptorContainer ; - REFERENCE < ::com::sun::star::task::XStatusIndicator > m_xIndicator; + OINTERFACECONTAINERHELPER m_aInterceptorContainer ; + Reference< XStatusIndicator > m_xIndicator ; SfxViewShell* m_pViewShell ; SfxBaseController* m_pController ; sal_Bool m_bDisposing ; - sal_Bool m_bSuspendState; - css::uno::Reference< css::frame::XTitle > m_xTitleHelper; + sal_Bool m_bSuspendState ; + Reference< XTitle > m_xTitleHelper ; + Sequence< PropertyValue > m_aCreationArgs ; IMPL_SfxBaseController_DataContainer( MUTEX& aMutex , SfxViewShell* pViewShell , @@ -560,7 +566,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run if ( !m_pData->m_pViewShell ) throw DisposedException(); - return Reference< XWindow >( GetViewFrame_Impl()->GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); + return Reference< XWindow >( GetViewFrame_Impl().GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } ::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) @@ -570,7 +576,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run throw DisposedException(); const SfxObjectFactory& rDocFac( m_pData->m_pViewShell->GetObjectShell()->GetFactory() ); - sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl()->GetCurViewId(), rDocFac.GetViewFactoryCount() ); + sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl().GetCurViewId(), rDocFac.GetViewFactoryCount() ); OSL_ENSURE( nViewNo < rDocFac.GetViewFactoryCount(), "SfxBaseController::getViewControllerName: view ID not found in view factories!" ); ::rtl::OUString sViewName; @@ -580,12 +586,27 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run return sViewName; } -SfxViewFrame* SfxBaseController::GetViewFrame_Impl() const +Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() throw (RuntimeException) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) + throw DisposedException(); + + return m_pData->m_aCreationArgs; +} + +void SfxBaseController::SetCreationArguments_Impl( const Sequence< PropertyValue >& i_rCreationArgs ) +{ + OSL_ENSURE( m_pData->m_aCreationArgs.getLength() == 0, "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" ); + m_pData->m_aCreationArgs = i_rCreationArgs; +} + +SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const { ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); - return pActFrame; + return *pActFrame; } //________________________________________________________________________________________________________ @@ -1360,7 +1381,8 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) pViewFrame->Resize( TRUE ); // if there's a JumpMark given, then, well, jump to it - const ::rtl::OUString sJumpMark = aDocumentArgs.getOrDefault( "JumpMark", ::rtl::OUString() ); + ::comphelper::NamedValueCollection aViewArgs( getCreationArguments() ); + const ::rtl::OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", ::rtl::OUString() ); const bool bHasJumpMark = ( sJumpMark.getLength() > 0 ); OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) || ( !sJumpMark.getLength() ), diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 28e875c6619b..0f7e0d074544 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2010,6 +2010,11 @@ Reference < XController > SfxViewShell::GetController() return pImp->pController; } +SfxBaseController* SfxViewShell::GetBaseController_Impl() const +{ + return pImp->pController; +} + void SfxViewShell::AddContextMenuInterceptor_Impl( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) { pImp->aInterceptorContainer.addInterface( xInterceptor ); -- cgit v1.2.3 From 1f3b28fe29a7e59d23f9f0cee9eff8e16370df4b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 11:28:14 +0100 Subject: autorecovery: made JumpMark a argument of the to-be-created view. For this purpose, the loader moves this argument from the loader args to the args which are later passed to XModel2.createViewController, and the Controller implementation retrieves it from there. (In this course, XController2.getCreationArguments has been introduced, and implemented in the two known XController2 implementations in the code base.) --- dbaccess/inc/genericcontroller.hxx | 3 ++- dbaccess/source/ui/browser/genericcontroller.cxx | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dbaccess/inc/genericcontroller.hxx b/dbaccess/inc/genericcontroller.hxx index b4570bc1215b..933a3314d589 100644 --- a/dbaccess/inc/genericcontroller.hxx +++ b/dbaccess/inc/genericcontroller.hxx @@ -471,8 +471,9 @@ namespace dbaui // ::com::sun::star::frame::XController2 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getComponentWindow() throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCreationArguments() throw (::com::sun::star::uno::RuntimeException); - // ::com::sun::star::frame::XController2 + // ::com::sun::star::frame::XController virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ) = 0; diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index a24c2d4e30dc..41ea2d9a1f7f 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -477,6 +477,14 @@ Reference< XWindow > SAL_CALL OGenericUnoController::getComponentWindow() throw return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Default" ) ); } +// ----------------------------------------------------------------------- +Sequence< PropertyValue > SAL_CALL OGenericUnoController::getCreationArguments() throw (RuntimeException) +{ + // currently we do not support any creation args, so anything passed to XModel2::createViewController would be + // lost, so we can equally return an empty sequence here + return Sequence< PropertyValue >(); +} + // ----------------------------------------------------------------------- void OGenericUnoController::attachFrame( const Reference< XFrame >& _rxFrame ) throw( RuntimeException ) { -- cgit v1.2.3 From 8706a8ea0b1d9dab021891d8675ce9f734f46149 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 11:28:14 +0100 Subject: autorecovery: made JumpMark a argument of the to-be-created view. For this purpose, the loader moves this argument from the loader args to the args which are later passed to XModel2.createViewController, and the Controller implementation retrieves it from there. (In this course, XController2.getCreationArguments has been introduced, and implemented in the two known XController2 implementations in the code base.) --- offapi/com/sun/star/frame/XController2.idl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/offapi/com/sun/star/frame/XController2.idl b/offapi/com/sun/star/frame/XController2.idl index ec4ae530feb0..e743a515076b 100644 --- a/offapi/com/sun/star/frame/XController2.idl +++ b/offapi/com/sun/star/frame/XController2.idl @@ -32,6 +32,7 @@ #include #include +#include //============================================================================= @@ -61,6 +62,16 @@ interface XController2 : XController - if it's passed there, a view/controller pair of the same type will be created.

*/ [readonly, attribute] string ViewControllerName; + + /** denotes the arguments used to create the instance. + +

Usually, controllers are created via XModel2::createViewController, where the + caller can pass not only a controller name, but also arguments parametrizing the to-be-created instance. + Those arguments used at creation time can subsequently be retrieved using the CreationArguments + member.

+ */ + [readonly, attribute] sequence< ::com::sun::star::beans::PropertyValue > + CreationArguments; }; //============================================================================= -- cgit v1.2.3 From d8bba185c2b34969e8c4c7d2d052f87c50ca50e5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 13:10:00 +0100 Subject: autorecovery: allowed the SFX doc loader to in-place replace a view in an existing frame This was previously done in SfxViewFrame::LoadNewSfxView_Impl. Now, the loader recognizes if a model is to be loaded into a frame with an existing view to the same model, and properly handles this (passing a PreviousViewController argument to the view factory). LoadNewSfxView_Impl died in this course (the remaining few lines have been outline). --- sfx2/inc/sfx2/viewfrm.hxx | 17 ++----- sfx2/source/doc/sfxbasemodel.cxx | 4 +- sfx2/source/view/frmload.cxx | 95 +++++++++++++++++++++++++--------------- sfx2/source/view/viewfrm.cxx | 62 ++++++++++++-------------- 4 files changed, 94 insertions(+), 84 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 9afbdc1d1e21..ab218d89034a 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -320,18 +320,9 @@ private: SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ); - /** loads a new view of our document into our frame - - This method completely bypasses the UNO loader mechanism, it exchanges the current view on SFX level. Use - it for quick inplace view switches only. - */ - SAL_DLLPRIVATE SfxViewShell* LoadNewSfxView_Impl( const ::rtl::OUString& i_rViewName, SfxViewShell* i_pOldShell ); - /** loads the given existing document into the given frame - This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. Don't - use this method if you want to plug the document into the frame on SFX level only. In such a case, use - LoadNewSfxView_Impl instead. + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. @param i_rDoc the document to load @@ -346,7 +337,7 @@ private: @throws Exception if something goes wrong. The caller is responsible for handling this. */ - SAL_DLLPRIVATE static void LoadViewIntoFrame_Impl( + SAL_DLLPRIVATE static SfxViewShell* LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rLoadArgs, @@ -356,9 +347,7 @@ private: /** loads the given existing document into the given frame - This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. Don't - use this method if you want to plug the document into the frame on SFX level only. In such a case, use - LoadNewSfxView_Impl instead. + This is done using the XComponentLoader interface of the frame, so the SFX document loader is invoked. If no frame is given, a blank top level frame is created. diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index cec28b6eb4f2..58ac982989fb 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -4004,12 +4004,12 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie // determine previous shell (used in some special cases) ::comphelper::NamedValueCollection aCreationArgs( i_rArguments ); - Reference< XController > xPreviousController = aCreationArgs.getOrDefault( "PreviousView", Reference< XController >() ); + Reference< XController > xPreviousController = aCreationArgs.getOrDefault( "PreviousViewController", Reference< XController >() ); SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), "SfxBaseModel::createViewController: invalid old controller!" ); // now that we used that arg, remove it, so the controller will not remember it below - aCreationArgs.remove( "PreviousView" ); + aCreationArgs.remove( "PreviousViewController" ); // determine the ViewFrame belonging to the given XFrame SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 5737398fa78d..00316762158e 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -47,6 +47,7 @@ #include "sfx2/sfxsids.hrc" #include "sfx2/sfxuno.hxx" #include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" /** === begin UNO includes === **/ #include @@ -104,6 +105,7 @@ using ::com::sun::star::util::XCloseable; using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::container::XIndexAccess; using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XController; /** === end UNO using === **/ SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) @@ -580,21 +582,25 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // then closing the first view/frame. aDescriptor.put( "Frame", _rTargetFrame ); + // did the caller already pass a model? + Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + const bool bExternalModel = xModel.is(); + // check for factory URLs to create a new doc, instead of loading one const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); bool bInitNewModel = bIsFactoryURL; - if ( bIsFactoryURL ) + if ( bIsFactoryURL && !bExternalModel ) { const ::rtl::OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 ); // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 - USHORT nSlotParam = impl_findSlotParam( sFactory ); + const USHORT nSlotParam = impl_findSlotParam( sFactory ); if ( nSlotParam != 0 ) { return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame ); } - bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); + const bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); if ( bDescribesValidTemplate ) { // if the media descriptor allowed us to determine a template document to create the new document @@ -614,14 +620,16 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA aDescriptor.put( "FileName", aDescriptor.get( "URL" ) ); } - // did the caller already pass a model? - Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); - const bool bExternalModel = xModel.is(); - sal_Bool bLoadSuccess = sal_False; SfxFrameWeak wFrame; try { + // extract view releant arguments from the loader args + ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); + + // it's allowed to to an "in-place replace" of a view/controller in a frame + Reference< XController > xReplacedViewController; + // no model passed from outside? => create one from scratch if ( !xModel.is() ) { @@ -632,11 +640,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } // create the new doc - ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); // load resp. init it - Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); + const Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); if ( bInitNewModel ) { xLoadable->initNew(); @@ -651,20 +659,36 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } else { + // if the existent model is to be loaded into a frame where already another view to the same model + // exists, then preserve this info for the view factory + Reference< XController > xPreviousController( _rTargetFrame->getController() ); + if ( ( xPreviousController.is() ) + && ( xModel == xPreviousController->getModel() ) + ) + { + aViewCreationArgs.put( "PreviousViewController", xPreviousController ); + xReplacedViewController = xPreviousController; + } + // tell the doc its (current) load args. + impl_removeLoaderArguments( aDescriptor ); xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); - - // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could - // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) - // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document - // might have a mode other than the one passed to the loader, and we always overwrite the former with - // the latter. + // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could + // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) + // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document + // might have a mode other than the one passed to the loader, and we always overwrite the former with + // the latter. } // get the SfxObjectShell (still needed at the moment) - SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + const SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); + // ensure the ID of the to-be-created view is in the descriptor, if possible + const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); + const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + // if the document is created hidden, prevent it from being deleted until it is shown or disposed impl_lockHiddenDocument( *xDoc, aDescriptor ); // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, @@ -675,25 +699,26 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // code at the very end of this method cares for closing the XModel, which should also close the // ObjectShell. - // create a frame - SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); - wFrame = pTargetFrame; - - // prepare it - pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor ); - - // ensure the ID of the to-be-created view is in the descriptor, if possible - const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); - const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); - const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + // obtain/create a frame + SfxFrame* pTargetFrame = NULL; + if ( xReplacedViewController.is() ) + { + SfxViewFrame* pReplacedViewFrame = SfxViewFrame::GetFirst( xDoc, false ); + ENSURE_OR_THROW( pReplacedViewFrame, "replacing a non-SFX view of a SFX-document should is impossible" ); + pTargetFrame = pReplacedViewFrame->GetFrame(); + ENSURE_OR_THROW( pTargetFrame, "invalid existing view - could not obtain an SfxFrame" ); + } + else + { + pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); + wFrame = pTargetFrame; - // extract view releant arguments from the loader args - ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); - // TODO: this should probably be done before the content of aDescriptor is actually passed to the - // XModel, i.e. before its load/initNew is called. + // prepare it + pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor ); + } // plug the document into the frame - Reference< XController2 > xController = SfxViewFrame::LoadDocument_Impl( + const Reference< XController2 > xController = SfxViewFrame::LoadDocument_Impl( *xDoc, pTargetFrame->GetFrameInterface(), aViewCreationArgs.getPropertyValues(), sViewName ); ENSURE_OR_THROW( xController.is(), "invalid controller" ); // this is expected to throw in case of a failure ... @@ -701,7 +726,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA if ( !bExternalModel ) { pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String sDocumentURL = xDoc->GetMedium()->GetName(); + const String sDocumentURL = xDoc->GetMedium()->GetName(); if ( sDocumentURL.Len() ) SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); } @@ -710,7 +735,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } catch ( Exception& ) { - Any aError( ::cppu::getCaughtException() ); + const Any aError( ::cppu::getCaughtException() ); if ( !aDescriptor.getOrDefault( "Silent", sal_False ) ) impl_handleCaughtError_nothrow( aError, aDescriptor ); } @@ -723,7 +748,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA { try { - Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); + const Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); xCloseable->close( sal_True ); } catch ( Exception& ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 7ca134ae0931..7ac7147ac914 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2042,7 +2042,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell Reference< XFrame > xFrame( i_rFrame ); bool bOwnFrame = false; - bool bSuccess = false; + SfxViewShell* pSuccessView = NULL; try { if ( !xFrame.is() ) @@ -2053,8 +2053,13 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell bOwnFrame = true; } - LoadViewIntoFrame_Impl( i_rDoc, xFrame, Sequence< PropertyValue >(), i_nViewId, i_bHidden ); - bSuccess = true; + pSuccessView = LoadViewIntoFrame_Impl( + i_rDoc, + xFrame, + Sequence< PropertyValue >(), // means "reuse existing model's args" + i_nViewId, + i_bHidden + ); if ( bOwnFrame && !i_bHidden ) { @@ -2068,8 +2073,8 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell DBG_UNHANDLED_EXCEPTION(); } - if ( bSuccess ) - return SfxViewFrame::Get( xFrame->getController(), &i_rDoc ); + if ( pSuccessView ) + return pSuccessView->GetViewFrame(); if ( bOwnFrame ) { @@ -2087,7 +2092,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell } //-------------------------------------------------------------------- -void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, +SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId, const bool i_bHidden ) { @@ -2099,6 +2104,8 @@ void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const R aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); if ( i_bHidden ) aTransformLoadArgs.put( "Hidden", i_bHidden ); + else + aTransformLoadArgs.remove( "Hidden" ); ::rtl::OUString sURL( xDocument->getURL() ); if ( !sURL.getLength() ) @@ -2107,27 +2114,10 @@ void SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const R Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, aTransformLoadArgs.getPropertyValues() ); -} - -//-------------------------------------------------------------------- -SfxViewShell* SfxViewFrame::LoadNewSfxView_Impl( const ::rtl::OUString& i_rViewName , SfxViewShell* i_pOldShell ) -{ - ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - OSL_PRECOND( GetViewShell() == NULL, "SfxViewFrame::LoadNewSfxView_Impl: not allowed to be called with an exsiting view shell!" ); - - ::comphelper::NamedValueCollection aViewCreationArgs; - if ( i_pOldShell != NULL ) - aViewCreationArgs.put( "PreviousView", i_pOldShell->GetController() ); - const Reference< XController2 > xController = LoadDocument_Impl( - *GetObjectShell(), - GetFrame()->GetFrameInterface(), - aViewCreationArgs.getPropertyValues(), - i_rViewName - ); - - SfxViewShell* pViewShell = SfxViewShell::Get( xController.get() ); - ENSURE_OR_THROW( pViewShell, "invalid controller returned by view factory" ); + SfxViewShell* pViewShell = SfxViewShell::Get( i_rFrame->getController() ); + ENSURE_OR_THROW( pViewShell, + "SfxViewFrame::LoadViewIntoFrame_Impl: loading an SFX doc into a frame resulted in a non-SFX view - quite impossible" ); return pViewShell; } @@ -2239,6 +2229,8 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl { try { + ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); + // if we already have a view shell, remove it SfxViewShell* pOldSh = GetViewShell(); OSL_PRECOND( pOldSh, "SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" ); @@ -2251,19 +2243,23 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl // remove sub shells from Dispatcher before switching to new ViewShell PopShellAndSubShells_Impl( *pOldSh ); - - // reset view shell, that's a precondition for the LoadNewSfxView_Impl below - SetViewShell_Impl( NULL ); } GetBindings().ENTERREGISTRATIONS(); LockAdjustPosSizePixel(); - // create and load new ViewShell + // ID of the new view SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); - const sal_Int16 nViewNo = ( bIsIndex || !nViewIdOrNo ) ? nViewIdOrNo : rDocFact.GetViewNo_Impl( nViewIdOrNo, 0 ); - const ::rtl::OUString sViewName( rDocFact.GetViewFactory( nViewNo ).GetViewName() ); - SfxViewShell* pNewSh = LoadNewSfxView_Impl( sViewName, pOldSh ); + const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; + + // create and load new ViewShell + SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( + *GetObjectShell(), + GetFrame()->GetFrameInterface(), + Sequence< PropertyValue >(), // means "reuse existing model's args" + nViewId, + false + ); // allow resize events to be processed UnlockAdjustPosSizePixel(); -- cgit v1.2.3 From 8c7ba14bf2acf14d12afb115e9024c73235faca5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 13:49:14 +0100 Subject: autorecovery: moved SfxViewFrame::LoadDocument_Impl to SfxFrameLoader_Impl::impl_createDocumentView --- sfx2/inc/frmload.hxx | 12 +++++++++++- sfx2/inc/sfx2/viewfrm.hxx | 7 ------- sfx2/source/view/frmload.cxx | 31 +++++++++++++++++++++++++++---- sfx2/source/view/viewfrm.cxx | 25 ------------------------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 5fd13c1bf088..48d03ec6dd07 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -37,6 +37,8 @@ /** === begin UNO includes === **/ #include #include +#include +#include #include #include #include @@ -119,7 +121,7 @@ private: ) const; SfxObjectShellLock impl_findObjectShell( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_rxDocument + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rxDocument ) const; void impl_lockHiddenDocument( @@ -149,6 +151,14 @@ private: impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > + impl_createDocumentView( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel2 >& i_rModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const ::rtl::OUString& i_rViewName + ); }; #endif diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index ab218d89034a..9c454526cd0a 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -307,13 +307,6 @@ public: SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void SetCurViewId_Impl( const USHORT i_nID ); - SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > - LoadDocument_Impl( - const SfxObjectShell& i_rDoc, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rViewFactoryArgs, - const ::rtl::OUString& i_rViewName - ); //#endif private: diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 00316762158e..b6bd1e68f042 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -106,6 +106,7 @@ using ::com::sun::star::document::XViewDataSupplier; using ::com::sun::star::container::XIndexAccess; using ::com::sun::star::frame::XController2; using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XModel2; /** === end UNO using === **/ SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) @@ -364,7 +365,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti } // -------------------------------------------------------------------------------------------------------------------- -SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel >& i_rxDocument ) const +SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const { for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) { @@ -559,6 +560,28 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO return nViewId; } +// -------------------------------------------------------------------------------------------------------------------- +Reference< XController2 > SfxFrameLoader_Impl::impl_createDocumentView( const Reference< XModel2 >& i_rModel, + const Reference< XFrame >& i_rFrame, const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const ::rtl::OUString& i_rViewName ) +{ + // let the model create a new controller + const Reference< XController2 > xController( i_rModel->createViewController( + i_rViewName, + i_rViewFactoryArgs.getPropertyValues(), + i_rFrame + ), UNO_SET_THROW ); + + // introduce model/view/controller to each other + xController->attachModel( i_rModel.get() ); + i_rModel->connectController( xController.get() ); + i_rFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( i_rFrame ); + i_rModel->setCurrentController( xController.get() ); + + return xController; +} + // -------------------------------------------------------------------------------------------------------------------- sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, const Reference< XFrame >& _rTargetFrame ) @@ -583,7 +606,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA aDescriptor.put( "Frame", _rTargetFrame ); // did the caller already pass a model? - Reference< XModel > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel >() ); + Reference< XModel2 > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel2 >() ); const bool bExternalModel = xModel.is(); // check for factory URLs to create a new doc, instead of loading one @@ -718,8 +741,8 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } // plug the document into the frame - const Reference< XController2 > xController = SfxViewFrame::LoadDocument_Impl( - *xDoc, pTargetFrame->GetFrameInterface(), aViewCreationArgs.getPropertyValues(), sViewName ); + const Reference< XController2 > xController = impl_createDocumentView( xModel, pTargetFrame->GetFrameInterface(), + aViewCreationArgs, sViewName ); ENSURE_OR_THROW( xController.is(), "invalid controller" ); // this is expected to throw in case of a failure ... diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 7ac7147ac914..7193a3a8fb81 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2007,31 +2007,6 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const return pViewFrame; } -//-------------------------------------------------------------------- -Reference< XController2 > SfxViewFrame::LoadDocument_Impl( - const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const Sequence< PropertyValue >& i_rViewFactoryArgs, - const ::rtl::OUString& i_rViewName ) -{ - ENSURE_OR_THROW( i_rFrame.is(), "illegal frame" ); - const Reference < XModel2 > xModel( i_rDoc.GetModel(), UNO_QUERY_THROW ); - - // let the model create a new controller - const Reference< XController2 > xController( xModel->createViewController( - i_rViewName, - i_rViewFactoryArgs, - i_rFrame - ), UNO_SET_THROW ); - - // introduce model/view/controller to each other - xController->attachModel( xModel.get() ); - xModel->connectController( xController.get() ); - i_rFrame->setComponent( xController->getComponentWindow(), xController.get() ); - xController->attachFrame( i_rFrame ); - xModel->setCurrentController( xController.get() ); - - return xController; -} - //-------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const USHORT i_nViewId, const bool i_bHidden ) -- cgit v1.2.3 From f61147ad8c63e5e961a756ebb47634e701c33631 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Fri, 11 Dec 2009 18:16:26 +0100 Subject: chart43: #i107575# avoid assertion 'ImageAryData::Failed to load image' while activating a chart --- officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu index 296a16a9e697..32efe1f97441 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/ChartCommands.xcu @@ -529,7 +529,7 @@ Select Chart Element - 1 + 0
-- cgit v1.2.3 From 6c2a8daf2b59da21db98d9d110a88b8c92d03eed Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 21:51:06 +0100 Subject: autorecovery: moved more SFX-dependent code from frame loader's ::load to proper place in SfxBaseModel/Controller --- sfx2/inc/sfx2/frame.hxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 91 +++++++++++++++++++++++++++++----------- sfx2/source/view/frame.cxx | 4 +- sfx2/source/view/frame2.cxx | 8 ++-- sfx2/source/view/frmload.cxx | 43 +------------------ 5 files changed, 75 insertions(+), 73 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index a57feb7a8461..e2f98d4ac9c3 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -219,7 +219,7 @@ public: SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); - SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs ); + SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 58ac982989fb..de7c98b986f9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1157,12 +1157,26 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon if ( impl_isDisposed() ) throw lang::DisposedException(); + OSL_PRECOND( xController.is(), "SfxBaseModel::connectController: invalid controller!" ); + if ( !xController.is() ) + return; + sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); uno::Sequence< uno::Reference< frame::XController > > aNewSeq( nOldCount + 1 ); for ( sal_uInt32 n = 0; n < nOldCount; n++ ) aNewSeq.getArray()[n] = m_pData->m_seqControllers.getConstArray()[n]; aNewSeq.getArray()[nOldCount] = xController; m_pData->m_seqControllers = aNewSeq; + + if ( m_pData->m_seqControllers.getLength() == 1 ) + { + SfxViewFrame* pViewFrame = SfxViewFrame::Get( xController, GetObjectShell() ); + ENSURE_OR_THROW( pViewFrame, "SFX document without SFX view!?" ); + pViewFrame->UpdateDocument_Impl(); + const String sDocumentURL = GetObjectShell()->GetMedium()->GetName(); + if ( sDocumentURL.Len() ) + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); + } } //________________________________________________________________________________________________________ @@ -3942,8 +3956,16 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef css::lang::IllegalArgumentException, css::uno::Exception ) { - return createViewController( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "view0" ) ), Sequence< PropertyValue >(), i_rFrame ); - // TODO: extend the SfxViewFactory with support for speaking view names + ::vos::OClearableGuard aGuard( Application::GetSolarMutex() ); + if ( impl_isDisposed() ) + throw lang::DisposedException(); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); + + aGuard.clear(); + + return createViewController( sDefaultViewName, Sequence< PropertyValue >(), i_rFrame ); } //============================================================================= @@ -3960,27 +3982,37 @@ SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const ::com::sun::star:: } if ( !pViewFrame ) { - // no view frame, yet, but perhaps a mere frame? - SfxFrame* pFrame = NULL; - for ( pFrame = SfxFrame::GetFirst(); - pFrame; - pFrame = SfxFrame::GetNext( *pFrame ) - ) + #if OSL_DEBUG_LEVEL > 0 + for ( SfxFrame* pCheckFrame = SfxFrame::GetFirst(); + pCheckFrame; + pCheckFrame = SfxFrame::GetNext( *pCheckFrame ) + ) { - if ( ( pFrame->GetFrameInterface() == i_rFrame ) - && ( pFrame->GetCurrentViewFrame() == NULL ) - // TODO: this condition is somewhat hacky, as it relies on the fact that this is (usually) - // the SfxFrame which is, up the stack, within its InsertDocument_Impl call. - // Before the refactoring is finally done, this is to be removed. - ) + if ( pCheckFrame->GetFrameInterface() == i_rFrame ) + { + if ( ( pCheckFrame->GetCurrentViewFrame() != NULL ) + || ( pCheckFrame->GetCurrentDocument() != NULL ) + ) + // Note that it is perfectly letgitimate that during loading into an XFrame which already contains + // a document, there exist two SfxFrame instances bound to this XFrame - the old one, which will be + // destroyed later, and the new one, which we're going to create + continue; + + OSL_ENSURE( false, "SfxBaseModel::FindOrCreateViewFrame_Impl: there already is an SfxFrame for the given XFrame, but no view in it!" ); + // nowadays, we're the only instance allowed to create an SfxFrame for an XFrame, so this case here should not happen break; + } } - if ( !pFrame ) - { - pFrame = SfxFrame::Create( i_rFrame ); - ENSURE_OR_THROW( pFrame, "no SfxFrame created for the XFrame" ); - } - pViewFrame = new SfxViewFrame( pFrame, GetObjectShell() ); + #endif + + SfxFrame* pTargetFrame = SfxFrame::Create( i_rFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + + // prepare it + pTargetFrame->PrepareForDoc_Impl( *GetObjectShell() ); + + // create view frame + pViewFrame = new SfxViewFrame( pTargetFrame, GetObjectShell() ); } return pViewFrame; } @@ -3997,23 +4029,32 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie if ( impl_isDisposed() ) throw lang::DisposedException(); + if ( !i_rFrame.is() ) + throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 3 ); + // find the proper SFX view factory SfxViewFactory* pViewFactory = GetObjectShell()->GetFactory().GetViewFactoryByViewName( i_rViewName ); if ( !pViewFactory ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); // determine previous shell (used in some special cases) - ::comphelper::NamedValueCollection aCreationArgs( i_rArguments ); - Reference< XController > xPreviousController = aCreationArgs.getOrDefault( "PreviousViewController", Reference< XController >() ); + Reference< XController > xPreviousController( i_rFrame->getController() ); + const Reference< XModel > xMe( this ); + if ( ( xPreviousController.is() ) + && ( xMe != xPreviousController->getModel() ) + ) + { + xPreviousController.clear(); + } SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), "SfxBaseModel::createViewController: invalid old controller!" ); - // now that we used that arg, remove it, so the controller will not remember it below - aCreationArgs.remove( "PreviousViewController" ); // determine the ViewFrame belonging to the given XFrame SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); + // TODO: if we created the SfxFrame, and something of the below goes wrong, then we need to properly close the + // Sfx(View)Frame // delegate to SFX' view factory pViewFrame->GetBindings().ENTERREGISTRATIONS(); @@ -4035,7 +4076,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie // pass the creation arguments to the controller SfxBaseController* pBaseController = pViewShell->GetBaseController_Impl(); ENSURE_OR_THROW( pBaseController, "invalid controller implementation!" ); - pBaseController->SetCreationArguments_Impl( aCreationArgs.getPropertyValues() ); + pBaseController->SetCreationArguments_Impl( i_rArguments ); // some initial view settings, coming from our most recent attachResource call ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 8d582e6e432a..44df30b6fd70 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -375,7 +375,7 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) void SfxFrame::GetViewData_Impl() { // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die - // festen Daten werden nur einmal ( nach InsertDocument_Impl in UpdateDescriptor ) + // festen Daten werden nur einmal ( nach PrepareForDoc_Impl in UpdateDescriptor ) // geholt, um Zeit zu sparen. SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) @@ -412,7 +412,7 @@ void SfxFrame::GetViewData_Impl() void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { - // Beim InsertDocument_Impl wird der Descriptor des Frames aktualisiert + // Beim PrepareForDoc_Impl wird der Descriptor des Frames aktualisiert // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres // Restaurieren der View n"otig sind, sind damit festgehalten. // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index d9aa7f6e3890..edb927d20001 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -465,17 +465,19 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const } } -void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs ) +void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc ) { + const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs() ); + // hidden? OSL_ENSURE( !pImp->bHidden, "when does this happen?" ); - pImp->bHidden = i_rArgs.getOrDefault( "Hidden", pImp->bHidden ); + pImp->bHidden = aDocumentArgs.getOrDefault( "Hidden", pImp->bHidden ); // update our descriptor UpdateDescriptor( &i_rDoc ); // plugin mode - sal_Int16 nPluginMode = i_rArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index b6bd1e68f042..9d765fa1aca8 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -644,15 +644,11 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } sal_Bool bLoadSuccess = sal_False; - SfxFrameWeak wFrame; try { // extract view releant arguments from the loader args ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); - // it's allowed to to an "in-place replace" of a view/controller in a frame - Reference< XController > xReplacedViewController; - // no model passed from outside? => create one from scratch if ( !xModel.is() ) { @@ -684,14 +680,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA { // if the existent model is to be loaded into a frame where already another view to the same model // exists, then preserve this info for the view factory - Reference< XController > xPreviousController( _rTargetFrame->getController() ); - if ( ( xPreviousController.is() ) - && ( xModel == xPreviousController->getModel() ) - ) - { - aViewCreationArgs.put( "PreviousViewController", xPreviousController ); - xReplacedViewController = xPreviousController; - } // tell the doc its (current) load args. impl_removeLoaderArguments( aDescriptor ); @@ -722,38 +710,12 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // code at the very end of this method cares for closing the XModel, which should also close the // ObjectShell. - // obtain/create a frame - SfxFrame* pTargetFrame = NULL; - if ( xReplacedViewController.is() ) - { - SfxViewFrame* pReplacedViewFrame = SfxViewFrame::GetFirst( xDoc, false ); - ENSURE_OR_THROW( pReplacedViewFrame, "replacing a non-SFX view of a SFX-document should is impossible" ); - pTargetFrame = pReplacedViewFrame->GetFrame(); - ENSURE_OR_THROW( pTargetFrame, "invalid existing view - could not obtain an SfxFrame" ); - } - else - { - pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame ); - wFrame = pTargetFrame; - - // prepare it - pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor ); - } - // plug the document into the frame - const Reference< XController2 > xController = impl_createDocumentView( xModel, pTargetFrame->GetFrameInterface(), + const Reference< XController2 > xController = impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); ENSURE_OR_THROW( xController.is(), "invalid controller" ); // this is expected to throw in case of a failure ... - if ( !bExternalModel ) - { - pTargetFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - const String sDocumentURL = xDoc->GetMedium()->GetName(); - if ( sDocumentURL.Len() ) - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); - } - bLoadSuccess = sal_True; } catch ( Exception& ) @@ -763,9 +725,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA impl_handleCaughtError_nothrow( aError, aDescriptor ); } - // clean up, if necessary - impl_cleanUp( bLoadSuccess, wFrame ); - // if loading was not successful, also close the document (the SfxFrame was already closed by impl_cleanUp) if ( !bLoadSuccess && !bExternalModel ) { -- cgit v1.2.3 From 3df3758bd64435d207ccc1aff7d9aba4466a3095 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 11 Dec 2009 22:07:36 +0100 Subject: autorecovery: SfxBaseModel::createViewController: ensure the created SfxFrame (if any) is closed in case of a failure --- sfx2/inc/sfx2/sfxbasemodel.hxx | 8 ++++- sfx2/source/doc/sfxbasemodel.cxx | 64 ++++++++++++++++++++++++++++++++++++---- sfx2/source/view/frmload.cxx | 11 ++----- 3 files changed, 68 insertions(+), 15 deletions(-) diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index b3b542715ab6..6e7f9be72b11 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -203,6 +203,9 @@ class SfxEventHint; class SfxViewFrame; struct IMPL_SfxBaseModel_DataContainer ; // impl. struct to hold member of class SfxBaseModel +namespace sfx { namespace intern { + class ViewCreationGuard; +} } //________________________________________________________________________________________________________ // class declarations //________________________________________________________________________________________________________ @@ -1522,7 +1525,10 @@ private: SAL_DLLPRIVATE css::uno::Reference< css::frame::XTitle > impl_getTitleHelper (); SAL_DLLPRIVATE css::uno::Reference< css::frame::XUntitledNumbers > impl_getUntitledHelper (); - SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) const; + SAL_DLLPRIVATE SfxViewFrame* FindOrCreateViewFrame_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, + ::sfx::intern::ViewCreationGuard& i_rGuard + ) const; //________________________________________________________________________________________________________ // private variables and methods diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index de7c98b986f9..ac550a33b86d 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3969,7 +3969,55 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef } //============================================================================= -SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) const +namespace sfx { namespace intern { + + /** a class which, in its dtor, cleans up variuos objects (well, at the moment only the frame) collected during + the creation of a document view, unless the creation was successful. + */ + class SAL_DLLPRIVATE ViewCreationGuard + { + public: + ViewCreationGuard() + :m_bSuccess( false ) + { + } + + ~ViewCreationGuard() + { + if ( !m_bSuccess ) + impl_closeAll(); + } + + void takeFrameOwnership( SfxFrame* i_pFrame ) + { + OSL_PRECOND( !m_aWeakFrame, "ViewCreationGuard::takeFrameOwnership: already have a frame!" ); + OSL_PRECOND( i_pFrame != NULL, "ViewCreationGuard::takeFrameOwnership: invalid frame!" ); + m_aWeakFrame = i_pFrame; + } + + void releaseAll() + { + m_bSuccess = true; + } + + private: + void impl_closeAll() + { + if ( m_aWeakFrame && !m_aWeakFrame->GetCurrentDocument() ) + { + m_aWeakFrame->SetFrameInterface_Impl( NULL ); + m_aWeakFrame->DoClose(); + } + } + + private: + bool m_bSuccess; + SfxFrameWeak m_aWeakFrame; + }; +} } + +//============================================================================= +SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame >& i_rFrame, ::sfx::intern::ViewCreationGuard& i_rGuard ) const { SfxViewFrame* pViewFrame = NULL; for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); @@ -4007,6 +4055,7 @@ SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const ::com::sun::star:: SfxFrame* pTargetFrame = SfxFrame::Create( i_rFrame ); ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + i_rGuard.takeFrameOwnership( pTargetFrame ); // prepare it pTargetFrame->PrepareForDoc_Impl( *GetObjectShell() ); @@ -4050,11 +4099,12 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), "SfxBaseModel::createViewController: invalid old controller!" ); + // a guard which will clean up in case of failure + ::sfx::intern::ViewCreationGuard aViewCreationGuard; + // determine the ViewFrame belonging to the given XFrame - SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame ); + SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame, aViewCreationGuard ); OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); - // TODO: if we created the SfxFrame, and something of the below goes wrong, then we need to properly close the - // Sfx(View)Frame // delegate to SFX' view factory pViewFrame->GetBindings().ENTERREGISTRATIONS(); @@ -4098,7 +4148,11 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } - return Reference< XController2 >( pViewShell->GetController(), UNO_QUERY_THROW ); + // tell the guard we were successful + aViewCreationGuard.releaseAll(); + + // outta gere + return pBaseController; } //============================================================================= diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 9d765fa1aca8..6eba855290f4 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -678,9 +678,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA } else { - // if the existent model is to be loaded into a frame where already another view to the same model - // exists, then preserve this info for the view factory - // tell the doc its (current) load args. impl_removeLoaderArguments( aDescriptor ); xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); @@ -711,11 +708,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // ObjectShell. // plug the document into the frame - const Reference< XController2 > xController = impl_createDocumentView( xModel, _rTargetFrame, - aViewCreationArgs, sViewName ); - ENSURE_OR_THROW( xController.is(), "invalid controller" ); - // this is expected to throw in case of a failure ... - + impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); bLoadSuccess = sal_True; } catch ( Exception& ) @@ -725,7 +718,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA impl_handleCaughtError_nothrow( aError, aDescriptor ); } - // if loading was not successful, also close the document (the SfxFrame was already closed by impl_cleanUp) + // if loading was not successful, close the document if ( !bLoadSuccess && !bExternalModel ) { try -- cgit v1.2.3 From d0a84019a692c1f9c4f21b8bd94d0794e4746078 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Sun, 13 Dec 2009 20:50:32 +0100 Subject: dba33b: #i10000# --- sfx2/source/doc/docfac.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 51d50eec1062..32c57d302d06 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -335,7 +335,6 @@ sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const s SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rViewName ) const { - SfxViewFactory* pViewFactory = NULL; for ( USHORT nViewNo = 0; nViewNo < GetViewFactoryCount(); ++nViewNo -- cgit v1.2.3 From 16dacff35f047b4acb5ea594ed01e9ce76fc525e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Dec 2009 12:55:05 +0100 Subject: autorecovery: replace some SfxFrameItem occurences by SfxUnoFrameItem As a consequence, replace some occurences of SfxFrame with XFrame. This allows getting rid of yet some more Sfx code in the (SFX) doc loader. Also, it prevents premature creations of SfxFrame instances during loading, since now the frame is really created when it is needed only. --- sfx2/inc/frmload.hxx | 9 -------- sfx2/inc/sfx2/frame.hxx | 22 ++++++++++++++++-- sfx2/inc/sfx2/viewfrm.hxx | 3 ++- sfx2/sdi/sfx.sdi | 10 ++++---- sfx2/sdi/sfxslots.sdi | 1 + sfx2/source/appl/appopen.cxx | 48 ++++++++++++++++++++++++++------------- sfx2/source/appl/appserv.cxx | 15 +++++++----- sfx2/source/appl/appuno.cxx | 22 ++++++++++++++---- sfx2/source/control/unoctitm.cxx | 2 +- sfx2/source/doc/objmisc.cxx | 8 +++---- sfx2/source/view/frame.cxx | 47 ++++++++++++++++++++++++++++++-------- sfx2/source/view/frmload.cxx | 49 ++-------------------------------------- sfx2/source/view/viewfrm.cxx | 20 ++++++++-------- 13 files changed, 141 insertions(+), 115 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 48d03ec6dd07..32217b786da8 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -107,11 +107,6 @@ private: ::comphelper::NamedValueCollection& io_rDescriptor ) const; - sal_Bool impl_cleanUp( - const sal_Bool i_bSuccess, - const SfxFrameWeak& i_wFrame - ) const; - bool impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const; @@ -134,10 +129,6 @@ private: const ::comphelper::NamedValueCollection& i_rDescriptor ) const; - SfxFrame* impl_getOrCreateEmptySfxFrame( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame - ) const; - void impl_removeLoaderArguments( ::comphelper::NamedValueCollection& io_rDescriptor ); diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index e2f98d4ac9c3..57e788c6f784 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -157,7 +157,8 @@ public: static SfxFrame* GetFirst(); static SfxFrame* GetNext( SfxFrame& ); - const SfxPoolItem* LoadDocumentSynchron( SfxItemSet& aSet ); + static const SfxPoolItem* + OpenDocumentSynchron( SfxItemSet& aSet, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rTargetFrame ); SfxBroadcaster& GetBroadcaster() const; SfxObjectShell* GetCurrentDocument() const; @@ -286,7 +287,24 @@ public: ::com::sun::star::uno::Any GetValue() const { return aValue; } virtual int operator==( const SfxPoolItem& ) const; - virtual String GetValueText() const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); +}; + +class SFX2_DLLPUBLIC SfxUnoFrameItem : public SfxPoolItem +{ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + m_xFrame; + +public: + TYPEINFO(); + SfxUnoFrameItem(); + SfxUnoFrameItem( sal_uInt16 nWhich, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& + GetFrame() const + { return m_xFrame; } + virtual int operator==( const SfxPoolItem& ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 9c454526cd0a..76d33c25a5bc 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -168,8 +168,9 @@ public: static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); - static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId = 0 ); static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxUnoFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const USHORT i_nViewId = 0 ); static SfxViewFrame* Current(); static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 7caf442758b1..aefed0f9e028 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -8038,7 +8038,7 @@ SfxVoidItem AutoPilotAddressDataSource SID_ADDRESS_DATA_SOURCE //-------------------------------------------------------------------------- SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME ) [ /* flags: */ AutoUpdate = FALSE, @@ -8063,7 +8063,7 @@ SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD //-------------------------------------------------------------------------- SfxVoidItem InsertLabels FN_LABEL -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME ) [ /* flags: */ AutoUpdate = FALSE, @@ -8088,7 +8088,7 @@ SfxVoidItem InsertLabels FN_LABEL //-------------------------------------------------------------------------- SfxVoidItem NewXForms FN_XFORMS_INIT -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME ) [ /* flags: */ AutoUpdate = FALSE, @@ -8113,7 +8113,7 @@ SfxVoidItem NewXForms FN_XFORMS_INIT //-------------------------------------------------------------------------- SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME ) [ /* flags: */ AutoUpdate = FALSE, @@ -8138,7 +8138,7 @@ SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT //-------------------------------------------------------------------------- SfxVoidItem NewPresentation SID_NEWSD -( SfxFrameItem Frame SID_DOCFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME ) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/sdi/sfxslots.sdi b/sfx2/sdi/sfxslots.sdi index a5a76df5f13d..6d73a137dbd1 100644 --- a/sfx2/sdi/sfxslots.sdi +++ b/sfx2/sdi/sfxslots.sdi @@ -59,6 +59,7 @@ TypeLibFile( "sfxslots.tlb" ) item String SfxFrameItem; //! Dummy item String SfxObjectShellItem //! Dummy item String SfxUsrAnyItem //! Dummy + item String SfxUnoFrameItem //! Dummy item String SvxClipboardFmtItem; //! Dummy struct Point diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index f0d5e2322ba6..7874f05890fb 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1120,12 +1120,22 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) return; } - SFX_REQUEST_ARG(rReq, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - SfxFrame *pFrame = NULL; - if ( pFrmItem ) - pFrame = pFrmItem->GetFrame(); - else if ( SfxViewFrame::Current() ) - pFrame = SfxViewFrame::Current()->GetFrame(); + SfxFrame* pTargetFrame = NULL; + Reference< XFrame > xTargetFrame; + + SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); + if ( pFrameItem ) + pTargetFrame = pFrameItem->GetFrame(); + + if ( !pTargetFrame ) + { + SFX_REQUEST_ARG(rReq, pUnoFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE); + if ( pUnoFrameItem ) + xTargetFrame = pUnoFrameItem->GetFrame(); + } + + if ( !pTargetFrame && !xTargetFrame.is() && SfxViewFrame::Current() ) + pTargetFrame = SfxViewFrame::Current()->GetFrame(); // check if caller has set a callback SFX_REQUEST_ARG(rReq, pLinkItem, SfxLinkItem, SID_DONELINK, FALSE ); @@ -1202,18 +1212,24 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // { // if a frame is given, it must be used for the starting point of the targetting mechanism // this code is also used if asynchronous loading is possible, because loadComponent always is synchron - Reference < XFrame > xFrame; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); - else - xFrame = Reference < XFrame >( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + if ( !xTargetFrame.is() ) + { + if ( pTargetFrame ) + { + xTargetFrame = pTargetFrame->GetFrameInterface(); + } + else + { + xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + } + } // make URL ready SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_FILE_NAME, FALSE ); aFileName = pURLItem->GetValue(); if( aFileName.Len() && aFileName.GetChar(0) == '#' ) // Mark without URL { - SfxViewFrame *pView = pFrame ? pFrame->GetCurrentViewFrame() : 0; + SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : 0; if ( !pView ) pView = SfxViewFrame::Current(); pView->GetViewShell()->JumpToMark( aFileName.Copy(1) ); @@ -1231,13 +1247,13 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // if loading must be done synchron, we must wait for completion to get a return value // find frame by myself; I must konw the exact frame to get the controller for the return value from it //if( aTarget.getLength() ) - // xFrame = xFrame->findFrame( aTarget, FrameSearchFlag::ALL ); + // xTargetFrame = xTargetFrame->findFrame( aTarget, FrameSearchFlag::ALL ); Reference < XComponent > xComp; try { - xComp = ::comphelper::SynchronousDispatch::dispatch( xFrame, aFileName, aTarget, 0, aArgs ); -// Reference < XComponentLoader > xLoader( xFrame, UNO_QUERY ); + xComp = ::comphelper::SynchronousDispatch::dispatch( xTargetFrame, aFileName, aTarget, 0, aArgs ); +// Reference < XComponentLoader > xLoader( xTargetFrame, UNO_QUERY ); // xComp = xLoader->loadComponentFromURL( aFileName, aTarget, 0, aArgs ); } catch(const RuntimeException&) @@ -1262,7 +1278,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); xTrans->parseStrict( aURL ); - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); + Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY ); Reference < XDispatch > xDisp = xProv.is() ? xProv->queryDispatch( aURL, aTarget, FrameSearchFlag::ALL ) : Reference < XDispatch >();; RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, "PERFORMANCE - SfxApplication::OpenDocExec_Impl" ); if ( xDisp.is() ) diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 02cb82963930..e40d2dea29ba 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -266,9 +266,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrame, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); - if (pFrame) - pFrame->GetValue() >>= xFrame; + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + if ( pFrameItem ) + xFrame = pFrameItem->GetFrame(); SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_SVXDLG_CUSTOMIZE, @@ -895,7 +895,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) const SfxPoolItem* pItem = NULL; Reference < XFrame > xFrame; if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) - ( (SfxUnoAnyItem*)pItem )->GetValue() >>= xFrame; + { + OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); + xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame(); + } SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) { @@ -1063,9 +1066,9 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pFrameItem ) - pFrameItem->GetValue() >>= xFrame; + xFrame = pFrameItem->GetFrame(); if ( !xFrame.is() ) { diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 4d2a1f234ba6..8ca5c85c7174 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -470,7 +470,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; String aName = rProp.Name; if ( aName == sFrame ) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + { + Reference< XFrame > xFrame; + OSL_VERIFY( rProp.Value >>= xFrame ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); + } else if ( aName == sHidden ) { @@ -562,11 +566,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque } else if ( aName == sFrame ) { - Reference< XFrame > xVal; - sal_Bool bOK = (rProp.Value >>= xVal); + Reference< XFrame > xFrame; + sal_Bool bOK = (rProp.Value >>= xFrame); DBG_ASSERT( bOK, "invalid type for Frame" ); if (bOK) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); } else if ( aName == sAsTemplate ) { @@ -1380,7 +1384,15 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sFrame; - pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + if ( pItem->ISA( SfxUsrAnyItem ) ) + { + OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); + pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); + } + else if ( pItem->ISA( SfxUnoFrameItem ) ) + pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); + else + OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 190cc47dc2f6..de274b2adf47 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -759,7 +759,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util } SfxAllItemSet aInternalSet( SFX_APP()->GetPool() ); if (xFrameRef.is()) // an empty set is no problem ... but an empty frame reference can be a problem ! - aInternalSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrameRef) ) ); + aInternalSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrameRef ) ); sal_Bool bSuccess = sal_False; sal_Bool bFailure = sal_False; diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index ce0de006829c..9bf2264cc446 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -2137,13 +2137,11 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) { Window* pWindow = 0; SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet(); - SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pUnoItem ) { - uno::Reference < frame::XFrame > xFrame; - pUnoItem->GetValue() >>= xFrame; - if ( xFrame.is() ) - pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() ); + pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); } if ( !pWindow ) diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 44df30b6fd70..6558af8b0fe6 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -103,6 +103,7 @@ using namespace ::com::sun::star::container; TYPEINIT1(SfxFrame, SfxListener); TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem); TYPEINIT1(SfxUsrAnyItem, SfxPoolItem); +TYPEINIT1_AUTOFACTORY(SfxUnoFrameItem, SfxPoolItem); SvCompatWeakHdl* SfxFrame::GetHdl() { @@ -640,11 +641,6 @@ int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const return sal_False; } -String SfxUsrAnyItem::GetValueText() const -{ - return String(); -} - SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const { return new SfxUsrAnyItem( Which(), aValue ); @@ -662,6 +658,39 @@ sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*n return sal_True; } +SfxUnoFrameItem::SfxUnoFrameItem() + : SfxPoolItem() + , m_xFrame() +{ +} + +SfxUnoFrameItem::SfxUnoFrameItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) + : SfxPoolItem( nWhichId ) + , m_xFrame( i_rFrame ) +{ +} + +int SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const +{ + return i_rItem.ISA( SfxUnoFrameItem ) && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; +} + +SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const +{ + return new SfxUnoFrameItem( Which(), m_xFrame ); +} + +sal_Bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +{ + rVal <<= m_xFrame; + return sal_True; +} + +sal_Bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +{ + return ( rVal >>= m_xFrame ); +} + SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur ) : pFrame( &rFrame ) , bRecursive( bRecur ) @@ -959,10 +988,10 @@ SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame ) return NULL; } -const SfxPoolItem* SfxFrame::LoadDocumentSynchron( SfxItemSet& aSet ) +const SfxPoolItem* SfxFrame::OpenDocumentSynchron( SfxItemSet& i_rSet, const Reference< XFrame >& i_rTargetFrame ) { - aSet.Put( SfxFrameItem( SID_DOCFRAME, this ) ); - aSet.ClearItem( SID_TARGETNAME ); - return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); + i_rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, i_rTargetFrame ) ); + i_rSet.ClearItem( SID_TARGETNAME ); + return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, i_rSet ); } diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 6eba855290f4..956cef506201 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -255,45 +255,12 @@ namespace } } -// -------------------------------------------------------------------------------------------------------------------- -SfxFrame* SfxFrameLoader_Impl::impl_getOrCreateEmptySfxFrame( const Reference< XFrame >& i_rFrame ) const -{ - for ( SfxFrame* pFrame = SfxFrame::GetFirst(); - pFrame; - pFrame = SfxFrame::GetNext( *pFrame ) - ) - { - if ( pFrame->GetFrameInterface() == i_rFrame ) - { - if ( ( pFrame->GetCurrentViewFrame() != NULL ) - || ( pFrame->GetCurrentDocument() != NULL ) - ) - // an empty SfxFrame was requested, so we can't use this instance. - // Note that it is perfectly letgitimate that during loading into an XFrame which already contains - // a document, there exist two SfxFrame instances bound to this XFrame - the old one, which will be - // destroyed later, and the new one, which we're going to create - continue; - - return pFrame; - } - } - - SfxFrame* pFrame = SfxFrame::Create( i_rFrame ); - ENSURE_OR_THROW( pFrame, "could not create an SfxFrame" ); - return pFrame; -} - // -------------------------------------------------------------------------------------------------------------------- sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame ) { - SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( i_rxFrame ); - SfxFrameWeak wFrame = pTargetFrame; - SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); - aRequest.AppendItem( SfxFrameItem ( SID_DOCFRAME, pTargetFrame ) ); - - sal_Bool bSuccess = lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); - return impl_cleanUp( bSuccess, wFrame ); + aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) ); + return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); } // -------------------------------------------------------------------------------------------------------------------- @@ -379,18 +346,6 @@ SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< X return NULL; } -// -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_cleanUp( const sal_Bool i_bSuccess, const SfxFrameWeak& i_wFrame ) const -{ - if ( !i_bSuccess && i_wFrame && !i_wFrame->GetCurrentDocument() ) - { - i_wFrame->SetFrameInterface_Impl( NULL ); - i_wFrame->DoClose(); - } - - return i_bSuccess; -} - // -------------------------------------------------------------------------------------------------------------------- bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 7193a3a8fb81..6b1d06ce4508 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2112,20 +2112,22 @@ SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const USHORT i //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrame* i_pTargetFrame, const USHORT i_nViewId ) +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rTargetFrame, const USHORT i_nViewId ) { - Reference< XFrame > xFrame; - if ( i_pTargetFrame ) - xFrame = i_pTargetFrame->GetFrameInterface(); - - return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, xFrame, i_nViewId, false ); + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, i_nViewId, false ); } //-------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) { - return LoadDocumentIntoFrame( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId ); + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : NULL, i_nViewId, false ); +} + +//-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxUnoFrameItem* i_pFrameItem, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId, false ); } //-------------------------------------------------------------------- @@ -2386,9 +2388,9 @@ void SfxViewFrame::ExecView_Impl Reference < XFrame > xFrame; // the frame (optional arg. TODO: this is currently not supported in the slot definition ...) - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); if ( pFrameItem ) - pFrameItem->GetValue() >>= xFrame; + xFrame = pFrameItem->GetFrame(); LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId, false ); -- cgit v1.2.3 From e68cf1abaf8d5545fe771ccafd92ce4b88989136 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Dec 2009 12:55:05 +0100 Subject: autorecovery: replace some SfxFrameItem occurences by SfxUnoFrameItem As a consequence, replace some occurences of SfxFrame with XFrame. This allows getting rid of yet some more Sfx code in the (SFX) doc loader. Also, it prevents premature creations of SfxFrame instances during loading, since now the frame is really created when it is needed only. --- sw/source/ui/app/apphdl.cxx | 2 +- sw/source/ui/app/applab.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 8b1d64cf3f5d..1fe69e88eacd 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -959,7 +959,7 @@ void NewXForms( SfxRequest& rReq ) static_cast( &xDocSh )->GetDoc()->initXForms( true ); // load document into frame - SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); // set return value diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 3af0fe9369e1..122217501b64 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -237,7 +237,7 @@ static sal_uInt16 nBCTitleNo = 0; pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); } - SFX_REQUEST_ARG( rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE ); + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); -- cgit v1.2.3 From 8a632e0d88c2b46fa7b9c11e985dd235e259cfeb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Dec 2009 12:55:05 +0100 Subject: autorecovery: replace some SfxFrameItem occurences by SfxUnoFrameItem As a consequence, replace some occurences of SfxFrame with XFrame. This allows getting rid of yet some more Sfx code in the (SFX) doc loader. Also, it prevents premature creations of SfxFrame instances during loading, since now the frame is really created when it is needed only. --- sd/inc/sdmod.hxx | 9 +++++++-- sd/source/ui/app/sdmod1.cxx | 26 ++++++++++++++------------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index 7481759cff4c..dc0cf334ed44 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -72,6 +72,11 @@ class DrawDocShell; class SdGlobalResourceContainer; } +namespace com { namespace sun { namespace star { namespace frame { + class XFrame; +} } } } + + // ---------------------- // - SdOptionStreamMode - // ---------------------- @@ -168,8 +173,8 @@ private: SfxFrame* ExecuteNewDocument( SfxRequest& rReq ); static void ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium ); - static SfxFrame* CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTargetFrame = 0 ); - static SfxFrame* CreateFromTemplate( const String& rTemplatePath, SfxFrame* pTargetFrame = 0 ); + static SfxFrame* CreateEmptyDocument( DocumentType eDocType, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); + static SfxFrame* CreateFromTemplate( const String& rTemplatePath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ); /** The resource container controls the lifetime of some singletons. */ diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 36901f7208c1..4a739e3ffbb0 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -87,6 +87,8 @@ using ::sd::framework::FrameworkHelper; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::frame::XFrame; namespace { @@ -530,7 +532,7 @@ void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocume } } -SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, SfxFrame* pTargetFrame ) +SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Reference< XFrame >& i_rFrame ) { SfxFrame* pFrame = 0; @@ -549,7 +551,7 @@ SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, SfxFrame* p } else if( pDocShell ) { - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, pTargetFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } @@ -563,10 +565,10 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxFrame* pFrame = 0; if ( SvtModuleOptions().IsImpress() ) { - SfxFrame* pTargetFrame = 0; - SFX_REQUEST_ARG( rReq, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); + Reference< XFrame > xTargetFrame; + SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE); if ( pFrmItem ) - pTargetFrame = pFrmItem->GetFrame(); + xTargetFrame = pFrmItem->GetFrame(); bool bMakeLayoutVisible = false; SfxViewFrame* pViewFrame = NULL; @@ -586,12 +588,12 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) if( aStandardTemplate.Len() > 0 ) { //load a template document - pFrame = CreateFromTemplate( aStandardTemplate, pTargetFrame ); + pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame ); } else { //create an empty document - pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, pTargetFrame ); + pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame ); bMakeLayoutVisible = true; } } @@ -624,7 +626,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxStringItem aReferer( SID_REFERER, UniString() ); SfxStringItem aPassword( SID_PASSWORD, aPasswrd ); - if ( pTargetFrame ) + if ( xTargetFrame.is() ) { SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() ); aSet.Put( aFile ); @@ -634,7 +636,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) if (aPasswrd.Len() > 0) aSet.Put( aPassword ); - const SfxPoolItem* pRet = pTargetFrame->LoadDocumentSynchron( aSet ); + const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame ); const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); if ( pFrameItem && pFrameItem->GetFrame() ) pFrame = pFrameItem->GetFrame()->GetFrame(); @@ -680,7 +682,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) SfxObjectShell* pShell = xShell; if( pShell ) { - pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, pTargetFrame ); + pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame ); DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; @@ -768,7 +770,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) return pFrame; } -SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTargetFrame ) +SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< XFrame >& i_rFrame ) { SfxFrame* pFrame = 0; @@ -785,7 +787,7 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, SfxFrame* pTarge pDoc->StopWorkStartupDelay(); } - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, pTargetFrame ); + SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; } -- cgit v1.2.3 From b33fda9d468b5f845c5a3c91be67049107d5a41a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 14 Dec 2009 22:14:39 +0100 Subject: dba33e: #i107678# don't clone the source form when creating an forms environment, this nowadays (correctly) also copies all children --- svx/source/form/fmobj.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 6bf300b094a1..f1cbdc043a03 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -519,7 +519,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > while (nCurrentSourceIndex <= nIndex) { sal_Bool bEqualDSS = sal_False; - while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bounded by nIndex) + while (!bEqualDSS) // (we don't have to check nCurrentSourceIndex here : it's bound by nIndex) { xSourceContainer->getByIndex(nCurrentSourceIndex) >>= xCurrentSourceForm; DBG_ASSERT(xCurrentSourceForm.is(), "FmFormObj::ensureModelEnv : invalid form ancestor (2) !"); @@ -581,12 +581,11 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > // correct this ... try { - Reference< XPersistObject > xSourcePersist(xCurrentSourceForm, UNO_QUERY); - DBG_ASSERT(xSourcePersist.is(), "FmFormObj::ensureModelEnv : invalid form (no persist object) !"); - - // create and insert (into the destination) a clone of the form - Reference< XCloneable > xCloneable( xSourcePersist, UNO_QUERY_THROW ); - xCurrentDestForm.set( xCloneable->createClone(), UNO_QUERY_THROW ); + // create and insert (into the destination) a copy of the form + xCurrentDestForm.set( + ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.form.component.DataForm" ) ), + UNO_QUERY_THROW ); + ::comphelper::copyProperties( xCurrentSourceForm, xCurrentDestForm ); DBG_ASSERT(nCurrentDestIndex == xDestContainer->getCount(), "FmFormObj::ensureModelEnv : something went wrong with the numbers !"); xDestContainer->insertByIndex(nCurrentDestIndex, makeAny(xCurrentDestForm)); @@ -604,7 +603,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > } } - // now xCurrentDestForm is a form aequivalent to xSourceForm (which means they have the same DSS and the same number + // now xCurrentDestForm is a form equivalent to xSourceForm (which means they have the same DSS and the same number // of left siblings with the same DSS, which counts for all their ancestors, too) // go down -- cgit v1.2.3 From 1fe9ecbd1e32170c5f54e0cd2bdc85fbd0f212e7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 10:31:37 +0100 Subject: autorecovery: SetDontCreateCancellable is dead --- sfx2/inc/sfx2/docfile.hxx | 1 - sfx2/source/doc/docfile.cxx | 7 ------- svx/source/svxlink/fileobj.cxx | 2 -- 3 files changed, 10 deletions(-) diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 53712002dbe7..e1b881a45ebc 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -226,7 +226,6 @@ public: void SetUsesCache( sal_Bool ); sal_Bool IsExpired() const; void SetName( const String& rName, sal_Bool bSetOrigURL = sal_False ); - void SetDontCreateCancellable(); sal_Bool IsAllowedForExternalBrowser() const; long GetFileVersion() const; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c4078dba3118..5fc7cfa7cd47 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3083,13 +3083,6 @@ sal_Bool SfxMedium::IsDownloadDone_Impl() return pImp->bDownloadDone; } -//---------------------------------------------------------------- - -void SfxMedium::SetDontCreateCancellable( ) -{ - OSL_ENSURE( false, "SfxMedium::SetDontCreateCancellable: dead code!" ); -} - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SfxMedium::GetInputStream() { if ( !pImp->xInputStream.is() ) diff --git a/svx/source/svxlink/fileobj.cxx b/svx/source/svxlink/fileobj.cxx index 2ccc8754dffc..6e0863fc8d40 100644 --- a/svx/source/svxlink/fileobj.cxx +++ b/svx/source/svxlink/fileobj.cxx @@ -299,8 +299,6 @@ BOOL SvFileObject::LoadFile_Impl() aStreamToLoadFrom.m_xInputStreamToLoadFrom, aStreamToLoadFrom.m_bIsReadOnly); // setStreamToLoadFrom(0,0); - // Keinen Eintrag im Roter Button Menu - xMed->SetDontCreateCancellable(); if( sReferer.Len() ) xMed->SetReferer( sReferer ); -- cgit v1.2.3 From ef15b85ee3a40f37a5d2c298a0d5660577ae78df Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- sfx2/inc/sfx2/viewfrm.hxx | 13 ++- sfx2/source/appl/app.cxx | 10 +-- sfx2/source/appl/appchild.cxx | 4 +- sfx2/source/appl/appopen.cxx | 4 +- sfx2/source/appl/appserv.cxx | 7 +- sfx2/source/appl/workwin.cxx | 4 +- sfx2/source/control/bindings.cxx | 16 ++-- sfx2/source/control/dispatch.cxx | 52 ++++++------ sfx2/source/control/request.cxx | 2 +- sfx2/source/control/statcach.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 10 +-- sfx2/source/dialog/basedlgs.cxx | 4 +- sfx2/source/dialog/dockwin.cxx | 4 +- sfx2/source/dialog/partwnd.cxx | 2 +- sfx2/source/dialog/tabdlg.cxx | 2 +- sfx2/source/doc/objmisc.cxx | 12 +-- sfx2/source/doc/objserv.cxx | 25 +++--- sfx2/source/doc/objxtor.cxx | 6 +- sfx2/source/doc/sfxbasemodel.cxx | 67 ++++++++-------- sfx2/source/menu/mnuitem.cxx | 2 +- sfx2/source/menu/virtmenu.cxx | 10 +-- sfx2/source/notify/eventsupplier.cxx | 2 +- sfx2/source/view/frame.cxx | 8 +- sfx2/source/view/impviewframe.hxx | 8 +- sfx2/source/view/ipclient.cxx | 6 +- sfx2/source/view/prnmon.cxx | 2 +- sfx2/source/view/sfxbasecontroller.cxx | 50 ++++++------ sfx2/source/view/viewfrm.cxx | 142 ++++++++++++++++----------------- sfx2/source/view/viewfrm2.cxx | 8 +- sfx2/source/view/viewsh.cxx | 24 +++--- svx/source/cui/cfg.cxx | 2 +- svx/source/cui/hlmailtp.cxx | 2 +- svx/source/dialog/hyprlink.cxx | 2 +- svx/source/dialog/rubydialog.cxx | 2 +- svx/source/editeng/svxacorr.cxx | 5 +- svx/source/form/datanavi.cxx | 2 +- svx/source/form/fmPropBrw.cxx | 38 ++++----- svx/source/form/fmshimp.cxx | 5 +- svx/source/tbxctrls/tbxcolor.cxx | 2 +- 39 files changed, 277 insertions(+), 291 deletions(-) diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 76d33c25a5bc..7d1695d012b2 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -159,7 +159,7 @@ protected: virtual ~SfxViewFrame(); public: - SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL ); + SfxViewFrame( SfxFrame& rFrame, SfxObjectShell *pDoc = NULL ); TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) @@ -238,18 +238,18 @@ public: virtual SfxObjectShell* GetObjectShell(); USHORT GetCurViewId() const; - SfxFrame* GetFrame() const; + SfxFrame& GetFrame() const; SfxViewFrame* GetTopViewFrame() const; BOOL DoClose(); ULONG GetFrameType() const - { return GetFrame()->GetFrameType(); } + { return GetFrame().GetFrameType(); } SfxFrame* GetTopFrame() const - { return GetFrame()->GetTopFrame(); } + { return GetFrame().GetTopFrame(); } void GetTargetList( TargetList& rList ) const - { GetFrame()->GetTargetList( rList ); } + { GetFrame().GetTargetList( rList ); } void CancelTransfers() - { GetFrame()->CancelTransfers(); } + { GetFrame().CancelTransfers(); } void SetModalMode( BOOL ); BOOL IsInModalMode() const; @@ -266,7 +266,6 @@ public: void ChildWindowState(SfxItemSet&); //#if 0 // _SOLAR__PRIVATE - SAL_DLLPRIVATE void SetFrame_Impl( SfxFrame* ); SAL_DLLPRIVATE void SetDowning_Impl(); SAL_DLLPRIVATE void GetDocNumber_Impl(); SAL_DLLPRIVATE BOOL IsDowning_Impl() const; diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 2c2f406affa3..44d8c20bba52 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -560,11 +560,11 @@ short SfxApplication::QuerySave_Impl( SfxObjectShell& rDoc, sal_Bool /*bAutoSave String aMsg( SfxResId( STR_ISMODIFIED ) ); aMsg.SearchAndReplaceAscii( "%1", rDoc.GetTitle() ); - SfxFrame *pFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); - pFrame->Appear(); + SfxFrame& rFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); + rFrame.Appear(); WinBits nBits = WB_YES_NO_CANCEL | WB_DEF_NO; - QueryBox aBox( &pFrame->GetWindow(), nBits, aMsg ); + QueryBox aBox( &rFrame.GetWindow(), nBits, aMsg ); return aBox.Execute(); } @@ -688,7 +688,7 @@ uno::Reference< task::XStatusIndicator > SfxApplication::GetStatusIndicator() co while ( pTop->GetParentViewFrame_Impl() ) pTop = pTop->GetParentViewFrame_Impl(); - return pTop->GetFrame()->GetWorkWindow_Impl()->GetStatusIndicator(); + return pTop->GetFrame().GetWorkWindow_Impl()->GetStatusIndicator(); } SfxTbxCtrlFactArr_Impl& SfxApplication::GetTbxCtrlFactories_Impl() const @@ -805,7 +805,7 @@ SfxApplication::ChooseScript() OSL_TRACE("create selector dialog"); const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); AbstractScriptSelectorDialog* pDlg = diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index f9698c3b4782..3296b4c5af8d 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -170,9 +170,9 @@ SfxTemplateDialog* SfxApplication::GetTemplateDialog() SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) const { if ( pFrame ) - return pFrame->GetFrame()->GetWorkWindow_Impl(); + return pFrame->GetFrame().GetWorkWindow_Impl(); else if ( pAppData_Impl->pViewFrame ) - return pAppData_Impl->pViewFrame->GetFrame()->GetWorkWindow_Impl(); + return pAppData_Impl->pViewFrame->GetFrame().GetWorkWindow_Impl(); else return NULL; } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 7874f05890fb..b0f61c9212cb 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1135,7 +1135,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) } if ( !pTargetFrame && !xTargetFrame.is() && SfxViewFrame::Current() ) - pTargetFrame = SfxViewFrame::Current()->GetFrame(); + pTargetFrame = &SfxViewFrame::Current()->GetFrame(); // check if caller has set a callback SFX_REQUEST_ARG(rReq, pLinkItem, SfxLinkItem, SID_DONELINK, FALSE ); @@ -1324,7 +1324,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( pShell->GetController() == xController ) { - pCntrFrame = pShell->GetViewFrame()->GetFrame(); + pCntrFrame = &pShell->GetViewFrame()->GetFrame(); break; } } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index e40d2dea29ba..625acdb085fd 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -999,7 +999,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) } if ( pView ) - pView->GetFrame()->Appear(); + pView->GetFrame().Appear(); const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs && pView ) @@ -1073,9 +1073,8 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) if ( !xFrame.is() ) { const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); + if ( pViewFrame ) + xFrame = pViewFrame->GetFrame().GetFrameInterface(); } do // artificial loop for flow control diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index c1780cd7be5f..48d05f8a6c89 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1434,8 +1434,8 @@ sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell ) if ( pDispatcher ) { SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( pFrame && pFrame->GetFrame() ) - xFrame = pFrame->GetFrame()->GetFrameInterface(); + if ( pFrame ) + xFrame = pFrame->GetFrame().GetFrameInterface(); } return xFrame; diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index edf19cafb179..0e78d64f6ecd 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -722,7 +722,7 @@ void SfxBindings::InvalidateAll pImp->pCaches->GetObject(n)->Invalidate(bWithMsg); /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( bWithMsg && xFrame.is() ) xFrame->contextChanged(); @@ -1384,7 +1384,7 @@ void SfxBindings::UpdateSlotServer_Impl() if ( !nRegLevel ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); //if ( xFrame.is() ) // xFrame->contextChanged(); pImp->bContextChanged = FALSE; @@ -1923,7 +1923,7 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int pImp->bContextChanged = FALSE; /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( xFrame.is() ) xFrame->contextChanged();*/ } @@ -2030,7 +2030,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xProv; if ( pDisp ) xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > - ( pDisp->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDisp->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); SetDispatchProvider_Impl( xProv ); InvalidateAll( sal_True ); @@ -2313,7 +2313,7 @@ void SfxBindings::SetActiveFrame( const ::com::sun::star::uno::Reference< ::com: SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( rFrame, ::com::sun::star::uno::UNO_QUERY ) ); else SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); } const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBindings::GetActiveFrame() const @@ -2322,7 +2322,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBin if ( xFrame.is() || !pDispatcher ) return xFrame; else - return pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(); + return pDispatcher->GetFrame()->GetFrame().GetFrameInterface(); } void SfxBindings::SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rProv ) @@ -2350,7 +2350,7 @@ SystemWindow* SfxBindings::GetSystemWindow() const while ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); SfxViewFrame* pTop = pFrame->GetTopViewFrame(); - return pTop->GetFrame()->GetTopWindow_Impl(); + return pTop->GetFrame().GetTopWindow_Impl(); } BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) @@ -2374,7 +2374,7 @@ BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) xServiceManager->createInstance(our_aModuleManagerName) , ::com::sun::star::uno::UNO_QUERY_THROW); ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY_THROW); sAppName = xModuleManager->identify(xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence source; diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 4684eb5e5182..ac38ebeb4b64 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -249,7 +249,7 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest { // ggf. Recording anwerfen com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrame()->GetFrameInterface(), + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( @@ -298,7 +298,7 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest if ( !pView ) pView = SfxViewFrame::Current(); if ( pView ) - SfxHelp::OpenHelpAgent( pView->GetFrame(), rReq.GetSlot() ); + SfxHelp::OpenHelpAgent( &pView->GetFrame(), rReq.GetSlot() ); SfxExecFunc pFunc = rSlot.GetExecFnc(); rShell.CallExec( pFunc, rReq ); @@ -801,7 +801,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( pBindings ) { pBindings->SetDispatcher(this); - pBindings->SetActiveFrame( pImp->pFrame->GetFrame()->GetFrameInterface() ); + pBindings->SetActiveFrame( pImp->pFrame->GetFrame().GetFrameInterface() ); } } else @@ -821,7 +821,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( bMDI && pImp->pFrame ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -829,7 +829,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); } if ( pImp->aToDoStack.Count() ) @@ -887,7 +887,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pImp->pFrame && !(pImp->pFrame->GetObjectShell()->IsInPlaceActive() ) ) { - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); if ( pWorkWin ) { for (sal_uInt16 n=0; naChildWins.Count();) @@ -915,10 +915,10 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pNew && pImp->pFrame ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xOldFrame( - pNew->GetFrame()->GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); + pNew->GetFrame().GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xMyFrame( - GetFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xOldFrame == xMyFrame ) bHidePopups = FALSE; @@ -926,7 +926,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( bHidePopups ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -934,7 +934,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); } Flush(); @@ -1680,10 +1680,10 @@ void SfxDispatcher::SetMenu_Impl() SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxFrame* pFrm = pTop->GetFrame(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -1716,7 +1716,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) sal_Bool bUpdate = bForce; while ( pDisp && pDisp->pImp->pFrame ) { - SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDisp || pAct == this ) { @@ -1730,7 +1730,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) pDisp = pDisp->pImp->pParent; } - if ( !bUpdate || pImp->pFrame->GetFrame()->IsClosing_Impl() ) + if ( !bUpdate || pImp->pFrame->GetFrame().IsClosing_Impl() ) return 0; SfxViewFrame* pTop = pImp->pFrame ? pImp->pFrame->GetTopViewFrame() : NULL; @@ -1767,14 +1767,14 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) if ( bUIActive && /* !bIsIPActive && */ ( !pClient || !pClient->IsObjectUIActive() ) ) SetMenu_Impl(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame()->GetWorkWindow_Impl(); pTaskWin->ResetStatusBar_Impl(); SfxDispatcher *pDispat = this; while ( pDispat ) { - SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDispat || pAct == this ) { @@ -1812,7 +1812,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { sal_uInt32 nHelpId = 0; SFX_APP(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); sal_Bool bIsActive = sal_False; sal_Bool bIsTaskActive = sal_False; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); @@ -1974,7 +1974,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { // internal frames also may control statusbar SfxBindings& rBindings = pImp->pFrame->GetBindings(); - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); } } @@ -2251,7 +2251,7 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl sal_uInt16 nLevels = pImp->aStack.Count(); while ( pParent && pParent->pImp->pFrame ) { - if ( pParent->pImp->pFrame->GetFrame()->HasComponent() ) + if ( pParent->pImp->pFrame->GetFrame().HasComponent() ) { // Components d"urfen intercepten if ( pParent->_TryIntercept_Impl( nSlot, rServer, sal_True ) ) @@ -2745,7 +2745,7 @@ SfxPopupMenuManager* SfxDispatcher::Popup( sal_uInt16 nConfigId,Window *pWin, co nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2785,7 +2785,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2808,7 +2808,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin //---------------------------------------------------------------------- void SfxDispatcher::ExecutePopup( const ResId &rId, Window *pWin, const Point *pPos ) { - Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); /* SfxPopupMenuManager aPop( rId, *GetBindings() ); aPop.AddClipboardFunctions(); @@ -2915,10 +2915,10 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxFrame* pFrm = pTop->GetFrame(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 61747fae7d32..da33ea2b0694 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -869,7 +869,7 @@ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRe com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - (pView ? pView : SfxViewFrame::Current())->GetFrame()->GetFrameInterface(), + (pView ? pView : SfxViewFrame::Current())->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); if(xSet.is()) diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index cb7e0f042f0d..6ac7b9935226 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -345,7 +345,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons else if ( rDispat.GetFrame() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xFrameProv( - rDispat.GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + rDispat.GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xFrameProv != xProv ) return GetSlotServer( rDispat, xFrameProv ); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index de274b2adf47..78c717fdf735 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -220,8 +220,8 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !pBindings->GetDispatcher_Impl() || !pBindings->GetDispatcher_Impl()->GetFrame() ) return; - SfxFrame *pFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); - SfxFrame *pParent = pFrame->GetParentFrame(); + SfxFrame& rFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); + SfxFrame *pParent = rFrame.GetParentFrame(); if ( pParent ) // parent may intercept xDispatch = TryGetDispatch( pParent ); @@ -229,7 +229,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDispatch.is() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = rFrame.GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDispatch = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -253,7 +253,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDisp.is() && pFrame->HasComponent() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDisp = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -755,7 +755,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util { SfxViewFrame* pViewFrame = pDispatcher->GetFrame(); if (pViewFrame) - xFrameRef = pViewFrame->GetFrame()->GetFrameInterface(); + xFrameRef = pViewFrame->GetFrame().GetFrameInterface(); } SfxAllItemSet aInternalSet( SFX_APP()->GetPool() ); if (xFrameRef.is()) // an empty set is no problem ... but an empty frame reference can be a problem ! diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 6b92cb0137de..08773f4da141 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -429,7 +429,7 @@ long SfxModelessDialog::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) { @@ -531,7 +531,7 @@ long SfxFloatingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS ) { diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index cf7d04ef0875..4ac93b0a9a4f 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -164,7 +164,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , if (xFactoryMgr.is()) { SfxDispatcher* pDispatcher = pBindings->GetDispatcher(); - uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); uno::Sequence< uno::Any > aArgs(2); beans::PropertyValue aPropValue; aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); @@ -1855,7 +1855,7 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); // In VCL geht Notify zun"achst an das Fenster selbst, // also base class rufen, sonst erf"ahrt der parent nichts diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index 64461c49d850..74b32f255003 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -181,7 +181,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl if ( pBind->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xSupp.is() ) xSupp->getFrames()->append( xFrame ); } diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 80f0daba71b9..8c3d0b45d8cd 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -1791,7 +1791,7 @@ long SfxTabDialog::Notify( NotifyEvent& rNEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pViewFrame->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pViewFrame->GetFrame(), nHelpId ); } } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 9bf2264cc446..348751ad9687 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1130,7 +1130,7 @@ void SfxObjectShell::SetProgress_Impl void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) { SfxApplication* pSfxApp = SFX_APP(); - if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame()->IsClosing_Impl() ) + if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame().IsClosing_Impl() ) { SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); if ( !pHiddenItem || !pHiddenItem->GetValue() ) @@ -2097,9 +2097,9 @@ void SfxObjectShell::SetWaitCursor( BOOL bSet ) const for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, this ) ) { if ( bSet ) - pFrame->GetFrame()->GetWindow().EnterWait(); + pFrame->GetFrame().GetWindow().EnterWait(); else - pFrame->GetFrame()->GetWindow().LeaveWait(); + pFrame->GetFrame().GetWindow().LeaveWait(); } } @@ -2159,7 +2159,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) // get any visible frame pView = SfxViewFrame::GetFirst(this); if ( pView ) - pFrame = pView->GetFrame(); + pFrame = &pView->GetFrame(); } if ( pFrame ) @@ -2228,7 +2228,7 @@ BOOL SfxObjectShell::IsInPlaceActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace(); + return pFrame && pFrame->GetFrame().IsInPlace(); } BOOL SfxObjectShell::IsUIActive() @@ -2237,7 +2237,7 @@ BOOL SfxObjectShell::IsUIActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace() && pFrame->GetFrame()->GetWorkWindow_Impl()->IsVisible_Impl(); + return pFrame && pFrame->GetFrame().IsInPlace() && pFrame->GetFrame().GetWorkWindow_Impl()->IsVisible_Impl(); } void SfxObjectShell::UIActivate( BOOL ) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 38883f44b12c..cfcc4cead11d 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -389,7 +389,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !pFrame ) return; - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); return; @@ -527,10 +527,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // get statusindicator uno::Reference< task::XStatusIndicator > xStatusIndicator; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame() ) + if ( pFrame ) { uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame->GetFrame()->GetFrameInterface(), + pFrame->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if( xStatFactory.is() ) xStatusIndicator = xStatFactory->createStatusIndicator(); @@ -650,9 +650,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) && pFilt->GetVersion() >= SOFFICE_FILEFORMAT_60 ) { SfxViewFrame* pDocViewFrame = SfxViewFrame::GetFirst( this ); - SfxFrame* pDocFrame = pDocViewFrame ? pDocViewFrame->GetFrame() : NULL; - if ( pDocFrame ) - SfxHelp::OpenHelpAgent( pDocFrame, HID_DID_SAVE_PACKED_XML ); + if ( pDocViewFrame ) + SfxHelp::OpenHelpAgent( &pDocViewFrame->GetFrame(), HID_DID_SAVE_PACKED_XML ); } // the StoreAsURL/StoreToURL method have called this method with false @@ -716,7 +715,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_CLOSEDOC: { SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -731,7 +730,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { // Auf dieses Dokument existiert noch eine Sicht, die // in einem FrameSet liegt; diese darf nat"urlich nicht @@ -750,8 +749,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( !pFrame->GetFrame()->GetParentFrame() ) - pFrame->GetFrame()->DoClose(); + if ( !pFrame->GetFrame().GetParentFrame() ) + pFrame->GetFrame().DoClose(); pFrame = SfxViewFrame::GetNext( *pFrame, this ); } } @@ -925,7 +924,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame = pFrame->GetTopViewFrame(); pDoc = pFrame->GetObjectShell(); @@ -958,7 +957,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { SfxObjectShell *pDoc = this; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -1205,7 +1204,7 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) { SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, TRUE ); if ( pFrame ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) ); rReq.Done(); break; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 831ea5f64d5e..4212b3613f4b 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -539,7 +539,7 @@ sal_uInt16 SfxObjectShell::PrepareClose return sal_False; SfxViewFrame* pFirst = SfxViewFrame::GetFirst( this ); - if( pFirst && !pFirst->GetFrame()->PrepareClose_Impl( bUI, bForBrowsing ) ) + if( pFirst && !pFirst->GetFrame().PrepareClose_Impl( bUI, bForBrowsing ) ) return sal_False; // prepare views for closing @@ -575,7 +575,7 @@ sal_uInt16 SfxObjectShell::PrepareClose // minimierte restoren SfxFrame* pTop = pFrame->GetTopFrame(); SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); // fragen, ob gespeichert werden soll short nRet = RET_YES; @@ -588,7 +588,7 @@ sal_uInt16 SfxObjectShell::PrepareClose if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && HasName() && getDocProperties()->getPrintDate().Month > 0) { - SfxHelp::OpenHelpAgent(pFirst->GetFrame(), HID_CLOSE_WARNING); + SfxHelp::OpenHelpAgent( &pFirst->GetFrame(), HID_CLOSE_WARNING ); } const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); const ::rtl::OUString sTitle = xTitle->getTitle (); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index ac550a33b86d..868ccb138a02 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -374,38 +374,35 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell ) pFrame = SfxViewFrame::GetNext( *pFrame, pObjectShell ) ) { - SfxFrame* pSfxFrame = pFrame->GetFrame(); - if ( pSfxFrame ) + SfxFrame& rSfxFrame = pFrame->GetFrame(); + try { - try + // get vcl window related to the frame and lock it if it is still not locked + uno::Reference< frame::XFrame > xFrame = rSfxFrame.GetFrameInterface(); + Window* pWindow = GetVCLWindow( xFrame ); + if ( !pWindow ) + throw uno::RuntimeException(); + + if ( pWindow->IsEnabled() ) { - // get vcl window related to the frame and lock it if it is still not locked - uno::Reference< frame::XFrame > xFrame = pSfxFrame->GetFrameInterface(); - Window* pWindow = GetVCLWindow( xFrame ); - if ( !pWindow ) - throw uno::RuntimeException(); + pWindow->Disable(); - if ( pWindow->IsEnabled() ) + try { - pWindow->Disable(); - - try - { - sal_Int32 nLen = m_aLockedFrames.getLength(); - m_aLockedFrames.realloc( nLen + 1 ); - m_aLockedFrames[nLen] = xFrame; - } - catch( uno::Exception& ) - { - pWindow->Enable(); - throw; - } + sal_Int32 nLen = m_aLockedFrames.getLength(); + m_aLockedFrames.realloc( nLen + 1 ); + m_aLockedFrames[nLen] = xFrame; + } + catch( uno::Exception& ) + { + pWindow->Enable(); + throw; } } - catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); - } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); } } } @@ -3416,9 +3413,9 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz throw uno::Exception(); // TODO: error handling SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ); - if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame()->IsInPlace() ) + if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame().IsInPlace() ) { - Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame()->GetFrameInterface()->getContainerWindow() ); + Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() ); Size aWinSize = pWindow->GetSizePixel(); awt::Size aCurrent = getVisualAreaSize( nAspect ); Size aDiff( aSize.Width-aCurrent.Width, aSize.Height-aCurrent.Height ); @@ -4025,7 +4022,7 @@ SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) ) { - if ( pViewFrame->GetFrame()->GetFrameInterface() == i_rFrame ) + if ( pViewFrame->GetFrame().GetFrameInterface() == i_rFrame ) break; } if ( !pViewFrame ) @@ -4061,7 +4058,7 @@ SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame pTargetFrame->PrepareForDoc_Impl( *GetObjectShell() ); // create view frame - pViewFrame = new SfxViewFrame( pTargetFrame, GetObjectShell() ); + pViewFrame = new SfxViewFrame( *pTargetFrame, GetObjectShell() ); } return pViewFrame; } @@ -4131,7 +4128,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie // some initial view settings, coming from our most recent attachResource call ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) - pViewFrame->GetFrame()->SetMenuBarOn_Impl( FALSE ); + pViewFrame->GetFrame().SetMenuBarOn_Impl( FALSE ); const sal_Int16 nPluginMode = aDocumentLoadArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); if ( nPluginMode == 1 ) @@ -4139,12 +4136,12 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie pViewFrame->ForceOuterResize_Impl( FALSE ); pViewFrame->GetBindings().HidePopups( TRUE ); - SfxFrame* pFrame = pViewFrame->GetFrame(); + SfxFrame& rFrame = pViewFrame->GetFrame(); // MBA: layoutmanager of inplace frame starts locked and invisible - pFrame->GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - pFrame->GetWorkWindow_Impl()->Lock_Impl( TRUE ); + rFrame.GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + rFrame.GetWorkWindow_Impl()->Lock_Impl( TRUE ); - pFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + rFrame.GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 6619c17d3077..9521db239923 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -456,7 +456,7 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl( Reference aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); pMenu = aConf.CreateBookmarkMenu( aXFrame, GetId() == SID_NEWDOCDIRECT ? BOOKMARK_NEWMENU : BOOKMARK_WIZARDMENU ); if( pMenu ) { diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index e0b6f6f32bf2..e298ae172556 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -348,7 +348,7 @@ void SfxVirtualMenu::CreateFromSVMenu() DBG_CHKTHIS(SfxVirtualMenu, 0); // Merge Addon popup menus into the SV Menu - Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface() ); if ( pSVMenu->IsMenuBar() ) { @@ -611,7 +611,7 @@ IMPL_LINK( SfxVirtualMenu, SettingsChanged, void*, EMPTYARG ) SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); BOOL bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); BOOL bIsHiContrastMode = IsHiContrastMode(); - Reference xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if ( !bIsAddonPopupMenu ) { @@ -683,7 +683,7 @@ void SfxVirtualMenu::UpdateImages() BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pSVMenu->GetItemCount(); SfxViewFrame * pViewFrame = pBindings->GetDispatcher()->GetFrame(); - Reference xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference xFrame( pViewFrame->GetFrame().GetFrameInterface() ); for ( USHORT nSVPos=0; nSVPos < nItemCount; ++nSVPos ) { @@ -732,7 +732,7 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) { BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pMenu->GetItemCount(); - Reference aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); for ( USHORT nPos=0; nPos < nItemCount; ++nPos ) { @@ -901,7 +901,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) // Create special popup menu that is filled with the 3rd party components popup menu items Reference aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); PopupMenu* pAddonMenu = NULL; try diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index a01b1df73c82..8c84e5c9602d 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -269,7 +269,7 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg { xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > ( - pView->GetFrame()->GetFrameInterface(), UNO_QUERY ); + pView->GetFrame().GetFrameInterface(), UNO_QUERY ); } else { diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 6558af8b0fe6..36eade11a1bc 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -234,7 +234,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing ) for ( const SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pCur ); !bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pCur ) ) { - bOther = ( pFrame->GetFrame() != this ); + bOther = ( &pFrame->GetFrame() != this ); } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) ); @@ -317,7 +317,7 @@ void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { SfxViewFrame* pFrm; for( pFrm = SfxViewFrame::GetFirst( pObj ); - pFrm && pFrm->GetFrame() == this; + pFrm && &pFrm->GetFrame() == this; pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ; // Keine anderer Frame mehr auf Doc -> Cancel if( !pFrm ) @@ -558,7 +558,7 @@ void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame ) } SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p ) - : SfxPoolItem( nWhichId ), pFrame( p ? p->GetFrame() : NULL ) + : SfxPoolItem( nWhichId ), pFrame( p ? &p->GetFrame() : NULL ) { wFrame = pFrame; } @@ -948,7 +948,7 @@ void SfxFrame::Resize() if ( nHandle ) { SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); - pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame()->GetWorkWindow_Impl(); + pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame().GetWorkWindow_Impl(); } } diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index 32a7bfbe23b9..5460d613c7e8 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -39,7 +39,7 @@ struct SfxViewFrame_Impl String aFrameTitle; TypeId aLastType; String aActualURL; - SfxFrame* pFrame; + SfxFrame& rFrame; svtools::AsynchronLink* pReloader; Window* pWindow; SfxViewFrame* pActiveChild; @@ -57,8 +57,8 @@ struct SfxViewFrame_Impl sal_Bool bActive; String aFactoryName; - SfxViewFrame_Impl( SfxFrame* i_pFrame ) - : pFrame( i_pFrame ) + SfxViewFrame_Impl( SfxFrame& i_rFrame ) + : rFrame( i_rFrame ) , pReloader(0 ) , pWindow( 0 ) , bWindowWasEnabled(sal_True) @@ -83,7 +83,7 @@ public: bActive( FALSE ), pFrame( p ) { - p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + p->GetFrame().GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); } virtual void Resize(); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 51752e25c81a..b9635c2f3bd7 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -204,7 +204,7 @@ throw (::com::sun::star::uno::RuntimeException) // currently needs SFX code SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); - SfxWorkWindow *pWorkWin = pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pFrame->GetFrame().GetWorkWindow_Impl(); pWorkWin->UpdateObjectBars_Impl(); } */ @@ -234,7 +234,7 @@ uno::Reference < frame::XFrame > SfxInPlaceClient_Impl::GetFrame() const { if ( !m_pClient ) throw uno::RuntimeException(); - return m_pClient->GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(); + return m_pClient->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); } void SAL_CALL SfxInPlaceClient_Impl::saveObject() @@ -736,7 +736,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject } } - if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame()->IsClosing_Impl() ) + if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame().IsClosing_Impl() ) // sometimes applications reconnect clients on shutting down because it happens in their Paint methods return; diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx index 21d484e550ab..54f3e1ca8f8b 100644 --- a/sfx2/source/view/prnmon.cxx +++ b/sfx2/source/view/prnmon.cxx @@ -320,7 +320,7 @@ SfxPrintProgress::~SfxPrintProgress() pImp->pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile ); // EndPrint-Notification an Frame - //pImp->pViewShell->GetViewFrame()->GetFrame()->Lock_Impl(FALSE); + //pImp->pViewShell->GetViewFrame()->GetFrame().Lock_Impl(FALSE); pImp->EndListening( *(pImp->pViewShell->GetObjectShell()) ); // the following call might destroy the view or even the document diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 5deec8bb0dd1..962f7e02f4d4 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -566,7 +566,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (Run if ( !m_pData->m_pViewShell ) throw DisposedException(); - return Reference< XWindow >( GetViewFrame_Impl().GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); + return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } ::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) @@ -822,13 +822,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pSlot = rSlotPool.GetUnoSlot( aMasterCommand ); else pSlot = rSlotPool.GetUnoSlot( aURL.Path ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, bMasterCommand ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -843,7 +843,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -879,13 +879,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct ); const SfxSlot* pSlot = rSlotPool.GetSlot( nId ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, sal_False ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -900,7 +900,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -1051,7 +1051,7 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime { SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ; if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) - pFrame->GetFrame()->SetIsClosing_Impl(); + pFrame->GetFrame().SetIsClosing_Impl(); m_pData->m_pViewShell->DiscardClients_Impl(); m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; @@ -1092,10 +1092,10 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( pFrame->GetViewShell() == pShell ) { // Enter registrations only allowed if we are the owner! - if ( pFrame->GetFrame()->OwnsBindings_Impl() ) + if ( pFrame->GetFrame().OwnsBindings_Impl() ) pFrame->GetBindings().ENTERREGISTRATIONS(); - pFrame->GetFrame()->SetFrameInterface_Impl( aXFrame ); - pFrame->GetFrame()->DoClose_Impl(); + pFrame->GetFrame().SetFrameInterface_Impl( aXFrame ); + pFrame->GetFrame().DoClose_Impl(); } } } @@ -1149,7 +1149,7 @@ SfxViewShell* SfxBaseController::GetViewShell_Impl() const { ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() ) - m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame()->GetWorkWindow_Impl() ); + m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() ); return m_pData->m_xIndicator; } @@ -1327,7 +1327,7 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) pViewFrame->GetDispatcher()->Update_Impl( sal_True ); Window* pFrameWin = &pViewFrame->GetWindow(); - if ( pFrameWin != &pViewFrame->GetFrame()->GetWindow() ) + if ( pFrameWin != &pViewFrame->GetFrame().GetWindow() ) pFrameWin->Show(); if ( i_eConnect == E_CONNECT ) @@ -1337,29 +1337,29 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); const bool bHasPluginMode = ( nPluginMode != 0 ); - SfxFrame* pFrame = pViewFrame->GetFrame(); + SfxFrame& rFrame = pViewFrame->GetFrame(); SfxObjectShell& rDoc = *m_pData->m_pViewShell->GetObjectShell(); - if ( !pFrame->IsMarkedHidden_Impl() ) + if ( !rFrame.IsMarkedHidden_Impl() ) { if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) pViewFrame->GetDispatcher()->HideUI( TRUE ); else pViewFrame->GetDispatcher()->HideUI( FALSE ); - if ( pFrame->IsInPlace() ) + if ( rFrame.IsInPlace() ) pViewFrame->LockAdjustPosSizePixel(); if ( nPluginMode == 3 ) - pFrame->GetWorkWindow_Impl()->SetInternalDockingAllowed( FALSE ); + rFrame.GetWorkWindow_Impl()->SetInternalDockingAllowed( FALSE ); - if ( !pFrame->IsInPlace() ) + if ( !rFrame.IsInPlace() ) pViewFrame->GetDispatcher()->Update_Impl(); pViewFrame->Show(); - pFrame->GetWindow().Show(); - if ( !pFrame->IsInPlace() || ( nPluginMode == 3 ) ) - pViewFrame->MakeActive_Impl( pFrame->GetFrameInterface()->isActive() ); + rFrame.GetWindow().Show(); + if ( !rFrame.IsInPlace() || ( nPluginMode == 3 ) ) + pViewFrame->MakeActive_Impl( rFrame.GetFrameInterface()->isActive() ); - if ( pFrame->IsInPlace() ) + if ( rFrame.IsInPlace() ) { pViewFrame->UnlockAdjustPosSizePixel(); // force resize for OLE server to fix layout problems of writer and math @@ -1370,14 +1370,14 @@ void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) } else { - DBG_ASSERT( !pFrame->IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); - pFrame->GetWindow().Show(); + DBG_ASSERT( !rFrame.IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); + rFrame.GetWindow().Show(); } // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! pViewFrame->UpdateTitle(); - if ( !pFrame->IsInPlace() ) + if ( !rFrame.IsInPlace() ) pViewFrame->Resize( TRUE ); // if there's a JumpMark given, then, well, jump to it diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 6b1d06ce4508..63d2aedf2523 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -240,7 +240,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq, sal_Bool bAsync ) void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { - SfxFrame *pParent = GetFrame()->GetParentFrame(); + SfxFrame *pParent = GetFrame().GetParentFrame(); if ( rReq.GetSlot() == SID_RELOAD ) { // Bei CTRL-Reload den aktiven Frame reloaden @@ -260,11 +260,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // Wenn nur ein Reload der Graphiken eines oder mehrerer ChildFrames // gemacht werden soll - SfxFrame *pFrame = GetFrame(); - if ( pParent == pFrame && pFrame->GetChildFrameCount() ) + SfxFrame& rFrame = GetFrame(); + if ( pParent == &rFrame && rFrame.GetChildFrameCount() ) { sal_Bool bReloadAvailable = sal_False; - SfxFrameIterator aIter( *pFrame, sal_False ); + SfxFrameIterator aIter( rFrame, sal_False ); SfxFrame *pChild = aIter.FirstFrame(); while ( pChild ) { @@ -303,7 +303,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { case SID_EDITDOC: { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) break; // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch @@ -488,7 +488,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // ReloadForEdit bei Framesets schaltet auch FramesetEditmode sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) + if ( bIsReadonly != bWasReadonly && !GetFrame().GetParentFrame() ) { SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); GetDispatcher()->Execute( SID_EDIT_FRAMESET, @@ -537,7 +537,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // AutoLoad ist ggf. verboten SFX_REQUEST_ARG(rReq, pAutoLoadItem, SfxBoolItem, SID_AUTOLOAD, sal_False); if ( pAutoLoadItem && pAutoLoadItem->GetValue() && - GetFrame()->IsAutoLoadLocked_Impl() ) + GetFrame().IsAutoLoadLocked_Impl() ) return; SfxObjectShellLock xOldObj( pSh ); @@ -552,7 +552,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // ggf. beim User nachfragen sal_Bool bDo = ( GetViewShell()->PrepareClose() != FALSE ); SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False); - if ( bDo && GetFrame()->DocIsModified_Impl() && + if ( bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) ) { QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_LASTVERSION) ); @@ -582,7 +582,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SfxViewFrame *pView = GetFirst( xOldObj ); while ( pView ) { - Reference< XFrame > xFrame( pView->GetFrame()->GetFrameInterface() ); + Reference< XFrame > xFrame( pView->GetFrame().GetFrameInterface() ); OSL_ENSURE( xFrame.is(), "SfxViewFrame::ExecReload_Impl: no XFrame?!" ); aViewFrames.push_back( ViewDescriptor( xFrame, pView->GetCurViewId() ) ); @@ -812,11 +812,11 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) // Ich bin gerade am Reloaden und Yielde so vor mich hin ... return; - GetFrame()->GetParentFrame(); + GetFrame().GetParentFrame(); SfxWhichIter aIter( rSet ); for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) { // Wenn die Komponente es nicht selbst dispatched, dann // macht es auch keinen Sinn! @@ -1027,7 +1027,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl() DBG_CHKTHIS(SfxViewFrame, 0); DBG_ASSERT( xObjSh.Is(), "no SfxObjectShell to release!" ); - GetFrame()->ReleasingComponent_Impl( sal_True ); + GetFrame().ReleasingComponent_Impl( sal_True ); if ( GetWindow().HasChildPathFocus( sal_True ) ) { DBG_ASSERT( !GetActiveChildFrame_Impl(), "Wrong active child frame!" ); @@ -1081,7 +1081,7 @@ sal_Bool SfxViewFrame::Close() { DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( GetFrame()->IsClosing_Impl() || !GetFrame()->GetFrameInterface().is(), "ViewFrame closed too early!" ); + DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" ); // Wenn bis jetzt noch nicht gespeichert wurde, sollen eingebettete Objekte // auch nicht mehr automatisch gespeichert werden! @@ -1136,7 +1136,7 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pOldFrame || !pOldFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pOldFrame || !pOldFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentActivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1154,8 +1154,8 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) // ViewFrames, erh"alt er ein ParentDeactivate if ( bUI ) { -// if ( GetFrame()->GetWorkWindow_Impl() ) -// GetFrame()->GetWorkWindow_Impl()->SaveStatus_Impl(); +// if ( GetFrame().GetWorkWindow_Impl() ) +// GetFrame().GetWorkWindow_Impl()->SaveStatus_Impl(); /* SfxMedium* pMed = GetObjectShell() ? GetObjectShell()->GetMedium() : NULL; if( pMed ) @@ -1170,7 +1170,7 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pNewFrame || !pNewFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pNewFrame || !pNewFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentDeactivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1187,7 +1187,7 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) { if ( GetViewShell() && GetWindow().IsVisible() ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { /* Size aSize( GetViewShell()->GetWindow()->GetSizePixel() ); @@ -1215,7 +1215,7 @@ sal_Bool SfxViewFrame::SetBorderPixelImpl { pImp->aBorder = rBorder; - if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() ) + if ( IsResizeInToOut_Impl() && !GetFrame().IsInPlace() ) { Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); if ( aSize.Width() && aSize.Height() ) @@ -1320,14 +1320,14 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } case SFX_HINT_DEINITIALIZING: - GetFrame()->DoClose(); + GetFrame().DoClose(); break; case SFX_HINT_DYING: // when the Object is being deleted, destroy the view too if ( xObjSh.Is() ) ReleaseObjectShell_Impl(); else - GetFrame()->DoClose(); + GetFrame().DoClose(); break; } @@ -1378,7 +1378,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_TOGGLEFULLSCREENMODE: { - if ( GetFrame()->OwnsBindings_Impl() ) + if ( GetFrame().OwnsBindings_Impl() ) GetBindings().GetDispatcher_Impl()->Update_Impl( sal_True ); break; } @@ -1441,7 +1441,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame::SfxViewFrame ( - SfxFrame* pFrame, + SfxFrame& rFrame, SfxObjectShell* pObjShell ) @@ -1452,21 +1452,21 @@ SfxViewFrame::SfxViewFrame (default ist die zuerst registrierte SfxViewShell-Subklasse). */ - : pImp( new SfxViewFrame_Impl( pFrame ) ) + : pImp( new SfxViewFrame_Impl( rFrame ) ) , pDispatcher(0) , pBindings( new SfxBindings ) , nAdjustPosPixelLock( 0 ) { DBG_CTOR( SfxViewFrame, NULL ); - pFrame->SetCurrentViewFrame_Impl( this ); - pFrame->SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); + rFrame.SetCurrentViewFrame_Impl( this ); + rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); Construct_Impl( pObjShell ); - pImp->pWindow = new SfxFrameViewWindow_Impl( this, pFrame->GetWindow() ); - pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); - pFrame->SetOwnsBindings_Impl( sal_True ); - pFrame->CreateWorkWindow_Impl(); + pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() ); + pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() ); + rFrame.SetOwnsBindings_Impl( sal_True ); + rFrame.CreateWorkWindow_Impl(); } //------------------------------------------------------------------------ @@ -1481,14 +1481,14 @@ SfxViewFrame::~SfxViewFrame() ReleaseObjectShell_Impl(); - if ( GetFrame()->OwnsBindings_Impl() ) + if ( GetFrame().OwnsBindings_Impl() ) // Die Bindings l"oscht der Frame! KillDispatcher_Impl(); delete pImp->pWindow; - if ( GetFrame() && GetFrame()->GetCurrentViewFrame() == this ) - GetFrame()->SetCurrentViewFrame_Impl( NULL ); + if ( GetFrame().GetCurrentViewFrame() == this ) + GetFrame().SetCurrentViewFrame_Impl( NULL ); // von Frame-Liste abmelden SfxApplication *pSfxApp = SFX_APP(); @@ -1632,7 +1632,7 @@ void SfxViewFrame::ShowStatusText( const String& /*rText*/) /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) { @@ -1648,7 +1648,7 @@ void SfxViewFrame::HideStatusText() /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) pMgr->GetStatusBar()->ShowItems(); @@ -1794,7 +1794,7 @@ void SfxViewFrame::Enable( sal_Bool bEnable ) } else { - Window *pWindow = &GetFrame()->GetTopFrame()->GetWindow(); + Window *pWindow = &GetFrame().GetTopFrame()->GetWindow(); if ( !bEnable ) pImp->bWindowWasEnabled = pWindow->IsInputEnabled(); if ( !bEnable || pImp->bWindowWasEnabled ) @@ -1855,12 +1855,12 @@ void SfxViewFrame::Show() // Frame-Window anzeigen, aber nur wenn der ViewFrame kein eigenes Window // hat oder wenn er keine Component enth"alt - if ( &GetWindow() == &GetFrame()->GetWindow() || !GetFrame()->HasComponent() ) + if ( &GetWindow() == &GetFrame().GetWindow() || !GetFrame().HasComponent() ) GetWindow().Show(); - GetFrame()->GetWindow().Show(); + GetFrame().GetWindow().Show(); /* SfxViewFrame* pCurrent = SfxViewFrame::Current(); - if ( GetFrame()->GetFrameInterface()->isActive() && + if ( GetFrame().GetFrameInterface()->isActive() && pCurrent != this && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) && !GetActiveChildFrame_Impl() ) @@ -1899,7 +1899,7 @@ void SfxViewFrame::LockObjectShell_Impl( sal_Bool bLock ) //-------------------------------------------------------------------- void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) { - if ( GetViewShell() && !GetFrame()->IsClosing_Impl() ) + if ( GetViewShell() && !GetFrame().IsClosing_Impl() ) { if ( IsVisible_Impl() ) { @@ -1918,7 +1918,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } SfxViewFrame* pCurrent = SfxViewFrame::Current(); - css::uno::Reference< css::frame::XFrame > xFrame = GetFrame()->GetFrameInterface(); + css::uno::Reference< css::frame::XFrame > xFrame = GetFrame().GetFrameInterface(); if ( !bPreview ) { SetViewFrame( this ); @@ -1934,7 +1934,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) SfxInPlaceClient *pCli = GetViewShell()->GetUIActiveClient(); if ( ( !pCli || !pCli->IsObjectUIActive() ) && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) ) - GetFrame()->GrabFocusOnComponent_Impl(); + GetFrame().GrabFocusOnComponent_Impl(); } } else @@ -1976,10 +1976,10 @@ void SfxViewFrame::SetActiveChildFrame_Impl( SfxViewFrame *pViewFrame ) pImp->pActiveChild = pViewFrame; - Reference< XFramesSupplier > xFrame( GetFrame()->GetFrameInterface(), UNO_QUERY ); + Reference< XFramesSupplier > xFrame( GetFrame().GetFrameInterface(), UNO_QUERY ); Reference< XFrame > xActive; if ( pViewFrame ) - xActive = pViewFrame->GetFrame()->GetFrameInterface(); + xActive = pViewFrame->GetFrame().GetFrameInterface(); if ( xFrame.is() ) // PB: #74432# xFrame cann be NULL xFrame->setActiveFrame( xActive ); @@ -2232,7 +2232,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl // create and load new ViewShell SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( *GetObjectShell(), - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), Sequence< PropertyValue >(), // means "reuse existing model's args" nViewId, false @@ -2313,7 +2313,7 @@ void SfxViewFrame::ExecView_Impl if ( nFrame == 0 ) nFrame = USHRT_MAX; - SfxFrameIterator aIter( *GetFrame(), sal_False ); + SfxFrameIterator aIter( GetFrame(), sal_False ); SfxFrame *pFrame = aIter.FirstFrame(); sal_uInt16 nActFrame = 1; while ( pFrame ) @@ -2376,7 +2376,7 @@ void SfxViewFrame::ExecView_Impl } // ViewData bei FrameSets rekursiv holen - GetFrame()->GetViewData_Impl(); + GetFrame().GetViewData_Impl(); SfxMedium* pMed = GetObjectShell()->GetMedium(); // do not open the new window hidden @@ -2571,7 +2571,7 @@ void SfxViewFrame::StateView_Impl //------------------------------------------------------------------------- void SfxViewFrame::ToTop() { - GetFrame()->Appear(); + GetFrame().Appear(); } //------------------------------------------------------------------------- @@ -2581,40 +2581,34 @@ SfxViewFrame* SfxViewFrame::GetParentViewFrame() const Der ParentViewFrame ist der ViewFrame des ParentFrames */ { - SfxFrame *pFrame = GetFrame()->GetParentFrame(); + SfxFrame *pFrame = GetFrame().GetParentFrame(); return pFrame ? pFrame->GetCurrentViewFrame() : NULL; } //------------------------------------------------------------------------- -SfxFrame* SfxViewFrame::GetFrame() const +SfxFrame& SfxViewFrame::GetFrame() const /* Beschreibung: GetFrame liefert den Frame, in dem sich der ViewFrame befindet */ { - return pImp->pFrame; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetFrame_Impl( SfxFrame *pFrame ) -{ - pImp->pFrame = pFrame; + return pImp->rFrame; } //------------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::GetTopViewFrame() const { - return GetFrame()->GetTopFrame()->GetCurrentViewFrame(); + return GetFrame().GetTopFrame()->GetCurrentViewFrame(); } Window& SfxViewFrame::GetWindow() const { - return pImp->pWindow ? *pImp->pWindow : GetFrame()->GetWindow(); + return pImp->pWindow ? *pImp->pWindow : GetFrame().GetWindow(); } sal_Bool SfxViewFrame::DoClose() { - return GetFrame()->DoClose(); + return GetFrame().DoClose(); } String SfxViewFrame::GetActualPresentationURL_Impl() const @@ -2638,7 +2632,7 @@ void SfxViewFrame::SetModalMode( sal_Bool bModal ) BOOL SfxViewFrame::IsInModalMode() const { - return pImp->bModal || GetFrame()->GetWindow().IsInModalMode(); + return pImp->bModal || GetFrame().GetWindow().IsInModalMode(); } void SfxViewFrame::Resize( BOOL bForce ) @@ -2650,7 +2644,7 @@ void SfxViewFrame::Resize( BOOL bForce ) SfxViewShell *pShell = GetViewShell(); if ( pShell ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { Point aPoint = GetWindow().GetPosPixel(); DoAdjustPosSizePixel( pShell, aPoint, aSize ); @@ -2930,7 +2924,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) // try to find any active recorder on this frame ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet(xFrame,com::sun::star::uno::UNO_QUERY); @@ -2995,7 +2989,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_TOGGLESTATUSBAR: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3045,11 +3039,11 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) SfxViewFrame *pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< ::com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3084,7 +3078,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) } pWork->ShowFullScreenMode( bNewFullScreenMode ); pWork->SetMenuBarMode( bNewFullScreenMode ? MENUBAR_MODE_HIDE : MENUBAR_MODE_NORMAL ); - GetFrame()->GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); + GetFrame().GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); if ( !pItem ) rReq.AppendItem( SfxBoolItem( SID_WIN_FULLSCREEN, bNewFullScreenMode ) ); rReq.Done(); @@ -3138,7 +3132,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3161,7 +3155,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3175,7 +3169,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) ); @@ -3196,7 +3190,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) SfxViewFrame* pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) ); @@ -3245,7 +3239,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) return; - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface(); + Reference < XFrame > xFrame = GetFrame().GetTopFrame()->GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ) ); BOOL bShow = FALSE; BOOL bHasChild = xBeamer.is(); @@ -3346,7 +3340,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) } else if ( nSID == SID_BROWSER ) { - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface()-> + Reference < XFrame > xFrame = GetFrame().GetTopFrame()->GetFrameInterface()-> findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ); if ( !xFrame.is() ) rState.DisableItem( nSID ); @@ -3364,7 +3358,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) SfxWorkWindow* SfxViewFrame::GetWorkWindow_Impl( USHORT /*nId*/ ) { SfxWorkWindow* pWork = 0; - pWork = GetFrame()->GetWorkWindow_Impl(); + pWork = GetFrame().GetWorkWindow_Impl(); return pWork; } diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index c7452978d564..9558d84e050a 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -287,7 +287,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) USHORT nId = pIdItem ? pIdItem->GetValue() : 0; // ausfuehren - SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = GetFrame().GetWorkWindow_Impl(); if ( bShow ) { // Zuerst die Floats auch anzeigbar machen @@ -341,7 +341,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) String aFact = String::CreateFromAscii("private:factory/"); aFact += aFactName; aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); + aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, &GetFrame() ) ); aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) ); SFX_APP()->ExecuteSlot( aReq ); const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); @@ -353,7 +353,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) case SID_CLOSEWIN: { // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); if ( !xTask.is() ) break; @@ -429,7 +429,7 @@ void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) case SID_CLOSEWIN: { // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); if ( !xTask.is() ) rSet.DisableItem(nWhich); break; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 0f7e0d074544..d624101f5e79 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -392,7 +392,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) case SID_ACTIVATE_STYLE_APPLY: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -488,7 +488,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( pMailDocType ) aDocType = pMailDocType->GetValue(); - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR; if ( nId == SID_MAIL_SENDDOC ) @@ -532,7 +532,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) const sal_Int32 FILTERFLAG_EXPORT = 0x00000002; css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); - css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); css::uno::Reference< css::frame::XModel > xModel; const rtl::OUString aModuleManager( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" )); @@ -690,7 +690,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( !pShowItem || bActive != pImp->bPlugInsActive ) { SfxFrame* pTopFrame = GetFrame()->GetTopFrame(); - if ( pTopFrame != GetFrame()->GetFrame() ) + if ( pTopFrame != &GetFrame()->GetFrame() ) { // FramesetDocument SfxViewShell *pShell = pTopFrame->GetCurrentViewFrame()->GetViewShell(); @@ -776,7 +776,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) aPrinterName = Printer::GetDefaultPrinterName(); if ( aPrinterName.getLength() > 0 ) { - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); ::rtl::OUStringBuffer aBuffer( 60 ); aBuffer.append( RetrieveLabelFromCommand( @@ -874,7 +874,7 @@ ErrCode SfxViewShell::DoVerb(long /*nVerb*/) void SfxViewShell::OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* /*pClient*/ ) { if ( !bActive ) - GetFrame()->GetFrame()->Appear(); + GetFrame()->GetFrame().Appear(); } //-------------------------------------------------------------------- @@ -896,7 +896,7 @@ void SfxViewShell::InplaceDeactivated( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) { - uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); if ( xParentFrame.is() ) xParentFrame->setActiveFrame( xOwnFrame ); @@ -909,12 +909,12 @@ void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIDeactivated( SfxInPlaceClient* /*pClient*/ ) { - if ( !pFrame->GetFrame()->IsClosing_Impl() || + if ( !pFrame->GetFrame().IsClosing_Impl() || SfxViewFrame::Current() != pFrame ) pFrame->GetDispatcher()->Update_Impl( TRUE ); pFrame->GetBindings().HidePopups(FALSE); - // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); // uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); // if ( xParentFrame.is() ) // xParentFrame->setActiveFrame( uno::Reference < frame::XFrame >() ); @@ -995,7 +995,7 @@ void SfxViewShell::Activate( BOOL bMDI ) { SfxObjectShell *pSh = GetViewFrame()->GetObjectShell(); if ( pSh->GetModel().is() ) - pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame()->GetController() ); + pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame().GetController() ); SetCurrentDocument(); } @@ -1685,7 +1685,7 @@ BOOL SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) if (!pImp->pAccExec) { pImp->pAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper(); - pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame()->GetFrameInterface()); + pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame().GetFrameInterface()); } return pImp->pAccExec->execute(aKey.GetKeyCode()); @@ -2169,7 +2169,7 @@ void SfxViewShell::CheckOwnerShip_Impl() { // document couldn't be closed or it shouldn't, now try at least to close the frame com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xFrame.is() ) { try diff --git a/svx/source/cui/cfg.cxx b/svx/source/cui/cfg.cxx index 5df1e03edb53..a6b4eb05ac39 100644 --- a/svx/source/cui/cfg.cxx +++ b/svx/source/cui/cfg.cxx @@ -1967,7 +1967,7 @@ void SvxConfigPage::Reset( const SfxItemSet& ) } if ( !_inout_rxFrame.is() && SfxViewFrame::Current() ) - _inout_rxFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + _inout_rxFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); if ( !_inout_rxFrame.is() ) { diff --git a/svx/source/cui/hlmailtp.cxx b/svx/source/cui/hlmailtp.cxx index 982e79c9d921..37dd3e7d980c 100644 --- a/svx/source/cui/hlmailtp.cxx +++ b/svx/source/cui/hlmailtp.cxx @@ -316,7 +316,7 @@ IMPL_LINK ( SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, void *, EMPTYARG ) } -/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); +/* uno::Reference< frame::XDispatchProvider > xProv( pViewFrame->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xProv.is() ) { !!! (pb) we need a new config item here diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 0cb6cc4d52df..5b45296fa7f0 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -953,7 +953,7 @@ void SvxHyperlinkDlg::OpenDoc( const String& rURL, SfxViewFrame* pViewFrame ) if ( pViewFrame ) { - SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? pViewFrame->GetFrame() : NULL ); + SfxFrameItem aView( SID_DOCFRAME, pViewFrame ? &pViewFrame->GetFrame() : NULL ); if ( pDisp ) pDisp->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aName, &aView, &aNewView, &aSilent, &aReadOnly, &aReferer, &aExternal, 0L ); diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index c957290d55c4..cd4f1300ed11 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -324,7 +324,7 @@ void SvxRubyDialog::Activate() aStylistPB.Enable(bEnable); //get selection from current view frame SfxViewFrame* pCurFrm = SfxViewFrame::Current(); - Reference< XController > xCtrl = pCurFrm->GetFrame()->GetController(); + Reference< XController > xCtrl = pCurFrm->GetFrame().GetController(); pImpl->SetController(xCtrl); if(pImpl->HasSelectionChanged()) { diff --git a/svx/source/editeng/svxacorr.cxx b/svx/source/editeng/svxacorr.cxx index 88e1543ab8c9..2330640200af 100644 --- a/svx/source/editeng/svxacorr.cxx +++ b/svx/source/editeng/svxacorr.cxx @@ -1327,8 +1327,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, } while( FALSE ); SfxViewFrame* pVFrame; - if( nRet && 0 != (pVFrame = SfxViewFrame::Current()) && - pVFrame->GetFrame() ) + if( nRet && 0 != (pVFrame = SfxViewFrame::Current()) ) { ULONG nHelpId = 0; if( nRet & ( Autocorrect|CptlSttSntnc|CptlSttWrd|ChgToEnEmDash ) ) @@ -1361,7 +1360,7 @@ ULONG SvxAutoCorrect::AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt, if( nHelpId ) { nHelpId += HID_AUTOCORR_HELP_START - 1; - SfxHelp::OpenHelpAgent( pVFrame->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pVFrame->GetFrame(), nHelpId ); } } diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index ffe012734ae5..c63cd643d8ac 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1611,7 +1611,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference( - pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index ccce6b50ee20..d29d0a1096ff 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -31,20 +31,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -#include "fmhelp.hrc" -#include "fmprop.hrc" +#include "fmhelp.hrc" +#include "fmprop.hrc" #include "fmPropBrw.hxx" #include "fmresids.hrc" #include "fmservs.hxx" -#include "fmshimp.hxx" -#include "fmpgeimp.hxx" +#include "fmshimp.hxx" +#include "fmpgeimp.hxx" -#include "svx/dialmgr.hxx" -#include "svx/fmpage.hxx" -#include "svx/fmshell.hxx" -#include "svx/sdrpagewindow.hxx" -#include "svx/svdpagv.hxx" -#include "svx/svxids.hrc" +#include "svx/dialmgr.hxx" +#include "svx/fmpage.hxx" +#include "svx/fmshell.hxx" +#include "svx/sdrpagewindow.hxx" +#include "svx/svdpagv.hxx" +#include "svx/svxids.hrc" /** === begin UNO includes === **/ #include @@ -63,20 +63,20 @@ /** === end UNO includes === **/ #include -#include +#include #include #include #include -#include +#include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include @@ -248,7 +248,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding if ( _pBindings->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); // if ( xSupp.is() ) // xSupp->getFrames()->append( m_xMeAsFrame ); // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 06bd3cd128f4..6c68c32c7706 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -518,9 +518,8 @@ FmXFormShell::FmXFormShell( FmFormShell& _rShell, SfxViewFrame* _pViewFrame ) m_aMarkTimer.SetTimeout(100); m_aMarkTimer.SetTimeoutHdl(LINK(this,FmXFormShell,OnTimeOut)); - SfxFrame* pFrame = _pViewFrame ? _pViewFrame->GetFrame() : NULL; - if ( pFrame ) - m_xAttachedFrame = pFrame->GetFrameInterface(); + if ( _pViewFrame ) + m_xAttachedFrame = _pViewFrame->GetFrame().GetFrameInterface(); // to prevent deletion of this we acquire our refcounter once ::comphelper::increment(FmXFormShell_BASE::m_refCount); diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx index 495742e4ef0b..b27e9f4e7a60 100644 --- a/svx/source/tbxctrls/tbxcolor.cxx +++ b/svx/source/tbxctrls/tbxcolor.cxx @@ -65,7 +65,7 @@ namespace svx { try { - Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY ); if ( xFrameProps.is() ) xFrameProps->getPropertyValue( PROPNAME_LAYOUTMANAGER ) >>= m_xLayouter; -- cgit v1.2.3 From 3a25d7157f5d23ab307d3d94a2ddda219affae9f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:31:21 +0100 Subject: autorecovery: Sfx(View)Frame::GetTopFrame now also returning a SfxFrame& instead of an SfxFrame* --- sfx2/inc/sfx2/frame.hxx | 2 +- sfx2/inc/sfx2/viewfrm.hxx | 2 +- sfx2/source/appl/sfxhelp.cxx | 2 +- sfx2/source/control/dispatch.cxx | 2 +- sfx2/source/doc/objxtor.cxx | 4 ++-- sfx2/source/view/frame.cxx | 4 ++-- sfx2/source/view/ipclient.cxx | 12 ++++++------ sfx2/source/view/viewfrm.cxx | 10 +++++----- sfx2/source/view/viewsh.cxx | 2 +- svx/source/cui/hltpbase.cxx | 2 +- svx/source/dialog/hyprlink.cxx | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index 57e788c6f784..cfd0ee05c031 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -163,7 +163,7 @@ public: SfxBroadcaster& GetBroadcaster() const; SfxObjectShell* GetCurrentDocument() const; SfxViewFrame* GetCurrentViewFrame() const; - SfxFrame* GetTopFrame() const; + SfxFrame& GetTopFrame() const; sal_Bool IsParent( SfxFrame* ) const; sal_uInt32 GetFrameType() const; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 7d1695d012b2..d1f3d18b501b 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -244,7 +244,7 @@ public: BOOL DoClose(); ULONG GetFrameType() const { return GetFrame().GetFrameType(); } - SfxFrame* GetTopFrame() const + SfxFrame& GetTopFrame() const { return GetFrame().GetTopFrame(); } void GetTargetList( TargetList& rList ) const { GetFrame().GetTargetList( rList ); } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8a6622636c14..f8104f5fbe1c 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -975,7 +975,7 @@ void SfxHelp::OpenHelpAgent( SfxFrame *pFrame, ULONG nHelpId ) ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) ), UNO_QUERY ); xTrans->parseStrict(aURL); - Reference< XDispatchProvider > xDispProv( pFrame->GetTopFrame()->GetFrameInterface(), UNO_QUERY ); + Reference< XDispatchProvider > xDispProv( pFrame->GetTopFrame().GetFrameInterface(), UNO_QUERY ); Reference< XDispatch > xHelpDispatch; if ( xDispProv.is() ) xHelpDispatch = xDispProv->queryDispatch( diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index ac38ebeb4b64..441bc846c4f9 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1768,7 +1768,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) SetMenu_Impl(); SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); - SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame().GetWorkWindow_Impl(); pTaskWin->ResetStatusBar_Impl(); SfxDispatcher *pDispat = this; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 4212b3613f4b..a4fa3c845b91 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -573,8 +573,8 @@ sal_uInt16 SfxObjectShell::PrepareClose if ( bUI && IsModified() && pFrame ) { // minimierte restoren - SfxFrame* pTop = pFrame->GetTopFrame(); - SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); + SfxFrame& rTop = pFrame->GetTopFrame(); + SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() ); pFrame->GetFrame().Appear(); // fragen, ob gespeichert werden soll diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 36eade11a1bc..25f6147ffdf5 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -284,12 +284,12 @@ void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) pChildArr->Remove( nPos ); }; -SfxFrame* SfxFrame::GetTopFrame() const +SfxFrame& SfxFrame::GetTopFrame() const { const SfxFrame* pParent = this; while ( pParent->pParentFrame ) pParent = pParent->pParentFrame; - return const_cast< SfxFrame* >( pParent ); + return *const_cast< SfxFrame* >( pParent ); } sal_Bool SfxFrame::IsClosing_Impl() const diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index b9635c2f3bd7..97e5d46af7f7 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -986,7 +986,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { if ( m_pViewSh ) - m_pViewSh->GetViewFrame()->GetTopFrame()->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); try { m_pImp->m_xObject->setClientSite( m_pImp->m_xClient ); @@ -1036,8 +1036,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( m_pViewSh ) { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); - pFrame->GetTopFrame()->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } } @@ -1097,7 +1097,7 @@ void SfxInPlaceClient::DeactivateObject() } if ( m_pViewSh ) - m_pViewSh->GetViewFrame()->GetTopFrame()->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) { @@ -1119,8 +1119,8 @@ void SfxInPlaceClient::DeactivateObject() { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); SfxViewFrame::SetViewFrame( pFrame ); - pFrame->GetTopFrame()->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } catch (com::sun::star::uno::Exception& ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 63d2aedf2523..79c1a3914aad 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -844,7 +844,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) case SID_RELOAD: { - SfxFrame* pFrame = GetTopFrame(); + SfxFrame* pFrame = &GetTopFrame(); if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) rSet.DisableItem(nWhich); @@ -1794,7 +1794,7 @@ void SfxViewFrame::Enable( sal_Bool bEnable ) } else { - Window *pWindow = &GetFrame().GetTopFrame()->GetWindow(); + Window *pWindow = &GetFrame().GetTopFrame().GetWindow(); if ( !bEnable ) pImp->bWindowWasEnabled = pWindow->IsInputEnabled(); if ( !bEnable || pImp->bWindowWasEnabled ) @@ -2598,7 +2598,7 @@ SfxFrame& SfxViewFrame::GetFrame() const //------------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::GetTopViewFrame() const { - return GetFrame().GetTopFrame()->GetCurrentViewFrame(); + return GetFrame().GetTopFrame().GetCurrentViewFrame(); } Window& SfxViewFrame::GetWindow() const @@ -3239,7 +3239,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) return; - Reference < XFrame > xFrame = GetFrame().GetTopFrame()->GetFrameInterface(); + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ) ); BOOL bShow = FALSE; BOOL bHasChild = xBeamer.is(); @@ -3340,7 +3340,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) } else if ( nSID == SID_BROWSER ) { - Reference < XFrame > xFrame = GetFrame().GetTopFrame()->GetFrameInterface()-> + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface()-> findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ); if ( !xFrame.is() ) rState.DisableItem( nSID ); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index d624101f5e79..41188880b01d 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -689,7 +689,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) // ausfuehren if ( !pShowItem || bActive != pImp->bPlugInsActive ) { - SfxFrame* pTopFrame = GetFrame()->GetTopFrame(); + SfxFrame* pTopFrame = &GetFrame()->GetTopFrame(); if ( pTopFrame != &GetFrame()->GetFrame() ) { // FramesetDocument diff --git a/svx/source/cui/hltpbase.cxx b/svx/source/cui/hltpbase.cxx index b727602255f7..5bcd915516bd 100644 --- a/svx/source/cui/hltpbase.cxx +++ b/svx/source/cui/hltpbase.cxx @@ -72,7 +72,7 @@ SvxFramesComboBox::SvxFramesComboBox ( Window* pParent, const ResId& rResId, { TargetList* pList = new TargetList; SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; - SfxFrame* pFrame = pViewFrame ? pViewFrame->GetTopFrame() : 0; + SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetTopFrame() : 0; if ( pFrame ) { pFrame->GetTargetList(*pList); diff --git a/svx/source/dialog/hyprlink.cxx b/svx/source/dialog/hyprlink.cxx index 5b45296fa7f0..94dfcb196d84 100644 --- a/svx/source/dialog/hyprlink.cxx +++ b/svx/source/dialog/hyprlink.cxx @@ -475,7 +475,7 @@ void SvxHyperlinkDlg::TargetMenu(const String& rSelEntry, BOOL bExecute) if (pVwFrm) // Alle moeglichen Target Frames zusammensammeln und anzeigen { TargetList aList; - pVwFrm->GetTopFrame()->GetTargetList(aList); + pVwFrm->GetTopFrame().GetTargetList(aList); USHORT nCount = (USHORT)aList.Count(); if( nCount ) -- cgit v1.2.3 From 55988d12e9edbdabd2a6b9b83c995e787d07b940 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 16 Dec 2009 12:46:33 +0100 Subject: dba33e: #i107717# impl first entry points for db extensions --- connectivity/inc/connectivity/TTableHelper.hxx | 9 ++ connectivity/inc/connectivity/dbtools.hxx | 27 ++++ connectivity/source/commontools/TIndexes.cxx | 154 ++++++++++++----------- connectivity/source/commontools/TKeys.cxx | 154 +++++++++++++---------- connectivity/source/commontools/TTableHelper.cxx | 109 +++++++++++----- connectivity/source/commontools/dbtools2.cxx | 32 +++++ 6 files changed, 313 insertions(+), 172 deletions(-) diff --git a/connectivity/inc/connectivity/TTableHelper.hxx b/connectivity/inc/connectivity/TTableHelper.hxx index d1c2cd331ada..f9384333930d 100644 --- a/connectivity/inc/connectivity/TTableHelper.hxx +++ b/connectivity/inc/connectivity/TTableHelper.hxx @@ -36,6 +36,10 @@ #include "connectivity/sdbcx/VKey.hxx" #include "connectivity/StdTypeDefs.hxx" #include +#include +#include +#include +#include namespace connectivity { @@ -158,6 +162,11 @@ namespace connectivity void addKey(const ::rtl::OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties); virtual ::rtl::OUString getTypeCreatePattern() const; + + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename> getRenameService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration> getAlterService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration> getKeyService() const; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration> getIndexService() const; }; } #endif // CONNECTIVITY_TABLEHELPER_HXX diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index 32ef3bcb7da1..29bb9d0641d8 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -353,6 +353,33 @@ namespace dbtools ,const ::rtl::OUString& _sProperty, sal_Bool _bDefault = sal_False); + /** retrieves a particular indirect data source setting + + @param _rxDataSource + a data source component + @param _pAsciiSettingsName + the ASCII name of the setting to obtain + @param _rSettingsValue + the value of the setting, upon successfull return + + @return + if the setting is not present in the DataSource::Info + member of the data source + otherwise + */ + OOO_DLLPUBLIC_DBTOOLS + bool getDataSourceSetting( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource, + const sal_Char* _pAsciiSettingsName, + ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue + ); + OOO_DLLPUBLIC_DBTOOLS + bool getDataSourceSetting( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource, + const ::rtl::OUString& _sSettingsName, + ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue + ); + OOO_DLLPUBLIC_DBTOOLS ::rtl::OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); /** quote the given name with the given quote string. diff --git a/connectivity/source/commontools/TIndexes.cxx b/connectivity/source/commontools/TIndexes.cxx index cf17b7a51411..c07e3e302f9a 100644 --- a/connectivity/source/commontools/TIndexes.cxx +++ b/connectivity/source/commontools/TIndexes.cxx @@ -143,73 +143,80 @@ sdbcx::ObjectType OIndexesHelper::appendObject( const ::rtl::OUString& _rForName if ( m_pTable->isNew() ) return cloneDescriptor( descriptor ); - ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - ::rtl::OUStringBuffer aSql( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CREATE "))); - ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); + if ( m_pTable->getIndexService().is() ) + { + m_pTable->getIndexService()->addIndex(m_pTable,descriptor); + } + else + { + ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); + ::rtl::OUStringBuffer aSql( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CREATE "))); + ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString::createFromAscii("."); - if(comphelper::getBOOL(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISUNIQUE)))) - aSql.appendAscii("UNIQUE "); - aSql.appendAscii("INDEX "); + if(comphelper::getBOOL(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISUNIQUE)))) + aSql.appendAscii("UNIQUE "); + aSql.appendAscii("INDEX "); - ::rtl::OUString aCatalog,aSchema,aTable; - dbtools::qualifiedNameComponents(m_pTable->getMetaData(),m_pTable->getName(),aCatalog,aSchema,aTable,::dbtools::eInDataManipulation); - ::rtl::OUString aComposedName; + ::rtl::OUString aCatalog,aSchema,aTable; + dbtools::qualifiedNameComponents(m_pTable->getMetaData(),m_pTable->getName(),aCatalog,aSchema,aTable,::dbtools::eInDataManipulation); + ::rtl::OUString aComposedName; - aComposedName = dbtools::composeTableName(m_pTable->getMetaData(),aCatalog,aSchema,aTable,sal_True,::dbtools::eInIndexDefinitions); - if ( _rForName.getLength() ) - { - aSql.append( ::dbtools::quoteName( aQuote, _rForName ) ); - aSql.appendAscii(" ON "); - aSql.append(aComposedName); - aSql.appendAscii(" ( "); - - Reference xColumnSup(descriptor,UNO_QUERY); - Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - sal_Bool bAddIndexAppendix = ::dbtools::getBooleanDataSourceSetting( m_pTable->getConnection(), "AddIndexAppendix" ); - sal_Int32 nCount = xColumns->getCount(); - for(sal_Int32 i = 0 ; i < nCount; ++i) + aComposedName = dbtools::composeTableName(m_pTable->getMetaData(),aCatalog,aSchema,aTable,sal_True,::dbtools::eInIndexDefinitions); + if ( _rForName.getLength() ) { - xColProp.set(xColumns->getByIndex(i),UNO_QUERY); - aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + aSql.append( ::dbtools::quoteName( aQuote, _rForName ) ); + aSql.appendAscii(" ON "); + aSql.append(aComposedName); + aSql.appendAscii(" ( "); - if ( bAddIndexAppendix ) + Reference xColumnSup(descriptor,UNO_QUERY); + Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + sal_Bool bAddIndexAppendix = ::dbtools::getBooleanDataSourceSetting( m_pTable->getConnection(), "AddIndexAppendix" ); + sal_Int32 nCount = xColumns->getCount(); + for(sal_Int32 i = 0 ; i < nCount; ++i) { + xColProp.set(xColumns->getByIndex(i),UNO_QUERY); + aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + + if ( bAddIndexAppendix ) + { - aSql.appendAscii(any2bool(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISASCENDING))) - ? - " ASC" - : - " DESC"); + aSql.appendAscii(any2bool(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_ISASCENDING))) + ? + " ASC" + : + " DESC"); + } + aSql.appendAscii(","); } - aSql.appendAscii(","); + aSql.setCharAt(aSql.getLength()-1,')'); } - aSql.setCharAt(aSql.getLength()-1,')'); - } - else - { - aSql.append(aComposedName); + else + { + aSql.append(aComposedName); - Reference xColumnSup(descriptor,UNO_QUERY); - Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - if(xColumns->getCount() != 1) - throw SQLException(); + Reference xColumnSup(descriptor,UNO_QUERY); + Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + if(xColumns->getCount() != 1) + throw SQLException(); - xColumns->getByIndex(0) >>= xColProp; + xColumns->getByIndex(0) >>= xColProp; - aSql.append(aDot); - aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); - } + aSql.append(aDot); + aSql.append(::dbtools::quoteName( aQuote,comphelper::getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))))); + } - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - ::rtl::OUString sSql = aSql.makeStringAndClear(); - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + ::rtl::OUString sSql = aSql.makeStringAndClear(); + xStmt->execute(sSql); + ::comphelper::disposeComponent(xStmt); + } } return createObject( _rForName ); @@ -221,27 +228,34 @@ void OIndexesHelper::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElem Reference< XConnection> xConnection = m_pTable->getConnection(); if( xConnection.is() && !m_pTable->isNew()) { - ::rtl::OUString aName,aSchema; - sal_Int32 nLen = _sElementName.indexOf('.'); - if(nLen != -1) - aSchema = _sElementName.copy(0,nLen); - aName = _sElementName.copy(nLen+1); + if ( m_pTable->getIndexService().is() ) + { + m_pTable->getIndexService()->dropIndex(m_pTable,_sElementName); + } + else + { + ::rtl::OUString aName,aSchema; + sal_Int32 nLen = _sElementName.indexOf('.'); + if(nLen != -1) + aSchema = _sElementName.copy(0,nLen); + aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); + ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); - ::rtl::OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::eInIndexDefinitions, false, false, true ); - ::rtl::OUString sIndexName,sTemp; - sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), sTemp, aSchema, aName, sal_True, ::dbtools::eInIndexDefinitions ); + ::rtl::OUString aComposedName = dbtools::composeTableName( m_pTable->getMetaData(), m_pTable, ::dbtools::eInIndexDefinitions, false, false, true ); + ::rtl::OUString sIndexName,sTemp; + sIndexName = dbtools::composeTableName( m_pTable->getMetaData(), sTemp, aSchema, aName, sal_True, ::dbtools::eInIndexDefinitions ); - aSql += sIndexName - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) - + aComposedName; + aSql += sIndexName + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) + + aComposedName; - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(aSql); + ::comphelper::disposeComponent(xStmt); + } } } } diff --git a/connectivity/source/commontools/TKeys.cxx b/connectivity/source/commontools/TKeys.cxx index 3dbe711552d7..c4cfc27b741a 100644 --- a/connectivity/source/commontools/TKeys.cxx +++ b/connectivity/source/commontools/TKeys.cxx @@ -150,69 +150,80 @@ sdbcx::ObjectType OKeysHelper::appendObject( const ::rtl::OUString& _rForName, c return xNewDescriptor; } - // if we're here, we belong to a table which is not new, i.e. already exists in the database. - // In this case, really append the new index. - const ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE))); + sal_Int32 nUpdateRule = 0, nDeleteRule = 0; + ::rtl::OUString sReferencedName; - ::rtl::OUString aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString aDot = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - - aSql += composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::eInTableDefinitions, false, false, true ); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ")); - - if ( nKeyType == KeyType::PRIMARY ) + if ( nKeyType == KeyType::FOREIGN ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PRIMARY KEY (")); + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)) >>= sReferencedName; + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_UPDATERULE)) >>= nUpdateRule; + descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DELETERULE)) >>= nDeleteRule; } - else if ( nKeyType == KeyType::FOREIGN ) + + if ( m_pTable->getKeyService().is() ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY (")); + m_pTable->getKeyService()->addKey(m_pTable,descriptor); } else - throw SQLException(); - - Reference xColumnSup(descriptor,UNO_QUERY); - Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); - Reference< XPropertySet > xColProp; - for(sal_Int32 i=0;igetCount();++i) { - ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); - aSql += ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); + // if we're here, we belong to a table which is not new, i.e. already exists in the database. + // In this case, really append the new index. + ::rtl::OUStringBuffer aSql; + aSql.appendAscii("ALTER TABLE "); + ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString( ); + ::rtl::OUString aDot = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); - sal_Int32 nUpdateRule = 0, nDeleteRule = 0; - ::rtl::OUString sReferencedName; + aSql.append(composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable, ::dbtools::eInTableDefinitions, false, false, true )); + aSql.appendAscii(" ADD "); - if ( nKeyType == KeyType::FOREIGN ) - { - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_REFERENCEDTABLE)) >>= sReferencedName; - - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" REFERENCES ")) - + ::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::eInTableDefinitions); - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); + if ( nKeyType == KeyType::PRIMARY ) + { + aSql.appendAscii(" PRIMARY KEY ("); + } + else if ( nKeyType == KeyType::FOREIGN ) + { + aSql.appendAscii(" FOREIGN KEY ("); + } + else + throw SQLException(); - for(sal_Int32 i=0;igetCount();++i) + Reference xColumnSup(descriptor,UNO_QUERY); + Reference xColumns(xColumnSup->getColumns(),UNO_QUERY); + Reference< XPropertySet > xColProp; + for(sal_Int32 i = 0 ; i < xColumns->getCount() ; ++i) { - xColumns->getByIndex(i) >>= xColProp; - aSql += ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_RELATEDCOLUMN)))) - + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + if ( i > 0 ) + aSql.appendAscii(","); + ::cppu::extractInterface(xColProp,xColumns->getByIndex(i)); + aSql.append( ::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME)))) ); + } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); + aSql.appendAscii(")"); - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_UPDATERULE)) >>= nUpdateRule; - descriptor->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_DELETERULE)) >>= nDeleteRule; + if ( nKeyType == KeyType::FOREIGN ) + { + aSql.appendAscii(" REFERENCES "); + aSql.append(::dbtools::quoteTableName(m_pTable->getConnection()->getMetaData(),sReferencedName,::dbtools::eInTableDefinitions)); + aSql.appendAscii(" ("); - aSql += getKeyRuleString(sal_True ,nUpdateRule); - aSql += getKeyRuleString(sal_False ,nDeleteRule); - } + for(sal_Int32 i=0;igetCount();++i) + { + if ( i > 0 ) + aSql.appendAscii(","); + xColumns->getByIndex(i) >>= xColProp; + aSql.append(::dbtools::quoteName( aQuote,getString(xColProp->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))))); - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - xStmt->execute(aSql); + } + aSql.appendAscii(")"); + aSql.append(getKeyRuleString(sal_True ,nUpdateRule)); + aSql.append(getKeyRuleString(sal_False ,nDeleteRule)); + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + xStmt->execute(aSql.makeStringAndClear()); + } // find the name which the database gave the new key ::rtl::OUString sNewName( _rForName ); try @@ -269,34 +280,41 @@ void OKeysHelper::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName Reference< XConnection> xConnection = m_pTable->getConnection(); if ( xConnection.is() && !m_pTable->isNew() ) { - ::rtl::OUString aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER TABLE ")); - - aSql += composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::eInTableDefinitions, false, false, true ); - Reference xKey(getObject(_nPos),UNO_QUERY); - - sal_Int32 nKeyType = KeyType::PRIMARY; - if ( xKey.is() ) - { - ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); - xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType; - } - if ( KeyType::PRIMARY == nKeyType ) + if ( m_pTable->getKeyService().is() ) { - aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP PRIMARY KEY")); + m_pTable->getKeyService()->dropKey(m_pTable,xKey); } else { - aSql += getDropForeignKey(); - const ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString(); - aSql += ::dbtools::quoteName( aQuote,_sElementName); - } + ::rtl::OUStringBuffer aSql; + aSql.appendAscii("ALTER TABLE "); - Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(aSql); - ::comphelper::disposeComponent(xStmt); + aSql.append( composeTableName( m_pTable->getConnection()->getMetaData(), m_pTable,::dbtools::eInTableDefinitions, false, false, true )); + + sal_Int32 nKeyType = KeyType::PRIMARY; + if ( xKey.is() ) + { + ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap(); + xKey->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_TYPE)) >>= nKeyType; + } + if ( KeyType::PRIMARY == nKeyType ) + { + aSql.appendAscii(" DROP PRIMARY KEY"); + } + else + { + aSql.append(getDropForeignKey()); + const ::rtl::OUString aQuote = m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString(); + aSql.append( ::dbtools::quoteName( aQuote,_sElementName) ); + } + + Reference< XStatement > xStmt = m_pTable->getConnection()->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(aSql.makeStringAndClear()); + ::comphelper::disposeComponent(xStmt); + } } } } diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index 477ec01c0499..38b5d7fc52f3 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -101,11 +101,40 @@ namespace connectivity struct OTableHelperImpl { TKeyMap m_aKeys; - Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + // helper services which can be provided by extensions + Reference< ::com::sun::star::sdb::tools::XTableRename> m_xRename; + Reference< ::com::sun::star::sdb::tools::XTableAlteration> m_xAlter; + Reference< ::com::sun::star::sdb::tools::XKeyAlteration> m_xKeyAlter; + Reference< ::com::sun::star::sdb::tools::XIndexAlteration> m_xIndexAlter; + + Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; ::comphelper::ImplementationReference< OTableContainerListener,XContainerListener> m_xTablePropertyListener; ::std::vector< ColumnDesc > m_aColumnDesc; + OTableHelperImpl(const Reference< ::com::sun::star::sdbc::XConnection >& _xConnection) + : m_xConnection(_xConnection) + { + try + { + m_xMetaData = m_xConnection->getMetaData(); + Reference xFac(_xConnection,UNO_QUERY); + if ( xFac.is() ) + { + static const ::rtl::OUString s_sTableRename(RTL_CONSTASCII_USTRINGPARAM("TableRenameServiceName")); + m_xRename.set(xFac->createInstance(s_sTableRename),UNO_QUERY); + static const ::rtl::OUString s_sTableAlteration(RTL_CONSTASCII_USTRINGPARAM("TableAlterationServiceName")); + m_xAlter.set(xFac->createInstance(s_sTableAlteration),UNO_QUERY); + static const ::rtl::OUString s_sKeyAlteration(RTL_CONSTASCII_USTRINGPARAM("KeyAlterationServiceName")); + m_xKeyAlter.set(xFac->createInstance(s_sKeyAlteration),UNO_QUERY); + static const ::rtl::OUString s_sIndexAlteration(RTL_CONSTASCII_USTRINGPARAM("IndexAlterationServiceName")); + m_xIndexAlter.set(xFac->createInstance(s_sIndexAlteration),UNO_QUERY); + } + } + catch(const Exception&) + { + } + } }; } @@ -113,16 +142,8 @@ OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, const Reference< XConnection >& _xConnection, sal_Bool _bCase) :OTable_TYPEDEF(_pTables,_bCase) - ,m_pImpl(new OTableHelperImpl) + ,m_pImpl(new OTableHelperImpl(_xConnection)) { - try - { - m_pImpl->m_xConnection = _xConnection; - m_pImpl->m_xMetaData = m_pImpl->m_xConnection->getMetaData(); - } - catch(const Exception&) - { - } } // ------------------------------------------------------------------------- OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, @@ -140,16 +161,8 @@ OTableHelper::OTableHelper( sdbcx::OCollection* _pTables, _Description, _SchemaName, _CatalogName) - ,m_pImpl(new OTableHelperImpl) + ,m_pImpl(new OTableHelperImpl(_xConnection)) { - try - { - m_pImpl->m_xConnection = _xConnection; - m_pImpl->m_xMetaData = m_pImpl->m_xConnection->getMetaData(); - } - catch(const Exception&) - { - } } // ----------------------------------------------------------------------------- OTableHelper::~OTableHelper() @@ -483,24 +496,31 @@ void SAL_CALL OTableHelper::rename( const ::rtl::OUString& newName ) throw(SQLEx if(!isNew()) { - ::rtl::OUString sSql = getRenameStart(); - ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); + if ( m_pImpl->m_xRename.is() ) + { + m_pImpl->m_xRename->rename(this,newName); + } + else + { + ::rtl::OUString sSql = getRenameStart(); + ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); - ::rtl::OUString sCatalog,sSchema,sTable; - ::dbtools::qualifiedNameComponents(getMetaData(),newName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); + ::rtl::OUString sCatalog,sSchema,sTable; + ::dbtools::qualifiedNameComponents(getMetaData(),newName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - ::rtl::OUString sComposedName; - sComposedName = ::dbtools::composeTableName(getMetaData(),m_CatalogName,m_SchemaName,m_Name,sal_True,::dbtools::eInDataManipulation); - sSql += sComposedName - + ::rtl::OUString::createFromAscii(" TO "); - sComposedName = ::dbtools::composeTableName(getMetaData(),sCatalog,sSchema,sTable,sal_True,::dbtools::eInDataManipulation); - sSql += sComposedName; + ::rtl::OUString sComposedName; + sComposedName = ::dbtools::composeTableName(getMetaData(),m_CatalogName,m_SchemaName,m_Name,sal_True,::dbtools::eInDataManipulation); + sSql += sComposedName + + ::rtl::OUString::createFromAscii(" TO "); + sComposedName = ::dbtools::composeTableName(getMetaData(),sCatalog,sSchema,sTable,sal_True,::dbtools::eInDataManipulation); + sSql += sComposedName; - Reference< XStatement > xStmt = m_pImpl->m_xConnection->createStatement( ); - if ( xStmt.is() ) - { - xStmt->execute(sSql); - ::comphelper::disposeComponent(xStmt); + Reference< XStatement > xStmt = m_pImpl->m_xConnection->createStatement( ); + if ( xStmt.is() ) + { + xStmt->execute(sSql); + ::comphelper::disposeComponent(xStmt); + } } OTable_TYPEDEF::rename(newName); @@ -579,3 +599,24 @@ Reference< XConnection> OTableHelper::getConnection() const { return m_pImpl->m_xConnection; } +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XTableRename> OTableHelper::getRenameService() const +{ + return m_pImpl->m_xRename; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XTableAlteration> OTableHelper::getAlterService() const +{ + return m_pImpl->m_xAlter; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XKeyAlteration> OTableHelper::getKeyService() const +{ + return m_pImpl->m_xKeyAlter; +} +// ----------------------------------------------------------------------------- +Reference< ::com::sun::star::sdb::tools::XIndexAlteration> OTableHelper::getIndexService() const +{ + return m_pImpl->m_xIndexAlter; +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index e08c3a33076d..8e7c3bdb5dca 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -596,7 +596,39 @@ bool getBooleanDataSourceSetting( const Reference< XConnection >& _rxConnection, } return bValue; } +// ------------------------------------------------------------------------- +bool getDataSourceSetting( const Reference< XInterface >& _xChild, const ::rtl::OUString& _sAsciiSettingsName, + Any& /* [out] */ _rSettingsValue ) +{ + bool bIsPresent = false; + try + { + const Reference< XPropertySet> xDataSourceProperties( findDataSource( _xChild ), UNO_QUERY ); + OSL_ENSURE( xDataSourceProperties.is(), "getDataSourceSetting: invalid data source object!" ); + if ( !xDataSourceProperties.is() ) + return false; + + const Reference< XPropertySet > xSettings( + xDataSourceProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Settings") ) ), + UNO_QUERY_THROW + ); + _rSettingsValue = xSettings->getPropertyValue( _sAsciiSettingsName ); + bIsPresent = true; + } + catch( const Exception& ) + { + bIsPresent = false; + } + return bIsPresent; +} +// ------------------------------------------------------------------------- +bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const sal_Char* _pAsciiSettingsName, + Any& /* [out] */ _rSettingsValue ) +{ + ::rtl::OUString sAsciiSettingsName = ::rtl::OUString::createFromAscii(_pAsciiSettingsName); + return getDataSourceSetting( _rxDataSource, sAsciiSettingsName,_rSettingsValue ); +} // ----------------------------------------------------------------------------- sal_Bool isDataSourcePropertyEnabled(const Reference& _xProp,const ::rtl::OUString& _sProperty,sal_Bool _bDefault) { -- cgit v1.2.3 From d7bee45fb0d3178bcf4bfe52fddd9e2b73735ee8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 17 Dec 2009 10:48:18 +0100 Subject: dba33e: #i107251#: allow to work with an external number formatter --- .../inc/connectivity/formattedcolumnvalue.hxx | 14 ++++ .../source/commontools/formattedcolumnvalue.cxx | 90 +++++++++++++--------- 2 files changed, 68 insertions(+), 36 deletions(-) diff --git a/connectivity/inc/connectivity/formattedcolumnvalue.hxx b/connectivity/inc/connectivity/formattedcolumnvalue.hxx index fbe39a75f20d..a2139a6739af 100644 --- a/connectivity/inc/connectivity/formattedcolumnvalue.hxx +++ b/connectivity/inc/connectivity/formattedcolumnvalue.hxx @@ -36,6 +36,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -77,6 +78,19 @@ namespace dbtools const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn ); + /** constructs an instance + + The format key for the string value exchange is taken from the given column object. + If it has a non- property value FormatKey, this key is taken. + Otherwise, a default format matching the column type is determined. + + The locale of this fallback format is the current system locale. + */ + FormattedColumnValue( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn + ); + // note that all methods of this class need to be virtual, since it's // used in a load-on-demand context in module SVX diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index 76519aa6a551..b2481d0c1020 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -45,13 +45,11 @@ /** === end UNO includes === **/ #include - #include - #include - #include #include +#include //........................................................................ namespace dbtools @@ -62,6 +60,7 @@ namespace dbtools using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; @@ -116,21 +115,7 @@ namespace dbtools //................................................................ void lcl_clear_nothrow( FormattedColumnValue_Data& _rData ) { - if ( _rData.m_xFormatter.is() ) - { - try - { - Reference< XComponent > xFormatterComp( _rData.m_xFormatter, UNO_QUERY ); - if ( xFormatterComp.is() ) - xFormatterComp->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - _rData.m_xFormatter.clear(); - } - + _rData.m_xFormatter.clear(); _rData.m_nFormatKey = 0; _rData.m_nFieldType = DataType::OTHER; _rData.m_nKeyType = NumberFormat::UNDEFINED; @@ -141,21 +126,24 @@ namespace dbtools } //................................................................ - void lcl_initColumnDataValue_nothrow( const ::comphelper::ComponentContext& _rContext, FormattedColumnValue_Data& _rData, - const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn ) + void lcl_initColumnDataValue_nothrow( FormattedColumnValue_Data& _rData, + const Reference< XNumberFormatter >& i_rNumberFormatter, const Reference< XPropertySet >& _rxColumn ) { lcl_clear_nothrow( _rData ); - OSL_PRECOND( _rxRowSet.is(), "lcl_initColumnDataValue_nothrow: no row set!" ); - OSL_PRECOND( _rxColumn.is(), "lcl_initColumnDataValue_nothrow: no column!" ); - if ( !_rxRowSet.is() || !_rxColumn.is() ) + OSL_PRECOND( i_rNumberFormatter.is(), "lcl_initColumnDataValue_nothrow: no number formats -> no formatted values!" ); + if ( !i_rNumberFormatter.is() ) return; try { + Reference< XNumberFormatsSupplier > xNumberFormatsSupp( i_rNumberFormatter->getNumberFormatsSupplier(), UNO_SET_THROW ); + + // remember the column _rData.m_xColumn.set( _rxColumn, UNO_QUERY_THROW ); _rData.m_xColumnUpdate.set( _rxColumn, UNO_QUERY ); + // determine the field type, and whether it's a numeric field OSL_VERIFY( _rxColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) ) >>= _rData.m_nFieldType ); switch ( _rData.m_nFieldType ) @@ -180,10 +168,6 @@ namespace dbtools break; } - // get the number formats supplier of the connection of the form - Reference< XConnection > xConnection( getConnection( _rxRowSet ), UNO_QUERY_THROW ); - Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_False, _rContext.getLegacyServiceFactory() ), UNO_QUERY_THROW ); - // get the format key of our bound field Reference< XPropertySetInfo > xPSI( _rxColumn->getPropertySetInfo(), UNO_QUERY_THROW ); bool bHaveFieldFormat = false; @@ -197,23 +181,49 @@ namespace dbtools // fall back to a format key as indicated by the field type Locale aSystemLocale; MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage(), aSystemLocale ); - Reference< XNumberFormatTypes > xNumTypes( xSupplier->getNumberFormats(), UNO_QUERY_THROW ); + Reference< XNumberFormatTypes > xNumTypes( xNumberFormatsSupp->getNumberFormats(), UNO_QUERY_THROW ); _rData.m_nFormatKey = getDefaultNumberFormat( _rxColumn, xNumTypes, aSystemLocale ); } // some more formatter settings - _rData.m_nKeyType = ::comphelper::getNumberFormatType( xSupplier->getNumberFormats(), _rData.m_nFormatKey ); - Reference< XPropertySet > xFormatSettings( xSupplier->getNumberFormatSettings(), UNO_QUERY_THROW ); + _rData.m_nKeyType = ::comphelper::getNumberFormatType( xNumberFormatsSupp->getNumberFormats(), _rData.m_nFormatKey ); + Reference< XPropertySet > xFormatSettings( xNumberFormatsSupp->getNumberFormatSettings(), UNO_QUERY_THROW ); OSL_VERIFY( xFormatSettings->getPropertyValue( ::rtl::OUString::createFromAscii( "NullDate" ) ) >>= _rData.m_aNullDate ); - // create a formatter working with the connection's number format supplier - _rData.m_xFormatter.set( _rContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); - _rData.m_xFormatter->attachNumberFormatsSupplier( xSupplier ); + // remember the formatter + _rData.m_xFormatter = i_rNumberFormatter; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //................................................................ + void lcl_initColumnDataValue_nothrow( const ::comphelper::ComponentContext& i_rContext, FormattedColumnValue_Data& i_rData, + const Reference< XRowSet >& i_rRowSet, const Reference< XPropertySet >& i_rColumn ) + { + OSL_PRECOND( i_rRowSet.is(), "lcl_initColumnDataValue_nothrow: no row set!" ); + if ( !i_rRowSet.is() ) + return; + + Reference< XNumberFormatter > xNumberFormatter; + try + { + // get the number formats supplier of the connection of the form + Reference< XConnection > xConnection( getConnection( i_rRowSet ), UNO_QUERY_THROW ); + Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_True, i_rContext.getLegacyServiceFactory() ), UNO_SET_THROW ); + + // create a number formatter for it + xNumberFormatter.set( i_rContext.createComponent( "com.sun.star.util.NumberFormatter" ), UNO_QUERY_THROW ); + xNumberFormatter->attachNumberFormatsSupplier( xSupplier ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } + + lcl_initColumnDataValue_nothrow( i_rData, xNumberFormatter, i_rColumn ); } } @@ -221,11 +231,19 @@ namespace dbtools //= FormattedColumnValue //==================================================================== //-------------------------------------------------------------------- - FormattedColumnValue::FormattedColumnValue( const ::comphelper::ComponentContext& _rContext, - const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& _rxColumn ) + FormattedColumnValue::FormattedColumnValue( const ::comphelper::ComponentContext& i_rContext, + const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& i_rColumn ) + :m_pData( new FormattedColumnValue_Data ) + { + lcl_initColumnDataValue_nothrow( i_rContext, *m_pData, _rxRowSet, i_rColumn ); + } + + //-------------------------------------------------------------------- + FormattedColumnValue::FormattedColumnValue( const Reference< XNumberFormatter >& i_rNumberFormatter, + const Reference< XPropertySet >& _rxColumn ) :m_pData( new FormattedColumnValue_Data ) { - lcl_initColumnDataValue_nothrow( _rContext, *m_pData, _rxRowSet, _rxColumn ); + lcl_initColumnDataValue_nothrow( *m_pData, i_rNumberFormatter, _rxColumn ); } //-------------------------------------------------------------------- -- cgit v1.2.3 From d973b931c32fe0f78b8514ef0334dcc947cd2e76 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 17 Dec 2009 13:44:23 +0100 Subject: autorecovery: do not create SfxFrame instances for an XFrame outside the loader --- sfx2/inc/sfx2/frame.hxx | 5 +++-- sfx2/source/appl/appserv.cxx | 9 +++++---- sfx2/source/view/frame2.cxx | 17 ++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index cfd0ee05c031..832389ad5981 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -138,8 +138,9 @@ protected: public: TYPEINFO(); - static SfxFrame* Create( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame ); - static SfxFrame* CreateBlank(); + static SfxFrame* Create( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); + static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + CreateBlankFrame(); static SfxFrame* Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ); SvCompatWeakHdl* GetHdl(); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 625acdb085fd..2fea15cc27e6 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -982,11 +982,12 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) aLoadArgs.put( "Model", pBasicIDE->GetModel() ); aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); - Reference< XFrame > xStartModuleFrame( lcl_findStartModuleFrame( aContext ) ); - SfxFrame* pFrame = xStartModuleFrame.is() ? SfxFrame::Create( xStartModuleFrame ) : SfxFrame::CreateBlank(); - ENSURE_OR_THROW( pFrame, "could not create a SfxFrame to load the Basic IDE into!" ); + Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) ); + if ( !xTargetFrame.is() ) + xTargetFrame = SfxFrame::CreateBlankFrame(); + ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" ); - xLoader->load( aLoadArgs.getPropertyValues(), pFrame->GetFrameInterface() ); + xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame ); } catch( const Exception& ) { diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index edb927d20001..65eab2e30b15 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -237,21 +237,20 @@ void SfxFrameWindow_Impl::DoResize() pFrame->Resize(); } -SfxFrame* SfxFrame::CreateBlank() +Reference < XFrame > SfxFrame::CreateBlankFrame() { - SfxFrame* pFrame = NULL; + Reference < XFrame > xFrame; try { ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); - Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); - pFrame = Create( xFrame ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - return pFrame; + return xFrame; } SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) @@ -315,15 +314,15 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewI return pFrame; } -SfxFrame* SfxFrame::Create( Reference < XFrame > xFrame ) +SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame ) { // create a new TopFrame to an external XFrame object ( wrap controller ) - ENSURE_OR_THROW( xFrame.is(), "NULL frame not allowed" ); - Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + ENSURE_OR_THROW( i_rFrame.is(), "NULL frame not allowed" ); + Window* pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() ); ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); SfxFrame* pFrame = new SfxFrame( *pWindow, false ); - pFrame->SetFrameInterface_Impl( xFrame ); + pFrame->SetFrameInterface_Impl( i_rFrame ); return pFrame; } -- cgit v1.2.3 From 7255eca208d1cfdc2d294c168d0e849ae7150b22 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 09:48:23 +0100 Subject: autorecovery: removed a few unused slot IDs --- sfx2/inc/sfx2/sfxsids.hrc | 202 +------------ sfx2/sdi/sfx.sdi | 589 ++---------------------------------- sfx2/source/appl/appbas.cxx | 5 - sfx2/source/control/dispatch.cxx | 24 -- sfx2/source/dialog/mailmodelapi.cxx | 16 - sfx2/source/doc/objstor.cxx | 1 - sfx2/source/doc/objxtor.cxx | 9 - sfx2/source/view/viewfrm.cxx | 55 +--- sfx2/util/hidother.src | 30 -- svx/sdi/svx.sdi | 25 -- 10 files changed, 23 insertions(+), 933 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index c6d4771d97d5..cf9f3008ec6d 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -123,7 +123,6 @@ #define SID_NONE 0 #define SID_UNKNOWN SID_SFX_START -#define SID_SUBREQUEST (SID_SFX_START+90) //------------------------------------------------------------------------- @@ -153,79 +152,28 @@ #define SID_PRINTER_CHANGESTODOC (SID_SFX_START + 324) #define SID_PRINTPREVIEW (SID_SFX_START + 325) -#define SID_MAIL_DATE (SID_SFX_START + 326) -#define SID_MAIL_FROM (SID_SFX_START + 327) #define SID_MAIL_SUBJECT (SID_SFX_START + 328) -#define SID_MAIL_OPEN (SID_SFX_START + 329) #define SID_MAIL_NOTIFY (SID_SFX_START + 330) #define SID_MAIL_SENDDOC (SID_SFX_START + 331) #define SID_MAIL_SENDDOCASPDF (SID_SFX_START + 1672) - #define SID_MAIL_RECIPIENT (SID_SFX_START + 334) #define SID_MAIL_TEXT (SID_SFX_START + 335) #define SID_MAIL_ATTACH (SID_SFX_START + 336) #define SID_MAIL_PRIORITY (SID_SFX_START + 337) -#define SID_MAIL_DELETE (SID_SFX_START + 338) -#define SID_MAIL_NEW (SID_SFX_START + 339) - -#define SID_MAIL_NEWWITHSERVER (SID_SFX_START + 360) -#define SID_MAIL_REPLY (SID_SFX_START + 361) -#define SID_MAIL_FOLLOWUP (SID_SFX_START + 362) -#define SID_MAIL_FORWARD (SID_SFX_START + 363) -#define SID_MAIL_SEND (SID_SFX_START + 364) -#define SID_MAIL_FILE (SID_SFX_START + 365) -#define SID_MAIL_MARKASREAD (SID_SFX_START + 366) -#define SID_MAIL_MARKASUNREAD (SID_SFX_START + 367) -#define SID_MAIL_NEXT (SID_SFX_START + 368) -#define SID_MAIL_PREV (SID_SFX_START + 369) -#define SID_MAIL_NEXTDELETE (SID_SFX_START + 370) -#define SID_MAIL_PREVDELETE (SID_SFX_START + 371) -#define SID_MAIL_OPEN_NEWS (SID_SFX_START + 372) -#define SID_MAIL_THREAD_MARKASREAD (SID_SFX_START + 373) -#define SID_MAIL_THREAD_MARKASUNREAD (SID_SFX_START + 374) + #define SID_MAIL_ATTACH_FILE (SID_SFX_START + 375) -#define SID_MAIL_DETACH_FILE (SID_SFX_START + 376) -#define SID_MAIL_MARK (SID_SFX_START + 377) -#define SID_MAIL_TXTFORMAT (SID_SFX_START + 378) -#define SID_MAIL_UPDATETOOLBOX (SID_SFX_START + 379) - -#define SID_OPEN_ANCHOR (SID_SFX_START + 380) -#define SID_MAIL_ADDRESSBOOK (SID_SFX_START + 1644) -#define SID_MAIL_ALLNEWSGROUPS (SID_SFX_START + 382) -#define SID_MAIL_GROUPREPLY (SID_SFX_START + 383) -#define SID_MAIL_SIGNATURE (SID_SFX_START + 384) -#define SID_MAIL_PREPAREEXPORT (SID_SFX_START + 385) -#define SID_MAIL_NEXTUNREAD (SID_SFX_START + 386) -#define SID_MAIL_PREVUNREAD (SID_SFX_START + 387) + #define SID_MAIL_EXPORT_FINISHED (SID_SFX_START + 388) -#define SID_NEWSSERVER_NAME (SID_SFX_START + 389) -#define SID_NEWS_GROUP_CHANGED (SID_SFX_START + 390) -#define SID_MAILBROWSER_CTRL (SID_SFX_START + 391) -#define SID_NEWSGROUP_NAME (SID_SFX_START + 392) #define SID_WEBHTML (SID_SFX_START + 393) #define SID_MAIL_SCROLLBODY_PAGEDOWN (SID_SFX_START + 1588) -#define SID_MAIL_REPLY_FOLLOWUP (SID_SFX_START + 1635) -#define SID_PHONE_STATUSBAR_CONTROL (SID_SFX_START + 398) -#define SID_RECOGNIZER_STATUSBAR_CONTROL (SID_SFX_START + 399) #define SID_PROGRESS_STATUSBAR_CONTROL (SID_SFX_START + 1597) -#define SID_RESOURCE_WARNING (SID_SFX_START + 333) - #define SID_APPLICATION (SID_SFX_START + 340) #define SID_PROGNAME (SID_SFX_START + 341) #define SID_PROGFILENAME (SID_SFX_START + 342) -#define SID_PROGPATH (SID_SFX_START + 343) -#define SID_INTERACTIVEMODE (SID_SFX_START + 344) -#define SID_PARENTOBJECT (SID_SFX_START + 345) #define SID_SELECTION (SID_SFX_START + 346) -#define SID_CREATOR (SID_SFX_START + 347) - -#define SID_COLL_COUNT (SID_SFX_START + 350) -#define SID_COLL_ITEM (SID_SFX_START + 351) -#define SID_COLL_REMOVE (SID_SFX_START + 352) -#define SID_COLL_ADD (SID_SFX_START + 353) // 360-400 siehe SID_MAIL_... @@ -277,26 +225,14 @@ #define SID_RELOAD (SID_SFX_START + 508) #define SID_PRINTDOCDIRECT (SID_SFX_START + 509) #define SID_PICKLIST (SID_SFX_START + 510) -#define SID_EDIT_FRAMESET (SID_SFX_START + 646) -#define SID_SPLIT_HORIZONTAL (SID_SFX_START + 647) -#define SID_SPLIT_VERTICAL (SID_SFX_START + 648) -#define SID_SPLIT_PARENT_HORIZONTAL (SID_SFX_START + 649) -#define SID_SPLIT_PARENT_VERTICAL (SID_SFX_START + 650) -#define SID_MODIFY_FRAME (SID_SFX_START + 651) -#define SID_DELETE_FRAME (SID_SFX_START + 652) -#define SID_FRAME_NAME (SID_SFX_START + 825) -#define SID_FRAME_CONTENT (SID_SFX_START + 826) #define SID_PLUGIN_MODE (SID_SFX_START + 827) -#define SID_LOCKBYTES_FACTORY (SID_SFX_START + 828) #define SID_EXPORTDOC (SID_SFX_START + 829) #define SID_EXPORTDOCASPDF (SID_SFX_START + 1673) #define SID_DIRECTEXPORTDOCASPDF (SID_SFX_START + 1674) #define SID_UPDATEDOCMODE (SID_SFX_START + 1668) -#define SID_NOCACHE (SID_SFX_START + 653) #define SID_FORCERELOAD (SID_SFX_START + 1502) #define SID_FILE_DIALOG (SID_SFX_START + 304) -#define SID_GRAFIC_DIALOG (SID_SFX_START + 305) #define SID_PATH (SID_SFX_START + 308) #define SID_SAVEDOCS (SID_SFX_START + 309) #define SID_STANDARD_DIR (SID_SFX_START + 450) @@ -305,88 +241,20 @@ // browse-ids #define SID_BROWSE_FORWARD (SID_SFX_START + 1300) #define SID_BROWSE_BACKWARD (SID_SFX_START + 1301) - // FREE, formerly SID_BROWSE_STOP #define SID_BROWSE_HOME (SID_SFX_START + 1303) -#define SID_AUTOBROWSE (SID_SFX_START + 1304) -#define SID_AUTOMAIL (SID_SFX_START + 1305) -#define SID_BROWSING (SID_SFX_START + 1306) -#define SID_ADDR_BOOK (SID_SFX_START + 1307) -#define SID_EXPLORER (SID_SFX_START + 1308) #define SID_CREATELINK (SID_SFX_START + 1309) #define SID_BOOKMARK_TITLE (SID_SFX_START + 1310) #define SID_BOOKMARK_URL (SID_SFX_START + 1311) #define SID_EDITDOC (SID_SFX_START + 1312) #define SID_BROWSER_MODE (SID_SFX_START + 1313) #define SID_PLUGINS_ACTIVE (SID_SFX_START + 1314) -#define SID_SAVEDOCTOBOOKMARK (SID_SFX_START + 1315) -#define SID_CLEARMEMCACHE (SID_SFX_START + 1316) #define SID_BROWSER (SID_SFX_START + 1318) #define SID_MACROEXECMODE (SID_SFX_START + 1319) -#define SID_EXPLORERCONTENT_OPEN (SID_SFX_START + 1322) -#define SID_EXPLORERCONTENT_OPEN_DOCUMENT (SID_SFX_START + 1321) -#define SID_EXPLORERCONTENT_OPEN_TEMPLATE (SID_SFX_START + 1362) -#define SID_EXPLORERCONTENT_OPEN_FOLDER (SID_SFX_START + 1542) -#define SID_EXPLORERCONTENT_OPEN_OBJECT (SID_SFX_START + 1543) -#define SID_EXPLORERCONTENT_NEW (SID_SFX_START + 1323) -#define SID_EXPLORERCONTENT_DESTROY (SID_SFX_START + 1324) -#define SID_EXPLORERCONTENT_MAKEROOT (SID_SFX_START + 1325) -#define SID_EXPLORERCONTENT_RENAME (SID_SFX_START + 1326) -#define SID_EXPLORERCONTENT_COPY (SID_SFX_START + 1327) -#define SID_EXPLORERCONTENT_PASTE (SID_SFX_START + 1328) -#define SID_EXPLORERCONTENT_CREATELINK (SID_SFX_START + 1329) -#define SID_EXPLORERCONTENT_DEFAULTTEMPLATE (SID_SFX_START + 1330) -#define SID_EXPLORER_CREATEFOLDER (SID_SFX_START + 1331) -#define SID_EXPLORER_CREATEBOOKMARK (SID_SFX_START + 1332) -#define SID_EXPLORER_CREATEWORKPLACE (SID_SFX_START + 1333) -#define SID_EXPLORER_CREATELINK (SID_SFX_START + 1334) -#define SID_EXPLORER_CREATEMAILINTRAY (SID_SFX_START + 1335) -#define SID_EXPLORER_CREATENEWSSERVER (SID_SFX_START + 1336) -#define SID_EXPLORER_CREATEFTPSERVER (SID_SFX_START + 1337) -#define SID_EXPLORER_CREATEDATABASE (SID_SFX_START + 1338) -#define SID_EXPLORER_CREATEGALLERY (SID_SFX_START + 1339) -#define SID_PROPERTIES (SID_SFX_START + 1350) -#define SID_EXPLORER_MAKEROOT (SID_SFX_START + 1351) -#define SID_EXPLORER_MAKEBMKDIR (SID_SFX_START + 1352) -#define SID_EXPLORER_PREVLEVEL (SID_SFX_START + 1353) -#define SID_EXPLORER_IMPORTBOOKMARKS (SID_SFX_START + 1354) -#define SID_EXPLORER_SEARCHORIGINAL (SID_SFX_START + 1355) -#define SID_EXPLORER_DETAILS (SID_SFX_START + 1356) -#define SID_EXPLORER_ICONS (SID_SFX_START + 1357) -#define SID_VIEWTYPE_DETAILS (SID_SFX_START + 1358) -#define SID_EXPLORER_MSGROUP_FSYS (SID_SFX_START + 1359) -#define SID_EXPLORER_MSGROUP_NEWSARTICLE (SID_SFX_START + 1360) -#define SID_EXPLORER_MSGROUP_NEWSGROUP (SID_SFX_START + 1361) -#define SID_EXPLORER_RESETURL (SID_SFX_START + 1520) - -#define SID_EXPLORER_DOCINFO (SID_SFX_START + 1363) -#define SID_EXPLORER_PREVIEW (SID_SFX_START + 1364) -#define SID_EXPLORER_MSGROUP_FTPFILE (SID_SFX_START + 1365) -#define SID_SEARCHORIGINAL (SID_SFX_START + 1366) -#define SID_EXPLORER_MSGROUP_MAILS (SID_SFX_START + 1367) -#define SID_EXPLORER_MSGROUP_CHAOS (SID_SFX_START + 1368) // die Id steht mit diesem Wert in chaos/cntids.hrc!! //#define SID_INTERNET_ONLINE (SID_SFX_START + 1370) -#define SID_INTERNET_UPDATE (SID_SFX_START + 1371) -#define SID_INTERNET_1 (SID_SFX_START + 1372) -#define SID_INTERNET_2 (SID_SFX_START + 1373) -#define SID_INTERNET_3 (SID_SFX_START + 1374) - #define SID_FILTER_DATA (SID_SFX_START + 1375) -#define SID_EXPLORER_SEARCH_DLG (SID_SFX_START + 1380) -#define SID_EXPLORER_MULTIQUICKSEARCH (SID_SFX_START + 1522) -#define SID_EXPLORER_SHOWEXTENSION (SID_SFX_START + 1594) -#define SID_EXPLORER_MAIL_HEADER (SID_SFX_START + 1595) -#define SID_EXPLORER_MAIL_BODY (SID_SFX_START + 1596) - -#define SID_TABPAGE (SID_SFX_START + 1383) -//#define SID_EXPLORER_CREATESEARCHFOLDER (SID_SFX_START + 1384) -#define SID_EMPTY_TRASH (SID_SFX_START + 1385) -#define SID_AFTEROPENEVENT (SID_SFX_START + 1386) -#define SID_QUERYICON (SID_SFX_START + 1387) -#define SID_SYNCEXPLORER (SID_SFX_START + 1388) -#define SID_EXPLORER_PASTE_ASLINK (SID_SFX_START + 1389) #define SID_EXPLORER_FILEPROPS_START (SID_SFX_START + 1390) #define SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399) @@ -394,73 +262,23 @@ #define ID_FILETP_START SID_EXPLORER_FILEPROPS_START #define ID_FILETP_READONLY (ID_FILETP_START + 0) #define ID_FILETP_TITLE (ID_FILETP_START + 1) -#define ID_FILETP_SIZE (ID_FILETP_START + 2) -#define ID_FILETP_TYPE (ID_FILETP_START + 3) -#define ID_FILETP_PATH (ID_FILETP_START + 4) -#define ID_FILETP_CREATED (ID_FILETP_START + 5) -#define ID_FILETP_CHANGED (ID_FILETP_START + 6) -#define ID_FILETP_EDIT (ID_FILETP_START + 7) -#define ID_FILETP_IMAGE (ID_FILETP_START + 8) -#define ID_FILETP_LINK (ID_FILETP_START + 9) -#define ID_FILETP_END (ID_FILETP_START + 9) - -#define SID_NEWFRAMESET (SID_SFX_START + 1400) #define SID_EXPLORER_PROPS_START (SID_SFX_START + 1410) #define SID_EXPLORER_PROPS_END (SID_SFX_START + 1499) - - -#define SID_TRASH_RECOVER (SID_SFX_START + 1502) -#define SID_TRASH_AUTOEMPTY (SID_SFX_START + 1503) -#define SID_TRASH_EMPTY (SID_SFX_START + 1504) -#define SID_EXPLORER_BOOKMARKDIR (SID_SFX_START + 1505) -#define SID_EXPLORER_SEARCHORIG (SID_SFX_START + 1506) -#define SID_FRAMESPACING (SID_SFX_START + 1507) -#define SID_LATEINIT_DONE (SID_SFX_START + 1508) #define SID_AUTOLOAD (SID_SFX_START + 1509) -#define SID_FRAMECOUNT (SID_SFX_START + 1510) -#define SID_ISTOP (SID_SFX_START + 1511) #define SID_VIEW (SID_SFX_START + 1512) -#define SID_ORIG_PROPERTIES (SID_SFX_START + 1513) -#define SID_MAIL_NOTIFY_RESET (SID_SFX_START + 1514) #define SID_FILLFRAME (SID_SFX_START + 1516) -#define SID_LOAD_LIBRARY (SID_SFX_START + 1517) #define SID_BASEURL (SID_SFX_START + 1518) #define SID_TEMPLATE (SID_SFX_START + 1519) -#define SID_UNLOAD_LIBRARY (SID_SFX_START + 1523) -#define SID_ADD_LIBRARY (SID_SFX_START + 1524) -#define SID_REMOVE_LIBRARY (SID_SFX_START + 1525) -#define SID_CLASSNAME (SID_SFX_START + 1526) -#define SID_INTERCEPTOR (SID_SFX_START + 1527) -#define SID_TARGETPATH (SID_SFX_START + 1528) - -#define SID_START (SID_SFX_START + 1529) -#define SID_STOP (SID_SFX_START + 1530) -#define SID_VALUE (SID_SFX_START + 1531) -#define SID_SUSPEND (SID_SFX_START + 1532) -#define SID_RESUME (SID_SFX_START + 1533) -#define SID_LOCKALL (SID_SFX_START + 1534) -#define SID_WAITPOINTER (SID_SFX_START + 1535) - #define SID_ONLINE_REGISTRATION (SID_SFX_START + 1537) #define SID_ONLINE_REGISTRATION_DLG (SID_SFX_START + 1540) #define SID_CONTENTTYPE (SID_SFX_START + 1541) -#define SID_DOC_IGNOREINFORMATIONLOST (SID_SFX_START + 1544) -#define SID_EXPLORER_SELECTIONSIZE (SID_SFX_START + 1545) #define SID_SAVETO (SID_SFX_START + 1546) -#define SID_ADJUSTICONS (SID_SFX_START + 1547) -#define SID_AUTO_ADJUSTICONS (SID_SFX_START + 1548) -#define SID_ICONGRID (SID_SFX_START + 1549) -#define SID_BINDING (SID_SFX_START + 1550) - -#define SID_ISCHILDFRAMELOAD (SID_SFX_START + 1552) -#define SID_PARENTFRAME (SID_SFX_START + 1554) - #define SID_CREATE_BASICOBJECT (SID_SFX_START + 1555) #define SID_DELETE_BASICOBJECT (SID_SFX_START + 1556) @@ -469,27 +287,11 @@ #define SID_UPDATE_VERSION (SID_SFX_START + 1568) #define SID_BUILD_VERSION (SID_SFX_START + 1569) -#define SID_INSERT_TASKFRAME (SID_SFX_START + 1572) -#define SID_TASK (SID_SFX_START + 1573) -#define SID_ACTIVETASK (SID_SFX_START + 1574) -#define SID_EXPLORER_ISDESKTOP (SID_SFX_START + 1576) - -#define SID_CHAOSDOC_LAYOUT1 (SID_SFX_START + 1578) -#define SID_CHAOSDOC_LAYOUT2 (SID_SFX_START + 1579) -#define SID_CHAOSDOC_LAYOUT3 (SID_SFX_START + 1580) -#define SID_CHAOSDOC_LAYOUT4 (SID_SFX_START + 1581) - #define SID_VERSION (SID_SFX_START + 1583) -#define SID_UNO (SID_SFX_START + 1584) #define SID_DOCUMENT_COMPARE (SID_SFX_START + 1586) #define SID_DOCUMENT_MERGE (SID_SFX_START + 1587) -#define SID_EXECUTE (SID_SFX_START + 1593) -#define SID_OWNS_FRAME (SID_SFX_START + 1598) - -#define SID_OFFICE_VERSION_ID (SID_SFX_START + 1599) -#define SID_USE_FILTEROPTIONS (SID_SFX_START + 1600) #define SID_OFFICE_PLK (SID_SFX_START + 1601) #define SID_OFFICE_PALK (SID_SFX_START + 1604) #define SID_CHECK_KEY (SID_SFX_START + 1605) diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index aefed0f9e028..e415c4d7287b 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -980,31 +980,6 @@ SfxVoidItem ClearHistory SID_CLEARHISTORY GroupId = GID_OPTIONS; ] -//-------------------------------------------------------------------------- -SfxVoidItem ClearMemCache SID_CLEARMEMCACHE -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_OPTIONS; -] - //-------------------------------------------------------------------------- SfxBoolItem CloseWins SID_CLOSEWINS () @@ -1599,31 +1574,6 @@ SfxVoidItem DeleteCurrent SID_BASICIDE_DELETECURRENT GroupId = GID_MACRO; ] -//-------------------------------------------------------------------------- -SfxVoidItem DeleteFrame SID_DELETE_FRAME -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxUInt16Item DeleteStyle SID_STYLE_DELETE (SfxStringItem Param SID_STYLE_DELETE,SfxUInt16Item Family SID_STYLE_FAMILY) @@ -1727,33 +1677,6 @@ SfxBoolItem EditDoc SID_EDITDOC GroupId = GID_DOCUMENT; ] -//-------------------------------------------------------------------------- -SfxBoolItem EditFrameSet SID_EDIT_FRAMESET - -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxVoidItem EditMacro SID_BASICIDE_EDITMACRO (SfxMacroInfoItem aMacroInfo SID_BASICIDE_ARG_MACROINFO) @@ -1857,31 +1780,6 @@ SfxBoolItem ExtendedHelp SID_EXTENDEDHELP GroupId = GID_APPLICATION; ] -//-------------------------------------------------------------------------- -SfxVoidItem FileDocument SID_SAVEDOCTOBOOKMARK -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_DOCUMENT; -] - //-------------------------------------------------------------------------- SfxStringItem FileName SID_FILE_NAME @@ -1962,114 +1860,6 @@ SfxVoidItem FormatMenu SID_FORMATMENU GroupId = GID_EDIT; ] -//-------------------------------------------------------------------------- -SfxStringItem FrameContent SID_FRAME_CONTENT - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = TRUE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxUInt16Item FrameCount SID_FRAMECOUNT - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - -//-------------------------------------------------------------------------- -SfxStringItem FrameName SID_FRAME_NAME - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = TRUE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxUInt16Item FrameSpacing SID_FRAMESPACING - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - //-------------------------------------------------------------------------- SfxTemplateItem FrameStyle SID_STYLE_FAMILY3 @@ -3224,33 +3014,6 @@ SfxVoidItem InsertObjectFloatingFrame SID_INSERT_FLOATINGFRAME GroupId = GID_INSERT; ] -//-------------------------------------------------------------------------- -SfxBoolItem Interactive SID_INTERACTIVEMODE - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - //-------------------------------------------------------------------------- SfxBoolItem InternetOnline SID_INTERNET_ONLINE @@ -3303,31 +3066,6 @@ SfxVoidItem InternetSearch SID_INTERNET_SEARCH GroupId = ; ] -//-------------------------------------------------------------------------- -SfxVoidItem InternetUpdate SID_INTERNET_UPDATE -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = TRUE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - //-------------------------------------------------------------------------- SfxBoolItem IsLoading SID_DOC_LOADING @@ -3356,62 +3094,7 @@ SfxBoolItem IsLoading SID_DOC_LOADING ] //-------------------------------------------------------------------------- -SfxBoolItem IsLoadingImages SID_IMG_LOADING - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_VIEW; -] - -//-------------------------------------------------------------------------- -SfxBoolItem IsPrinting SID_PRINTOUT -[ - SfxVoidItem PrintOut(SfxInt16Item from SID_PRINT_FIRST_PAGE,SfxInt16Item to SID_PRINT_LAST_PAGE,SfxInt16Item copies SID_PRINT_COPIES,SfxBoolItem silent SID_SILENT); - - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_DOCUMENT; -] - -//-------------------------------------------------------------------------- -SfxBoolItem IsTopWindow SID_ISTOP +SfxBoolItem IsLoadingImages SID_IMG_LOADING [ /* flags: */ @@ -3419,8 +3102,8 @@ SfxBoolItem IsTopWindow SID_ISTOP Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, Toggle = FALSE, Container = TRUE, RecordAbsolute = FALSE, @@ -3434,37 +3117,40 @@ SfxBoolItem IsTopWindow SID_ISTOP MenuConfig = FALSE, StatusBarConfig = FALSE, ToolBoxConfig = FALSE, - GroupId = ; + GroupId = GID_VIEW; ] //-------------------------------------------------------------------------- -SfxVoidItem JumpToMark SID_JUMPTOMARK -(SfxStringItem Bookmark SID_JUMPTOMARK) +SfxBoolItem IsPrinting SID_PRINTOUT [ + SfxVoidItem PrintOut(SfxInt16Item from SID_PRINT_FIRST_PAGE,SfxInt16Item to SID_PRINT_LAST_PAGE,SfxInt16Item copies SID_PRINT_COPIES,SfxBoolItem silent SID_SILENT); + /* flags: */ AutoUpdate = FALSE, Cachable = Cachable, FastCall = FALSE, HasCoreId = FALSE, - HasDialog = FALSE, + HasDialog = TRUE, ReadOnlyDoc = TRUE, Toggle = FALSE, - Container = FALSE, + Container = TRUE, RecordAbsolute = FALSE, RecordPerSet; Synchron; + Readonly = TRUE, + /* config: */ AccelConfig = FALSE, MenuConfig = FALSE, StatusBarConfig = FALSE, ToolBoxConfig = FALSE, - GroupId = GID_NAVIGATOR; + GroupId = GID_DOCUMENT; ] //-------------------------------------------------------------------------- -SfxStringItem Keywords SID_DOCINFO_KEYWORDS - +SfxVoidItem JumpToMark SID_JUMPTOMARK +(SfxStringItem Bookmark SID_JUMPTOMARK) [ /* flags: */ AutoUpdate = FALSE, @@ -3479,18 +3165,16 @@ SfxStringItem Keywords SID_DOCINFO_KEYWORDS RecordPerSet; Synchron; - Readonly = FALSE, - /* config: */ AccelConfig = FALSE, MenuConfig = FALSE, StatusBarConfig = FALSE, ToolBoxConfig = FALSE, - GroupId = ; + GroupId = GID_NAVIGATOR; ] //-------------------------------------------------------------------------- -SfxBoolItem LateInitDone SID_LATEINIT_DONE +SfxStringItem Keywords SID_DOCINFO_KEYWORDS [ /* flags: */ @@ -3499,21 +3183,21 @@ SfxBoolItem LateInitDone SID_LATEINIT_DONE FastCall = FALSE, HasCoreId = FALSE, HasDialog = FALSE, - ReadOnlyDoc = FALSE, + ReadOnlyDoc = TRUE, Toggle = FALSE, - Container = TRUE, + Container = FALSE, RecordAbsolute = FALSE, RecordPerSet; Synchron; - Readonly = TRUE, + Readonly = FALSE, /* config: */ AccelConfig = FALSE, MenuConfig = FALSE, StatusBarConfig = FALSE, ToolBoxConfig = FALSE, - GroupId = GID_APPLICATION; + GroupId = ; ] //-------------------------------------------------------------------------- @@ -3963,32 +3647,6 @@ SfxVoidItem MacroDialog SID_BASICCHOOSER GroupId = GID_MACRO; ] -//-------------------------------------------------------------------------- -SfxVoidItem MailNotifyReset SID_MAIL_NOTIFY_RESET -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = TRUE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - - //-------------------------------------------------------------------------- SfxUInt16Item MailReceipt SID_MAIL_NOTIFY @@ -4201,31 +3859,6 @@ SfxStringItem ModifiedStatus SID_DOC_MODIFIED GroupId = GID_VIEW; ] -//-------------------------------------------------------------------------- -SfxVoidItem ModifyFrame SID_MODIFY_FRAME -() -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = TRUE, - RecordPerItem; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxVoidItem ModuleDialog SID_BASICIDE_MODULEDLG () @@ -4354,34 +3987,6 @@ SfxVoidItem NewDialog SID_BASICIDE_NEWDIALOG GroupId = GID_MACRO; ] -//-------------------------------------------------------------------------- -SfxObjectItem NewFrameSet SID_NEWFRAMESET -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* status: */ - SlotType = SfxStringItem - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_APPLICATION; -] - //-------------------------------------------------------------------------- SfxVoidItem NewModule SID_BASICIDE_NEWMODULE () @@ -4534,33 +4139,6 @@ SfxStringItem ObjectMenue SID_OBJECT GroupId = GID_EDIT; ] -//-------------------------------------------------------------------------- -SfxStringItem OfficeVersionId SID_OFFICE_VERSION_ID - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_SPECIAL; -] - //-------------------------------------------------------------------------- SfxStringItem OldPALK SID_OLD_PALK @@ -4980,33 +4558,6 @@ SfxStringItem DocPath SID_DOCPATH GroupId = ; ] -//-------------------------------------------------------------------------- -SfxStringItem Path SID_PROGPATH - -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - Readonly = TRUE, - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = ; -] - //-------------------------------------------------------------------------- SfxVoidItem PickList SID_PICKLIST () @@ -6414,106 +5965,6 @@ SfxBoolItem SourceView SID_SOURCEVIEW GroupId = GID_OPTIONS; ] -//-------------------------------------------------------------------------- -SfxObjectItem SplitHorizontal SID_SPLIT_HORIZONTAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitParentHorizontal SID_SPLIT_PARENT_HORIZONTAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitParentVertical SID_SPLIT_PARENT_VERTICAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxObjectItem SplitVertical SID_SPLIT_VERTICAL -(SfxStringItem Frame SID_FRAMETITLE) -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxVoidItem StartRegistrationDialog SID_ONLINE_REGISTRATION_DLG () diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index bb7d2eddbbbd..af6106ffa6da 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -425,11 +425,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) break; } - case SID_INTERACTIVEMODE: - { - break; - } - case SID_ATTR_UNDO_COUNT: { SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, sal_False); diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 441bc846c4f9..23958a708381 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -242,7 +242,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SFX_STACK(SfxDispatcher::Call_Impl); // darf der Slot gerufen werden (i.S.v. enabled) - SfxApplication *pSfxApp = SFX_APP(); if ( rSlot.IsMode(SFX_SLOT_FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) ) { if ( GetFrame() ) @@ -273,19 +272,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest // Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht // "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE); - SFX_REQUEST_ARG(rReq, pOrigItem, SfxExecuteItem, SID_SUBREQUEST, sal_False); - SfxExecuteItem *pExecuteItem = pOrigItem - ? (SfxExecuteItem*)pOrigItem->Clone() - : 0; - - // ggf. TabPage-ID setzen - SfxAppData_Impl *pAppData = pSfxApp->Get_Impl(); - SFX_REQUEST_ARG(rReq, pTabPageItem, SfxUInt16Item, SID_TABPAGE, sal_False); - if ( pTabPageItem ) - { - pAppData->nAutoTabPageId = pTabPageItem->GetValue(); - rReq.RemoveItem( SID_TABPAGE ); // sonst ArgCount > 0 => Seiteneff. - } // API-Call-Klammerung und Document-Lock w"ahrend des Calls { @@ -319,16 +305,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest } } - // TabPage-ID und Executing-SID zurueck setzen - if ( pTabPageItem ) - pAppData->nAutoTabPageId = 0; - - if( pExecuteItem ) - { - Execute( *pExecuteItem ); - delete pExecuteItem; - } - if ( rReq.IsDone() ) { SfxBindings *pBindings = GetBindings(); diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx index d5fececf3b38..398d1f688e68 100644 --- a/sfx2/source/dialog/mailmodelapi.cxx +++ b/sfx2/source/dialog/mailmodelapi.cxx @@ -331,14 +331,6 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocument( const ::rtl::OUString& _sAt // save the document if ( xMod.is() ) { - // save old settings -/* - BOOL bModified = xMod->isModified(); - // prepare for mail export - TODO - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); -*/ // detect filter const SfxFilter* pFilter = SfxFilter::GetDefaultFilter(lcl_getFactoryName(_xModel)); // sal_Bool bHasFilter = pFilter != NULL; @@ -435,14 +427,6 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocAsPDF( const ::rtl::OUString& _sAt // save the document if ( xMod.is() ) { - /* TODO - // save old settings - BOOL bModified = xMod->isModified(); - // prepare for mail export - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); - */ - // Get PDF Filter from document ::rtl::OUString sPDFMediaType(RTL_CONSTASCII_USTRINGPARAM("application/pdf")); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 87e3915287f5..46370407d184 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2765,7 +2765,6 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl pSet->ClearItem( SID_OPTIONS ); //pSet->ClearItem( SID_FILE_FILTEROPTIONS ); pSet->ClearItem( SID_VERSION ); - //pSet->ClearItem( SID_USE_FILTEROPTIONS ); pSet->ClearItem( SID_EDITDOC ); pSet->ClearItem( SID_OVERWRITE ); pSet->ClearItem( SID_DEFAULTFILEPATH ); diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index a4fa3c845b91..c5fdd41e4a82 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -633,15 +633,6 @@ sal_uInt16 SfxObjectShell::PrepareClose } } - // ggf. hinweisen, da\s unter Fremdformat gespeichert - if( pMedium ) - { - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIgnoreInformationLost, - SfxBoolItem, SID_DOC_IGNOREINFORMATIONLOST, sal_False); - if( pIgnoreInformationLost && pIgnoreInformationLost->GetValue() ) - bUI = sal_False; - } - pImp->bPreparedForClose = sal_True; return sal_True; } diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 79c1a3914aad..b22d60de46d7 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -297,8 +297,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } SfxObjectShell* pSh = GetObjectShell(); - sal_Bool bWasReadonly = pSh->IsReadOnly(); - switch ( rReq.GetSlot() ) { case SID_EDITDOC: @@ -439,12 +437,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // r/o-Doc kann nicht in Editmode geschaltet werden? rReq.Done( sal_False ); - SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) { // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); - if ( !pFSetItem && RET_YES == aBox.Execute() ) + if ( RET_YES == aBox.Execute() ) { SfxApplication* pApp = SFX_APP(); SfxAllItemSet aSet( pApp->GetPool() ); @@ -485,16 +482,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) rReq.Done( sal_True ); // if( nOpenMode == SFX_STREAM_READONLY ) // pMed->Close(); - - // ReloadForEdit bei Framesets schaltet auch FramesetEditmode - sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame().GetParentFrame() ) - { - SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); - GetDispatcher()->Execute( SID_EDIT_FRAMESET, - SFX_CALLMODE_RECORD, &aItem, 0L ); - pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); - } return; } } @@ -2300,46 +2287,6 @@ void SfxViewFrame::ExecView_Impl break; } - case SID_FILLFRAME: - { - // Bei Mail etc. k"onnen die Frames nicht angesprochen werden - SfxViewFrame *pRet = NULL; - SFX_REQUEST_ARG( - rReq, pItem, SfxStringItem, SID_FILLFRAME, sal_False ); - if ( pItem ) - { - String aName( pItem->GetValue() ); - sal_uInt16 nFrame = (sal_uInt16) aName.ToInt32(); - if ( nFrame == 0 ) - nFrame = USHRT_MAX; - - SfxFrameIterator aIter( GetFrame(), sal_False ); - SfxFrame *pFrame = aIter.FirstFrame(); - sal_uInt16 nActFrame = 1; - while ( pFrame ) - { - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( - nActFrame == nFrame || - ( - pView && - aName.CompareIgnoreCaseToAscii( pView->SfxShell::GetName() ) == COMPARE_EQUAL - ) - ) - { - pRet = pView; - break; - } - - pFrame = aIter.NextFrame( *pFrame ); - nActFrame++; - } - } - - rReq.SetReturnValue( SfxObjectItem( SID_DOCFRAME, pRet ) ); - break; - } - case SID_VIEWSHELL: { const SfxPoolItem *pItem = 0; diff --git a/sfx2/util/hidother.src b/sfx2/util/hidother.src index 92f029929ffb..b13aa6ba5158 100644 --- a/sfx2/util/hidother.src +++ b/sfx2/util/hidother.src @@ -60,35 +60,12 @@ hidspecial SID_STYLE_FAMILY4 { HelpID = SID_STYLE_FAMILY4; }; hidspecial SID_STYLE_FAMILY5 { HelpID = SID_STYLE_FAMILY5; }; hidspecial SID_FILTER_NAME { HelpID = SID_FILTER_NAME; }; hidspecial HID_NAVIGATOR_WINDOW { HelpID = HID_NAVIGATOR_WINDOW; }; -hidspecial SID_EXPLORERCONTENT_OPEN { HelpId = SID_EXPLORERCONTENT_OPEN; }; -hidspecial SID_EXPLORERCONTENT_OPEN_FOLDER { HelpId = SID_EXPLORERCONTENT_OPEN_FOLDER; }; -hidspecial SID_EXPLORERCONTENT_OPEN_TEMPLATE { HelpId = SID_EXPLORERCONTENT_OPEN_TEMPLATE; }; -hidspecial SID_EXPLORERCONTENT_OPEN_DOCUMENT { HelpId = SID_EXPLORERCONTENT_OPEN_DOCUMENT; }; -hidspecial SID_EXPLORERCONTENT_OPEN_OBJECT { HelpId = SID_EXPLORERCONTENT_OPEN_OBJECT; }; hidspecial HID_HELPAGENT_TIP_BOX { HelpId = HID_HELPAGENT_TIP_BOX; }; -hidspecial SID_EXPLORER_SEARCH_DLG { HelpId = SID_EXPLORER_SEARCH_DLG; }; -hidspecial SID_TRASH_RECOVER { HelpId = SID_TRASH_RECOVER; }; -hidspecial SID_TRASH_AUTOEMPTY { HelpId = SID_TRASH_AUTOEMPTY; }; -hidspecial SID_TRASH_EMPTY { HelpId = SID_TRASH_EMPTY; }; -hidspecial SID_EXPLORERCONTENT_NEW { HelpId = SID_EXPLORERCONTENT_NEW; }; -hidspecial SID_EXPLORERCONTENT_DESTROY { HelpId = SID_EXPLORERCONTENT_DESTROY; }; -hidspecial SID_EXPLORERCONTENT_RENAME { HelpId = SID_EXPLORERCONTENT_RENAME; }; -hidspecial SID_EXPLORERCONTENT_COPY { HelpId = SID_EXPLORERCONTENT_COPY; }; -hidspecial SID_EXPLORERCONTENT_PASTE { HelpId = SID_EXPLORERCONTENT_PASTE; }; -hidspecial SID_EXPLORERCONTENT_CREATELINK { HelpId = SID_EXPLORERCONTENT_CREATELINK; }; -hidspecial SID_EXPLORERCONTENT_MAKEROOT { HelpId = SID_EXPLORERCONTENT_MAKEROOT; }; -hidspecial SID_EXPLORERCONTENT_DEFAULTTEMPLATE { HelpId = SID_EXPLORERCONTENT_DEFAULTTEMPLATE; }; -hidspecial SID_PROPERTIES { HelpId = SID_PROPERTIES; }; -hidspecial SID_EXPLORER_BOOKMARKDIR { HelpId = SID_EXPLORER_BOOKMARKDIR; }; -hidspecial SID_EXPLORER_SEARCHORIG { HelpId = SID_EXPLORER_SEARCHORIG; }; hidspecial HID_TEMPLDLG_TOOLBOX_LEFT { HelpId = HID_TEMPLDLG_TOOLBOX_LEFT;}; hidspecial HID_EXPLORER_SRCH_COUNT { HelpId = HID_EXPLORER_SRCH_COUNT;}; -hidspecial SID_EXPLORER_PASTE_ASLINK { HelpId = SID_EXPLORER_PASTE_ASLINK;}; hidspecial HID_INTERFACE_SFXPLUGINVIEW { HelpID = HID_INTERFACE_SFXPLUGINVIEW; }; hidspecial HID_TABDLG_RESET_BTN { HelpID = HID_TABDLG_RESET_BTN; }; hidspecial HID_TABDLG_STANDARD_BTN { HelpID = HID_TABDLG_STANDARD_BTN; }; -hidspecial SID_EXPLORER_RESETURL { HelpID = SID_EXPLORER_RESETURL; }; -hidspecial SID_ORIG_PROPERTIES { HelpID = SID_ORIG_PROPERTIES; }; hidspecial HID_CONFIG_EVENT_OFFICE_BASED { HelpID = HID_CONFIG_EVENT_OFFICE_BASED; }; hidspecial HID_CONFIG_EVENT_DOCUMENT_BASED { HelpID = HID_CONFIG_EVENT_DOCUMENT_BASED; }; hidspecial HID_EXPLORER_SRCH_LATEST_COUNT { HelpID = HID_EXPLORER_SRCH_LATEST_COUNT; }; @@ -100,10 +77,6 @@ hidspecial HID_CHAOSDOC_WIN { HelpID = HID_CHAOSDOC_WIN; }; hidspecial HID_CHAOSDOC_WIN_HEADER { HelpID = HID_CHAOSDOC_WIN_HEADER; }; hidspecial HID_CHAOSDOC_WIN_PARTS { HelpID = HID_CHAOSDOC_WIN_PARTS; }; hidspecial HID_CHAOSDOC_WIN_BODY { HelpID = HID_CHAOSDOC_WIN_BODY; }; -hidspecial SID_CHAOSDOC_LAYOUT1 { HelpID = SID_CHAOSDOC_LAYOUT1; }; -hidspecial SID_CHAOSDOC_LAYOUT2 { HelpID = SID_CHAOSDOC_LAYOUT2; }; -hidspecial SID_CHAOSDOC_LAYOUT3 { HelpID = SID_CHAOSDOC_LAYOUT3; }; -hidspecial SID_CHAOSDOC_LAYOUT4 { HelpID = SID_CHAOSDOC_LAYOUT4; }; hidspecial HID_BRWBOX_HEADERBAR { HelpID = HID_BRWBOX_HEADERBAR; }; hidspecial HID_TASKBAR { HelpID = HID_TASKBAR; }; hidspecial HID_TASKBUTTONBAR { HelpID = HID_TASKBUTTONBAR; }; @@ -129,9 +102,6 @@ hidspecial HID_CHAOS_NEW_SUBSCR_BOX { HelpID = HID_CHAOS_NEW_SUBSCR_ hidspecial HID_CHAOS_NEW_BOOKMARK { HelpID = HID_CHAOS_NEW_BOOKMARK; }; hidspecial HID_CHAOS_NEW_PUB_BOX { HelpID = HID_CHAOS_NEW_PUB_BOX; }; hidspecial HID_UUI_END { HelpID = HID_UUI_END; }; // aka HID_CHAOS_NEW_DATABASE -hidspecial SID_EXPLORER_SHOWEXTENSION { HelpID = SID_EXPLORER_SHOWEXTENSION; }; -hidspecial SID_EXPLORER_MAIL_HEADER { HelpID = SID_EXPLORER_MAIL_HEADER; }; -hidspecial SID_EXPLORER_MAIL_BODY { HelpID = SID_EXPLORER_MAIL_BODY; }; hidspecial HID_CNT_DLG_SEARCH_BT_SHOW { HelpID = HID_CNT_DLG_SEARCH_BT_SHOW; }; hidspecial HID_CNT_DLG_SEARCH_BT_UPDATE { HelpID = HID_CNT_DLG_SEARCH_BT_UPDATE; }; hidspecial HID_CNT_DLG_SEARCH_BT_SYNCHRONIZE { HelpID = HID_CNT_DLG_SEARCH_BT_SYNCHRONIZE; }; diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index e3826708c196..c4a82a436c39 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -13192,31 +13192,6 @@ SfxVoidItem SpellCheckerChanged SID_SPELLCHECKER_CHANGED GroupId = GID_SPECIAL; ] -//-------------------------------------------------------------------------- -SfxVoidItem PrepareMailExport SID_MAIL_PREPAREEXPORT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EXPLORER; -] - //-------------------------------------------------------------------------- SfxUInt16Item Year2000 SID_ATTR_YEAR2000 () -- cgit v1.2.3 From 73005868eed0fe2c59bdc115f7f5af89411a4dbe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 12:32:21 +0100 Subject: autorecovery: explicitly specify 'Hidden' when recovering documents, and remove the hack of not showing a frame when there is a 'SalvagedFile' item in the load args --- framework/source/loadenv/loadenv.cxx | 19 +++++++++---------- framework/source/services/autorecovery.cxx | 3 +++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index ee39e583e5e7..911a0430763f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1629,7 +1629,6 @@ void LoadEnv::impl_reactForLoadingState() // We dont hide already visible frames here ... css::uno::Reference< css::awt::XWindow > xWindow = m_xTargetFrame->getContainerWindow(); sal_Bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN(), sal_False); - sal_Bool bRecovered = (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()) != m_lMediaDescriptor.end()); sal_Bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_MINIMIZED(), sal_False); if (bMinimized) @@ -1641,7 +1640,7 @@ void LoadEnv::impl_reactForLoadingState() ((WorkWindow*)pWindow)->Minimize(); } else - if (!bHidden && !bRecovered) + if (!bHidden) { // show frame ... if it's not still visible ... // But do nothing if it's already visible! @@ -1750,18 +1749,18 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X Window* pWindow = VCLUnoHelper::GetWindow(xWindow); if ( pWindow ) { - bool bForceFrontAndFocus(false); - css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey( - xSMGR, - ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"), - ::rtl::OUString::createFromAscii("NewDocumentHandling"), - ::rtl::OUString::createFromAscii("ForceFocusAndToFront"), - ::comphelper::ConfigurationHelper::E_READONLY); + bool bForceFrontAndFocus(false); + css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey( + xSMGR, + ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"), + ::rtl::OUString::createFromAscii("NewDocumentHandling"), + ::rtl::OUString::createFromAscii("ForceFocusAndToFront"), + ::comphelper::ConfigurationHelper::E_READONLY); a >>= bForceFrontAndFocus; pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 ); } - + /* #i19976# We tried to prevent a toFront() call in case the user putted the loading document into the background .. diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 9328ed9d9a5c..74894ddc4718 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2448,6 +2448,9 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa lDescriptor[::comphelper::MediaDescriptor::PROP_REFERRER()] <<= REFERRER_USER; lDescriptor[::comphelper::MediaDescriptor::PROP_SALVAGEDFILE()] <<= ::rtl::OUString(); + // recovered documents are loaded hidden, and shown all at once, later + lDescriptor[::comphelper::MediaDescriptor::PROP_HIDDEN()] <<= true; + if (aParams.m_xProgress.is()) lDescriptor[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= aParams.m_xProgress; -- cgit v1.2.3 From 2dc2be789dceecfddf91aa182d3a47f5c421c6b3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 12:34:33 +0100 Subject: autorecovery: ensure that unsaved XML forms are properly recovered, by properly respecting the 'Hidden' load parameter --- sfx2/inc/frmload.hxx | 3 ++- sfx2/inc/sfx2/viewfrm.hxx | 2 +- sfx2/sdi/sfx.sdi | 10 +++++----- sfx2/source/view/frmload.cxx | 7 +++++-- sfx2/source/view/viewfrm.cxx | 16 ++++++++++------ 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx index 32217b786da8..0dedd89b3773 100644 --- a/sfx2/inc/frmload.hxx +++ b/sfx2/inc/frmload.hxx @@ -100,7 +100,8 @@ private: sal_Bool impl_createNewDocWithSlotParam( const USHORT _nSlotID, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rxFrame, + const bool i_bHidden ); void impl_determineFilter( diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index d1f3d18b501b..23ff0e4c7d43 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -169,8 +169,8 @@ public: static SfxViewFrame* LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ); static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); - static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxUnoFrameItem* i_pFrameItem, const USHORT i_nViewId = 0 ); static SfxViewFrame* LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrameItem, const USHORT i_nViewId = 0 ); + static SfxViewFrame* DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const USHORT i_nViewId = 0 ); static SfxViewFrame* Current(); static SfxViewFrame* GetFirst( const SfxObjectShell* pDoc = 0, BOOL bOnlyVisible = TRUE ); diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index e415c4d7287b..643389259e84 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -7489,7 +7489,7 @@ SfxVoidItem AutoPilotAddressDataSource SID_ADDRESS_DATA_SOURCE //-------------------------------------------------------------------------- SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD -( SfxUnoFrameItem Frame SID_FILLFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -7514,7 +7514,7 @@ SfxVoidItem InsertBusinessCard FN_BUSINESS_CARD //-------------------------------------------------------------------------- SfxVoidItem InsertLabels FN_LABEL -( SfxUnoFrameItem Frame SID_FILLFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -7539,7 +7539,7 @@ SfxVoidItem InsertLabels FN_LABEL //-------------------------------------------------------------------------- SfxVoidItem NewXForms FN_XFORMS_INIT -( SfxUnoFrameItem Frame SID_FILLFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -7564,7 +7564,7 @@ SfxVoidItem NewXForms FN_XFORMS_INIT //-------------------------------------------------------------------------- SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT -( SfxUnoFrameItem Frame SID_FILLFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, @@ -7589,7 +7589,7 @@ SfxVoidItem AutoPilotPresentations SID_SD_AUTOPILOT //-------------------------------------------------------------------------- SfxVoidItem NewPresentation SID_NEWSD -( SfxUnoFrameItem Frame SID_FILLFRAME ) +( SfxUnoFrameItem Frame SID_FILLFRAME, SfxBoolItem Hidden SID_HIDDEN ) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 956cef506201..761772a87cd1 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -256,10 +256,13 @@ namespace } // -------------------------------------------------------------------------------------------------------------------- -sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame ) +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame, + const bool i_bHidden ) { SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) ); + if ( i_bHidden ) + aRequest.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); } @@ -575,7 +578,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA const USHORT nSlotParam = impl_findSlotParam( sFactory ); if ( nSlotParam != 0 ) { - return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame ); + return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame, aDescriptor.getOrDefault( "Hidden", false ) ); } const bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b22d60de46d7..17d5deb5fb1b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1998,10 +1998,6 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, const USHORT i_nViewId, const bool i_bHidden ) { - OSL_PRECOND( !i_bHidden || !i_rFrame.is(), - "SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow: loading *hidden* into an *existing* frame is not supported!" ); - // Care for this frame's visibility yourself, please - Reference< XFrame > xFrame( i_rFrame ); bool bOwnFrame = false; SfxViewShell* pSuccessView = NULL; @@ -2112,9 +2108,17 @@ SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const } //-------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxUnoFrameItem* i_pFrameItem, const USHORT i_nViewId ) +SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const USHORT i_nViewId ) { - return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem ? i_pFrameItem->GetFrame() : NULL, i_nViewId, false ); + SFX_REQUEST_ARG( i_rCreateDocRequest, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + SFX_REQUEST_ARG( i_rCreateDocRequest, pHiddenItem, SfxBoolItem, SID_HIDDEN, FALSE ); + + return LoadViewIntoFrame_Impl_NoThrow( + i_rDoc, + pFrameItem ? pFrameItem->GetFrame() : NULL, + i_nViewId, + pHiddenItem ? pHiddenItem->GetValue() : false + ); } //-------------------------------------------------------------------- -- cgit v1.2.3 From 94bf18438d4ea4f47c440d0d758ac6fa3d04f84e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 12:52:31 +0100 Subject: autorecovery: corrected GetViewName --- sfx2/source/view/viewfac.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index 00e26579aea4..41b05727b9f4 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -56,7 +56,7 @@ String SfxViewFactory::GetViewName() const { ::rtl::OUStringBuffer aViewName; aViewName.appendAscii( "view" ); - aViewName.append( GetOrdinal() ); + aViewName.append( sal_Int32( GetOrdinal() ) ); return aViewName.makeStringAndClear(); } -- cgit v1.2.3 From 575c2ce3a4d344a5a4d0769da19acf70fc683dad Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 21 Dec 2009 07:40:17 +0100 Subject: dba33e: #93000# fix locale --- officecfg/registry/data/org/openoffice/Setup.xcu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 75d67f0a017a..3664843292b7 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -598,7 +598,7 @@ GenericCategories - Table Data View + Base: Table Data View
@@ -620,7 +620,7 @@ GenericCategories - Bibliography + Bibliography -- cgit v1.2.3 From 0e402c37a75b637824b75ed38809ce196c2acfdb Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 29 Dec 2009 10:28:54 +0100 Subject: sw33bf02: #i104889# method - no empty value export for style:default-outline-level for ODF version < 1.2 --- xmloff/source/style/styleexp.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index f03c0ac9a78b..9ca113218a9d 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -200,13 +200,22 @@ sal_Bool XMLStyleExport::exportStyle( OUStringBuffer sTmp; sTmp.append( static_cast(nOutlineLevel)); GetExport().AddAttribute( XML_NAMESPACE_STYLE, - XML_DEFAULT_OUTLINE_LEVEL, - sTmp.makeStringAndClear() ); + XML_DEFAULT_OUTLINE_LEVEL, + sTmp.makeStringAndClear() ); } else { - GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_DEFAULT_OUTLINE_LEVEL, - OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + // --> OD 2009-12-29 #i104889# + // empty value for style:default-outline-level does exist + // since ODF 1.2. Thus, suppress its export for former versions. + if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 && + GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) + // <-- + { + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + XML_DEFAULT_OUTLINE_LEVEL, + OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + } } } }//<-end,zhaojianwei @@ -311,8 +320,9 @@ sal_Bool XMLStyleExport::exportStyle( } ///////////////////////////////////////////////// if ( bNoInheritedListStyle ) - GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_LIST_STYLE_NAME, - OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); + GetExport().AddAttribute( XML_NAMESPACE_STYLE, + XML_LIST_STYLE_NAME, + OUString( RTL_CONSTASCII_USTRINGPARAM( "" ))); } //<-end,zhaojianwei } -- cgit v1.2.3 From eafba820349005ea5426cab58911f9ff99969966 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 5 Jan 2010 22:32:38 +0100 Subject: autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change, the LoadDispatchListener became superfluous, and was removed. Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility of the loader, and must not happen inside the XController::attachModel call anymore. This change made the ModelControllerConnector class superfluous, so it has been removed, too. --- framework/inc/services/autorecovery.hxx | 17 +- .../source/inc/loadenv/loaddispatchlistener.hxx | 168 ------ framework/source/loadenv/loaddispatchlistener.cxx | 144 ----- framework/source/loadenv/makefile.mk | 1 - framework/source/services/autorecovery.cxx | 302 +++++++---- .../schema/org/openoffice/Office/Recovery.xcs | 39 +- sfx2/inc/sfx2/sfxbasemodel.hxx | 58 +- sfx2/source/doc/sfxbasemodel.cxx | 584 +++++++-------------- 8 files changed, 487 insertions(+), 826 deletions(-) delete mode 100644 framework/source/inc/loadenv/loaddispatchlistener.hxx delete mode 100644 framework/source/loadenv/loaddispatchlistener.cxx diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 8f6c62a2f39e..a9e0f5ebe506 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -170,7 +170,7 @@ class AutoRecovery : public css::lang::XTypeProvider E_UNKNOWN = 0, /// modified against the original file E_MODIFIED = 1, - /** We differe between the states: "modified in general" and "modified after last AutoSave". + /** We differ between the states: "modified in general" and "modified after last AutoSave". The first state will be interesting in case the crashed document will be restored. Then we have set the right modify state after loading the document. But the second state let us optimize the AutoSave itself. see member ListenForModify too ... @@ -308,10 +308,13 @@ class AutoRecovery : public css::lang::XTypeProvider ::rtl::OUString NewTempURL; ::rtl::OUString AppModule; // e.g. com.sun.star.text.TextDocument - used to identify app module + ::rtl::OUString FactoryService; // the service to create a document of the module ::rtl::OUString RealFilter; // real filter, which was used at loading time ::rtl::OUString DefaultFilter; // supports saving of the default format without loosing data ::rtl::OUString Extension; // file extension of the default filter ::rtl::OUString Title; // can be used as "DisplayName" on every recovery UI! + ::com::sun::star::uno::Sequence< ::rtl::OUString > + ViewNames; // names of the view which were active at emergency-save time sal_Int32 ID; }; @@ -864,7 +867,17 @@ class AutoRecovery : public css::lang::XTypeProvider //--------------------------------------- // TODO document me - void implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo); + void implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo); + + /** retrieves the names of all active views of the given document + @param rInfo + the document info, whose Document member must not be . + */ + void implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& rInfo ); + + /** updates the configuration so that for all documents, their current view/names are stored + */ + void implts_persistAllActiveViewNames(); //--------------------------------------- // TODO document me diff --git a/framework/source/inc/loadenv/loaddispatchlistener.hxx b/framework/source/inc/loadenv/loaddispatchlistener.hxx deleted file mode 100644 index b114866c7af7..000000000000 --- a/framework/source/inc/loadenv/loaddispatchlistener.hxx +++ /dev/null @@ -1,168 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loaddispatchlistener.hxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ -#define __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ - -//_______________________________________________ -// includes of own project - -#include -#include -#include - -//_______________________________________________ -// includes of uno interface -#include - -/* -#include -*/ - -//_______________________________________________ -// includes of an other project - -#ifndef _OSL_CONDITN_HXX_ -#include -#endif -#include - -//_______________________________________________ -// namespace - -namespace framework{ - -namespace css = ::com::sun::star; - -//_______________________________________________ -// definitions - -/** @short listen for finished dispatches, where document will be loaded. - - @descr This listener can be bound to an URL - so its well known - for which load request this event was triggered. - Thats needed - but not supported by the XDispatchResultListener - notification. - Further a condition can be used to synchronize any outside code - against the occurence of this event. - - @author as96863 - */ -class LoadDispatchListener : public css::frame::XDispatchResultListener // => css.lang.XEventListener - , private ThreadHelpBase - , public ::cppu::OWeakObject -{ - //___________________________________________ - // member - - private: - - /** @short the URL which is bound to this callback. */ - ::rtl::OUString m_sURL; - - /** @short the original event, which was notified to this object. */ - css::frame::DispatchResultEvent m_aResult; - - /** @short used to let the user of this instance wait, till an - event occures. - */ - ::osl::Condition m_aUserWait; - - //___________________________________________ - // native interface - - public: - - //_______________________________________ - /** @short initialize a new instance of this class. */ - LoadDispatchListener(); - - //_______________________________________ - /** @short deinitialize an instance of this class. */ - virtual ~LoadDispatchListener(); - - //_______________________________________ - /** @short bind this listenerr to a new URL. - - @param sURL - the new URL bound to this instance. - */ - void setURL(const ::rtl::OUString & sURL); - - //_______________________________________ - /** @short let the user of this instance wait. - - @descr If the call timed out - false is returned. - Otherwise it returns true. - Then the method getResult() has to be called, - to get the origianl event. - - @param nWait_ms - the time for wait in [ms]. - If its set to 0 this call is blocked till - an event occures! - - @return TRUE if an event occured in time - FALSE otherwhise. - */ - sal_Bool wait(sal_Int32 nWait_ms); - - //_______________________________________ - /** @short returns the result of this listener operation. - - @descr If wait() (which must be called before!) returns FALSE - the return of getResult() is undefined! - - @return The result of the got listener notification. - */ - css::frame::DispatchResultEvent getResult() const; - - //___________________________________________ - // uno interface - - public: - - //_______________________________________ - // css.uno.XInterface - FWK_DECLARE_XINTERFACE - - //_______________________________________ - // css.frame.XDispatchResultListener - virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException); - - //_______________________________________ - // css.lang.XEventListener - virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) - throw(css::uno::RuntimeException); -}; - -} // namespace framework - -#endif // __FRAMEWORK_LOADENV_LOADDISPATCHLISTENER_HXX_ diff --git a/framework/source/loadenv/loaddispatchlistener.cxx b/framework/source/loadenv/loaddispatchlistener.cxx deleted file mode 100644 index ca9e5118f582..000000000000 --- a/framework/source/loadenv/loaddispatchlistener.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: loaddispatchlistener.cxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_______________________________________________ -// includes of own project -#include -#include -#include - -//_______________________________________________ -// includes of uno interface -#include - -//_______________________________________________ -// includes of an other project -#include - -//_______________________________________________ -// namespace - -namespace framework{ - -// may there exist already a define .-( -#ifndef css -namespace css = ::com::sun::star; -#endif - -//_______________________________________________ -// declarations - -//----------------------------------------------- -DEFINE_XINTERFACE_2(LoadDispatchListener , - OWeakObject , - DIRECT_INTERFACE (css::frame::XDispatchResultListener ), - DERIVED_INTERFACE(css::lang::XEventListener, css::frame::XDispatchResultListener)) - -//----------------------------------------------- -LoadDispatchListener::LoadDispatchListener() - : ThreadHelpBase(&Application::GetSolarMutex()) -{ - // reset the condition object - so our user can wait there. - m_aUserWait.reset(); - // set defined state for our result value - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); -} - -//----------------------------------------------- -LoadDispatchListener::~LoadDispatchListener() -{ -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::dispatchFinished(const css::frame::DispatchResultEvent& aEvent) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult = aEvent; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void SAL_CALL LoadDispatchListener::disposing(const css::lang::EventObject&) - throw(css::uno::RuntimeException) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_aResult.State = css::frame::DispatchResultState::DONTKNOW; - m_aResult.Result.clear(); - aWriteLock.unlock(); - // <- SAFE ---------------------------------- - - // inform user about this arrived event - m_aUserWait.set(); -} - -//----------------------------------------------- -void LoadDispatchListener::setURL(const ::rtl::OUString & sURL) -{ - // SAFE -> ---------------------------------- - WriteGuard aWriteLock(m_aLock); - m_sURL = sURL; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- -} - -//----------------------------------------------- -sal_Bool LoadDispatchListener::wait(sal_Int32 /*nWait_ms*/) -{ - // Wait till an event occures - m_aUserWait.wait(0); - // reset the condition, so this method can be called again. - // Of course a new action has to be started outside too! - m_aUserWait.reset(); - - // TODO implement real timeout :-) - return sal_True; -} - -//----------------------------------------------- -css::frame::DispatchResultEvent LoadDispatchListener::getResult() const -{ - // SAFE -> ---------------------------------- - ReadGuard aReadLock(m_aLock); - return m_aResult; - // <- SAFE ---------------------------------- -} - -} // namespace framework diff --git a/framework/source/loadenv/makefile.mk b/framework/source/loadenv/makefile.mk index e0fa0940f5eb..105cc92c78ab 100644 --- a/framework/source/loadenv/makefile.mk +++ b/framework/source/loadenv/makefile.mk @@ -42,7 +42,6 @@ ENABLE_EXCEPTIONS= TRUE SLOFILES= \ $(SLO)$/loadenv.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/targethelper.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 74894ddc4718..a8fcb9046bf2 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -35,7 +35,6 @@ //_______________________________________________ // own includes -#include #include #include #include @@ -51,6 +50,8 @@ // interface includes #include #include +#include +#include #include #include #include @@ -71,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -79,10 +81,12 @@ // other includes #include #include +#include #include #include #include #include +#include #include #include @@ -102,6 +106,23 @@ namespace css = ::com::sun::star; #endif +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::frame::XModel2; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XStorable; +using ::com::sun::star::lang::XComponent; + namespace fpf = ::framework::pattern::frame; namespace framework @@ -135,6 +156,7 @@ static const ::rtl::OUString CFG_ENTRY_PROP_DOCUMENTSTATE = ::rtl::OUString: static const ::rtl::OUString CFG_ENTRY_PROP_FILTER = ::rtl::OUString::createFromAscii("Filter" ); static const ::rtl::OUString CFG_ENTRY_PROP_TITLE = ::rtl::OUString::createFromAscii("Title" ); static const ::rtl::OUString CFG_ENTRY_PROP_ID = ::rtl::OUString::createFromAscii("ID" ); +static const ::rtl::OUString CFG_ENTRY_PROP_VIEWNAMES = ::rtl::OUString::createFromAscii("ViewNames" ); static const ::rtl::OUString FILTER_PROP_TYPE = ::rtl::OUString::createFromAscii("Type" ); static const ::rtl::OUString FILTER_PROP_NAME = ::rtl::OUString::createFromAscii("Name" ); @@ -144,6 +166,7 @@ static const ::rtl::OUString DOCINFO_PROP_TEMPLATE = ::rtl::OUString:: // setup.xcu static const ::rtl::OUString CFG_ENTRY_PROP_EMPTYDOCUMENTURL = ::rtl::OUString::createFromAscii("ooSetupFactoryEmptyDocumentURL"); static const ::rtl::OUString CFG_ENTRY_PROP_DEFAULTFILTER = ::rtl::OUString::createFromAscii("ooSetupFactoryDefaultFilter" ); +static const ::rtl::OUString CFG_ENTRY_PROP_FACTORYSERVICE = ::rtl::OUString::createFromAscii("ooSetupFactoryDocumentService" ); static const ::rtl::OUString EVENT_ON_NEW = ::rtl::OUString::createFromAscii("OnNew" ); static const ::rtl::OUString EVENT_ON_LOAD = ::rtl::OUString::createFromAscii("OnLoad" ); @@ -784,7 +807,7 @@ void SAL_CALL AutoRecovery::addStatusListener(const css::uno::Reference< css::fr // container is threadsafe by using a shared mutex! m_lListener.addInterface(aURL.Complete, xListener); - // REINTRANT !? -> -------------------------------- + // REENTRANT !? -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); // THREAD SAFE -> ---------------------------------- @@ -1089,7 +1112,7 @@ void AutoRecovery::implts_readConfig() css::uno::Reference< css::container::XHierarchicalNameAccess > xCommonRegistry(implts_openConfig(), css::uno::UNO_QUERY); - // REINTRANT -> -------------------------------- + // REENTRANT -> -------------------------------- CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_ADD_REMOVE); // THREADSAFE -> ------------------------------- @@ -1101,7 +1124,7 @@ void AutoRecovery::implts_readConfig() // <- THREADSAFE ------------------------------- aCacheLock.unlock(); - // <- REINTRANT -------------------------------- + // <- REENTRANT -------------------------------- css::uno::Any aValue; @@ -1116,7 +1139,7 @@ void AutoRecovery::implts_readConfig() sal_Int32 c = lItems.getLength(); sal_Int32 i = 0; - // REINTRANT -> -------------------------- + // REENTRANT -> -------------------------- aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); for (i=0; igetPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE) >>= aInfo.DocumentState; xItem->getPropertyValue(CFG_ENTRY_PROP_MODULE ) >>= aInfo.AppModule ; xItem->getPropertyValue(CFG_ENTRY_PROP_TITLE ) >>= aInfo.Title ; - implts_specifyAppModuleAndFactoryURL(aInfo); + xItem->getPropertyValue(CFG_ENTRY_PROP_VIEWNAMES ) >>= aInfo.ViewNames ; + implts_specifyAppModuleAndFactory(aInfo); implts_specifyDefaultFilterAndExtension(aInfo); if (pItems[i].indexOf(RECOVERY_ITEM_BASE_IDENTIFIER)==0) @@ -1166,7 +1190,7 @@ void AutoRecovery::implts_readConfig() } aCacheLock.unlock(); - // <- REINTRANT -------------------------- + // <- REENTRANT -------------------------- } implts_actualizeTimer(); @@ -1234,17 +1258,12 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume } //----------------------------------------------- -void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo) +void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo& rInfo) { - if ( - (!rInfo.AppModule.getLength()) && - (!rInfo.Document.is() ) - ) - { - throw css::uno::RuntimeException( - ::rtl::OUString::createFromAscii("Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!"), - static_cast< css::frame::XDispatch* >(this)); - } + ENSURE_OR_THROW2( + rInfo.AppModule.getLength() || rInfo.Document.is(), + "Cant find out the application module nor its factory URL, if no application module (or a suitable) document is known!", + *this ); // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); @@ -1260,6 +1279,70 @@ void AutoRecovery::implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentI ::comphelper::SequenceAsHashMap lModuleDescription(xModuleConfig->getByName(rInfo.AppModule)); lModuleDescription[CFG_ENTRY_PROP_EMPTYDOCUMENTURL] >>= rInfo.FactoryURL; + lModuleDescription[CFG_ENTRY_PROP_FACTORYSERVICE] >>= rInfo.FactoryService; +} + +//----------------------------------------------- +void AutoRecovery::implts_collectActiveViewNames( AutoRecovery::TDocumentInfo& i_rInfo ) +{ + ENSURE_OR_THROW2( i_rInfo.Document.is(), "need at document, at the very least", *this ); + + i_rInfo.ViewNames.realloc(0); + + // obtain list of controllers of this document + ::std::vector< ::rtl::OUString > aViewNames; + const Reference< XModel2 > xModel( i_rInfo.Document, UNO_QUERY ); + if ( xModel.is() ) + { + const Reference< XEnumeration > xEnumControllers( xModel->getControllers() ); + while ( xEnumControllers->hasMoreElements() ) + { + const Reference< XController2 > xController( xEnumControllers->nextElement(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + } + else + { + const Reference< XController2 > xController( xModel->getCurrentController(), UNO_QUERY ); + ::rtl::OUString sViewName; + if ( xController.is() ) + sViewName = xController->getViewControllerName(); + OSL_ENSURE( sViewName.getLength(), "AutoRecovery::implts_collectActiveViewNames: (no XController2 ->) no view name -> no recovery of this view!" ); + + if ( sViewName.getLength() ) + aViewNames.push_back( sViewName ); + } + + i_rInfo.ViewNames.realloc( aViewNames.size() ); + ::std::copy( aViewNames.begin(), aViewNames.end(), i_rInfo.ViewNames.getArray() ); +} + +//----------------------------------------------- +void AutoRecovery::implts_persistAllActiveViewNames() +{ + // SAFE -> ---------------------------------- + WriteGuard aWriteLock(m_aLock); + + // This list will be filled with every document + // which should be saved as last one. E.g. if it was used + // already for an UI save operation => crashed ... and + // now we try to save it again ... which can fail again ( of course .-) ). + ::std::vector< AutoRecovery::TDocumentList::iterator > lDangerousDocs; + + AutoRecovery::TDocumentList::iterator pIt; + for ( pIt = m_lDocCache.begin(); + pIt != m_lDocCache.end() ; + ++pIt ) + { + implts_collectActiveViewNames( *pIt ); + implts_flushConfigItem( *pIt ); + } } //----------------------------------------------- @@ -1312,6 +1395,7 @@ void AutoRecovery::implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rIn xSet->setPropertyValue(CFG_ENTRY_PROP_DOCUMENTSTATE, css::uno::makeAny(rInfo.DocumentState)); xSet->setPropertyValue(CFG_ENTRY_PROP_MODULE , css::uno::makeAny(rInfo.AppModule )); xSet->setPropertyValue(CFG_ENTRY_PROP_TITLE , css::uno::makeAny(rInfo.Title )); + xSet->setPropertyValue(CFG_ENTRY_PROP_VIEWNAMES , css::uno::makeAny(rInfo.ViewNames )); if (bNew) xModify->insertByName(sID, css::uno::makeAny(xSet)); @@ -1707,7 +1791,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // <- SAFE ---------------------------------- // classify the used application module, which is used by this document. - implts_specifyAppModuleAndFactoryURL(aNew); + implts_specifyAppModuleAndFactory(aNew); // Hack! Check for "illegal office documents" ... as e.g. the Basic IDE // Its not realy a full featured office document. It doesnt provide an URL, any filter, a factory URL etcpp. @@ -2162,7 +2246,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl continue; // already auto saved during this session :-) - // This state must be reseted for all documents + // This state must be reset for all documents // if timer is started with normnal AutoSaveTimerIntervall! if ((aInfo.DocumentState & AutoRecovery::E_HANDLED) == AutoRecovery::E_HANDLED) continue; @@ -2315,7 +2399,8 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // try to save this document as a new temp file everytimes. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. - css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); + Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY); + ENSURE_OR_THROW( xDocRecover.is(), "invalid document" ); // safe the state about "trying to save" // ... we need it for recovery if e.g. a crash occures inside next line! @@ -2328,7 +2413,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { try { - xStore->storeToURL(rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList()); + xDocRecover->doEmergencySave( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); @@ -2603,60 +2688,110 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); - css::util::URL aURL; - aURL.Complete = sURL; - xParser->parseStrict(aURL); - - LoadDispatchListener* pLoadListener = new LoadDispatchListener(); - css::uno::Reference< css::frame::XDispatchResultListener > xLoadListener (static_cast< css::frame::XDispatchResultListener* >(pLoadListener), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFrame > xDesktop( xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XFrame > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XFrame > xNewTarget = xDesktop->findFrame(SPECIALTARGET_BLANK, 0); - css::uno::Reference< css::frame::XDispatchProvider > xProvider (xNewTarget, css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XNotifyingDispatch > xDispatcher( - xProvider->queryDispatch(aURL, SPECIALTARGET_SELF, 0), - css::uno::UNO_QUERY_THROW); + ::std::vector< Reference< XComponent > > aCleanup; + try + { + // create a new document of the desired type + Reference< XModel2 > xModel( xSMGR->createInstance( rInfo.FactoryService ), UNO_QUERY_THROW ); + aCleanup.push_back( xModel.get() ); - // load the document and listen for the state of this operation. - pLoadListener->setURL(aURL.Complete); + // put the filter name into the descriptor - we're not going to involve any type detection, so + // the document might be lost without the FilterName property + lDescriptor[ ::comphelper::MediaDescriptor::PROP_FILTERNAME() ] <<= rInfo.RealFilter; - // make sure the right progress is used always. - impl_establishProgress(rInfo, lDescriptor, xNewTarget); + if ( sURL == rInfo.FactoryURL ) + { + // if the document was a new, unmodified document, then there's nothing to recover, just to init + ENSURE_OR_THROW( ( rInfo.DocumentState & AutoRecovery::E_MODIFIED ) == 0, + "unexpected document state" ); + Reference< XLoadable > xModelLoad( xModel, UNO_QUERY_THROW ); + xModelLoad->initNew(); + } + else + { + // let it recover itself + Reference< XDocumentRecovery > xDocRecover( xModel, UNO_QUERY_THROW ); + xDocRecover->recoverDocument( + sURL, + lDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString() ), + lDescriptor.getAsConstPropertyValueList() + ); + } - try - { - xDispatcher->dispatchWithNotification( - aURL, - lDescriptor.getAsConstPropertyValueList(), - xLoadListener); + xModel->attachResource( sURL, lDescriptor.getAsConstPropertyValueList() ); + // TODO: remove load-process specific arguments from the descriptor, e.g. the status indicator - pLoadListener->wait(0); // wait for ever! + // re-create all the views + ::std::vector< ::rtl::OUString > aViewsToRestore( rInfo.ViewNames.getLength() ); + if ( rInfo.ViewNames.getLength() ) + ::std::copy( rInfo.ViewNames.getConstArray(), rInfo.ViewNames.getConstArray() + rInfo.ViewNames.getLength(), aViewsToRestore.begin() ); + // if we don't have views for whatever reason, then create a default-view, at least + if ( aViewsToRestore.empty() ) + aViewsToRestore.push_back( ::rtl::OUString() ); - css::frame::DispatchResultEvent aResult = pLoadListener->getResult(); - if (aResult.State != css::frame::DispatchResultState::SUCCESS) + for ( ::std::vector< ::rtl::OUString >::const_iterator viewName = aViewsToRestore.begin(); + viewName != aViewsToRestore.end(); + ++viewName + ) { - ::rtl::OUStringBuffer sMsg(256); - sMsg.appendAscii("Recovery of \""); - sMsg.append (aURL.Complete ); - sMsg.appendAscii("\" failed." ); - throw css::uno::Exception(sMsg.makeStringAndClear(), static_cast< css::frame::XDispatch* >(this)); + // create a frame + Reference< XFrame > xTargetFrame = xDesktop->findFrame( SPECIALTARGET_BLANK, 0 ); + aCleanup.push_back( xTargetFrame.get() ); + + // create a view to the document + Reference< XController2 > xController; + if ( viewName->getLength() ) + { + xController.set( xModel->createViewController( *viewName, Sequence< PropertyValue >(), xTargetFrame ), UNO_SET_THROW ); + } + else + { + xController.set( xModel->createDefaultViewController( xTargetFrame ), UNO_SET_THROW ); + } + + // introduce model/view/controller to each other + xController->attachModel( xModel.get() ); + xModel->connectController( xController.get() ); + xTargetFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( xTargetFrame ); + xModel->setCurrentController( xController.get() ); } - rInfo.Document = fpf::extractFrameModel(xNewTarget); + rInfo.Document = xModel.get(); } catch(const css::uno::RuntimeException&) { throw; } catch(const css::uno::Exception&) { - css::uno::Reference< css::util::XCloseable > xClose(xNewTarget, css::uno::UNO_QUERY); - xClose->close(sal_True); - xNewTarget.clear(); - throw; - } + Any aCaughtException( ::cppu::getCaughtException() ); + + // clean up + for ( ::std::vector< Reference< XComponent > >::const_iterator component = aCleanup.begin(); + component != aCleanup.end(); + ++component + ) + { + css::uno::Reference< css::util::XCloseable > xClose( *component, css::uno::UNO_QUERY ); + if ( xClose.is() ) + xClose->close( sal_True ); + else + (*component)->dispose(); + } + + // re-throw + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Recovery of \""); + sMsg.append (sURL ); + sMsg.appendAscii("\" failed." ); - // of course we must forget all references to this temp(!) progress - impl_forgetProgress(rInfo, lDescriptor, xNewTarget); + throw css::lang::WrappedTargetException( + sMsg.makeStringAndClear(), + static_cast< css::frame::XDispatch* >(this), + aCaughtException + ); + } } //----------------------------------------------- @@ -2765,7 +2900,7 @@ void AutoRecovery::implts_informListener( sal_Int32 eJ if ((eJob & AutoRecovery::E_AUTO_SAVE) == AutoRecovery::E_AUTO_SAVE) sFeature.append(CMD_DO_AUTO_SAVE); #ifdef ENABLE_WARNINGS - else + else if ( eJob != AutoRecovery::E_NO_JOB ) LOG_WARNING("AutoRecovery::implst_getJobDescription()", "Invalid job identifier detected.") #endif @@ -2821,35 +2956,18 @@ css::frame::FeatureStateEvent AutoRecovery::implst_createFeatureStateEvent( if (sEventType.equals(OPERATION_UPDATE) && pInfo) { // pack rInfo for transport via UNO - css::uno::Sequence< css::beans::NamedValue > lInfo(8); - lInfo[0].Name = CFG_ENTRY_PROP_ID; - lInfo[0].Value <<= pInfo->ID; - - lInfo[1].Name = CFG_ENTRY_PROP_ORIGINALURL; - lInfo[1].Value <<= pInfo->OrgURL; + ::comphelper::NamedValueCollection aInfo; + aInfo.put( CFG_ENTRY_PROP_ID, pInfo->ID ); + aInfo.put( CFG_ENTRY_PROP_ORIGINALURL, pInfo->OrgURL ); + aInfo.put( CFG_ENTRY_PROP_FACTORYURL, pInfo->FactoryURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPLATEURL, pInfo->TemplateURL ); + aInfo.put( CFG_ENTRY_PROP_TEMPURL, pInfo->OldTempURL.getLength() ? pInfo->OldTempURL : pInfo->NewTempURL ); + aInfo.put( CFG_ENTRY_PROP_MODULE, pInfo->AppModule ); + aInfo.put( CFG_ENTRY_PROP_TITLE, pInfo->Title ); + aInfo.put( CFG_ENTRY_PROP_VIEWNAMES, pInfo->ViewNames ); + aInfo.put( CFG_ENTRY_PROP_DOCUMENTSTATE, pInfo->DocumentState ); - lInfo[2].Name = CFG_ENTRY_PROP_FACTORYURL; - lInfo[2].Value <<= pInfo->FactoryURL; - - lInfo[3].Name = CFG_ENTRY_PROP_TEMPLATEURL; - lInfo[3].Value <<= pInfo->TemplateURL; - - lInfo[4].Name = CFG_ENTRY_PROP_TEMPURL; - if (pInfo->OldTempURL.getLength()) - lInfo[4].Value <<= pInfo->OldTempURL; - else - lInfo[4].Value <<= pInfo->NewTempURL; - - lInfo[5].Name = CFG_ENTRY_PROP_MODULE; - lInfo[5].Value <<= pInfo->AppModule; - - lInfo[6].Name = CFG_ENTRY_PROP_TITLE; - lInfo[6].Value <<= pInfo->Title; - - lInfo[7].Name = CFG_ENTRY_PROP_DOCUMENTSTATE; - lInfo[7].Value <<= pInfo->DocumentState; - - aEvent.State <<= lInfo; + aEvent.State <<= aInfo.getPropertyValues(); } return aEvent; @@ -2907,6 +3025,9 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) css::uno::makeAny(sal_True), ::comphelper::ConfigurationHelper::E_STANDARD); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. @@ -2982,6 +3103,9 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // Be sure to know all open documents realy .-) implts_verifyCacheAgainstDesktopDocumentList(); + // for all docs, store their current view/names in the configurtion + implts_persistAllActiveViewNames(); + // The called method for saving documents runs // during normal AutoSave more then once. Because // it postpone active documents and save it later. diff --git a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs index 41ceb993f87e..975d2b2a994d 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs @@ -31,59 +31,64 @@ - TODO + - TODO + - TODO + - TODO + - TODO + - TODO + - TODO + - TODO + - TODO + - + + + + + +
- TODO + - TODO + @@ -93,13 +98,13 @@ - TODO + false - TODO + false @@ -117,17 +122,17 @@ - TODO + - TODO + true - TODO + 15 diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 6e7f9be72b11..fd2c73bfd323 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -47,6 +47,7 @@ #include #include #include +#include #include @@ -59,6 +60,8 @@ #include #include #include +#include +#include #include #include #include @@ -86,6 +89,8 @@ #include #include #include +#include +#include #include @@ -95,9 +100,9 @@ #include //________________________________________________________________________________________________________ -#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29) -#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29 -#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 29 +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 30 #include #endif @@ -236,10 +241,11 @@ namespace sfx { namespace intern { SfxListener */ -typedef ::comphelper::WeakImplHelper29 < XCHILD +typedef ::comphelper::WeakImplHelper30 < XCHILD , XDOCUMENTINFOSUPPLIER , ::com::sun::star::document::XDocumentPropertiesSupplier , ::com::sun::star::rdf::XDocumentMetadataAccess + , ::com::sun::star::document::XDocumentRecovery , XEVENTBROADCASTER , XEVENTLISTENER , XEVENTSSUPPLIER @@ -1292,6 +1298,16 @@ public: virtual ::rtl::OUString SAL_CALL getUntitledPrefix() throw (css::uno::RuntimeException); + // css.document.XDocumentRecovery + virtual void SAL_CALL doEmergencySave( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + throw ( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException ); + virtual void SAL_CALL recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + throw ( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException ); + //____________________________________________________________________________________________________ // ::com::sun::star::rdf::XNode: @@ -1471,6 +1487,7 @@ public: SAL_DLLPRIVATE sal_Bool impl_isDisposed() const ; sal_Bool IsDisposed() const ; + sal_Bool IsInitialized() const; ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData() throw (::com::sun::star::uno::RuntimeException); void SAL_CALL setViewData( const ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess >& aData ) throw (::com::sun::star::uno::RuntimeException); @@ -1481,7 +1498,6 @@ public: /** returns true if someone added a XEventListener to this XEventBroadcaster */ sal_Bool hasEventListeners() const; - protected: /* returns a unique id for the model that is valid as long as the document @@ -1542,6 +1558,38 @@ private: } ; // class SfxBaseModel +class SFX2_DLLPUBLIC SfxModelGuard +{ +public: + enum AllowedModelState + { + // not yet initialized + E_INITIALIZING, + // fully alive, i.e. initialized, and not yet disposed + E_FULLY_ALIVE + }; + + SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE ) + :m_aGuard( Application::GetSolarMutex() ) + { + if ( i_rModel.IsDisposed() ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *&i_rModel ); + if ( ( i_eState != E_INITIALIZING ) && !i_rModel.IsInitialized() ) + throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_rModel ); + } + ~SfxModelGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + +private: + ::vos::OClearableGuard m_aGuard; +}; + #undef css #endif // _SFX_SFXBASEMODEL_HXX_ diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 868ccb138a02..7c420779409c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -149,6 +149,8 @@ using ::com::sun::star::frame::XFrame; using ::com::sun::star::frame::XController; using ::com::sun::star::frame::XController2; using ::com::sun::star::lang::IllegalArgumentException; +using ::com::sun::star::io::IOException; +using ::com::sun::star::lang::WrappedTargetException; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. @@ -224,6 +226,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bClosing ; sal_Bool m_bSaving ; sal_Bool m_bSuicide ; + sal_Bool m_bInitialized ; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; @@ -242,6 +245,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bClosing ( sal_False ) , m_bSaving ( sal_False ) , m_bSuicide ( sal_False ) + , m_bInitialized ( sal_False ) , m_pStorageModifyListen ( NULL ) , m_xTitleHelper () , m_xNumberedControllers () @@ -659,9 +663,7 @@ uno::Reference< script::XStarBasicAccess > implGetStarBasicAccess( SfxObjectShel uno::Reference< XNAMECONTAINER > SAL_CALL SfxBaseModel::getLibraryContainer() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -680,9 +682,7 @@ void SAL_CALL SfxBaseModel::createLibrary( const ::rtl::OUString& LibName, const const ::rtl::OUString& ExternalSourceURL, const ::rtl::OUString& LinkTargetURL ) throw(ELEMENTEXISTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -699,9 +699,7 @@ void SAL_CALL SfxBaseModel::addModule( const ::rtl::OUString& LibraryName, const const ::rtl::OUString& Language, const ::rtl::OUString& Source ) throw( NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -718,9 +716,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const const ::com::sun::star::uno::Sequence< sal_Int8 >& Data ) throw(NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -737,9 +733,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_xParent; } @@ -750,7 +744,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno: void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& Parent) throw(NOSUPPORTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_xParent = Parent; } @@ -760,11 +754,7 @@ void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& P void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - // object already disposed? - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_bClosed ) { @@ -823,10 +813,7 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -838,11 +825,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -852,11 +835,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentInfo.is() ) { // WARNING: this will only work if (when loading a document) the @@ -902,11 +881,7 @@ uno::Reference< document::XDocumentProperties > SAL_CALL SfxBaseModel::getDocumentProperties() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentProperties.is() ) { uno::Reference< lang::XInitialization > xDocProps( @@ -954,10 +929,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) ) { // allows to set a windowless document to EMBEDDED state @@ -1034,10 +1006,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& ::rtl::OUString SAL_CALL SfxBaseModel::getURL() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); return m_pData->m_sURL ; } @@ -1047,10 +1016,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { uno::Sequence< beans::PropertyValue > seqArgsNew; @@ -1150,10 +1116,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); OSL_PRECOND( xController.is(), "SfxBaseModel::connectController: invalid controller!" ); if ( !xController.is() ) return; @@ -1182,9 +1145,7 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); if ( !nOldCount ) @@ -1212,9 +1173,8 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + ++m_pData->m_nControllerLockCount ; } @@ -1224,9 +1184,8 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + --m_pData->m_nControllerLockCount ; } @@ -1236,9 +1195,7 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return ( m_pData->m_nControllerLockCount != 0 ) ; } @@ -1248,10 +1205,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::u uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); // get the last active controller of this model if ( m_pData->m_xCurrent.is() ) @@ -1268,10 +1222,7 @@ uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::XController >& xCurrentController ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_xCurrent = xCurrentController; } @@ -1282,10 +1233,7 @@ void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::X uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< uno::XInterface > xReturn; uno::Reference< frame::XController > xController = getCurrentController() ; @@ -1309,9 +1257,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() t sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1324,9 +1270,7 @@ sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::un sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1339,9 +1283,7 @@ sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1355,10 +1297,7 @@ sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star:: sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsModified() : sal_False; } @@ -1370,10 +1309,7 @@ sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::Runtim void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) m_pData->m_pObjectShell->SetModified(bModified); @@ -1385,10 +1321,7 @@ void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0),xListener ); } @@ -1399,10 +1332,7 @@ void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTE void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0), xListener ); } @@ -1415,8 +1345,9 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo { static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving."); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !m_pData || m_pData->m_bClosed || m_pData->m_bClosing ) + SfxModelGuard aGuard( *this ); + + if ( m_pData->m_bClosed || m_pData->m_bClosing ) return; uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); @@ -1478,10 +1409,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1492,10 +1420,7 @@ void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTEN void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1506,10 +1431,7 @@ void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELIS uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) return m_pData->m_xPrintable->getPrinter(); @@ -1520,10 +1442,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw( void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->setPrinter( rPrinter ); @@ -1532,10 +1451,7 @@ void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& rOptions) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->print( rOptions ); @@ -1547,10 +1463,7 @@ void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& r sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->HasName() : sal_False; } @@ -1561,10 +1474,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti ::rtl::OUString SAL_CALL SfxBaseModel::getLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1584,10 +1494,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti sal_Bool SAL_CALL SfxBaseModel::isReadonly() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsReadOnly() : sal_True; } @@ -1603,10 +1510,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeSelf" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1704,10 +1608,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeAsURL" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1730,10 +1631,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1743,6 +1641,30 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& } } +void SAL_CALL SfxBaseModel::doEmergencySave( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + // just delegate this to storeToURL + storeToURL( i_TargetLocation, i_MediaDescriptor ); +} + +void SAL_CALL SfxBaseModel::recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + // delegate to our "load" method + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + + // our load implementation expects the SalvagedFile to be in the media descriptor + OSL_ENSURE( !aMediaDescriptor.has( "SalvagedFile" ) || ( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) == i_SalvagedFile ), + "SfxBaseModel::recoverDocument: inconsistent information!" ); + aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); + + // similar for the to-be-loaded file + OSL_ENSURE( !aMediaDescriptor.has( "URL" ) || ( aMediaDescriptor.getOrDefault( "URL", ::rtl::OUString() ) == i_SourceLocation ), + "SfxBaseModel::recoverDocument: inconsistent information!" ); + aMediaDescriptor.put( "URL", i_SourceLocation ); + + load( aMediaDescriptor.getPropertyValues() ); +} + //________________________________________________________________________________________________________ // XLoadable //________________________________________________________________________________________________________ @@ -1753,10 +1675,12 @@ void SAL_CALL SfxBaseModel::initNew() ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + // do not use the SfxModelGuard, it would throw, since we're not yet initialized + if ( IsDisposed() ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1785,10 +1709,12 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + // do not use the SfxModelGuard, it would throw, since we're not yet initialized + if ( IsDisposed() ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1951,10 +1877,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Any aAny; @@ -2193,10 +2116,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_Int32 nSuppFlavors = GraphicHelper::supportsMetaFileHandle_Impl() ? 10 : 8; uno::Sequence< DATAFLAVOR > aFlavorSeq( nSuppFlavors ); @@ -2265,10 +2185,7 @@ uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor ) throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) { @@ -2327,10 +2244,7 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xEvents.is() ) { @@ -2346,9 +2260,7 @@ uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() thr uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBasicLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries; if ( m_pData->m_pObjectShell ) @@ -2358,9 +2270,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDialogLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries; if ( m_pData->m_pObjectShell ) @@ -2370,9 +2280,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g ::sal_Bool SAL_CALL SfxBaseModel::getAllowMacroExecution() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell ) return m_pData->m_pObjectShell->AdjustMacroMode( String(), false ); @@ -2385,9 +2293,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContainer() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Reference< document::XEmbeddedScripts > xDocumentScripts; @@ -2423,10 +2329,7 @@ Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContaine void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2437,10 +2340,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLIS void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2603,11 +2503,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , void SfxBaseModel::changing() { - // object already disposed? - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); // the notification should not be sent if the document can not be modified if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() ) @@ -2682,6 +2578,17 @@ sal_Bool SfxBaseModel::IsDisposed() const return ( m_pData == NULL ) ; } +sal_Bool SfxBaseModel::IsInitialized() const +{ + if ( !m_pData || !m_pData->m_pObjectShell ) + { + OSL_ENSURE( false, "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); + return sal_False; + } + + return m_pData->m_pObjectShell->GetMedium() != NULL; +} + sal_Bool SfxBaseModel::impl_isDisposed() const { return ( m_pData == NULL ) ; @@ -2949,10 +2856,7 @@ void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName ) uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() && !m_pData->m_contViewData.is() ) { @@ -2995,10 +2899,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() void SAL_CALL SfxBaseModel::setViewData( const uno::Reference < container::XIndexAccess >& aData ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_contViewData = aData; } @@ -3038,10 +2939,7 @@ sal_Bool SfxBaseModel::hasEventListeners() const void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( impl_getPrintHelper() ) { @@ -3055,10 +2953,7 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPr void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) { @@ -3076,8 +2971,8 @@ void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view:: class SvObject; sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !impl_isDisposed() && GetObjectShell() ) + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( GetObjectShell() ) { SvGlobalName aName( aIdentifier ); if ( aName == SvGlobalName( SO3_GLOBAL_CLASSID ) ) @@ -3111,9 +3006,7 @@ void SfxBaseModel::ListenForStorage_Impl( const uno::Reference< embed::XStorage uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw ( uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( m_pData->m_pObjectShell.Is() ) @@ -3138,9 +3031,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() throw ( io::IOException, RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Sequence< ::rtl::OUString > aResult; sal_Int32 nResultSize = 0; @@ -3179,9 +3070,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() uno::Reference< script::provider::XScriptProvider > SAL_CALL SfxBaseModel::getScriptProvider() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::provider::XScriptProvider > xScriptProvider; @@ -3287,9 +3176,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfigurationManager() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_xUIConfigurationManager.is() ) { @@ -3405,9 +3292,7 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3439,9 +3324,7 @@ awt::Size SAL_CALL SfxBaseModel::getVisualAreaSize( sal_Int64 /*nAspect*/ ) uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3470,9 +3353,7 @@ sal_Int32 SAL_CALL SfxBaseModel::getMapUnit( sal_Int64 /*nAspect*/ ) throw ( uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3486,9 +3367,7 @@ embed::VisualRepresentation SAL_CALL SfxBaseModel::getPreferredVisualRepresentat uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); datatransfer::DataFlavor aDataFlavor( ::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ), @@ -3515,43 +3394,36 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - - if ( !m_pData->m_pObjectShell.Is() ) - throw IOEXCEPTION(); // TODO: + // do not use the SfxModelGuard, it would throw, since we're not yet initialized + if ( IsDisposed() ) + throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); + + // after i36090 is fixed the pool from object shell can be used + // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( SFX_APP()->GetPool() ); + + // the BaseURL is part of the ItemSet + SfxMedium* pMedium = new SfxMedium( xStorage, String() ); + TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); + pMedium->GetItemSet()->Put( aSet ); + + // allow to use an interactionhandler (if there is one) + pMedium->UseInteractionHandler( TRUE ); + + SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); + BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); + m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); + m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; - if ( m_pData->m_pObjectShell.Is() ) + // load document + if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) { - if( m_pData->m_pObjectShell->GetMedium() ) - // if a Medium is present, the document is already initialized - throw DOUBLEINITIALIZATIONEXCEPTION(); - - // after i36090 is fixed the pool from object shell can be used - // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - - // the BaseURL is part of the ItemSet - SfxMedium* pMedium = new SfxMedium( xStorage, String() ); - TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); - pMedium->GetItemSet()->Put( aSet ); - - // allow to use an interactionhandler (if there is one) - pMedium->UseInteractionHandler( TRUE ); - - SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); - m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; - - // load document - if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) - { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); - throw task::ErrorCodeIOException( ::rtl::OUString(), - uno::Reference< uno::XInterface >(), - nError ? nError : ERRCODE_IO_CANTREAD ); - } + sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + throw task::ErrorCodeIOException( ::rtl::OUString(), + uno::Reference< uno::XInterface >(), + nError ? nError : ERRCODE_IO_CANTREAD ); } } @@ -3562,9 +3434,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const uno::Reference< XSTORAGE >& xS EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3625,9 +3495,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3651,9 +3519,7 @@ uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentStorage() EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3666,9 +3532,7 @@ void SAL_CALL SfxBaseModel::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3678,9 +3542,7 @@ void SAL_CALL SfxBaseModel::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3706,9 +3568,7 @@ bool SfxBaseModel::impl_getPrintHelper() void SAL_CALL SfxBaseModel::setIdentifier(const ::rtl::OUString& Identifier) throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_sModuleIdentifier = Identifier; } @@ -3717,9 +3577,7 @@ bool SfxBaseModel::impl_getPrintHelper() ::rtl::OUString SAL_CALL SfxBaseModel::getIdentifier() throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); if (m_pData->m_sModuleIdentifier.getLength() > 0) return m_pData->m_sModuleIdentifier; if (m_pData->m_pObjectShell) @@ -3730,10 +3588,7 @@ bool SfxBaseModel::impl_getPrintHelper() //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XTitle >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xTitleHelper.is ()) { @@ -3753,10 +3608,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () //============================================================================= css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitledHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XUntitledNumbers >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xNumberedControllers.is ()) { @@ -3778,10 +3630,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); ::rtl::OUString aResult = impl_getTitleHelper()->getTitle (); if ( m_pData->m_pObjectShell ) @@ -3812,10 +3661,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle ) throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); impl_getTitleHelper()->setTitle (sTitle); } @@ -3826,10 +3672,7 @@ void SAL_CALL SfxBaseModel::addTitleChangeListener( const css::uno::Reference< c throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3842,10 +3685,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3858,10 +3698,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::frame::UntitledNumbersConst::INVALID_NUMBER; + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->leaseNumber (xComponent); } @@ -3872,11 +3709,7 @@ void SAL_CALL SfxBaseModel::releaseNumber( ::sal_Int32 nNumber ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumber (nNumber); } @@ -3886,11 +3719,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumberForComponent (xComponent); } @@ -3899,11 +3728,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference ::rtl::OUString SAL_CALL SfxBaseModel::getUntitledPrefix() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString (); - + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->getUntitledPrefix (); } @@ -3912,10 +3737,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getControllers() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::uno::Reference< css::container::XEnumeration >(); + SfxModelGuard aGuard( *this ); sal_Int32 c = m_pData->m_seqControllers.getLength(); sal_Int32 i = 0; @@ -3933,9 +3755,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getCo css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewControllerNames() throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); @@ -3953,9 +3773,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef css::lang::IllegalArgumentException, css::uno::Exception ) { - ::vos::OClearableGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); @@ -4071,9 +3889,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie css::lang::IllegalArgumentException, css::uno::Exception ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !i_rFrame.is() ) throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 3 ); @@ -4159,9 +3975,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie uno::Reference< rdf::XRepository > SAL_CALL SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4176,9 +3990,7 @@ SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getStringValue() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4193,9 +4005,7 @@ SfxBaseModel::getStringValue() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getNamespace() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4209,9 +4019,7 @@ SfxBaseModel::getNamespace() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getLocalName() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4228,9 +4036,7 @@ SfxBaseModel::getElementByMetadataReference( const ::com::sun::star::beans::StringPair & i_rReference) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4245,9 +4051,7 @@ uno::Reference< rdf::XMetadatable > SAL_CALL SfxBaseModel::getElementByURI(const uno::Reference< rdf::XURI > & i_xURI) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4263,9 +4067,7 @@ SfxBaseModel::getMetadataGraphsWithType( const uno::Reference & i_xType) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4282,9 +4084,7 @@ SfxBaseModel::addMetadataFile(const ::rtl::OUString & i_rFileName, throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4305,9 +4105,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, datatransfer::UnsupportedFlavorException, container::ElementExistException, rdf::ParseException, io::IOException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4325,9 +4123,7 @@ SfxBaseModel::removeMetadataFile( throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4343,9 +4139,7 @@ SfxBaseModel::addContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4361,9 +4155,7 @@ SfxBaseModel::removeContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4382,9 +4174,7 @@ SfxBaseModel::loadMetadataFromStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA( m_pData->CreateDMAUninitialized()); @@ -4412,9 +4202,7 @@ SfxBaseModel::storeMetadataToStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4431,9 +4219,7 @@ SfxBaseModel::loadMetadataFromMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA( m_pData->CreateDMAUninitialized()); @@ -4460,9 +4246,7 @@ SfxBaseModel::storeMetadataToMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference xDMA(m_pData->GetDMA()); if (!xDMA.is()) { -- cgit v1.2.3 From 0a9b2be95dc6801be8f798d81aab13b1a9c37f60 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 11:11:09 +0100 Subject: dba33e: #i106303# when saving to the storage we're already based on, then don't do this in-place, use a temporary target instead This ensures that password protected libraries, which are not yet unprotected, and thus cannot be loaded, are properly stored, too. --- basic/source/uno/namecont.cxx | 151 ++++++++++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 49 deletions(-) diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index c397e402fac4..f7d8da9906f5 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1737,7 +1737,7 @@ void SfxLibraryContainer::implImportLibDescriptor // Methods of new XLibraryStorage interface? -void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete ) +void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, sal_Bool bComplete ) { const Sequence< OUString > aNames = maNameContainer.getElementNames(); sal_Int32 nNameCount = aNames.getLength(); @@ -1758,35 +1758,13 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave ); // Write to storage? - sal_Bool bStorage = xStorage.is(); - uno::Reference< embed::XStorage > xLibrariesStor; + sal_Bool bStorage = i_rStorage.is(); uno::Reference< embed::XStorage > xSourceLibrariesStor; - if( bStorage ) + uno::Reference< embed::XStorage > xTargetLibrariesStor; + ::rtl::OUString sTempTargetStorName; + const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage ); + if ( bStorage ) { - // when we save to our root storage, ensure the libs are all loaded. Else the below cleaning - // of the target storage will loose them. - if ( xStorage == mxStorage ) - { - pName = aNames.getConstArray(); - for ( ; pName != pNamesEnd; ++pName ) - { - if ( !isLibraryLoaded( *pName ) ) - loadLibrary( *pName ); - } - } - - // first of all, clean the target library storage, since the storing procedure must do overwrite - try - { - if ( xStorage->hasByName( maLibrariesDir ) ) - xStorage->removeElement( maLibrariesDir ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } - // Don't write if only empty standard lib exists if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) ) { @@ -1797,29 +1775,52 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto return; } - try { - xLibrariesStor.set( xStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); + // create the empty target storage + try + { + ::rtl::OUString sTargetLibrariesStoreName; + if ( bInplaceStorage ) + { + // create a temporary target storage + const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) ); + do + { + ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase ); + sal_Int32 index = 0; + aTempTargetName.append( index ); + + sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear(); + if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + break; + } + while ( true ); + sTempTargetStorName = sTargetLibrariesStoreName; + } + else + { + sTargetLibrariesStoreName = maLibrariesDir; + if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + i_rStorage->removeElement( sTargetLibrariesStoreName ); + } + + xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - #if OSL_DEBUG_LEVEL > 0 - Any aError( ::cppu::getCaughtException() ); - ::rtl::OStringBuffer aMessage; - aMessage.append( "couln't open source library storage.\n\nException:" ); - aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); - #endif + DBG_UNHANDLED_EXCEPTION(); return; } + // open the source storage which might be used to copy yet-unmodified libraries try { - if ( ( mxStorage != xStorage ) && ( mxStorage->hasByName( maLibrariesDir ) ) ) - xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); + if ( mxStorage->hasByName( maLibrariesDir ) ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); } catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); + return; } } @@ -1831,7 +1832,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto SfxLibrary* pImplLib = getImplLib( *pName ); if( pImplLib->mbSharedIndexFile ) continue; - bool bExtensionLib = pImplLib->mbExtension; + const bool bExtensionLib = pImplLib->mbExtension; ::xmlscript::LibDescriptor& rLib = bExtensionLib ? aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray]; if( !bExtensionLib ) @@ -1851,12 +1852,14 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto if( pImplLib->implIsModified() || bComplete ) { - // Can we copy the storage? + // Can we simply copy the storage? if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() ) { - try { - xSourceLibrariesStor->copyElementTo( rLib.aName, xLibrariesStor, rLib.aName ); - } catch( uno::Exception& ) + try + { + xSourceLibrariesStor->copyElementTo( rLib.aName, xTargetLibrariesStor, rLib.aName ); + } + catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); // TODO: error handling? @@ -1869,7 +1872,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { try { - xLibraryStor = xLibrariesStor->openStorageElement( + xLibraryStor = xTargetLibrariesStor->openStorageElement( rLib.aName, embed::ElementModes::READWRITE ); } @@ -1901,7 +1904,8 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor ); if( bStorage ) { - try { + try + { uno::Reference< embed::XTransactedObject > xTransact( xLibraryStor, uno::UNO_QUERY_THROW ); xTransact->commit(); } @@ -1921,6 +1925,55 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto rLib.bReadOnly = pImplLib->mbReadOnlyLink; } + // if we did an in-place save into a storage (i.e. a save into the storage we were already based on), + // then we need to clean up the temporary storage we used for this + if ( bInplaceStorage && sTempTargetStorName.getLength() ) + { + try + { + // for this, we first remove everything from the source storage, then copy the complete content + // from the temporary target storage. From then on, what used to be the "source storage" becomes + // the "targt storage" for all subsequent operations. + + // (We cannot simply remove the storage, denoted by maLibrariesDir, from i_rStorage - there might be + // open references to it.) + + // remove + const Sequence< ::rtl::OUString > aRemoveNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); + pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); + ++pRemoveName + ) + { + xSourceLibrariesStor->removeElement( *pRemoveName ); + } + + // copy + const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); + pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); + ++pCopyName + ) + { + xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + } + + // close and remove temp target + xTargetLibrariesStor->dispose(); + i_rStorage->removeElement( sTempTargetStorName ); + xTargetLibrariesStor.clear(); + sTempTargetStorName = ::rtl::OUString(); + + // adjust target + xTargetLibrariesStor = xSourceLibrariesStor; + xSourceLibrariesStor.clear(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + if( !mbOldInfoFormat && !maModifiable.isModified() ) return; maModifiable.setModified( sal_False ); @@ -1946,7 +1999,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); try { - xInfoStream = xLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); + xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY ); OSL_ENSURE ( xProps.is(), "The stream must implement XPropertySet!\n" ); if ( !xProps.is() ) @@ -2005,7 +2058,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto xmlscript::exportLibraryContainer( xHandler, pLibArray ); if ( bStorage ) { - uno::Reference< embed::XTransactedObject > xTransact( xLibrariesStor, uno::UNO_QUERY ); + uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY ); OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" ); if ( !xTransact.is() ) throw uno::RuntimeException(); -- cgit v1.2.3 From 9f6018ec1472d7e4f2f26b300d8c00b09fda1fe8 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 11:29:46 +0100 Subject: aw079: #i107500# changed 3D renderer to be able to render overlapping transparent parts from back to front (Z-sorted) --- .../processor3d/defaultprocessor3d.hxx | 13 +- .../processor3d/zbufferprocessor3d.hxx | 20 +- .../source/primitive2d/sceneprimitive2d.cxx | 5 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 72 ++++- .../source/processor3d/defaultprocessor3d.cxx | 54 ++-- .../source/processor3d/zbufferprocessor3d.cxx | 331 ++++++++++++++------- 6 files changed, 319 insertions(+), 176 deletions(-) diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index e965d22ab880..d0f886cca703 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -41,6 +41,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -90,14 +91,17 @@ namespace drawinglayer basegfx::BColorModifierStack maBColorModifierStack; // the current active texture - texture::GeoTexSvx* mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; // the current active transparence texture - texture::GeoTexSvx* mpTransparenceGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; // SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; + // counter for entered transparence textures + sal_uInt32 mnTransparenceCounter; + // bitfield unsigned mbModulate : 1; unsigned mbFilter : 1; @@ -135,8 +139,9 @@ namespace drawinglayer // data read access renderer stuff const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } - const texture::GeoTexSvx* getGeoTexSvx() const { return mpGeoTexSvx; } - const texture::GeoTexSvx* getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; } bool getModulate() const { return mbModulate; } bool getFilter() const { return mbFilter; } bool getSimpleTextureActive() const { return mbSimpleTextureActive; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index d2ef8bd7f249..b2e09205dba9 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -58,6 +58,7 @@ namespace drawinglayer { } class ZBufferRasterConverter3D; +class RasterPrimitive3D; ////////////////////////////////////////////////////////////////////////////// @@ -81,21 +82,15 @@ namespace drawinglayer // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create sal_uInt16 mnAntiAlialize; - // bitfield - // a combination of bools to allow two-pass rendering to render - // the transparent parts in the 2nd run (if any) as needed for Z-Buffer - unsigned mbProcessTransparent : 1; - unsigned mbContainsTransparent : 1; - + // remembered RasterPrimitive3D's which need to be painted back to front + // for transparent 3D parts + std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; - // the processing method for a single, known primitive - virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive); - public: ZBufferProcessor3D( const geometry::ViewInformation3D& rViewInformation3D, @@ -108,12 +103,7 @@ namespace drawinglayer sal_uInt16 nAntiAlialize); virtual ~ZBufferProcessor3D(); - // helpers for drawing transparent parts in 2nd run. To use this - // processor, call processNonTransparent and then processTransparent - // with the same primitives. The 2nd call will only do something, - // when transparent parts are contained - void processNonTransparent(const primitive3d::Primitive3DSequence& rSource); - void processTransparent(const primitive3d::Primitive3DSequence& rSource); + void finish(); // get the result as bitmapEx BitmapEx getBitmapEx() const; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index ad36a40ea996..9c32c50e7160 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -235,8 +235,9 @@ namespace drawinglayer aUnitVisibleRange, nOversampleValue); - aZBufferProcessor3D.processNonTransparent(getChildren3D()); - aZBufferProcessor3D.processTransparent(getChildren3D()); + aZBufferProcessor3D.process(getChildren3D()); + aZBufferProcessor3D.finish(); + const_cast< ScenePrimitive2D* >(this)->maOldRenderedBitmap = aZBufferProcessor3D.getBitmapEx(); const Size aBitmapSizePixel(maOldRenderedBitmap.GetSizePixel()); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 2866bb292e58..bb0bdfe34154 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -337,17 +337,69 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); - if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + static bool bCheckTrapezoidDecomposition(false); + static bool bShowOutlinesThere(false); + if(bCheckTrapezoidDecomposition) { - // #i98289# - // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete - // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since - // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This - // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. - aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + // clip against discrete ViewPort + const basegfx::B2DRange& rDiscreteViewport = getViewInformation2D().getDiscreteViewport(); + basegfx::B2DPolyPolygon aLocalPolyPolygon(basegfx::tools::clipPolygonOnRange( + aLocalPolygon, rDiscreteViewport, true, false)); + + if(aLocalPolyPolygon.count()) + { + // subdivide + aLocalPolyPolygon = basegfx::tools::adaptiveSubdivideByDistance( + aLocalPolyPolygon, 0.5); + + // trapezoidize + static double fLineWidth(2.0); + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::createLineTrapezoidFromB2DPolyPolygon(aB2DTrapezoidVector, aLocalPolyPolygon, fLineWidth); + + const sal_uInt32 nCount(aB2DTrapezoidVector.size()); + + if(nCount) + { + basegfx::BColor aInvPolygonColor(aHairlineColor); + aInvPolygonColor.invert(); + + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aTempPolygon(aB2DTrapezoidVector[a].getB2DPolygon()); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(Color(aHairlineColor)); + mpOutputDevice->SetLineColor(); + } + + mpOutputDevice->DrawPolygon(aTempPolygon); + + if(bShowOutlinesThere) + { + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aInvPolygonColor)); + mpOutputDevice->DrawPolyLine(aTempPolygon, 0.0); + } + } + } + } } + else + { + if(bPixelBased && getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()) + { + // #i98289# + // when a Hairline is painted and AntiAliasing is on the option SnapHorVerLinesToDiscrete + // allows to suppress AntiAliasing for pure horizontal or vertical lines. This is done since + // not-AntiAliased such lines look more pleasing to the eye (e.g. 2D chart content). This + // NEEDS to be done in discrete coordinates, so only useful for pixel based rendering. + aLocalPolygon = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aLocalPolygon); + } - mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); + } } // direct draw of transformed BitmapEx primitive @@ -684,8 +736,8 @@ namespace drawinglayer aLocalPolyPolygon, 0.5); // trapezoidize - const basegfx::B2DTrapezoidVector aB2DTrapezoidVector(basegfx::tools::trapezoidSubdivide( - aLocalPolyPolygon)); + basegfx::B2DTrapezoidVector aB2DTrapezoidVector; + basegfx::tools::trapezoidSubdivide(aB2DTrapezoidVector, aLocalPolyPolygon); const sal_uInt32 nCount(aB2DTrapezoidVector.size()); diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index d9194ca4b5eb..d4ed86de3b6e 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -71,8 +71,8 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - const bool bOldSimpleTextureActive(mbSimpleTextureActive); - texture::GeoTexSvx* pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; + const bool bOldSimpleTextureActive(getSimpleTextureActive()); + boost::shared_ptr< texture::GeoTexSvx > pOldTex = (bTransparence) ? mpTransparenceGeoTexSvx : mpGeoTexSvx; // create texture const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient(); @@ -82,7 +82,7 @@ namespace drawinglayer const basegfx::BColor aStart(rFillGradient.getStartColor()); const basegfx::BColor aEnd(rFillGradient.getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - texture::GeoTexSvx* pNewTex = 0L; + boost::shared_ptr< texture::GeoTexSvx > pNewTex; if(nMaxSteps) { @@ -106,32 +106,32 @@ namespace drawinglayer { case attribute::GRADIENTSTYLE_LINEAR: { - pNewTex = new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientLinear(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_AXIAL: { - pNewTex = new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientAxial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RADIAL: { - pNewTex = new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY()); + pNewTex.reset(new texture::GeoTexSvxGradientRadial(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY())); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - pNewTex = new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientElliptical(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_SQUARE: { - pNewTex = new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientSquare(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } case attribute::GRADIENTSTYLE_RECT: { - pNewTex = new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle()); + pNewTex.reset(new texture::GeoTexSvxGradientRect(aOutlineRange, aStart, aEnd, nSteps, rFillGradient.getBorder(), rFillGradient.getOffsetX(), rFillGradient.getOffsetY(), -rFillGradient.getAngle())); break; } } @@ -141,7 +141,7 @@ namespace drawinglayer else { // no color distance -> same color, use simple texture - pNewTex = new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance()); + pNewTex.reset(new texture::GeoTexSvxMono(aStart, 1.0 - aStart.luminance())); mbSimpleTextureActive = true; } @@ -158,9 +158,6 @@ namespace drawinglayer // process sub-list process(rSubSequence); - // delete texture - delete pNewTex; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -186,7 +183,7 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // calculate logic pixel size in object coordinates. Create transformation view // to object by inverting ObjectToView @@ -206,15 +203,11 @@ namespace drawinglayer const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY); // create texture and set - texture::GeoTexSvxMultiHatch* pNewTex = new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize); - mpGeoTexSvx = pNewTex; + mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize)); // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -231,32 +224,29 @@ namespace drawinglayer // rescue values const bool bOldModulate(getModulate()); mbModulate = rPrimitive.getModulate(); const bool bOldFilter(getFilter()); mbFilter = rPrimitive.getFilter(); - texture::GeoTexSvx* pOldTex = mpGeoTexSvx; + boost::shared_ptr< texture::GeoTexSvx > pOldTex = mpGeoTexSvx; // create texture const attribute::FillBitmapAttribute& rFillBitmapAttribute = rPrimitive.getBitmap(); if(rFillBitmapAttribute.getTiling()) { - mpGeoTexSvx = new texture::GeoTexSvxBitmapTiled( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmapTiled( rFillBitmapAttribute.getBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } else { - mpGeoTexSvx = new texture::GeoTexSvxBitmap( + mpGeoTexSvx.reset(new texture::GeoTexSvxBitmap( rFillBitmapAttribute.getBitmap(), rFillBitmapAttribute.getTopLeft() * rPrimitive.getTextureSize(), - rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize()); + rFillBitmapAttribute.getSize() * rPrimitive.getTextureSize())); } // process sub-list process(rSubSequence); - // delete texture - delete mpGeoTexSvx; - // restore values mbModulate = bOldModulate; mbFilter = bOldFilter; @@ -320,7 +310,7 @@ namespace drawinglayer if(bPaintIt) { // get rid of texture coordinates if there is no texture - if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx() && !getTransparenceGeoTexSvx()) + if(aFill.areTextureCoordinatesUsed() && !getGeoTexSvx().get() && !getTransparenceGeoTexSvx().get()) { aFill.clearTextureCoordinates(); } @@ -507,7 +497,9 @@ namespace drawinglayer { // AlphaTexturePrimitive3D const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); + mnTransparenceCounter++; impRenderGradientTexturePrimitive3D(rPrimitive, true); + mnTransparenceCounter--; break; } case PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D : @@ -556,8 +548,10 @@ namespace drawinglayer mrSdrLightingAttribute(rSdrLightingAttribute), maRasterRange(), maBColorModifierStack(), - mpGeoTexSvx(0), - mpTransparenceGeoTexSvx(0), + mpGeoTexSvx(), + mpTransparenceGeoTexSvx(), + maDrawinglayerOpt(), + mnTransparenceCounter(0), mbModulate(false), mbFilter(false), mbSimpleTextureActive(false) diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index b5a59e10a119..9346958f6b69 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -50,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -233,14 +234,14 @@ private: basegfx::B2DPoint aTexCoor(0.0, 0.0); getTextureCoor(aTexCoor); - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { // calc color in spot. This may also set to invisible already when // e.g. bitmap textures have transparent parts mrProcessor.getGeoTexSvx()->modifyBColor(aTexCoor, rColor, fOpacity); } - if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx()) + if(basegfx::fTools::more(fOpacity, 0.0) && mrProcessor.getTransparenceGeoTexSvx().get()) { // calc opacity. Object has a 2nd texture, a transparence texture mrProcessor.getTransparenceGeoTexSvx()->modifyOpacity(aTexCoor, fOpacity); @@ -249,7 +250,7 @@ private: if(basegfx::fTools::more(fOpacity, 0.0)) { - if(mrProcessor.getGeoTexSvx()) + if(mrProcessor.getGeoTexSvx().get()) { if(mbUseNrm) { @@ -317,9 +318,9 @@ private: mbModifyColor = mrProcessor.getBColorModifierStack().count(); mbHasTexCoor = SCANLINE_EMPTY_INDEX != rA.getTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getTextureIndex(); mbHasInvTexCoor = SCANLINE_EMPTY_INDEX != rA.getInverseTextureIndex() && SCANLINE_EMPTY_INDEX != rB.getInverseTextureIndex(); - const bool bTextureActive(mrProcessor.getGeoTexSvx() || mrProcessor.getTransparenceGeoTexSvx()); + const bool bTextureActive(mrProcessor.getGeoTexSvx().get() || mrProcessor.getTransparenceGeoTexSvx().get()); mbUseTex = bTextureActive && (mbHasTexCoor || mbHasInvTexCoor || mrProcessor.getSimpleTextureActive()); - const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx()); + const bool bUseColorTex(mbUseTex && mrProcessor.getGeoTexSvx().get()); const bool bNeedNrmOrCol(!bUseColorTex || (bUseColorTex && mrProcessor.getModulate())); mbUseNrm = bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getNormalIndex() && SCANLINE_EMPTY_INDEX != rB.getNormalIndex(); mbUseCol = !mbUseNrm && bNeedNrmOrCol && SCANLINE_EMPTY_INDEX != rA.getColorIndex() && SCANLINE_EMPTY_INDEX != rB.getColorIndex(); @@ -434,7 +435,7 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(nOpacity >= 0x00ff) { - // full opacity, set z and color + // full opacity (not transparent), set z and color rOldZ = nNewZ; mrBuffer.getBPixel(nScanlineIndex) = basegfx::BPixel(aNewColor, 0xff); } @@ -444,8 +445,8 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(rDest.getOpacity()) { - // both transparent, mix color based on front pixel's opacity - // (the new one) + // mix new color by using + // color' = color * (1 - opacity) + newcolor * opacity const sal_uInt16 nTransparence(0x0100 - nOpacity); rDest.setRed((sal_uInt8)(((rDest.getRed() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getRed()) * nOpacity)) >> 8)); rDest.setGreen((sal_uInt8)(((rDest.getGreen() * nTransparence) + ((sal_uInt16)(255.0 * aNewColor.getGreen()) * nOpacity)) >> 8)); @@ -453,14 +454,14 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi if(0xff != rDest.getOpacity()) { - // destination is also transparent, mix opacities by weighting - // old opacity with new pixel's transparence and adding new opacity - rDest.setOpacity((sal_uInt8)(((rDest.getOpacity() * nTransparence) >> 8) + nOpacity)); + // both are transparent, mix new opacity by using + // opacity = newopacity * (1 - oldopacity) + oldopacity + rDest.setOpacity(((sal_uInt8)((nOpacity * (0x0100 - rDest.getOpacity())) >> 8)) + rDest.getOpacity()); } } else { - // dest is not visible. Set color. + // dest is unused, set color rDest = basegfx::BPixel(aNewColor, (sal_uInt8)nOpacity); } } @@ -477,135 +478,162 @@ void ZBufferRasterConverter3D::processLineSpan(const basegfx::RasterConversionLi } } +////////////////////////////////////////////////////////////////////////////// +// helper class to buffer output for transparent rasterprimitives (filled areas +// and lines) until the end of processing. To ensure correct transparent +// visualisation, ZBuffers require to not set Z and to mix with the transparent +// color. If transparent rasterprimitives overlap, it gets necessary to +// paint transparent rasterprimitives from back to front to ensure that the +// mixing happens from back to front. For that purpose, transparent +// rasterprimitives are held in this class during the processing run, remember +// all data and will be rendered + +class RasterPrimitive3D +{ +private: + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpGeoTexSvx; + boost::shared_ptr< drawinglayer::texture::GeoTexSvx > mpTransparenceGeoTexSvx; + drawinglayer::attribute::MaterialAttribute3D maMaterial; + basegfx::B3DPolyPolygon maPolyPolygon; + sal_uInt32 mfCenterZ; + + // bitfield + bool mbModulate : 1; + bool mbFilter : 1; + bool mbSimpleTextureActive : 1; + bool mbIsLine : 1; + +public: + RasterPrimitive3D( + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pGeoTexSvx, + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& pTransparenceGeoTexSvx, + const drawinglayer::attribute::MaterialAttribute3D& rMaterial, + const basegfx::B3DPolyPolygon& rPolyPolygon, + bool bModulate, + bool bFilter, + bool bSimpleTextureActive, + bool bIsLine) + : mpGeoTexSvx(pGeoTexSvx), + mpTransparenceGeoTexSvx(pTransparenceGeoTexSvx), + maMaterial(rMaterial), + maPolyPolygon(rPolyPolygon), + mfCenterZ(basegfx::tools::getRange(rPolyPolygon).getCenter().getZ()), + mbModulate(bModulate), + mbFilter(bFilter), + mbSimpleTextureActive(bSimpleTextureActive), + mbIsLine(bIsLine) + { + } + + RasterPrimitive3D& operator=(const RasterPrimitive3D& rComp) + { + mpGeoTexSvx = rComp.mpGeoTexSvx; + mpTransparenceGeoTexSvx = rComp.mpTransparenceGeoTexSvx; + maMaterial = rComp.maMaterial; + maPolyPolygon = rComp.maPolyPolygon; + mfCenterZ = rComp.mfCenterZ; + mbModulate = rComp.mbModulate; + mbFilter = rComp.mbFilter; + mbSimpleTextureActive = rComp.mbSimpleTextureActive; + mbIsLine = rComp.mbIsLine; + + return *this; + } + + bool operator<(const RasterPrimitive3D& rComp) const + { + return mfCenterZ < rComp.mfCenterZ; + } + + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } + const boost::shared_ptr< drawinglayer::texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } + const drawinglayer::attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; } + const basegfx::B3DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; } + bool getModulate() const { return mbModulate; } + bool getFilter() const { return mbFilter; } + bool getSimpleTextureActive() const { return mbSimpleTextureActive; } + bool getIsLine() const { return mbIsLine; } +}; + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor3d { - // the processing method for a single, known primitive - void ZBufferProcessor3D::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive) + void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const { - // it is a BasePrimitive3D implementation, use getPrimitiveID() call for switch - switch(rBasePrimitive.getPrimitiveID()) + if(mpBZPixelRaster) { - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + if(getTransparenceCounter()) { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); - - if(mbProcessTransparent) - { - impRenderGradientTexturePrimitive3D(rPrimitive, true); - } - else + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) { - mbContainsTransparent = true; + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; } - break; - } - case PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D : - { - // directdraw of PolygonHairlinePrimitive3D - const primitive3d::PolygonHairlinePrimitive3D& rPrimitive = static_cast< const primitive3d::PolygonHairlinePrimitive3D& >(rBasePrimitive); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) - { - impRenderPolygonHairlinePrimitive3D(rPrimitive); - } - break; + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + basegfx::B3DPolyPolygon(rHairline), + getModulate(), + getFilter(), + getSimpleTextureActive(), + true)); } - case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : + else { - // directdraw of PolyPolygonMaterialPrimitive3D - const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive = static_cast< const primitive3d::PolyPolygonMaterialPrimitive3D& >(rBasePrimitive); + // do rasterconversion + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - // do something when either not transparent and no transMap, or transparent and a TransMap - if((bool)mbProcessTransparent == (0 != getTransparenceGeoTexSvx())) + if(mnAntiAlialize > 1) { - impRenderPolyPolygonMaterialPrimitive3D(rPrimitive); - } - break; - } - default: - { - // use the DefaultProcessor3D::processBasePrimitive3D() - DefaultProcessor3D::processBasePrimitive3D(rBasePrimitive); - break; - } - } - } - - void ZBufferProcessor3D::processNonTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster) - { - mbProcessTransparent = false; - mbContainsTransparent = false; - process(rSource); - } - } - - void ZBufferProcessor3D::processTransparent(const primitive3d::Primitive3DSequence& rSource) - { - if(mpBZPixelRaster && mbContainsTransparent) - { - mbProcessTransparent = true; - process(rSource); - } - } + const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); - void ZBufferProcessor3D::rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const - { - if(mpBZPixelRaster) - { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + if(bForceLineSnap) + { + basegfx::B3DHomMatrix aTransform; + basegfx::B3DPolygon aSnappedHairline(rHairline); + const double fScaleDown(1.0 / mnAntiAlialize); + const double fScaleUp(mnAntiAlialize); - if(mnAntiAlialize > 1) - { - const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete()); + // take oversampling out + aTransform.scale(fScaleDown, fScaleDown, 1.0); + aSnappedHairline.transform(aTransform); - if(bForceLineSnap) - { - basegfx::B3DHomMatrix aTransform; - basegfx::B3DPolygon aSnappedHairline(rHairline); - const double fScaleDown(1.0 / mnAntiAlialize); - const double fScaleUp(mnAntiAlialize); + // snap to integer + aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); - // take oversampling out - aTransform.scale(fScaleDown, fScaleDown, 1.0); - aSnappedHairline.transform(aTransform); + // add oversampling again + aTransform.identity(); + aTransform.scale(fScaleUp, fScaleUp, 1.0); - // snap to integer - aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline); + if(false) + { + // when really want to go to single pixel lines, move to center. + // Without this translation, all hor/ver hairlines will be centered exactly + // between two pixel lines (which looks best) + const double fTranslateToCenter(mnAntiAlialize * 0.5); + aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + } - // add oversampling again - aTransform.identity(); - aTransform.scale(fScaleUp, fScaleUp, 1.0); + aSnappedHairline.transform(aTransform); - if(false) + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + } + else { - // when really want to go to single pixel lines, move to center. - // Without this translation, all hor/ver hairlines will be centered exactly - // between two pixel lines (which looks best) - const double fTranslateToCenter(mnAntiAlialize * 0.5); - aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } - - aSnappedHairline.transform(aTransform); - - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); } else { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize); + mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); } } - else - { - mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1); - } } } @@ -613,8 +641,30 @@ namespace drawinglayer { if(mpBZPixelRaster) { - mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); - mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + if(getTransparenceCounter()) + { + // transparent output; record for later sorting and painting from + // back to front + if(!mpRasterPrimitive3Ds) + { + const_cast< ZBufferProcessor3D* >(this)->mpRasterPrimitive3Ds = new std::vector< RasterPrimitive3D >; + } + + mpRasterPrimitive3Ds->push_back(RasterPrimitive3D( + getGeoTexSvx(), + getTransparenceGeoTexSvx(), + rMaterial, + rFill, + getModulate(), + getFilter(), + getSimpleTextureActive(), + false)); + } + else + { + mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial); + mpZBufferRasterConverter3D->rasterconvertB3DPolyPolygon(rFill, &maInvEyeToView, 0, mpBZPixelRaster->getHeight()); + } } } @@ -632,8 +682,7 @@ namespace drawinglayer maInvEyeToView(), mpZBufferRasterConverter3D(0), mnAntiAlialize(nAntiAlialize), - mbProcessTransparent(false), - mbContainsTransparent(false) + mpRasterPrimitive3Ds(0) { // generate ViewSizes const double fFullViewSizeX((rViewInformation2D.getObjectToViewTransformation() * basegfx::B2DVector(fSizeX, 0.0)).getLength()); @@ -729,6 +778,58 @@ namespace drawinglayer delete mpZBufferRasterConverter3D; delete mpBZPixelRaster; } + + if(mpRasterPrimitive3Ds) + { + OSL_ASSERT("ZBufferProcessor3D: destructed, but there are unrendered transparent geometries. Use ZBufferProcessor3D::finish() to render these (!)"); + delete mpRasterPrimitive3Ds; + } + } + + void ZBufferProcessor3D::finish() + { + if(mpRasterPrimitive3Ds) + { + // there are transparent rasterprimitives + const sal_uInt32 nSize(mpRasterPrimitive3Ds->size()); + + if(nSize > 1) + { + // sort them from back to front + std::sort(mpRasterPrimitive3Ds->begin(), mpRasterPrimitive3Ds->end()); + } + + for(sal_uInt32 a(0); a < nSize; a++) + { + // paint each one by setting the remembered data and calling + // the render method + const RasterPrimitive3D& rCandidate = (*mpRasterPrimitive3Ds)[a]; + + mpGeoTexSvx = rCandidate.getGeoTexSvx(); + mpTransparenceGeoTexSvx = rCandidate.getTransparenceGeoTexSvx(); + mbModulate = rCandidate.getModulate(); + mbFilter = rCandidate.getFilter(); + mbSimpleTextureActive = rCandidate.getSimpleTextureActive(); + + if(rCandidate.getIsLine()) + { + rasterconvertB3DPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon().getB3DPolygon(0)); + } + else + { + rasterconvertB3DPolyPolygon( + rCandidate.getMaterial(), + rCandidate.getPolyPolygon()); + } + } + + // delete them to signal the destructor that all is done and + // to allow asserting there + delete mpRasterPrimitive3Ds; + mpRasterPrimitive3Ds = 0; + } } BitmapEx ZBufferProcessor3D::getBitmapEx() const -- cgit v1.2.3 From 74ffe76476d5b8941454a2acce569737237fc1d7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 13:58:00 +0100 Subject: autorecovery: we're hidden when we're hidden, *not* when our associated model has been loaded hidden --- framework/source/services/frame.cxx | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 0e14404de381..d4bc50791a18 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -2705,21 +2705,7 @@ css::uno::Any SAL_CALL Frame::impl_getPropertyValue(const ::rtl::OUString& /*sPr break; case FRAME_PROPHANDLE_ISHIDDEN : -// aValue <<= m_bIsHidden; - { - sal_Bool bLoadedHidden = m_bIsHidden; - css::uno::Reference< css::frame::XModel > xModel; - if (m_xController.is()) - xModel = m_xController->getModel(); - if (xModel.is()) - { - ::comphelper::MediaDescriptor lDesc(xModel->getArgs()); - bLoadedHidden = lDesc.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_HIDDEN(), - (sal_Bool)sal_False); - } - aValue <<= bLoadedHidden; - } + aValue <<= m_bIsHidden; break; case FRAME_PROPHANDLE_LAYOUTMANAGER : -- cgit v1.2.3 From 3b2321d5120d8c9d654120312819bf1459941a20 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 14:14:21 +0100 Subject: autorecovery: only include documents in the autorecovery which support the XDocumentRecovery interface --- framework/inc/classes/checkediterator.hxx | 2 +- framework/inc/jobs/jobdata.hxx | 2 +- framework/inc/services/autorecovery.hxx | 4 +-- framework/source/inc/loadenv/loadenv.hxx | 2 +- framework/source/jobs/jobdata.cxx | 8 +++--- framework/source/jobs/jobresult.cxx | 4 +-- framework/source/loadenv/loadenv.cxx | 2 +- framework/source/services/autorecovery.cxx | 41 +++++++++++++++++------------- 8 files changed, 35 insertions(+), 30 deletions(-) diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx index dc3f22cc7274..fe036d9cff11 100644 --- a/framework/inc/classes/checkediterator.hxx +++ b/framework/inc/classes/checkediterator.hxx @@ -141,7 +141,7 @@ class CheckedIterator if( m_eEndState == E_UNKNOWN ) { - // Set new container and actualize other member. + // Set new container and update other member. m_pContainer = &rContainer ; m_eEndState = E_BEFOREEND ; m_pPosition = m_pContainer->begin(); diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx index e4bb10cd758d..165120ec2e7d 100644 --- a/framework/inc/jobs/jobdata.hxx +++ b/framework/inc/jobs/jobdata.hxx @@ -233,7 +233,7 @@ class JobData : private ThreadHelpBase after a job was sucessfully executed (by any outside code using our informations) it can return a result. This member make it part of this container too. So it can be used for further things. - We use it also to actualize our internal state and the configuration + We use it also to update our internal state and the configuration of the job. But note: only the last result will be saved here! */ JobResult m_aLastExecutionResult; diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index a9e0f5ebe506..8e73be79abaf 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -610,7 +610,7 @@ class AutoRecovery : public css::lang::XTypeProvider @threadsafe */ - void implts_actualizeTimer(); + void implts_updateTimer(); //--------------------------------------- /** @short stop the timer. @@ -678,7 +678,7 @@ class AutoRecovery : public css::lang::XTypeProvider //--------------------------------------- // TODO document me - void implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); + void implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); //--------------------------------------- // TODO document me diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index 40ded72db9f6..c1b23f0394eb 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -487,7 +487,7 @@ class LoadEnv : private ThreadHelpBase /** @short tries to detect the type and the filter of the specified content. - @descr This method actualize the available media descriptor of this instance, + @descr This method update the available media descriptor of this instance, so it contains the right type, a corresponding filter, may a valid frame loader etc. In case detection failed, this descriptor is corrected first, before a suitable exception will be thrown. diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index ce615370cd82..d93d4eb74abf 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -305,10 +305,10 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& /* SAFE { */ WriteGuard aWriteLock(m_aLock); - // actualize member + // update member m_lArguments = lArguments; - // actualize the configuration ... if possible! + // update the configuration ... if possible! if (m_eMode==E_ALIAS) { // It doesn't matter if this config object was already opened before. @@ -366,7 +366,7 @@ void JobData::setResult( const JobResult& aResult ) // overwrite the last saved result m_aLastExecutionResult = aResult; - // Don't use his informations to actualize + // Don't use his informations to update // e.g. the arguments of this job. It must be done // from outside! Here we save this information only. @@ -536,7 +536,7 @@ void JobData::disableJob() if (m_eMode!=E_EVENT) return; - // actualize the configuration + // update the configuration // It doesn't matter if this config object was already opened before. // It doesn nothing here then ... or it change the mode automaticly, if // it was opened using another one before. diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx index c30e2c411539..c02f46912bd8 100644 --- a/framework/source/jobs/jobresult.cxx +++ b/framework/source/jobs/jobresult.cxx @@ -84,7 +84,7 @@ JobResult::JobResult() /** @short special ctor @descr It initialize this new instance with a pure job execution result - and analyze it. Doing so, we actualize our other members. + and analyze it. Doing so, we update our other members.

It's a list of named values, packed inside this any. @@ -136,7 +136,7 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult ) // That can be usefull if something will fail here ... m_eParts = E_NOPART; - // analyze the result and actualize our other members + // analyze the result and update our other members ::comphelper::SequenceAsHashMap aProtocol(aResult); if ( aProtocol.empty() ) return; diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 911a0430763f..8fbe1dc6cb7b 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -821,7 +821,7 @@ void LoadEnv::impl_detectTypeAndFilter() // Attention: Because our stl media descriptor is a copy of an uno sequence // we cant use as an in/out parameter here. Copy it before and dont forget to - // actualize structure afterwards again! + // update structure afterwards again! css::uno::Sequence< css::beans::PropertyValue > lDescriptor = m_lMediaDescriptor.getAsConstPropertyValueList(); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index a8fcb9046bf2..7c45d96bd019 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -645,7 +645,7 @@ void SAL_CALL AutoRecovery::dispatch(const css::util::URL& // dont enable AutoSave hardly ! // reload configuration to know the current state. implts_readAutoSaveConfig(); - implts_actualizeTimer(); + implts_updateTimer(); // can it happen that might be the listener was stopped ? .-) // make sure it runs always ... even if AutoSave itself was disabled temporarly. implts_startListening(); @@ -791,7 +791,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) // <- SAFE ---------------------------------- // depends on bAllowAutoSaveReactivation implicitly by looking on m_eJob=E_AUTO_SAVE! see before ... - implts_actualizeTimer(); + implts_updateTimer(); if (bAllowAutoSaveReactivation) implts_startListening(); @@ -861,7 +861,7 @@ void SAL_CALL AutoRecovery::notifyEvent(const css::document::EventObject& aEvent else if (aEvent.EventName.equals(EVENT_ON_MODIFYCHANGED)) { - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); } /* at least one document starts saving process => Our application code isnt ready for multiple save requests @@ -970,7 +970,7 @@ void SAL_CALL AutoRecovery::changesOccurred(const css::util::ChangesEvent& aEven // Note: This call stops the timer and starts it again. // But it checks the different timer states internaly and // may be supress the restart! - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1193,7 +1193,7 @@ void AutoRecovery::implts_readConfig() // <- REENTRANT -------------------------- } - implts_actualizeTimer(); + implts_updateTimer(); } //----------------------------------------------- @@ -1330,11 +1330,6 @@ void AutoRecovery::implts_persistAllActiveViewNames() WriteGuard aWriteLock(m_aLock); // This list will be filled with every document - // which should be saved as last one. E.g. if it was used - // already for an UI save operation => crashed ... and - // now we try to save it again ... which can fail again ( of course .-) ). - ::std::vector< AutoRecovery::TDocumentList::iterator > lDangerousDocs; - AutoRecovery::TDocumentList::iterator pIt; for ( pIt = m_lDocCache.begin(); pIt != m_lDocCache.end() ; @@ -1555,7 +1550,7 @@ void AutoRecovery::implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& } //----------------------------------------------- -void AutoRecovery::implts_actualizeTimer() +void AutoRecovery::implts_updateTimer() { implts_stopTimer(); @@ -1646,7 +1641,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) m_eTimerType = AutoRecovery::E_POLL_TILL_AUTOSAVE_IS_ALLOWED; aWriteLock.unlock(); // <- SAFE ------------------------------ - implts_actualizeTimer(); + implts_updateTimer(); return 0; } @@ -1661,7 +1656,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) sal_Bool bUserIdle = (Application::GetLastInputInterval()>MIN_TIME_FOR_USER_IDLE); if (!bUserIdle) { - implts_actualizeTimer(); + implts_updateTimer(); return 0; } } @@ -1702,7 +1697,7 @@ IMPL_LINK(AutoRecovery, implts_timerExpired, void*, EMPTYARG) aWriteLock.unlock(); // <- SAFE ---------------------------------- - implts_actualizeTimer(); + implts_updateTimer(); } catch(const css::uno::Exception&) { @@ -1739,7 +1734,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // notification for already existing document ! // Can happen if events came in asynchronous on recovery time. // Then our cache was filled from the configuration ... but now we get some - // asynchronous events from the global event broadcaster. We must be shure that + // asynchronous events from the global event broadcaster. We must be sure that // we dont add the same document more then once. AutoRecovery::TDocumentList::iterator pIt = AutoRecovery::impl_searchDocument(m_lDocCache, xDocument); if (pIt != m_lDocCache.end()) @@ -1747,7 +1742,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // Normaly nothing must be done for this "late" notification. // But may be the modified state was changed inbetween. // Check it ... - implts_actualizeModifiedState(xDocument); + implts_updateModifiedState(xDocument); return; } @@ -1772,6 +1767,11 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (!xDesktop.is()) return; + // if the document doesn't support the XDocumentRecovery interface, we're not interested in it. + Reference< XDocumentRecovery > xDocRecovery( xDocument, UNO_QUERY ); + if ( !xDocRecovery.is() ) + return; + // get all needed informations of this document // We need it to update our cache or to locate already existing elements there! AutoRecovery::TDocumentInfo aNew; @@ -1800,7 +1800,12 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame (!aNew.OrgURL.getLength() ) && (!aNew.FactoryURL.getLength()) ) - return; + { + OSL_ENSURE( false, "AutoRecovery::implts_registerDocument: this should not happen anymore!" ); + // nowadays, the Basic IDE should already die on the "supports XDocumentRecovery" check. And no other known + // document type fits in here ... + return; + } // By the way - get some information about the default format for saving! // and save an information about the real used filter by this document. @@ -1923,7 +1928,7 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: } //----------------------------------------------- -void AutoRecovery::implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) +void AutoRecovery::implts_updateModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument) { CacheLockGuard aCacheLock(this, m_aLock, m_nDocCacheLock, LOCK_FOR_CACHE_USE); -- cgit v1.2.3 From 064e40d3714c7deeba0d8cbcb7086de9ba1f5144 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 16:34:35 +0100 Subject: aw079: #i107987# corrected selection and rotation for 3D light control --- svx/source/dialog/dlgctl3d.cxx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 8123a353bc63..b5956b3949df 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -514,8 +514,17 @@ void Svx3DLightControl::TrySelection(Point aPosPixel) if(aResult.size()) { - // take the frontmost one - const E3dCompoundObject* pResult = aResult[0]; + // exclude expansion object which will be part of + // the hits. It's invisible, but for HitTest, it's included + const E3dCompoundObject* pResult = 0; + + for(sal_uInt32 b(0); !pResult && b < aResult.size(); b++) + { + if(aResult[b] && aResult[b] != mpExpansionObject) + { + pResult = aResult[b]; + } + } if(pResult == mp3DObj) { @@ -780,8 +789,8 @@ void Svx3DLightControl::GetPosition(double& rHor, double& rVer) } if(IsGeometrySelected()) { - rHor = mfRotateY; - rVer = mfRotateX; + rHor = mfRotateY / F_PI180; // 0..360.0 + rVer = mfRotateX / F_PI180; // -90.0..90.0 } } @@ -824,8 +833,8 @@ void Svx3DLightControl::SetPosition(double fHor, double fVer) { if(mfRotateX != fVer || mfRotateY != fHor) { - mfRotateX = fVer; - mfRotateY = fHor; + mfRotateX = fVer * F_PI180; + mfRotateY = fHor * F_PI180; if(mp3DObj) { -- cgit v1.2.3 From 108c876c1c9a723b92f876662e02ee105a55bbfe Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 18:33:15 +0100 Subject: aw079: #i107557# Re-added the edge rounding control handle to text frame visualisations --- svx/source/svdraw/svdorect.cxx | 79 +++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 7d69955ec441..3e9b4b0cfa54 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -319,50 +319,67 @@ void SdrRectObj::NbcSetLogicRect(const Rectangle& rRect) sal_uInt32 SdrRectObj::GetHdlCount() const { - return 9L; + return IsTextFrame() ? 10 : 9; } SdrHdl* SdrRectObj::GetHdl(sal_uInt32 nHdlNum) const { - SdrHdl* pH=NULL; + SdrHdl* pH = NULL; Point aPnt; - SdrHdlKind eKind=HDL_MOVE; - if( IsTextFrame() && !nHdlNum ) + SdrHdlKind eKind = HDL_MOVE; + + if(!IsTextFrame()) { - pH=new ImpTextframeHdl(aRect); - pH->SetObj((SdrObject*)this); - pH->SetDrehWink(aGeo.nDrehWink); - return pH; + nHdlNum++; } - else + + switch(nHdlNum) { - switch (nHdlNum) { - case 0: { - long a=GetEckenradius(); - long b=Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert - if (a>b) a=b; - if (a<0) a=0; - aPnt=aRect.TopLeft(); - aPnt.X()+=a; - eKind=HDL_CIRC; - } break; // Eckenradius - case 1: aPnt=aRect.TopLeft(); eKind=HDL_UPLFT; break; // Oben links - case 2: aPnt=aRect.TopCenter(); eKind=HDL_UPPER; break; // Oben - case 3: aPnt=aRect.TopRight(); eKind=HDL_UPRGT; break; // Oben rechts - case 4: aPnt=aRect.LeftCenter(); eKind=HDL_LEFT ; break; // Links - case 5: aPnt=aRect.RightCenter(); eKind=HDL_RIGHT; break; // Rechts - case 6: aPnt=aRect.BottomLeft(); eKind=HDL_LWLFT; break; // Unten links - case 7: aPnt=aRect.BottomCenter(); eKind=HDL_LOWER; break; // Unten - case 8: aPnt=aRect.BottomRight(); eKind=HDL_LWRGT; break; // Unten rechts + case 0: + { + pH = new ImpTextframeHdl(aRect); + pH->SetObj((SdrObject*)this); + pH->SetDrehWink(aGeo.nDrehWink); + break; + } + case 1: + { + long a = GetEckenradius(); + long b = Max(aRect.GetWidth(),aRect.GetHeight())/2; // Wird aufgerundet, da GetWidth() eins draufaddiert + if (a>b) a=b; + if (a<0) a=0; + aPnt=aRect.TopLeft(); + aPnt.X()+=a; + eKind = HDL_CIRC; + break; } + case 2: aPnt=aRect.TopLeft(); eKind = HDL_UPLFT; break; // Oben links + case 3: aPnt=aRect.TopCenter(); eKind = HDL_UPPER; break; // Oben + case 4: aPnt=aRect.TopRight(); eKind = HDL_UPRGT; break; // Oben rechts + case 5: aPnt=aRect.LeftCenter(); eKind = HDL_LEFT ; break; // Links + case 6: aPnt=aRect.RightCenter(); eKind = HDL_RIGHT; break; // Rechts + case 7: aPnt=aRect.BottomLeft(); eKind = HDL_LWLFT; break; // Unten links + case 8: aPnt=aRect.BottomCenter(); eKind = HDL_LOWER; break; // Unten + case 9: aPnt=aRect.BottomRight(); eKind = HDL_LWRGT; break; // Unten rechts } - if (aGeo.nShearWink!=0) ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); - if (aGeo.nDrehWink!=0) RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); - if (eKind!=HDL_MOVE) { - pH=new SdrHdl(aPnt,eKind); + + if(!pH) + { + if(aGeo.nShearWink) + { + ShearPoint(aPnt,aRect.TopLeft(),aGeo.nTan); + } + + if(aGeo.nDrehWink) + { + RotatePoint(aPnt,aRect.TopLeft(),aGeo.nSin,aGeo.nCos); + } + + pH = new SdrHdl(aPnt,eKind); pH->SetObj((SdrObject*)this); pH->SetDrehWink(aGeo.nDrehWink); } + return pH; } -- cgit v1.2.3 From af7c6403dc669c0565be7530d50fef3445ad5e39 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- embeddedobj/source/commonembedding/miscobj.cxx | 2 + embeddedobj/source/commonembedding/persistence.cxx | 30 ++++++------- embeddedobj/source/inc/commonembobj.hxx | 1 + sfx2/inc/sfx2/objsh.hxx | 1 + sfx2/inc/sfx2/sfxbasemodel.hxx | 1 + sfx2/inc/sfx2/sfxmodelfactory.hxx | 2 + sfx2/source/doc/objxtor.cxx | 51 ++++++++++++++-------- sfx2/source/doc/sfxbasemodel.cxx | 41 +++++++++++------ sfx2/source/doc/sfxmodelfactory.cxx | 9 ++-- sfx2/source/inc/objshimp.hxx | 1 + 10 files changed, 89 insertions(+), 50 deletions(-) diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index e557437e336d..db515570fe98 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -66,6 +66,7 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( const uno::Reference< lang::XMulti , m_xFactory( xFactory ) , m_nMiscStatus( 0 ) , m_bEmbeddedScriptSupport( sal_True ) +, m_bDocumentRecoverySupport( sal_True ) , m_bWaitSaveCompleted( sal_False ) , m_bIsLink( sal_False ) , m_bLinkHasPassword( sal_False ) @@ -92,6 +93,7 @@ OCommonEmbeddedObject::OCommonEmbeddedObject( , m_xFactory( xFactory ) , m_nMiscStatus( 0 ) , m_bEmbeddedScriptSupport( sal_True ) +, m_bDocumentRecoverySupport( sal_True ) , m_bWaitSaveCompleted( sal_False ) , m_bIsLink( sal_True ) , m_bLinkHasPassword( sal_False ) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 47b16bf961af..9af3cf91c359 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include @@ -199,22 +200,17 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor( //------------------------------------------------------ static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< lang::XMultiServiceFactory >& _rxFactory, - const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport ) + const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport, const bool i_bDocumentRecoverySupport ) { - uno::Sequence< uno::Any > aArguments(2); - aArguments[0] <<= beans::NamedValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbeddedObject" ) ), - uno::makeAny( (sal_Bool)sal_True ) - ); - aArguments[1] <<= beans::NamedValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbeddedScriptSupport" ) ), - uno::makeAny( (sal_Bool)_bEmbeddedScriptSupport ) - ); + ::comphelper::NamedValueCollection aArguments; + aArguments.put( "EmbeddedObject", (sal_Bool)sal_True ); + aArguments.put( "EmbeddedScriptSupport", (sal_Bool)_bEmbeddedScriptSupport ); + aArguments.put( "DocumentRecoverySupport", (sal_Bool)i_bDocumentRecoverySupport ); uno::Reference< uno::XInterface > xDocument; try { - xDocument = _rxFactory->createInstanceWithArguments( _rDocumentServiceName, aArguments ); + xDocument = _rxFactory->createInstanceWithArguments( _rDocumentServiceName, aArguments.getWrappedPropertyValues() ); } catch( const uno::Exception& ) { @@ -308,7 +304,7 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY ); uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY ); @@ -359,7 +355,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY ); if ( !xLoadable.is() ) @@ -462,7 +458,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag OSL_ENSURE( xStorage.is(), "The storage can not be empty!" ); uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); //#i103460# ODF: take the size given from the parent frame as default uno::Reference< chart2::XChartDocument > xChart( xDocument, uno::UNO_QUERY ); @@ -804,7 +800,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc const uno::Sequence< beans::PropertyValue >& aMedDescr ) { uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), - m_bEmbeddedScriptSupport ) ); + m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY ); if ( !xLoadable.is() ) @@ -1063,6 +1059,10 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( { OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bEmbeddedScriptSupport ); } + else if ( lObjArgs[nObjInd].Name.equalsAscii( "DocumentRecoverySupport" ) ) + { + OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport ); + } sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE; diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 5a2827de3aa6..68c00500ff58 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -129,6 +129,7 @@ protected: ::rtl::OUString m_aDefaultParentBaseURL; ::rtl::OUString m_aModuleName; sal_Bool m_bEmbeddedScriptSupport; + sal_Bool m_bDocumentRecoverySupport; Interceptor* m_pInterceptor; diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 94d04c20a040..f9af74d9c82f 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -236,6 +236,7 @@ private: protected: SfxObjectShell(SfxObjectCreateMode); + SfxObjectShell( const sal_uInt64 i_nCreationFlags ); // see sfxmodelfactory.hxx virtual ~SfxObjectShell(); virtual void ModifyChanged(); diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index fd2c73bfd323..a276d7996b82 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1555,6 +1555,7 @@ private: IMPL_SfxBaseModel_DataContainer* m_pData ; // cannot be held in m_pData, since it needs to be accessed in non-threadsafe context const bool m_bSupportEmbeddedScripts; + const bool m_bSupportDocRecovery; } ; // class SfxBaseModel diff --git a/sfx2/inc/sfx2/sfxmodelfactory.hxx b/sfx2/inc/sfx2/sfxmodelfactory.hxx index 4b7d29efc95a..7553a968e2e9 100644 --- a/sfx2/inc/sfx2/sfxmodelfactory.hxx +++ b/sfx2/inc/sfx2/sfxmodelfactory.hxx @@ -43,8 +43,10 @@ namespace sfx2 { //........................................................................ + #define SFXMODEL_STANDARD (sal_uInt64)(0x0000) #define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001) #define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0002) + #define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0004) typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ( SAL_CALL * SfxModelFactoryFunc ) ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index c5fdd41e4a82..4d1dd31ff23c 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -65,6 +65,7 @@ #include #include +#include #ifndef _BASIC_SBUNO_HXX #include @@ -188,7 +189,7 @@ TYPEINIT1(SfxObjectShell, SfxShell); //-------------------------------------------------------------------- SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) -:mpObjectContainer(0) + :mpObjectContainer(0) ,pBasicManager( new SfxBasicManagerHolder ) ,rDocShell( _rDocShell ) ,aMacroMode( *this ) @@ -208,7 +209,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bImportDone ( sal_False) ,bInPrepareClose( sal_False ) ,bPreparedForClose( sal_False ) - ,bWaitingForPicklist( sal_False ) + ,bWaitingForPicklist( sal_True ) ,bForbidReload( sal_False ) ,bBasicInitialized( sal_False ) ,bIsPrintJobCancelable( sal_True ) @@ -220,6 +221,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bPreserveVersions( sal_True ) ,m_bMacroSignBroken( sal_False ) ,m_bNoBasicCapabilities( sal_False ) + ,m_bDocRecoverySupport( sal_True ) ,bQueryLoadTemplate( sal_True ) ,bLoadReadonly( sal_False ) ,bUseUserData( sal_True ) @@ -230,7 +232,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,nEventId ( 0) ,pReloadTimer ( 0) ,pMarkData( 0 ) - ,nLoadedFlags ( SFX_LOADED_MAINDOCUMENT ) + ,nLoadedFlags ( SFX_LOADED_ALL ) ,nFlagsInProgress( 0 ) ,bModalMode( sal_False ) ,bRunningMacro( sal_False ) @@ -249,6 +251,10 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) { + SfxObjectShell* pDoc = &_rDocShell; + SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); + rArr.C40_INSERT( SfxObjectShell, pDoc, rArr.Count() ); + bInList = sal_True; } //-------------------------------------------------------------------- @@ -258,6 +264,28 @@ SfxObjectShell_Impl::~SfxObjectShell_Impl() delete pBasicManager; } +//-------------------------------------------------------------------- + +SfxObjectShell::SfxObjectShell( const sal_uInt64 i_nCreationFlags ) + : pImp( new SfxObjectShell_Impl( *this ) ) + , pMedium(0) + , pStyleSheetPool(0) + , eCreateMode( ( i_nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD ) + , bHasName( sal_False ) +{ + DBG_CTOR(SfxObjectShell, 0); + + const bool bScriptSupport = ( i_nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; + if ( !bScriptSupport ) + SetHasNoBasic(); + + const bool bDocRecovery = ( i_nCreationFlags & SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) == 0; + if ( !bDocRecovery ) + pImp->m_bDocRecoverySupport = sal_False; +} + +//-------------------------------------------------------------------- + // initializes a document from a file-description SfxObjectShell::SfxObjectShell @@ -291,23 +319,10 @@ SfxObjectShell::SfxObjectShell : pImp( new SfxObjectShell_Impl( *this ) ), pMedium(0), pStyleSheetPool(0), - eCreateMode(eMode) + eCreateMode(eMode), + bHasName( sal_False ) { DBG_CTOR(SfxObjectShell, 0); - - bHasName = sal_False; - - pImp->bWaitingForPicklist = sal_True; - - // Aggregation InPlaceObject+Automation -//(mba) AddInterface( SvDispatch::ClassFactory() ); - - SfxObjectShell *pThis = this; - SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); - rArr.C40_INSERT( SfxObjectShell, pThis, rArr.Count() ); - pImp->bInList = sal_True; - pImp->nLoadedFlags = SFX_LOADED_ALL; -//REMOVE SetObjectShell( TRUE ); } //-------------------------------------------------------------------- diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 7c420779409c..9e3a306cc3ad 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -151,6 +151,9 @@ using ::com::sun::star::frame::XController2; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::io::IOException; using ::com::sun::star::lang::WrappedTargetException; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::document::XDocumentRecovery; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. @@ -537,6 +540,7 @@ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell ) : BaseMutex() , m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) ) , m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->Get_Impl() ? !pObjectShell->Get_Impl()->m_bNoBasicCapabilities : false ) +, m_bSupportDocRecovery( pObjectShell && pObjectShell->Get_Impl() ? pObjectShell->Get_Impl()->m_bDocRecoverySupport : false ) { DBG_CTOR(sfx2_SfxBaseModel,NULL); if ( pObjectShell != NULL ) @@ -560,7 +564,9 @@ SfxBaseModel::~SfxBaseModel() uno::Any SAL_CALL SfxBaseModel::queryInterface( const UNOTYPE& rType ) throw( uno::RuntimeException ) { - if ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + if ( ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + || ( !m_bSupportDocRecovery && rType.equals( XDocumentRecovery::static_type() ) ) + ) return Any(); return SfxBaseModel_Base::queryInterface( rType ); @@ -596,21 +602,31 @@ void SAL_CALL SfxBaseModel::release() throw( ) // XTypeProvider //________________________________________________________________________________________________________ -uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +namespace { - uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); - if ( !m_bSupportEmbeddedScripts ) + void lcl_stripType( Sequence< Type >& io_rTypes, const Type& i_rTypeToStrip ) { - // remove XEmbeddedScripts type from the sequence - Sequence< UNOTYPE > aStrippedTypes( aTypes.getLength() - 1 ); + Sequence< UNOTYPE > aStrippedTypes( io_rTypes.getLength() - 1 ); ::std::remove_copy_if( - aTypes.getConstArray(), - aTypes.getConstArray() + aTypes.getLength(), + io_rTypes.getConstArray(), + io_rTypes.getConstArray() + io_rTypes.getLength(), aStrippedTypes.getArray(), - ::std::bind2nd( ::std::equal_to< UNOTYPE >(), XEMBEDDEDSCRIPTS::static_type() ) + ::std::bind2nd( ::std::equal_to< Type >(), i_rTypeToStrip ) ); - aTypes = aStrippedTypes; + io_rTypes = aStrippedTypes; } +} + +uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +{ + uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); + + if ( !m_bSupportEmbeddedScripts ) + lcl_stripType( aTypes, XEMBEDDEDSCRIPTS::static_type() ); + + if ( !m_bSupportDocRecovery ) + lcl_stripType( aTypes, XDocumentRecovery::static_type() ); + return aTypes; } @@ -1709,10 +1725,7 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // do not use the SfxModelGuard, it would throw, since we're not yet initialized - if ( IsDisposed() ) - throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( IsInitialized() ) throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index e35bc41000c9..40b9ffceca2d 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -152,7 +152,8 @@ namespace sfx2 static bool isSpecialArgumentName( const ::rtl::OUString& _rValueName ) { return _rValueName.equalsAscii( "EmbeddedObject" ) - || _rValueName.equalsAscii( "EmbeddedScriptSupport" ); + || _rValueName.equalsAscii( "EmbeddedScriptSupport" ) + || _rValueName.equalsAscii( "DocumentRecoverySupport" ); } bool operator()( const Any& _rArgument ) const @@ -174,15 +175,17 @@ namespace sfx2 ::comphelper::NamedValueCollection aArgs( _rArguments ); const sal_Bool bEmbeddedObject = aArgs.getOrDefault( "EmbeddedObject", sal_False ); const sal_Bool bScriptSupport = aArgs.getOrDefault( "EmbeddedScriptSupport", sal_True ); + const sal_Bool bDocRecoverySupport = aArgs.getOrDefault( "DocumentRecoverySupport", sal_True ); sal_uInt64 nCreationFlags = ( bEmbeddedObject ? SFXMODEL_EMBEDDED_OBJECT : 0 ) - | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ); + | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) + | ( bDocRecoverySupport ? 0 : SFXMODEL_DISABLE_DOCUMENT_RECOVERY ); Reference< XInterface > xInstance( impl_createInstance( nCreationFlags ) ); // to mimic the bahaviour of the default factory's createInstanceWithArguments, we initialize - // the object with the given arguments, stripped by the two special ones + // the object with the given arguments, stripped by the three special ones Sequence< Any > aStrippedArguments( _rArguments.getLength() ); Any* pStrippedArgs = aStrippedArguments.getArray(); Any* pStrippedArgsEnd = ::std::remove_copy_if( diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 5fbfd1f1716b..49c9bca4306c 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -105,6 +105,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bPreserveVersions:1, m_bMacroSignBroken:1, // whether the macro signature was explicitly broken m_bNoBasicCapabilities:1, + m_bDocRecoverySupport:1, bQueryLoadTemplate:1, bLoadReadonly:1, bUseUserData:1, -- cgit v1.2.3 From 6ce5b7bd1b65cb2f48e50088d74db238cbccbb13 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:08:11 +0100 Subject: check for correct type and some refactoring --- .../odbcbase/ODatabaseMetaDataResultSet.cxx | 16 +++++++++---- .../source/drivers/odbcbase/OResultSet.cxx | 28 ++++++++++++---------- .../source/inc/odbc/ODatabaseMetaDataResultSet.hxx | 1 + connectivity/source/inc/odbc/OResultSet.hxx | 1 + 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index 77ecceeaacdf..d084561f9372 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -283,7 +283,7 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co aDate.day = 0; aDate.month = 0; aDate.year = 0; - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,&aDate,sizeof aDate); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate); return Date(aDate.day,aDate.month,aDate.year); } else @@ -434,7 +434,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) columnIndex = mapColumn(columnIndex); ::rtl::OUString aVal; if(columnIndex <= m_nDriverColumnCount) - aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,(SWORD)SQL_C_WCHAR,m_bWasNull,**this,m_nTextEncoding); + aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding); else m_bWasNull = sal_True; @@ -454,7 +454,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) columnIndex = mapColumn(columnIndex); TIME_STRUCT aTime={0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,&aTime,sizeof aTime); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime); else m_bWasNull = sal_True; return Time(0,aTime.second,aTime.minute,aTime.hour); @@ -472,7 +472,7 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) columnIndex = mapColumn(columnIndex); TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); else m_bWasNull = sal_True; return DateTime((sal_uInt16)aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); @@ -1316,5 +1316,11 @@ void ODatabaseMetaDataResultSet::checkColumnCount() } // ----------------------------------------------------------------------------- - +SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex) +{ + ::std::map::iterator aFind = m_aODBCColumnTypes.find(columnIndex); + if ( aFind == m_aODBCColumnTypes.end() ) + aFind = m_aODBCColumnTypes.insert(::std::map::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first; + return aFind->second; +} diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index fb1a08147338..49401aa41f01 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -469,11 +469,9 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro return nRet; } - ::std::map::iterator aFind = m_aODBCColumnTypes.find(columnIndex); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; + const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex); - switch(aFind->second) + switch(nColumnType) { case SQL_WVARCHAR: case SQL_WCHAR: @@ -482,7 +480,7 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro case SQL_CHAR: case SQL_LONGVARCHAR: { - ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,aFind->second,m_bWasNull,**this,m_nTextEncoding); + ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); return Sequence(reinterpret_cast(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } default: @@ -627,10 +625,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept else { checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - ::std::map::iterator aFind = m_aODBCColumnTypes.find(columnIndex); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; - nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,aFind->second,m_bWasNull,**this,m_nTextEncoding); + const SWORD nColumnType = impl_getColumnType_nothrow(columnIndex); + nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nColumnType,m_bWasNull,**this,m_nTextEncoding); } return nRet; } @@ -1505,10 +1501,8 @@ void OResultSet::fillRow(sal_Int32 _nToColumn) case DataType::LONGVARCHAR: case DataType::CLOB: { - ::std::map::iterator aFind = m_aODBCColumnTypes.find(nColumn); - if ( aFind == m_aODBCColumnTypes.end() ) - aFind = m_aODBCColumnTypes.insert(::std::map::value_type(nColumn,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,nColumn))).first; - *pColumn = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,nColumn,aFind->second,m_bWasNull,**this,m_nTextEncoding); + const SWORD nColumnType = impl_getColumnType_nothrow(nColumn); + *pColumn = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,nColumn,nColumnType,m_bWasNull,**this,m_nTextEncoding); } break; case DataType::BIGINT: @@ -1753,4 +1747,12 @@ void OResultSet::fillNeededData(SQLRETURN _nRet) while (nRet == SQL_NEED_DATA); } } +// ----------------------------------------------------------------------------- +SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex) +{ + ::std::map::iterator aFind = m_aODBCColumnTypes.find(columnIndex); + if ( aFind == m_aODBCColumnTypes.end() ) + aFind = m_aODBCColumnTypes.insert(::std::map::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex))).first; + return aFind->second; +} diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 6248417828ba..65c6ad438116 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -100,6 +100,7 @@ namespace connectivity sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); sal_Int32 mapColumn (sal_Int32 column); diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx index 9925457e99f6..fb93ba2db4bc 100644 --- a/connectivity/source/inc/odbc/OResultSet.hxx +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -176,6 +176,7 @@ namespace connectivity sal_Bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); TVoidPtr allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex); SQLRETURN unbind(sal_Bool _bUnbindHandle = sal_True); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; -- cgit v1.2.3 From 4380167e1451a1372dcbfa0e839235a46455dabc Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 7 Jan 2010 09:40:12 +0100 Subject: autorecovery: do not throw in getSomething when we're already disposed - there are some strange clients of this ... --- sfx2/source/doc/sfxbasemodel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9e3a306cc3ad..4c14143a0c0d 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2984,7 +2984,7 @@ void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view:: class SvObject; sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) { - SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( GetObjectShell() ) { SvGlobalName aName( aIdentifier ); -- cgit v1.2.3 From 3a654009a49750e5d515a9146dbab701969b4c08 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 12:25:46 +0100 Subject: dba33e: #i107461# care for case of column name --- connectivity/source/drivers/hsqldb/HTable.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index fa9a579ce8eb..b3bed60874f1 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -214,7 +214,7 @@ void SAL_CALL OHSQLTable::alterColumnByName( const ::rtl::OUString& colName, con // now we should look if the name of the column changed ::rtl::OUString sNewColumnName; descriptor->getPropertyValue(rProp.getNameByIndex(PROPERTY_ID_NAME)) >>= sNewColumnName; - if ( !sNewColumnName.equalsIgnoreAsciiCase(colName) ) + if ( !sNewColumnName.equals(colName) ) { const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); -- cgit v1.2.3 From 2eec0edf163b369aacb2df09c62b11abdec6cd40 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 08:12:03 +0100 Subject: dba33e: #i107315# convert SQL statement to MySQL notation --- connectivity/source/drivers/mysql/YTable.cxx | 4 ++-- connectivity/source/drivers/mysql/YTables.cxx | 19 +++++++++++++++++-- connectivity/source/inc/mysql/YTables.hxx | 5 +++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index 8a951936c23c..347ce027e462 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -284,7 +284,7 @@ void SAL_CALL OMySQLTable::alterColumnByName( const ::rtl::OUString& colName, co const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); sSql += ::dbtools::quoteName(sQuote,colName); sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - sSql += ::dbtools::createStandardColumnPart(descriptor,getConnection(),getTypeCreatePattern()); + sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(descriptor,getConnection(),getTypeCreatePattern())); executeStatement(sSql); } m_pColumns->refresh(); @@ -313,7 +313,7 @@ void OMySQLTable::alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rCo ::comphelper::copyProperties(_xDescriptor,xProp); xProp->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE),makeAny(nNewType)); - sSql += ::dbtools::createStandardColumnPart(xProp,getConnection(),getTypeCreatePattern()); + sSql += OTables::adjustSQL(::dbtools::createStandardColumnPart(xProp,getConnection(),getTypeCreatePattern())); executeStatement(sSql); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index d60deb22df7d..d63271399a2f 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -187,12 +187,27 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) } } // ------------------------------------------------------------------------- +::rtl::OUString OTables::adjustSQL(const ::rtl::OUString& _sSql) +{ + ::rtl::OUString sSQL = _sSql; + static const ::rtl::OUString s_sUNSIGNED(RTL_CONSTASCII_USTRINGPARAM("UNSIGNED")); + sal_Int32 nIndex = sSQL.indexOf(s_sUNSIGNED); + while(nIndex != -1 ) + { + sal_Int32 nParen = sSQL.indexOf(')',nIndex); + sal_Int32 nPos = nIndex + s_sUNSIGNED.getLength(); + ::rtl::OUString sNewUnsigned( sSQL.copy(nPos,nParen - nPos + 1)); + sSQL = sSQL.replaceAt(nIndex,s_sUNSIGNED.getLength()+sNewUnsigned.getLength(),sNewUnsigned + s_sUNSIGNED); + nIndex = sSQL.indexOf(s_sUNSIGNED,nIndex + s_sUNSIGNED.getLength()+sNewUnsigned.getLength()); + } + return sSQL; +} +// ------------------------------------------------------------------------- void OTables::createTable( const Reference< XPropertySet >& descriptor ) { const Reference< XConnection > xConnection = static_cast(m_rParent).getConnection(); static const ::rtl::OUString s_sCreatePattern(RTL_CONSTASCII_USTRINGPARAM("(M,D)")); - const ::rtl::OUString aSql = ::dbtools::createSqlCreateTableStatement(descriptor,xConnection,s_sCreatePattern); - + const ::rtl::OUString aSql = adjustSQL(::dbtools::createSqlCreateTableStatement(descriptor,xConnection,s_sCreatePattern)); Reference< XStatement > xStmt = xConnection->createStatement( ); if ( xStmt.is() ) { diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx index 55768286ada7..d60c919daae0 100644 --- a/connectivity/source/inc/mysql/YTables.hxx +++ b/connectivity/source/inc/mysql/YTables.hxx @@ -74,6 +74,11 @@ namespace connectivity can contain () which have to filled with values */ static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + + /** convert the sql statement to fit MySQL notation + @param _sSql in/out + */ + static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql); }; } } -- cgit v1.2.3 From cf9d195402bf250455e0321c47b9ffa4b2ea5515 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 09:22:40 +0100 Subject: dba33e: #i107472# catch exception --- connectivity/source/drivers/jdbc/JStatement.cxx | 68 ++++++++++++++----------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index f4d798973611..4a817501684a 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -712,38 +712,44 @@ void java_sql_Statement_Base::getFastPropertyValue( ) const { java_sql_Statement_Base* THIS = const_cast(this); - switch(nHandle) + try + { + switch(nHandle) + { + case PROPERTY_ID_QUERYTIMEOUT: + rValue <<= THIS->getQueryTimeOut(); + break; + case PROPERTY_ID_MAXFIELDSIZE: + rValue <<= THIS->getMaxFieldSize(); + break; + case PROPERTY_ID_MAXROWS: + rValue <<= THIS->getMaxRows(); + break; + case PROPERTY_ID_CURSORNAME: + rValue <<= THIS->getCursorName(); + break; + case PROPERTY_ID_RESULTSETCONCURRENCY: + rValue <<= THIS->getResultSetConcurrency(); + break; + case PROPERTY_ID_RESULTSETTYPE: + rValue <<= THIS->getResultSetType(); + break; + case PROPERTY_ID_FETCHDIRECTION: + rValue <<= THIS->getFetchDirection(); + break; + case PROPERTY_ID_FETCHSIZE: + rValue <<= THIS->getFetchSize(); + break; + case PROPERTY_ID_ESCAPEPROCESSING: + rValue <<= (sal_Bool)m_bEscapeProcessing; + break; + case PROPERTY_ID_USEBOOKMARKS: + default: + ; + } + } + catch(const Exception&) { - case PROPERTY_ID_QUERYTIMEOUT: - rValue <<= THIS->getQueryTimeOut(); - break; - case PROPERTY_ID_MAXFIELDSIZE: - rValue <<= THIS->getMaxFieldSize(); - break; - case PROPERTY_ID_MAXROWS: - rValue <<= THIS->getMaxRows(); - break; - case PROPERTY_ID_CURSORNAME: - rValue <<= THIS->getCursorName(); - break; - case PROPERTY_ID_RESULTSETCONCURRENCY: - rValue <<= THIS->getResultSetConcurrency(); - break; - case PROPERTY_ID_RESULTSETTYPE: - rValue <<= THIS->getResultSetType(); - break; - case PROPERTY_ID_FETCHDIRECTION: - rValue <<= THIS->getFetchDirection(); - break; - case PROPERTY_ID_FETCHSIZE: - rValue <<= THIS->getFetchSize(); - break; - case PROPERTY_ID_ESCAPEPROCESSING: - rValue <<= (sal_Bool)m_bEscapeProcessing; - break; - case PROPERTY_ID_USEBOOKMARKS: - default: - ; } } // ------------------------------------------------------------------------- -- cgit v1.2.3 From 75af76e9e1a58039e978aae3aba021f15f204968 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 11 Jan 2010 09:53:12 +0100 Subject: autorecovery: fix post-rebase build problems --- framework/util/makefile.mk | 1 - sfx2/source/view/frame2.cxx | 2 +- sfx2/source/view/viewfrm2.cxx | 2 +- svx/source/form/datanavi.cxx | 2 +- vbahelper/source/vbahelper/vbahelper.cxx | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index 0a07f3cf137d..b0b074da8b7c 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -282,7 +282,6 @@ SHL4OBJS= \ $(SLO)$/langselectionstatusbarcontroller.obj \ $(SLO)$/layoutmanager.obj \ $(SLO)$/loaddispatcher.obj \ - $(SLO)$/loaddispatchlistener.obj \ $(SLO)$/loadenv.obj \ $(SLO)$/menubarfactory.obj \ $(SLO)$/menubarmanager.obj \ diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index a32045fb6595..9e1f3823c2c9 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 686e694ce965..3d6721328d5a 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 7b7223281292..4e5df772d2bb 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1611,7 +1611,7 @@ namespace svxform DBG_ASSERT( pBindings != NULL, "DataNavigatorWindow::LoadModels(): no SfxBindings; can't get frame" ); m_xFrame = Reference( - pBindings->GetDispatcher().GetFrame()->GetFrame()->GetFrameInterface(), + pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index ca3a3b5d729f..df12c5a3f242 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -611,7 +611,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno:: { if ( bPreview ) { - if ( !pViewFrame->GetFrame()->IsInPlace() ) + if ( !pViewFrame->GetFrame().IsInPlace() ) { // #TODO is this necessary ( calc specific ) // SC_MOD()->InputEnterHandler(); -- cgit v1.2.3 From 3ae066f336ed7f61080a11cd916545d6a45f3d10 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:30:34 +0100 Subject: autorecovery: remove SID_VIEW, it is used only once, and mapped to SID_HIDDEN, anyway --- sfx2/inc/sfx2/sfxsids.hrc | 1 - sfx2/source/appl/appdde.cxx | 2 -- sfx2/source/appl/appopen.cxx | 22 ++-------------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 73febd7284aa..1dc5cbd3871d 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -267,7 +267,6 @@ #define SID_EXPLORER_PROPS_END (SID_SFX_START + 1499) #define SID_AUTOLOAD (SID_SFX_START + 1509) -#define SID_VIEW (SID_SFX_START + 1512) #define SID_FILLFRAME (SID_SFX_START + 1516) #define SID_BASEURL (SID_SFX_START + 1518) #define SID_TEMPLATE (SID_SFX_START + 1519) diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index 1e09c900e2cf..5117e27d287d 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -596,14 +596,12 @@ BOOL ImplDdeService::MakeTopic( const String& rNm ) // dann versuche die Datei zu laden: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, TRUE); -// SfxBoolItem aHidden(SID_HIDDEN, TRUE); SfxBoolItem aSilent(SID_SILENT, TRUE); SfxDispatcher* pDispatcher = SFX_APP()->GetDispatcher_Impl(); const SfxPoolItem* pRet = pDispatcher->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, &aName, &aNewView, - /*aHidden,*/ &aSilent, 0L ); if( pRet && pRet->ISA( SfxViewFrameItem ) && diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0c76d382dc5b..b0b63ba7f1af 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1146,21 +1146,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) rReq.RemoveItem( SID_DONELINK ); - // check if caller wants to create a view - BOOL bCreateView = TRUE; - SFX_REQUEST_ARG( rReq, pCreateViewItem, SfxBoolItem, SID_VIEW, FALSE ); - if ( pCreateViewItem ) - { - if ( !pCreateViewItem->GetValue() ) - bCreateView = FALSE; - // this is an "SFX only" parameter - rReq.RemoveItem( SID_VIEW ); - } - - // we can't load without a view - switch to hidden view - if ( !bCreateView ) - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - // check if the view must be hidden BOOL bHidden = FALSE; SFX_REQUEST_ARG(rReq, pHidItem, SfxBoolItem, SID_HIDDEN, FALSE); @@ -1334,12 +1319,9 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SfxObjectShell* pSh = pCntrFrame->GetCurrentDocument(); DBG_ASSERT( pSh, "Controller without ObjectShell ?!" ); - if ( bCreateView ) - rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - else - rReq.SetReturnValue( SfxObjectItem( 0, pSh ) ); + rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - if( ( bHidden || !bCreateView ) ) + if ( bHidden ) pSh->RestoreNoDelete(); } } -- cgit v1.2.3 From da9f8c23e89fd373fa39cb9e5f00674649e31e0d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- framework/inc/services/autorecovery.hxx | 6 -- framework/source/services/autorecovery.cxx | 29 ++++---- sfx2/inc/sfx2/objsh.hxx | 6 +- sfx2/inc/sfx2/sfxbasemodel.hxx | 8 +- sfx2/source/doc/objembed.cxx | 2 +- sfx2/source/doc/objmisc.cxx | 9 +-- sfx2/source/doc/objstor.cxx | 4 +- sfx2/source/doc/objxtor.cxx | 47 ++++++------ sfx2/source/doc/sfxbasemodel.cxx | 114 +++++++++++++++-------------- sfx2/source/inc/objshimp.hxx | 4 +- 10 files changed, 113 insertions(+), 116 deletions(-) diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 9439d960e3cf..86cf09252a34 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -170,12 +170,6 @@ class AutoRecovery : public css::lang::XTypeProvider E_UNKNOWN = 0, /// modified against the original file E_MODIFIED = 1, - /** We differ between the states: "modified in general" and "modified after last AutoSave". - The first state will be interesting in case the crashed document will be restored. Then we have - set the right modify state after loading the document. But the second state let us optimize the - AutoSave itself. see member ListenForModify too ... - */ - E_MODIFIED_SINCE_LAST_AUTOSAVE = 1024, /// an active document can be postponed to be saved later. E_POSTPONED = 2, /// was already handled during one AutoSave/Recovery session. diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index cd3388b575d3..f01925c80e12 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1837,7 +1837,6 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame if (xModifyCheck->isModified()) { aNew.DocumentState |= AutoRecovery::E_MODIFIED; - aNew.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } aCacheLock.lock(LOCK_FOR_CACHE_ADD_REMOVE); @@ -1845,7 +1844,7 @@ void AutoRecovery::implts_registerDocument(const css::uno::Reference< css::frame // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - // create a new cache entry ... this document isnt well known. + // create a new cache entry ... this document isn't known. ++m_nIdPool; aNew.ID = m_nIdPool; LOG_ASSERT(m_nIdPool>=0, "AutoRecovery::implts_registerDocument()\nOverflow of ID pool detected.") @@ -1924,7 +1923,6 @@ void AutoRecovery::implts_markDocumentModifiedAgainstLastBackup(const css::uno:: if (pIt != m_lDocCache.end()) { AutoRecovery::TDocumentInfo& rInfo = *pIt; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; /* Now we know, that this document was modified again and must be saved next time. But we dont need this information for every e.g. key input of the user. @@ -1959,12 +1957,10 @@ void AutoRecovery::implts_updateModifiedState(const css::uno::Reference< css::fr if (bModified) { rInfo.DocumentState |= AutoRecovery::E_MODIFIED; - rInfo.DocumentState |= AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } } @@ -2280,8 +2276,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_saveDocs( sal_Bool bAl // Not modified documents are not saved. // We safe an information about the URL only! - sal_Bool bModified = ((aInfo.DocumentState & AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE ) == AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE); - if (! bModified) + Reference< XDocumentRecovery > xDocRecover( aInfo.Document, UNO_QUERY_THROW ); + if ( !xDocRecover->wasModifiedSinceLastSave() ) { aInfo.DocumentState |= AutoRecovery::E_HANDLED; continue; @@ -2426,8 +2422,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // try to save this document as a new temp file everytimes. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. - Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY); - ENSURE_OR_THROW( xDocRecover.is(), "invalid document" ); + Reference< XDocumentRecovery > xDocRecover(rInfo.Document, css::uno::UNO_QUERY_THROW); // safe the state about "trying to save" // ... we need it for recovery if e.g. a crash occures inside next line! @@ -2440,7 +2435,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { try { - xDocRecover->doEmergencySave( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); + xDocRecover->saveToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); @@ -2484,7 +2479,6 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& rInfo.DocumentState &= ~AutoRecovery::E_TRY_SAVE; rInfo.DocumentState |= AutoRecovery::E_HANDLED; rInfo.DocumentState |= AutoRecovery::E_SUCCEDED; - rInfo.DocumentState &= ~AutoRecovery::E_MODIFIED_SINCE_LAST_AUTOSAVE; } else { @@ -2672,8 +2666,11 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); - sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); - xModify->setModified(bModified); + if ( xModify.is() ) + { + sal_Bool bModified = ((rInfo.DocumentState & AutoRecovery::E_MODIFIED) == AutoRecovery::E_MODIFIED); + xModify->setModified(bModified); + } rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_BACKUP; rInfo.DocumentState &= ~AutoRecovery::E_TRY_LOAD_ORIGINAL; @@ -2686,8 +2683,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa /* Normaly we listen as XModifyListener on a document to know if a document was changed since our last AutoSave. And we deregister us in case we know this state. - But directly after one documentw as recovered ... we must start listening. - Otherwhise the first "modify" dont reach us. Because weself called setModified() + But directly after one document as recovered ... we must start listening. + Otherwhise the first "modify" doesnt reach us. Because we ourself called setModified() on the document via API. And currently we dont listen for any events (not at the GlobalEventBroadcaster nor at any document!). */ @@ -2740,7 +2737,7 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL { // let it recover itself Reference< XDocumentRecovery > xDocRecover( xModel, UNO_QUERY_THROW ); - xDocRecover->recoverDocument( + xDocRecover->recoverFromFile( sURL, lDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString() ), lDescriptor.getAsConstPropertyValueList() diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx index 3a46a92a0560..0272ee6959ab 100644 --- a/sfx2/inc/sfx2/objsh.hxx +++ b/sfx2/inc/sfx2/objsh.hxx @@ -600,12 +600,11 @@ public: virtual SfxFrame* GetSmartSelf( SfxFrame* pSelf, SfxMedium& rMedium ); - void SetModel( SfxBaseModel* pModel ); - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetModel() const; // Nur uebergangsweise fuer die Applikationen !!! void SetBaseModel( SfxBaseModel* pModel ); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetBaseModel() const; // Nur uebergangsweise fuer die Applikationen !!! virtual SEQUENCE< OUSTRING > GetEventNames(); @@ -761,6 +760,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, sal_Bool bTypeMustBeSetAlready ); SAL_DLLPRIVATE void PrepareSecondTryLoad_Impl(); + SAL_DLLPRIVATE void SetInitialized_Impl( const bool i_fromInitNew ); // public-internals SAL_DLLPRIVATE IndexBitSet& GetNoSet_Impl(); diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index ad4a41f8b6b1..6ffcf4df5ca8 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1299,11 +1299,13 @@ public: throw (css::uno::RuntimeException); // css.document.XDocumentRecovery - virtual void SAL_CALL doEmergencySave( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() + throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); - virtual void SAL_CALL recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + virtual void SAL_CALL recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); @@ -1546,6 +1548,8 @@ private: ::sfx::intern::ViewCreationGuard& i_rGuard ) const; + SAL_DLLPRIVATE void NotifyModifyListeners_Impl() const; + //________________________________________________________________________________________________________ // private variables and methods //________________________________________________________________________________________________________ diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index 7b7a1bea1ea0..053cd7e8155e 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -308,7 +308,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const { if ( !pImp->mpObjectContainer ) - pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), pImp->xModel ); + pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), GetModel() ); return *pImp->mpObjectContainer; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 7d440ef77fab..63b4b2ee4c28 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -408,17 +408,11 @@ void SfxObjectShell::ModifyChanged() return; {DBG_CHKTHIS(SfxObjectShell, 0);} - SfxObjectShell *pDoc; - for ( pDoc = SfxObjectShell::GetFirst(); pDoc; - pDoc = SfxObjectShell::GetNext(*pDoc) ) - if( pDoc->IsModified() ) - break; SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) pViewFrame->GetBindings().Invalidate( SID_SAVEDOCS ); - Invalidate( SID_SIGNATURE ); Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... @@ -1439,8 +1433,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) } } - pImp->bInitialized = sal_True; - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + SetInitialized_Impl( false ); // Title is not available until loading has finished Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index b0b7fcda1333..38b42815e3d8 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -476,9 +476,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) impl_addToModelCollection(xModel); } - pImp->bInitialized = sal_True; - SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + SetInitialized_Impl( true ); return sal_True; } diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 66243973e1ad..8ceb42f66260 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -340,7 +340,7 @@ SfxObjectShell::~SfxObjectShell() // Ableitungszweig SfxInternObject ist wegen eines Compiler Bugs nicht // erlaubt SfxObjectShell::Close(); - pImp->xModel = NULL; + pImp->pBaseModel.set( NULL ); DELETEX(pImp->pReloadTimer ); @@ -354,8 +354,7 @@ SfxObjectShell::~SfxObjectShell() if ( pSfxApp->GetDdeService() ) pSfxApp->RemoveDdeTopic( this ); - if ( pImp->xModel.is() ) - pImp->xModel = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > (); + pImp->pBaseModel.set( NULL ); // don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned! if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( sal_False ) == pImp->m_xDocStorage ) @@ -605,7 +604,7 @@ sal_uInt16 SfxObjectShell::PrepareClose { SfxHelp::OpenHelpAgent( &pFirst->GetFrame(), HID_CLOSE_WARNING ); } - const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); + const Reference< XTitle > xTitle( *pImp->pBaseModel.get(), UNO_QUERY_THROW ); const ::rtl::OUString sTitle = xTitle->getTitle (); nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); } @@ -865,33 +864,26 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() //-------------------------------------------------------------------- -void SfxObjectShell::SetModel( SfxBaseModel* pModel ) +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetModel() const { - OSL_ENSURE( !pImp->xModel.is() || pModel == NULL, "Model already set!" ); - pImp->xModel = pModel; - if ( pModel ) - { - pModel->addCloseListener( new SfxModelListener_Impl(this) ); - } -} - -//-------------------------------------------------------------------- - -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& SfxObjectShell::GetModel() const -{ - return pImp->xModel; + return GetBaseModel(); } void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) { - SetModel(pModel); + OSL_ENSURE( !pImp->pBaseModel.is() || pModel == NULL, "Model already set!" ); + pImp->pBaseModel.set( pModel ); + if ( pImp->pBaseModel.is() ) + { + pImp->pBaseModel->addCloseListener( new SfxModelListener_Impl(this) ); + } } //-------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() const { - return pImp->xModel; + return pImp->pBaseModel.get(); } /* -----------------------------10.09.2001 15:56------------------------------ @@ -1072,3 +1064,16 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx return NULL; } +void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) +{ + pImp->bInitialized = sal_True; + if ( i_fromInitNew ) + { + SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + } + else + { + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + } +} diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index db04276a2a28..62d18142ccf6 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -157,8 +157,6 @@ using ::com::sun::star::document::XDocumentRecovery; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. - If several changes are done the "bQuiet" member can be used to - temporarily suppress notifications. */ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XModifyListener > @@ -166,12 +164,9 @@ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< public: SfxObjectShell& m_rShell; - bool bQuiet; - bool bGotModified; SfxDocInfoListener_Impl( SfxObjectShell& i_rDoc ) : m_rShell(i_rDoc) - , bQuiet(false) { }; ~SfxDocInfoListener_Impl(); @@ -188,12 +183,9 @@ void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& ) throw ( uno::RuntimeException ) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - bGotModified = true; // notify changes to the SfxObjectShell - if ( !bQuiet ) { - m_rShell.FlushDocInfo(); - } + m_rShell.FlushDocInfo(); } void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& ) @@ -230,6 +222,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bSaving ; sal_Bool m_bSuicide ; sal_Bool m_bInitialized ; + sal_Bool m_bModifiedSinceLastSave; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; @@ -249,6 +242,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bSaving ( sal_False ) , m_bSuicide ( sal_False ) , m_bInitialized ( sal_False ) + , m_bModifiedSinceLastSave( sal_False ) , m_pStorageModifyListen ( NULL ) , m_xTitleHelper () , m_xNumberedControllers () @@ -1657,25 +1651,39 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& } } -void SAL_CALL SfxBaseModel::doEmergencySave( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +::sal_Bool SAL_CALL SfxBaseModel::wasModifiedSinceLastSave() throw ( RuntimeException ) { - // just delegate this to storeToURL - storeToURL( i_TargetLocation, i_MediaDescriptor ); + SfxModelGuard aGuard( *this ); + return m_pData->m_bModifiedSinceLastSave; } -void SAL_CALL SfxBaseModel::recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +void SAL_CALL SfxBaseModel::saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) { + SfxModelGuard aGuard( *this ); + + // delegate + SfxSaveGuard aSaveGuard( this, m_pData, sal_False ); + impl_store( i_TargetLocation, i_MediaDescriptor, sal_True ); + + // no need for subsequent calls to saveToRecoveryFile, unless we're modified, again + m_pData->m_bModifiedSinceLastSave = sal_False; +} + +void SAL_CALL SfxBaseModel::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + SfxModelGuard aGuard( *this ); + // delegate to our "load" method ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); // our load implementation expects the SalvagedFile to be in the media descriptor OSL_ENSURE( !aMediaDescriptor.has( "SalvagedFile" ) || ( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) == i_SalvagedFile ), - "SfxBaseModel::recoverDocument: inconsistent information!" ); + "SfxBaseModel::recoverFromFile: inconsistent information!" ); aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); // similar for the to-be-loaded file OSL_ENSURE( !aMediaDescriptor.has( "URL" ) || ( aMediaDescriptor.getOrDefault( "URL", ::rtl::OUString() ) == i_SourceLocation ), - "SfxBaseModel::recoverDocument: inconsistent information!" ); + "SfxBaseModel::recoverFromFile: inconsistent information!" ); aMediaDescriptor.put( "URL", i_SourceLocation ); load( aMediaDescriptor.getPropertyValues() ); @@ -2431,7 +2439,9 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( pNamedHint ) { - if ( SFX_EVENT_STORAGECHANGED == pNamedHint->GetEventId() ) + switch ( pNamedHint->GetEventId() ) + { + case SFX_EVENT_STORAGECHANGED: { // for now this event is sent only on creation of a new storage for new document // and in case of reload of medium without document reload @@ -2462,12 +2472,17 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); } - else if ( SFX_EVENT_LOADFINISHED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_LOADFINISHED: { impl_getPrintHelper(); ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); + m_pData->m_bModifiedSinceLastSave = sal_False; } - else if ( SFX_EVENT_SAVEASDOCDONE == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_SAVEASDOCDONE: { m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName(); @@ -2478,9 +2493,20 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , addTitle_Impl( aArgs, aTitle ); attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), aArgs ); } - else if ( SFX_EVENT_DOCCREATED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_DOCCREATED: { impl_getPrintHelper(); + m_pData->m_bModifiedSinceLastSave = sal_False; + } + break; + + case SFX_EVENT_MODIFYCHANGED: + { + m_pData->m_bModifiedSinceLastSave = isModified(); + } + break; } postEvent_Impl( pNamedHint->GetEventName() ); @@ -2514,6 +2540,18 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , // public impl. //________________________________________________________________________________________________________ +void SfxBaseModel::NotifyModifyListeners_Impl() const +{ + ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); + if ( pIC ) + { + lang::EventObject aEvent( (frame::XModel *)this ); + pIC->notifyEach( &util::XModifyListener::modified, aEvent ); + } + + m_pData->m_bModifiedSinceLastSave = sal_True; +} + void SfxBaseModel::changing() { SfxModelGuard aGuard( *this ); @@ -2522,24 +2560,7 @@ void SfxBaseModel::changing() if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } void SfxBaseModel::impl_change() @@ -2548,24 +2569,7 @@ void SfxBaseModel::impl_change() if ( impl_isDisposed() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } //________________________________________________________________________________________________________ diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 4da01d464980..039b9c95bb40 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -130,7 +131,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool bReadOnlyUI; SvRefBaseRef xHeaderAttributes; sal_Bool bHiddenLockedByAPI; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel; + ::rtl::Reference< SfxBaseModel > + pBaseModel; sal_uInt16 nStyleFilter; sal_Bool bDisposing; -- cgit v1.2.3 From 216cc35f855f03c9976cd5663e5bb7a4f64de92a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 13 Jan 2010 15:46:51 +0100 Subject: autorecovery: save open/modified (Writer-based) reports and forms, when doing a session/emergency save Still, the documents are stored only, and not loaded. For storing, there's at least one known issue: The controller is unable to deliver the proper object name for a form which has been newly created, and then saved. In this case, an empty name (from the time where the form was created) will be returned, and used in the save process. --- svx/inc/svx/unomodel.hxx | 12 +++---- svx/source/xml/xmlexport.cxx | 84 +++++++++++++------------------------------- 2 files changed, 30 insertions(+), 66 deletions(-) diff --git a/svx/inc/svx/unomodel.hxx b/svx/inc/svx/unomodel.hxx index 70e27f06ac43..577140e6df7f 100644 --- a/svx/inc/svx/unomodel.hxx +++ b/svx/inc/svx/unomodel.hxx @@ -102,12 +102,12 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SAL_CALL createAnyCompareByName( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); }; -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, com::sun::star::uno::Reference xOut, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pExportService ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent ); -SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, com::sun::star::uno::Reference xInputStream, com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComponent, const char* pImportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const com::sun::star::uno::Reference& xOut, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pExportService ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent ); +SVX_DLLPUBLIC extern sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const com::sun::star::uno::Reference& xInputStream, const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xComponent, const char* pImportService ); #endif diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index aea2e3cb058f..5d2173871d78 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include +#include #include #include #include @@ -55,12 +56,12 @@ using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerExport( pModel, xOut, xComponent, "com.sun.star.comp.DrawingLayer.XMLExporter" ); } -sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut, Reference< lang::XComponent > xComponent, const char* pExportService ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut, const Reference< lang::XComponent >& xComponent, const char* pExportService ) { sal_Bool bDocRet = xOut.is(); @@ -70,12 +71,13 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; + Reference< lang::XComponent > xSourceDoc( xComponent ); try { - if( !xComponent.is() ) + if( !xSourceDoc.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xSourceDoc = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) ); } uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); @@ -130,7 +132,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xExporter( xFilter, uno::UNO_QUERY ); if( xExporter.is() ) { - xExporter->setSourceDocument( xComponent ); + xExporter->setSourceDocument( xSourceDoc ); uno::Sequence< beans::PropertyValue > aDescriptor( 0 ); bDocRet = xFilter->filter( aDescriptor ); @@ -141,11 +143,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference 1 - ByteString aError( "uno Exception caught while exporting:\n" ); - aError += ByteString( String( e.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#endif + DBG_UNHANDLED_EXCEPTION(); bDocRet = sal_False; } @@ -160,7 +158,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xOut ) +sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference& xOut ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerExport( pModel, xOut, xComponent ); @@ -168,12 +166,12 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, uno::Reference xInputStream, Reference< lang::XComponent > xComponent ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream, const Reference< lang::XComponent >& xComponent ) { return SvxDrawingLayerImport( pModel, xInputStream, xComponent, "com.sun.star.comp.Draw.XMLOasisImporter" ); } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xInputStream, Reference< lang::XComponent > xComponent, const char* pImportService ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService ) { sal_uInt32 nRet = 0; @@ -183,13 +181,14 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xObjectResolver; SvXMLEmbeddedObjectHelper *pObjectHelper = 0; - if( !xComponent.is() ) + Reference< lang::XComponent > xTargetDocument( xComponent ); + if( !xTargetDocument.is() ) { - xComponent = new SvxUnoDrawingModel( pModel ); - pModel->setUnoModel( Reference< XInterface >::query( xComponent ) ); + xTargetDocument = new SvxUnoDrawingModel( pModel ); + pModel->setUnoModel( Reference< XInterface >::query( xTargetDocument ) ); } - Reference< frame::XModel > xModel( xComponent, UNO_QUERY ); + Reference< frame::XModel > xTargetModel( xTargetDocument, UNO_QUERY ); try { @@ -202,7 +201,8 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::ReferencelockControllers(); + if ( xTargetModel.is() ) + xTargetModel->lockControllers(); // ------------------------------------- @@ -251,7 +251,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xComponent ); + xImporter->setTargetDocument( xTargetDocument ); // finally, parser the stream xParser->parseStream( aParserInput ); @@ -260,45 +260,9 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference 1 - ByteString aError( "SAX parse exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( xml::sax::SAXException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "SAX exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } - catch( io::IOException& r ) - { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "IO exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif - } catch( uno::Exception& r ) { -#if OSL_DEBUG_LEVEL > 1 - ByteString aError( "uno exception catched while importing:\n" ); - aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US ); - DBG_ERROR( aError.GetBuffer() ); -#else - (void) r; // avoid warnings -#endif + DBG_UNHANDLED_EXCEPTION(); } if( pGraphicHelper ) @@ -309,13 +273,13 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::ReferenceunlockControllers(); + if ( xTargetModel.is() ) + xTargetModel->unlockControllers(); return nRet == 0; } -sal_Bool SvxDrawingLayerImport( SdrModel* pModel, uno::Reference xInputStream ) +sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference& xInputStream ) { Reference< lang::XComponent > xComponent; return SvxDrawingLayerImport( pModel, xInputStream, xComponent ); -- cgit v1.2.3 From 04815f28a3eb94a6dc6b4e715ccee208e6fb506d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Jan 2010 15:53:07 +0100 Subject: vcl109: #i108290# KDE4 integration updates from shtylman --- fpicker/source/unx/kde4/KDE4FilePicker.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx index ae3f9ebf86ad..f14c219cb703 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -166,8 +166,6 @@ KDE4FilePicker::KDE4FilePicker( const uno::Reference //default mode _dialog->setOperationMode(KFileDialog::Opening); - - _dialog->setStyleSheet("color: black;"); } KDE4FilePicker::~KDE4FilePicker() @@ -212,6 +210,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute() _dialog->clearFilter(); _dialog->setFilter(_filter); + _dialog->filterWidget()->setEditable(false); //block and wait for user input if (_dialog->exec() == KFileDialog::Accepted) @@ -263,7 +262,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() QCheckBox *cb = dynamic_cast ( _customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]); - if (cb->isChecked()) + if (cb && cb->isChecked()) { extension = _dialog->currentFilter(); // assuming filter value is like this *.ext extension.replace("*",""); @@ -658,13 +657,13 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence &args ) case FILESAVE_AUTOEXTENSION: operationMode = KFileDialog::Saving; - addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); break; case FILESAVE_AUTOEXTENSION_PASSWORD: { operationMode = KFileDialog::Saving; - addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); + //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); break; } @@ -715,6 +714,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence &args ) } _dialog->setOperationMode(operationMode); + _dialog->setConfirmOverwrite(true); } void SAL_CALL KDE4FilePicker::cancel() -- cgit v1.2.3 From 9a6d9dd534a1783d522a00f6e5890c977ab2ac91 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 13 Jan 2010 15:58:25 +0100 Subject: sw33bf02: #b6912256# method - handle unexpected list level value --- xmloff/source/text/XMLTextNumRuleInfo.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xmloff/source/text/XMLTextNumRuleInfo.cxx b/xmloff/source/text/XMLTextNumRuleInfo.cxx index 30895a5edce6..36f882838ce6 100644 --- a/xmloff/source/text/XMLTextNumRuleInfo.cxx +++ b/xmloff/source/text/XMLTextNumRuleInfo.cxx @@ -123,6 +123,15 @@ void XMLTextNumRuleInfo::Set( } // <-- + // --> OD 2010-01-13 #b6912256# + if ( mnListLevel < 0 ) + { + DBG_ASSERT( false, + " - unexpected numbering level" ); + Reset(); + return; + } + // --> OD 2006-09-27 #i69627# bool bSuppressListStyle( false ); if ( mxNumRules.is() ) -- cgit v1.2.3 From a8195ceb6cb0a5526377d67da12ca0ce125b7b3b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 14 Jan 2010 19:16:10 +0100 Subject: sw33bf02: #i107372#: handle year/month in editing duration SfxDocumentMetaData: approximate conversion of year/month to seconds. SfxObjectShell::UpdateTime_Impl(): handle larger edit duration values. --- sfx2/source/doc/SfxDocumentMetaData.cxx | 4 +++- sfx2/source/doc/objcont.cxx | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 476d6f5186a5..18f32d5c4dc6 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -588,7 +588,9 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () { css::util::Duration d; if (textToDuration(d, i_rText)) { - return (d.Days * (24*3600)) + // #i107372#: approximate years/months + const sal_Int32 days( (d.Years * 365) + (d.Months * 30) + d.Days ); + return (days * (24*3600)) + (d.Hours * 3600) + (d.Minutes * 60) + d.Seconds; } else { return 0; // default diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 6883f0976566..2db19205cfa4 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -481,13 +481,24 @@ void SfxObjectShell::UpdateDocInfoForSave() //-------------------------------------------------------------------- +static void +lcl_add(util::Duration & rDur, Time const& rTime) +{ + // here we don't care about overflow: rDur is converted back to seconds + // anyway, and Time cannot store more than ~4000 hours + rDur.Hours += rTime.GetHour(); + rDur.Minutes += rTime.GetMin(); + rDur.Seconds += rTime.GetSec(); +} + // Bearbeitungszeit aktualisieren void SfxObjectShell::UpdateTime_Impl( const uno::Reference & i_xDocProps) { // Get old time from documentinfo - sal_Int32 secs = i_xDocProps->getEditingDuration(); - Time aOldTime(secs/3600, (secs%3600)/60, secs%60); + const sal_Int32 secs = i_xDocProps->getEditingDuration(); + util::Duration editDuration(sal_False, 0, 0, 0, + secs/3600, (secs%3600)/60, secs%60, 0); // Initialize some local member! Its neccessary for wollow operations! DateTime aNow ; // Date and time at current moment @@ -524,13 +535,14 @@ void SfxObjectShell::UpdateTime_Impl( nAddTime += aNow ; } - aOldTime += nAddTime; + lcl_add(editDuration, nAddTime); } pImp->nTime = aNow; try { - i_xDocProps->setEditingDuration( - aOldTime.GetHour()*3600+aOldTime.GetMin()*60+aOldTime.GetSec()); + const sal_Int32 newSecs( (editDuration.Hours*3600) + + (editDuration.Minutes*60) + editDuration.Seconds); + i_xDocProps->setEditingDuration(newSecs); i_xDocProps->setEditingCycles(i_xDocProps->getEditingCycles() + 1); } catch (lang::IllegalArgumentException &) -- cgit v1.2.3 From d0e9f1f751ecd16597d6a06276a40dfb4ae00fb8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 15 Jan 2010 15:21:15 +0100 Subject: autorecovery: save/recover forms and reports Still some lose ends. Most notably, the current code contains cases for other sub component types, but has no real implementation - attempting to save/recover those other types will yield multiple assertions only. Also, recovery of SRB-reports has not been tested, yet, chances are good there's some work ahead here. Other known open issues: - recovering sub components immediately shows them, instead of initially hiding them, and showing only when the main document window is shown - the implementation currently is no real session save, which would require saving information about *unmodified* open sub components (though not their actual content), and restoring them upon recovery. - doing an implicit "connect" at the controller of the to-be-recovered database document is a requirement to actually load the sub components, but might yield problems in case this requires interaction (e.g. a login). Need to investigate - the "recovery" storage is not removed from the database document storage after un/successful recovery - cancelling the recovery of a "modified" database document always suggests to store this doc somewhere --- embeddedobj/source/commonembedding/embedobj.cxx | 2 +- embeddedobj/source/commonembedding/miscobj.cxx | 3 +- embeddedobj/source/commonembedding/persistence.cxx | 44 +++++++++++++++------- embeddedobj/source/inc/commonembobj.hxx | 9 ++++- 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 85f9b8b0b2c9..1884b1b84a9e 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -192,7 +192,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) if ( !m_xObjectStorage.is() ) throw io::IOException(); //TODO: access denied - m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl( m_xObjectStorage ), m_bReadOnly ); + m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly ); } else { diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index db515570fe98..f666cfc4912a 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -646,7 +646,8 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership ) } catch ( uno::Exception& ) {} } - m_xObjectStorage = uno::Reference< embed::XStorage >(); + m_xObjectStorage.clear(); + m_xObjectLoadStorage.clear(); } m_bClosed = sal_True; // the closing succeeded diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 9af3cf91c359..a2c3d2bcef64 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -272,7 +272,7 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X { uno::Reference< document::XStorageBasedDocument > xDoc( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); if ( xDoc.is() ) - xDoc->switchToStorage( m_xObjectStorage ); + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); } #endif @@ -452,10 +452,9 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } //------------------------------------------------------ -uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl( - const uno::Reference< embed::XStorage >& xStorage ) +uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() { - OSL_ENSURE( xStorage.is(), "The storage can not be empty!" ); + OSL_ENSURE( m_xObjectStorage.is(), "The storage can not be empty!" ); uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); @@ -478,7 +477,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag if ( !xDoc.is() && !xLoadable.is() ) ///BUG: This should be || instead of && ? throw uno::RuntimeException(); - ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( xStorage ) ); + ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( m_xObjectStorage ) ); OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" ); if ( !aFilterName.getLength() ) @@ -499,7 +498,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag uno::Reference< io::XInputStream > xTempInpStream; if ( !xDoc.is() ) { - xTempInpStream = createTempInpStreamFromStor( xStorage, m_xFactory ); + xTempInpStream = createTempInpStreamFromStor( m_xObjectStorage, m_xFactory ); if ( !xTempInpStream.is() ) throw uno::RuntimeException(); @@ -550,7 +549,15 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag } if ( xDoc.is() ) - xDoc->loadFromStorage( xStorage, aArgs ); + { + if ( m_xObjectLoadStorage.is() ) + { + xDoc->loadFromStorage( m_xObjectLoadStorage, aArgs ); + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); + } + else + xDoc->loadFromStorage( m_xObjectStorage, aArgs ); + } else xLoadable->load( aArgs ); } @@ -725,6 +732,18 @@ void OCommonEmbeddedObject::SaveObject_Impl() } +//------------------------------------------------------ +void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< document::XStorageBasedDocument >& xDoc, const uno::Reference< embed::XStorage >& xStorage ) +{ + xDoc->switchToStorage( xStorage ); + uno::Reference< util::XModifiable > xModif( xDoc, uno::UNO_QUERY ); + if ( xModif.is() ) + xModif->setModified( sal_False ); + + if ( m_xObjectLoadStorage.is() ) + m_xObjectLoadStorage.clear(); +} + //------------------------------------------------------ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Int32 nStorageFormat, @@ -763,12 +782,7 @@ void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed: xDoc->storeToStorage( xStorage, aArgs ); if ( bAttachToTheStorage ) - { - xDoc->switchToStorage( xStorage ); - uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); - if ( xModif.is() ) - xModif->setModified( sal_False ); - } + SwitchDocToStorage_Impl( xDoc, xStorage ); } else #endif @@ -1063,6 +1077,10 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( { OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport ); } + else if ( lObjArgs[nObjInd].Name.equalsAscii( "RecoverFromStorage" ) ) + { + OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xObjectLoadStorage ); + } sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE; diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 68c00500ff58..69cdb3d4c7a3 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -150,6 +151,7 @@ protected: ::rtl::OUString m_aEntryName; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectStorage; + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectLoadStorage; // link related stuff ::rtl::OUString m_aLinkURL; @@ -200,8 +202,7 @@ private: ::com::sun::star::uno::Sequence< sal_Int32 > GetIntermediateStatesSequence_Impl( sal_Int32 nNewState ); ::rtl::OUString GetFilterName( sal_Int32 nVersion ); - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl(); ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadLink_Impl(); @@ -213,6 +214,10 @@ private: const ::rtl::OUString& aHierarchName, sal_Bool bAttachToStorage ); + void SwitchDocToStorage_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateDocFromMediaDescr_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr ); -- cgit v1.2.3 From 2a609ffe951abc0af3b70467f5475b5ee1bb381a Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Jan 2010 16:48:52 +0100 Subject: sw33bf02: #i108347#: change util::Duration to support MilliSeconds: SfxDocumentMetaData: adapt. dinfdlg.src: adapt dialog to milliseconds. sax::Converter: adapt. sax::Converter::convertDuration(): fix a bug in parsing fractional seconds. --- sfx2/qa/complex/DocumentMetaData.java | 10 +++++++--- sfx2/source/dialog/dinfdlg.cxx | 17 +++++++++-------- sfx2/source/dialog/dinfdlg.hrc | 4 ++-- sfx2/source/dialog/dinfdlg.src | 8 ++++---- sfx2/source/doc/SfxDocumentMetaData.cxx | 4 ++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/sfx2/qa/complex/DocumentMetaData.java b/sfx2/qa/complex/DocumentMetaData.java index 54b0f7afd3be..06770bbde053 100644 --- a/sfx2/qa/complex/DocumentMetaData.java +++ b/sfx2/qa/complex/DocumentMetaData.java @@ -370,7 +370,7 @@ public class DocumentMetaData extends ComplexTestCase dur.Hours = 777; dur.Minutes = 666; dur.Seconds = 555; - dur.HundredthSeconds = 444; + dur.MilliSeconds = 444; udpc.addProperty("Frobnicate", PropertyAttribute.REMOVEABLE, new Boolean(b)); @@ -447,7 +447,11 @@ public class DocumentMetaData extends ComplexTestCase udps.getPropertyValue("Frobnicate"))); assure ("UserDefined duration", eqDuration(dur, (Duration) udps.getPropertyValue("FrobDuration"))); - assure ("UserDefined time", eqTime(t, (Time) + // this is now a Duration! + Duration t_dur = new Duration(false, (short)0, (short)0, (short)0, + t.Hours, t.Minutes, t.Seconds, + (short)(10 * t.HundredthSeconds)); + assure ("UserDefined time", eqDuration(t_dur, (Duration) udps.getPropertyValue("FrobDuration2"))); assure ("UserDefined date", eqDate(date, (Date) udps.getPropertyValue("FrobEndDate"))); @@ -514,7 +518,7 @@ public class DocumentMetaData extends ComplexTestCase return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days && a.Hours == b.Hours && a.Minutes == b.Minutes && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds + && a.MilliSeconds == b.MilliSeconds && a.Negative == b.Negative; } diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index fe03231c6db7..c0f09c30e5f4 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1603,8 +1603,8 @@ class DurationDialog_Impl : public ModalDialog NumericField aMinuteNF; FixedText aSecondFT; NumericField aSecondNF; - FixedText aHSecondFT; - NumericField aHSecondNF; + FixedText aMSecondFT; + NumericField aMSecondNF; public: @@ -1616,8 +1616,9 @@ public: /*-- 20.11.2009 15:40:46--------------------------------------------------- -----------------------------------------------------------------------*/ -DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& rDuration ) : - ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), +DurationDialog_Impl::DurationDialog_Impl( + Window* pParent, const util::Duration& rDuration) + : ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), aDurationFL(this, SfxResId( FL_DURATION )), aOKPB( this, SfxResId( PB_OK )), aCancelPB( this, SfxResId( PB_CANCEL )), @@ -1635,8 +1636,8 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aMinuteNF( this, SfxResId( ED_MINUTE )), aSecondFT( this, SfxResId( FT_SECOND )), aSecondNF( this, SfxResId( ED_SECOND )), - aHSecondFT( this, SfxResId( FT_HSECOND )), - aHSecondNF( this, SfxResId( ED_HSECOND )) + aMSecondFT( this, SfxResId( FT_MSECOND )), + aMSecondNF( this, SfxResId( ED_MSECOND )) { FreeResource(); aNegativeCB.Check(rDuration.Negative); @@ -1646,7 +1647,7 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aHourNF.SetValue(rDuration.Hours ); aMinuteNF.SetValue(rDuration.Minutes); aSecondNF.SetValue(rDuration.Seconds); - aHSecondNF.SetValue(rDuration.HundredthSeconds); + aMSecondNF.SetValue(rDuration.MilliSeconds); } /*-- 20.11.2009 16:08:55--------------------------------------------------- @@ -1667,7 +1668,7 @@ util::Duration DurationDialog_Impl::GetDuration() const aRet.Hours = aHourNF.GetValue( ); aRet.Minutes = aMinuteNF.GetValue(); aRet.Seconds = aSecondNF.GetValue(); - aRet.HundredthSeconds = aHSecondNF.GetValue(); + aRet.MilliSeconds = aMSecondNF.GetValue(); return aRet; } diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc index 49647c40e3ee..2287c7465a60 100644 --- a/sfx2/source/dialog/dinfdlg.hrc +++ b/sfx2/source/dialog/dinfdlg.hrc @@ -172,8 +172,8 @@ #define ED_MINUTE 113 #define FT_SECOND 114 #define ED_SECOND 115 -#define FT_HSECOND 116 -#define ED_HSECOND 117 +#define FT_MSECOND 116 +#define ED_MSECOND 117 #define FL_DURATION 118 #endif diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index 3cad63ecb565..54d2674b977c 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -880,14 +880,14 @@ ModalDialog RID_EDIT_DURATIONS SpinSize = 1 ; Value = 0 ; }; - FixedText FT_HSECOND + FixedText FT_MSECOND { Pos = MAP_APPFONT ( 6 , 122 ) ; Size = MAP_APPFONT ( 60 , RSC_CD_FIXEDTEXT_HEIGHT ) ; Left = TRUE ; - Text [ en-US ] = "1/100 se~conds" ; + Text [ en-US ] = "Millise~conds" ; }; - NumericField ED_HSECOND + NumericField ED_MSECOND { Border = TRUE ; Pos = MAP_APPFONT ( 70 , 120 ) ; @@ -896,7 +896,7 @@ ModalDialog RID_EDIT_DURATIONS Spin = TRUE ; Minimum = 0 ; First = 1 ; - Last = 100 ; + Last = 1000 ; SpinSize = 1 ; Value = 0 ; }; diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 18f32d5c4dc6..49e96a8c252b 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -613,7 +613,7 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () ud.Hours = static_cast((i_value % (24 * 3600)) / 3600); ud.Minutes = static_cast((i_value % 3600) / 60); ud.Seconds = static_cast(i_value % 60); - ud.HundredthSeconds = 0; + ud.MilliSeconds = 0; return durationToText(ud); } @@ -953,7 +953,7 @@ propsToStrings(css::uno::Reference const & i_xPropSet) ud.Hours = ut.Hours; ud.Minutes = ut.Minutes; ud.Seconds = ut.Seconds; - ud.HundredthSeconds = ut.HundredthSeconds; + ud.MilliSeconds = 10 * ut.HundredthSeconds; values.push_back(durationToText(ud)); as.push_back(std::make_pair(vt, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time")))); -- cgit v1.2.3 From 8de5af2bcde263f7bf80b8c60cf0b0970b4f12c4 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Jan 2010 17:39:27 +0100 Subject: sw33bf02: #i107502#: more workarounds for OOo 2.x broken user-defined props --- sfx2/source/doc/SfxDocumentMetaData.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 49e96a8c252b..2b66a765201b 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -930,8 +930,13 @@ propsToStrings(css::uno::Reference const & i_xPropSet) values.push_back(s); // #i90847# OOo 2.x does stupid things if value-type="string"; // fortunately string is default anyway, so we can just omit it -// as.push_back(std::make_pair(vt, -// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); +// #i107502#: however, OOo 2.x only reads 4 user-defined without @value-type +// => best backward compatibility: first 4 without @value-type, rest with + if (4 <= i) + { + as.push_back(std::make_pair(vt, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); + } } else if (type == ::cppu::UnoType::get()) { css::util::DateTime dt; any >>= dt; -- cgit v1.2.3 From 6112d0d7b1bb831cc8003ce23e892bdcb08d1887 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 15:58:17 +0100 Subject: recoverFromFile is allowed (required, strictly) in the initialization phase --- sfx2/source/doc/sfxbasemodel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 62d18142ccf6..19af0866a1fc 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1671,7 +1671,7 @@ void SAL_CALL SfxBaseModel::saveToRecoveryFile( const ::rtl::OUString& i_TargetL void SAL_CALL SfxBaseModel::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) { - SfxModelGuard aGuard( *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); // delegate to our "load" method ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); -- cgit v1.2.3 From d69335c9383d953d27f56d8dbde3c0982faa70ca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 22:22:41 +0100 Subject: autorecovery: preserve the complete exception when throwing the LoadEnvException, not only the css.uno.Exception base info --- framework/source/inc/loadenv/loadenvexception.hxx | 8 ++++---- framework/source/loadenv/loadenv.cxx | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/framework/source/inc/loadenv/loadenvexception.hxx b/framework/source/inc/loadenv/loadenvexception.hxx index 18e200a1c3c5..f8f9d4230b43 100644 --- a/framework/source/inc/loadenv/loadenvexception.hxx +++ b/framework/source/inc/loadenv/loadenvexception.hxx @@ -175,11 +175,11 @@ class LoadEnvException @param exUno the original catched uno exception. */ - LoadEnvException( sal_Int32 nID , - const css::uno::Exception& exUno) + LoadEnvException( sal_Int32 nID , + const css::uno::Any& exUno) { - m_nID = nID ; - m_exOriginal <<= exUno; + m_nID = nID ; + m_exOriginal = exUno; } //_______________________________________ diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 2cf0ef38918f..e7910f417a3c 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1725,9 +1725,8 @@ void LoadEnv::impl_reactForLoadingState() if (bThrow) { - css::uno::Exception aEx; - if ( aRequest >>= aEx ) - throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aEx ); + if ( aRequest.isExtractableTo( ::cppu::UnoType< css::uno::Exception >::get() ) ) + throw LoadEnvException( LoadEnvException::ID_GENERAL_ERROR, aRequest ); } // <- SAFE ---------------------------------- -- cgit v1.2.3 From c0899590afa6bda70e18ac68a831bd6210bac45a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 22:46:39 +0100 Subject: autorecovery: since the AR service does not use the LoadEnv anymore, it needs to care for some media descriptor defaults (like for MacroExecutionMode) itself --- framework/source/inc/loadenv/loadenv.hxx | 9 +++++ framework/source/loadenv/loadenv.cxx | 60 ++++++++++++++++++++---------- framework/source/services/autorecovery.cxx | 5 ++- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/framework/source/inc/loadenv/loadenv.hxx b/framework/source/inc/loadenv/loadenv.hxx index c1b23f0394eb..9c513d34045f 100644 --- a/framework/source/inc/loadenv/loadenv.hxx +++ b/framework/source/inc/loadenv/loadenv.hxx @@ -420,6 +420,7 @@ class LoadEnv : private ThreadHelpBase virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) throw(css::uno::RuntimeException); */ + //___________________________________________ // static interface @@ -457,6 +458,14 @@ class LoadEnv : private ThreadHelpBase static EContentType classifyContent(const ::rtl::OUString& sURL , const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor); + /** TODO document me ... */ + static void initializeUIDefaults( + const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, + const bool _bUIMode, + QuietInteraction** o_ppQuiteInteraction + ); + /** TODO document me ... */ void impl_setResult(sal_Bool bResult); diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index e7910f417a3c..fb6d522b69d1 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -324,22 +324,41 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& /*TODO progress is bound to a frame ... How can we set it here? */ + // UI mode + const bool bUIMode = + ( ( m_eFeature & E_WORK_WITH_UI ) == E_WORK_WITH_UI ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False ) == sal_False ) && + ( m_lMediaDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False ) == sal_False ); + + initializeUIDefaults( + m_xSMGR, + m_lMediaDescriptor, + bUIMode, + &m_pQuietInteraction + ); + + aWriteLock.unlock(); + // <- SAFE ---------------------------------- +} + +/*----------------------------------------------- + 22.01.2010 +-----------------------------------------------*/ +void LoadEnv::initializeUIDefaults( const css::uno::Reference< css::lang::XMultiServiceFactory >& i_rSMGR, + ::comphelper::MediaDescriptor& io_lMediaDescriptor, const bool i_bUIMode, + QuietInteraction** o_ppQuietInteraction ) +{ css::uno::Reference< css::task::XInteractionHandler > xInteractionHandler; sal_Int16 nMacroMode ; sal_Int16 nUpdateMode ; - // UI mode - if ( - ((m_eFeature & E_WORK_WITH_UI) == E_WORK_WITH_UI) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_HIDDEN() , sal_False) == sal_False ) && - (m_lMediaDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), sal_False) == sal_False ) - ) + if ( i_bUIMode ) { nMacroMode = css::document::MacroExecMode::USE_CONFIG; nUpdateMode = css::document::UpdateDocMode::ACCORDING_TO_CONFIG; try { - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(m_xSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(i_rSMGR->createInstance(IMPLEMENTATIONNAME_UIINTERACTIONHANDLER), css::uno::UNO_QUERY); } catch(const css::uno::RuntimeException&) {throw;} catch(const css::uno::Exception& ) { } @@ -349,27 +368,28 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& { nMacroMode = css::document::MacroExecMode::NEVER_EXECUTE; nUpdateMode = css::document::UpdateDocMode::NO_UPDATE; - m_pQuietInteraction = new QuietInteraction(); - m_pQuietInteraction->acquire(); - xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(m_pQuietInteraction), css::uno::UNO_QUERY); + QuietInteraction* pQuietInteraction = new QuietInteraction(); + xInteractionHandler = css::uno::Reference< css::task::XInteractionHandler >(static_cast< css::task::XInteractionHandler* >(pQuietInteraction), css::uno::UNO_QUERY); + if ( o_ppQuietInteraction != NULL ) + { + *o_ppQuietInteraction = pQuietInteraction; + (*o_ppQuietInteraction)->acquire(); + } } if ( - (xInteractionHandler.is() ) && - (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == m_lMediaDescriptor.end()) + (xInteractionHandler.is() ) && + (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()) == io_lMediaDescriptor.end()) ) { - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteractionHandler; } - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - - if (m_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == m_lMediaDescriptor.end()) - m_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] <<= nMacroMode; - aWriteLock.unlock(); - // <- SAFE ---------------------------------- + if (io_lMediaDescriptor.find(::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()) == io_lMediaDescriptor.end()) + io_lMediaDescriptor[::comphelper::MediaDescriptor::PROP_UPDATEDOCMODE()] <<= nUpdateMode; } /*----------------------------------------------- diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index f01925c80e12..4ede5c8b8a42 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -32,6 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" #include "services/autorecovery.hxx" +#include //_______________________________________________ // own includes @@ -2622,6 +2623,8 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa else continue; // TODO ERROR! + LoadEnv::initializeUIDefaults( m_xSMGR, lDescriptor, true, NULL ); + // <- SAFE ------------------------------ aWriteLock.unlock(); @@ -2662,7 +2665,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa { ::comphelper::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs()); lPatchDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter; - rInfo.Document->attachResource(sURL, lPatchDescriptor.getAsConstPropertyValueList()); + rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); -- cgit v1.2.3 From 05ca2f4f9fa6195a27f281006125c6191d2c9631 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 25 Jan 2010 09:56:57 +0100 Subject: autorecovery: do not remove SalvagedFile from DBDoc's args if it still carries information --- framework/source/services/autorecovery.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 4ede5c8b8a42..defd5332d079 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2665,7 +2665,7 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa { ::comphelper::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs()); lPatchDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter; - rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); + rInfo.Document->attachResource(sURL, lPatchDescriptor.getAsConstPropertyValueList()); } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); -- cgit v1.2.3 From 6d315e9820439bd8566491da9fcd5fcb28174db7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 13:19:11 +0100 Subject: autorecovery: mav sanctioned the approach of the (now so-called) RecoveryStorage --- embeddedobj/source/commonembedding/miscobj.cxx | 2 +- embeddedobj/source/commonembedding/persistence.cxx | 13 +++++++------ embeddedobj/source/inc/commonembobj.hxx | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index f666cfc4912a..63863e54f2fd 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -647,7 +647,7 @@ void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership ) } m_xObjectStorage.clear(); - m_xObjectLoadStorage.clear(); + m_xRecoveryStorage.clear(); } m_bClosed = sal_True; // the closing succeeded diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index a2c3d2bcef64..e9aa0edd0ec8 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -550,9 +550,9 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag if ( xDoc.is() ) { - if ( m_xObjectLoadStorage.is() ) + if ( m_xRecoveryStorage.is() ) { - xDoc->loadFromStorage( m_xObjectLoadStorage, aArgs ); + xDoc->loadFromStorage( m_xRecoveryStorage, aArgs ); SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); } else @@ -736,12 +736,13 @@ void OCommonEmbeddedObject::SaveObject_Impl() void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< document::XStorageBasedDocument >& xDoc, const uno::Reference< embed::XStorage >& xStorage ) { xDoc->switchToStorage( xStorage ); + uno::Reference< util::XModifiable > xModif( xDoc, uno::UNO_QUERY ); if ( xModif.is() ) xModif->setModified( sal_False ); - if ( m_xObjectLoadStorage.is() ) - m_xObjectLoadStorage.clear(); + if ( m_xRecoveryStorage.is() ) + m_xRecoveryStorage.clear(); } //------------------------------------------------------ @@ -1077,9 +1078,9 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( { OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport ); } - else if ( lObjArgs[nObjInd].Name.equalsAscii( "RecoverFromStorage" ) ) + else if ( lObjArgs[nObjInd].Name.equalsAscii( "RecoveryStorage" ) ) { - OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xObjectLoadStorage ); + OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xRecoveryStorage ); } diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 69cdb3d4c7a3..2ba0e5cd4aca 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -151,7 +151,7 @@ protected: ::rtl::OUString m_aEntryName; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectStorage; - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectLoadStorage; + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xRecoveryStorage; // link related stuff ::rtl::OUString m_aLinkURL; -- cgit v1.2.3 From 8ae0efd7d8888ae6f3444e1633d8a6afc92519ea Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 10:53:30 +0100 Subject: autorecovery: when creating a new document, also respect the RecoveryStorage parameter --- embeddedobj/source/commonembedding/persistence.cxx | 180 +++++++++++---------- embeddedobj/source/inc/commonembobj.hxx | 21 ++- 2 files changed, 110 insertions(+), 91 deletions(-) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index e9aa0edd0ec8..55170093c43e 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -67,6 +67,8 @@ #include +#include + #define USE_STORAGEBASED_DOCUMENT using namespace ::com::sun::star; @@ -198,6 +200,22 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor( } +//------------------------------------------------------ +static void TransferMediaType( const uno::Reference< embed::XStorage >& i_rSource, const uno::Reference< embed::XStorage >& i_rTarget ) +{ + try + { + const uno::Reference< beans::XPropertySet > xSourceProps( i_rSource, uno::UNO_QUERY_THROW ); + const uno::Reference< beans::XPropertySet > xTargetProps( i_rTarget, uno::UNO_QUERY_THROW ); + const ::rtl::OUString sMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); + xTargetProps->setPropertyValue( sMediaTypePropName, xSourceProps->getPropertyValue( sMediaTypePropName ) ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + //------------------------------------------------------ static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< lang::XMultiServiceFactory >& _rxFactory, const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport, const bool i_bDocumentRecoverySupport ) @@ -300,6 +318,23 @@ void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::X SwitchOwnPersistence( xNewParentStorage, xNewOwnStorage, aNewName ); } +//------------------------------------------------------ +void OCommonEmbeddedObject::EmbedAndReparentDoc_Impl( const uno::Reference< util::XCloseable >& i_rxDocument ) const +{ + SetDocToEmbedded( uno::Reference< frame::XModel >( i_rxDocument, uno::UNO_QUERY ), m_aModuleName ); + + try + { + uno::Reference < container::XChild > xChild( i_rxDocument, uno::UNO_QUERY ); + if ( xChild.is() ) + xChild->setParent( m_xParent ); + } + catch( const lang::NoSupportException & ) + { + OSL_ENSURE( false, "OCommonEmbeddedObject::EmbedAndReparentDoc: cannot set parent at document!" ); + } +} + //------------------------------------------------------ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() { @@ -314,22 +349,31 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() try { // set the document mode to embedded as the first action on document!!! - SetDocToEmbedded( xModel, m_aModuleName ); + EmbedAndReparentDoc_Impl( xDocument ); - try + // if we have a storage to recover the document from, do not use initNew, but instead load from that storage + bool bInitNew = true; + if ( m_xRecoveryStorage.is() ) { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); + uno::Reference< document::XStorageBasedDocument > xDoc( xLoadable, uno::UNO_QUERY ); + OSL_ENSURE( xDoc.is(), "OCommonEmbeddedObject::InitNewDocument_Impl: cannot recover from a storage when the document is not storage based!" ); + if ( xDoc.is() ) + { + ::comphelper::NamedValueCollection aLoadArgs; + FillDefaultLoadArgs_Impl( m_xRecoveryStorage, aLoadArgs ); + + xDoc->loadFromStorage( m_xRecoveryStorage, aLoadArgs.getPropertyValues() ); + SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); + bInitNew = false; + } } - catch( const lang::NoSupportException & ) + + if ( bInitNew ) { - OSL_ENSURE( false, "Cannot set parent at document" ); + // init document as a new + xLoadable->initNew(); + xModel->attachResource( xModel->getURL(), m_aDocMediaDescriptor ); } - - // init document as a new - xLoadable->initNew(); - xModel->attachResource( xModel->getURL(),m_aDocMediaDescriptor); } catch( uno::Exception& ) { @@ -384,18 +428,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() try { // the document is not really an embedded one, it is a link - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); - - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) - { - OSL_ENSURE( false, "Cannot set parent at document" ); - } + EmbedAndReparentDoc_Impl( xDocument ); // load the document xLoadable->load( aArgs ); @@ -436,7 +469,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() } //------------------------------------------------------ -::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) +::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const { ::rtl::OUString aFilterName = GetPresetFilterName(); if ( !aFilterName.getLength() ) @@ -451,10 +484,28 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() return aFilterName; } +//------------------------------------------------------ +void OCommonEmbeddedObject::FillDefaultLoadArgs_Impl( const uno::Reference< embed::XStorage >& i_rxStorage, + ::comphelper::NamedValueCollection& o_rLoadArgs ) const +{ + o_rLoadArgs.put( "DocumentBaseURL", GetBaseURL_Impl() ); + o_rLoadArgs.put( "HierarchicalDocumentName", m_aEntryName ); + o_rLoadArgs.put( "ReadOnly", m_bReadOnly ); + + ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( i_rxStorage ) ); + OSL_ENSURE( aFilterName.getLength(), "OCommonEmbeddedObject::FillDefaultLoadArgs_Impl: Wrong document service name!" ); + if ( !aFilterName.getLength() ) + throw io::IOException(); // TODO: error message/code + + o_rLoadArgs.put( "FilterName", aFilterName ); +} + //------------------------------------------------------ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() { - OSL_ENSURE( m_xObjectStorage.is(), "The storage can not be empty!" ); + ENSURE_OR_THROW( m_xObjectStorage.is(), "no object storage" ); + + const uno::Reference< embed::XStorage > xSourceStorage( m_xRecoveryStorage.is() ? m_xRecoveryStorage : m_xObjectStorage ); uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(), m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) ); @@ -477,28 +528,13 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag if ( !xDoc.is() && !xLoadable.is() ) ///BUG: This should be || instead of && ? throw uno::RuntimeException(); - ::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( m_xObjectStorage ) ); - - OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" ); - if ( !aFilterName.getLength() ) - throw io::IOException(); - - sal_Int32 nLen = xDoc.is() ? 4 : 6; - uno::Sequence< beans::PropertyValue > aArgs( nLen ); - - aArgs[0].Name = ::rtl::OUString::createFromAscii( "DocumentBaseURL" ); - aArgs[0].Value <<= GetBaseURL_Impl(); - aArgs[1].Name = ::rtl::OUString::createFromAscii( "HierarchicalDocumentName" ); - aArgs[1].Value <<= m_aEntryName; - aArgs[2].Name = ::rtl::OUString::createFromAscii( "ReadOnly" ); - aArgs[2].Value <<= m_bReadOnly; - aArgs[3].Name = ::rtl::OUString::createFromAscii( "FilterName" ); - aArgs[3].Value <<= aFilterName; + ::comphelper::NamedValueCollection aLoadArgs; + FillDefaultLoadArgs_Impl( xSourceStorage, aLoadArgs ); uno::Reference< io::XInputStream > xTempInpStream; if ( !xDoc.is() ) { - xTempInpStream = createTempInpStreamFromStor( m_xObjectStorage, m_xFactory ); + xTempInpStream = createTempInpStreamFromStor( xSourceStorage, m_xFactory ); if ( !xTempInpStream.is() ) throw uno::RuntimeException(); @@ -516,50 +552,27 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" ); - aArgs[4].Name = ::rtl::OUString::createFromAscii( "URL" ); - aArgs[4].Value <<= aTempFileURL; // ::rtl::OUString::createFromAscii( "private:stream" ); - aArgs[5].Name = ::rtl::OUString::createFromAscii( "InputStream" ); - aArgs[5].Value <<= xTempInpStream; + aLoadArgs.put( "URL", aTempFileURL ); + aLoadArgs.put( "InputStream", xTempInpStream ); } - // aArgs[4].Name = ::rtl::OUString::createFromAscii( "AsTemplate" ); - // aArgs[4].Value <<= sal_True; + // aLoadArgs.put( "AsTemplate", sal_True ); - aArgs.realloc( m_aDocMediaDescriptor.getLength() + nLen ); - for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) - { - aArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name; - aArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value; - } + aLoadArgs.merge( m_aDocMediaDescriptor, true ); try { // set the document mode to embedded as the first step!!! - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); - - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) - { - OSL_ENSURE( false, "Cannot set parent at document" ); - } + EmbedAndReparentDoc_Impl( xDocument ); if ( xDoc.is() ) { - if ( m_xRecoveryStorage.is() ) - { - xDoc->loadFromStorage( m_xRecoveryStorage, aArgs ); + xDoc->loadFromStorage( xSourceStorage, aLoadArgs.getPropertyValues() ); + if ( xSourceStorage != m_xObjectStorage ) SwitchDocToStorage_Impl( xDoc, m_xObjectStorage ); - } - else - xDoc->loadFromStorage( m_xObjectStorage, aArgs ); } else - xLoadable->load( aArgs ); + xLoadable->load( aLoadArgs.getPropertyValues() ); } catch( uno::Exception& ) { @@ -572,6 +585,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag } catch( uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } @@ -661,7 +675,7 @@ void OCommonEmbeddedObject::SaveObject_Impl() } //------------------------------------------------------ -::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() +::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() const { ::rtl::OUString aBaseURL; sal_Int32 nInd = 0; @@ -824,18 +838,7 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDesc try { // set the document mode to embedded as the first action on the document!!! - SetDocToEmbedded( uno::Reference < frame::XModel >( xDocument, uno::UNO_QUERY ), m_aModuleName ); - - try - { - uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY ); - if ( xChild.is() ) - xChild->setParent( m_xParent ); - } - catch( const lang::NoSupportException & ) - { - OSL_ENSURE( false, "Cannot set parent at document" ); - } + EmbedAndReparentDoc_Impl( xDocument ); xLoadable->load( addAsTemplate( aMedDescr ) ); } @@ -1117,6 +1120,9 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( } else if ( nEntryConnectionMode == embed::EntryInitModes::TRUNCATE_INIT ) { + if ( m_xRecoveryStorage.is() ) + TransferMediaType( m_xRecoveryStorage, m_xObjectStorage ); + // TODO: m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly ); diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx index 2ba0e5cd4aca..f718151b6aa1 100644 --- a/embeddedobj/source/inc/commonembobj.hxx +++ b/embeddedobj/source/inc/commonembobj.hxx @@ -75,6 +75,10 @@ namespace cppu { class OMultiTypeInterfaceContainerHelper; } +namespace comphelper { + class NamedValueCollection; +} + #define NUM_SUPPORTED_STATES 5 // #define NUM_SUPPORTED_VERBS 5 @@ -183,8 +187,8 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage, const ::rtl::OUString& aNewName ); - ::rtl::OUString GetDocumentServiceName() { return m_aDocServiceName; } - ::rtl::OUString GetPresetFilterName() { return m_aPresetFilterName; } + ::rtl::OUString GetDocumentServiceName() const { return m_aDocServiceName; } + ::rtl::OUString GetPresetFilterName() const { return m_aPresetFilterName; } ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > StoreDocumentToTempStream_Impl( sal_Int32 nStorageFormat, @@ -201,7 +205,7 @@ private: ::com::sun::star::uno::Sequence< sal_Int32 > GetIntermediateStatesSequence_Impl( sal_Int32 nNewState ); - ::rtl::OUString GetFilterName( sal_Int32 nVersion ); + ::rtl::OUString GetFilterName( sal_Int32 nVersion ) const; ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl(); ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadLink_Impl(); @@ -218,12 +222,21 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ); + void FillDefaultLoadArgs_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rxStorage, + ::comphelper::NamedValueCollection& o_rLoadArgs + ) const; + + void EmbedAndReparentDoc_Impl( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& i_rxDocument + ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateDocFromMediaDescr_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr ); ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateTempDocFromLink_Impl(); - ::rtl::OUString GetBaseURL_Impl(); + ::rtl::OUString GetBaseURL_Impl() const; ::rtl::OUString GetBaseURLFrom_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); -- cgit v1.2.3 From ffe5c97056ab181367e49691d487eb6f6f375200 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- .../inc/drawinglayer/attribute/fillattribute.hxx | 138 ------ .../drawinglayer/attribute/fillbitmapattribute.hxx | 42 +- .../attribute/fillgradientattribute.hxx | 121 ++++++ .../drawinglayer/attribute/fillhatchattribute.hxx | 112 +++++ .../inc/drawinglayer/attribute/fontattribute.hxx | 81 ++-- .../inc/drawinglayer/attribute/lineattribute.hxx | 61 +-- .../attribute/linestartendattribute.hxx | 47 +- .../drawinglayer/attribute/materialattribute3d.hxx | 12 +- .../drawinglayer/attribute/sdrallattribute3d.hxx | 66 ++- .../inc/drawinglayer/attribute/sdrattribute.hxx | 223 ---------- .../inc/drawinglayer/attribute/sdrattribute3d.hxx | 217 ---------- .../drawinglayer/attribute/sdrfillattribute.hxx | 99 +++++ .../attribute/sdrfillbitmapattribute.hxx | 61 ++- .../drawinglayer/attribute/sdrlightattribute3d.hxx | 96 +++++ .../attribute/sdrlightingattribute3d.hxx | 99 +++++ .../drawinglayer/attribute/sdrlineattribute.hxx | 104 +++++ .../attribute/sdrlinestartendattribute.hxx | 102 +++++ .../attribute/sdrobjectattribute3d.hxx | 111 +++++ .../drawinglayer/attribute/sdrsceneattribute3d.hxx | 94 ++++ .../drawinglayer/attribute/sdrshadowattribute.hxx | 93 ++++ .../inc/drawinglayer/attribute/strokeattribute.hxx | 54 +-- .../drawinglayer/geometry/viewinformation2d.hxx | 6 + .../drawinglayer/geometry/viewinformation3d.hxx | 6 + .../drawinglayer/primitive2d/alphaprimitive2d.hxx | 103 ----- .../drawinglayer/primitive2d/baseprimitive2d.hxx | 8 +- .../primitive2d/drawinglayer_primitivetypes2d.hxx | 20 +- .../primitive2d/fillgradientprimitive2d.hxx | 2 +- .../primitive2d/fillhatchprimitive2d.hxx | 3 +- .../drawinglayer/primitive2d/gridprimitive2d.hxx | 2 +- .../drawinglayer/primitive2d/groupprimitive2d.hxx | 2 +- .../primitive2d/hiddengeometryprimitive2d.hxx | 79 ++++ .../primitive2d/hittestprimitive2d.hxx | 86 ---- .../drawinglayer/primitive2d/invertprimitive2d.hxx | 2 +- .../primitive2d/markerarrayprimitive2d.hxx | 2 +- .../primitive2d/metafileprimitive2d.hxx | 2 +- .../primitive2d/polygonprimitive2d.hxx | 2 + .../primitive2d/polypolygonprimitive2d.hxx | 6 +- .../drawinglayer/primitive2d/sceneprimitive2d.hxx | 4 +- .../primitive2d/sdrdecompositiontools2d.hxx | 85 ++++ .../primitive2d/transparenceprimitive2d.hxx | 103 +++++ .../primitive2d/unifiedalphaprimitive2d.hxx | 88 ---- .../primitive2d/unifiedtransparenceprimitive2d.hxx | 91 ++++ .../primitive3d/drawinglayer_primitivetypes3d.hxx | 38 +- .../drawinglayer/primitive3d/groupprimitive3d.hxx | 2 +- .../primitive3d/hatchtextureprimitive3d.hxx | 1 + .../primitive3d/hiddengeometryprimitive3d.hxx | 81 ++++ .../primitive3d/hittestprimitive3d.hxx | 88 ---- .../primitive3d/sdrcubeprimitive3d.hxx | 2 +- .../primitive3d/sdrdecompositiontools3d.hxx | 11 +- .../primitive3d/sdrextrudeprimitive3d.hxx | 2 +- .../primitive3d/sdrlatheprimitive3d.hxx | 2 +- .../primitive3d/sdrpolypolygonprimitive3d.hxx | 2 +- .../drawinglayer/primitive3d/sdrprimitive3d.hxx | 8 +- .../primitive3d/sdrsphereprimitive3d.hxx | 2 +- .../primitive3d/textureprimitive3d.hxx | 26 +- .../drawinglayer/processor2d/baseprocessor2d.hxx | 177 +++++++- .../drawinglayer/processor2d/canvasprocessor.hxx | 13 +- .../processor2d/contourextractor2d.hxx | 9 +- .../processor2d/hittestprocessor2d.hxx | 37 +- .../processor2d/linegeometryextractor2d.hxx | 9 +- .../processor2d/textaspolygonextractor2d.hxx | 8 +- .../processor2d/vclmetafileprocessor2d.hxx | 56 ++- .../processor2d/vclpixelprocessor2d.hxx | 23 +- .../drawinglayer/processor2d/vclprocessor2d.hxx | 13 +- .../drawinglayer/processor3d/baseprocessor3d.hxx | 27 +- .../processor3d/cutfindprocessor3d.hxx | 37 +- .../processor3d/defaultprocessor3d.hxx | 41 +- .../processor3d/geometry2dextractor.hxx | 19 +- .../drawinglayer/processor3d/shadow3dextractor.hxx | 35 +- .../processor3d/zbufferprocessor3d.hxx | 25 +- drawinglayer/prj/d.lst | 22 +- drawinglayer/source/attribute/fillattribute.cxx | 102 ----- .../source/attribute/fillbitmapattribute.cxx | 153 ++++++- .../source/attribute/fillgradientattribute.cxx | 250 +++++++++++ .../source/attribute/fillhatchattribute.cxx | 219 ++++++++++ drawinglayer/source/attribute/fontattribute.cxx | 220 +++++++++- drawinglayer/source/attribute/lineattribute.cxx | 142 +++++++ .../source/attribute/linestartendattribute.cxx | 148 ++++++- drawinglayer/source/attribute/makefile.mk | 27 +- .../source/attribute/materialattribute3d.cxx | 93 ++-- .../source/attribute/sdrallattribute3d.cxx | 169 ++------ drawinglayer/source/attribute/sdrattribute.cxx | 293 ------------- drawinglayer/source/attribute/sdrattribute3d.cxx | 219 ---------- drawinglayer/source/attribute/sdrfillattribute.cxx | 221 ++++++++++ .../source/attribute/sdrfillbitmapattribute.cxx | 259 +++++++++-- .../source/attribute/sdrlightattribute3d.cxx | 196 +++++++++ .../source/attribute/sdrlightingattribute3d.cxx | 235 ++++++++++ drawinglayer/source/attribute/sdrlineattribute.cxx | 250 +++++++++++ .../source/attribute/sdrlinestartendattribute.cxx | 254 +++++++++++ .../source/attribute/sdrobjectattribute3d.cxx | 292 +++++++++++++ .../source/attribute/sdrsceneattribute3d.cxx | 218 ++++++++++ .../source/attribute/sdrshadowattribute.cxx | 193 +++++++++ drawinglayer/source/attribute/strokeattribute.cxx | 139 +++++- drawinglayer/source/geometry/viewinformation2d.cxx | 47 ++ drawinglayer/source/geometry/viewinformation3d.cxx | 47 +- .../source/primitive2d/alphaprimitive2d.cxx | 78 ---- .../source/primitive2d/fillbitmapprimitive2d.cxx | 78 ++-- .../source/primitive2d/fillgradientprimitive2d.cxx | 38 +- .../source/primitive2d/fillhatchprimitive2d.cxx | 108 ++--- .../source/primitive2d/graphicprimitive2d.cxx | 6 +- .../primitive2d/hiddengeometryprimitive2d.cxx | 75 ++++ .../source/primitive2d/hittestprimitive2d.cxx | 76 ---- .../source/primitive2d/invertprimitive2d.cxx | 2 +- drawinglayer/source/primitive2d/makefile.mk | 89 ++-- .../source/primitive2d/mediaprimitive2d.cxx | 17 +- .../source/primitive2d/metafileprimitive2d.cxx | 31 +- .../source/primitive2d/pagepreviewprimitive2d.cxx | 5 +- .../source/primitive2d/polygonprimitive2d.cxx | 31 +- .../source/primitive2d/polypolygonprimitive2d.cxx | 105 +++-- .../source/primitive2d/sceneprimitive2d.cxx | 9 +- .../source/primitive2d/sdrdecompositiontools2d.cxx | 130 ++++++ .../source/primitive2d/shadowprimitive2d.cxx | 4 +- .../source/primitive2d/transparenceprimitive2d.cxx | 78 ++++ .../source/primitive2d/unifiedalphaprimitive2d.cxx | 129 ------ .../primitive2d/unifiedtransparenceprimitive2d.cxx | 136 ++++++ .../source/primitive2d/wallpaperprimitive2d.cxx | 3 +- .../primitive3d/hiddengeometryprimitive3d.cxx | 76 ++++ .../source/primitive3d/hittestprimitive3d.cxx | 76 ---- drawinglayer/source/primitive3d/makefile.mk | 2 +- .../source/primitive3d/polygontubeprimitive3d.cxx | 4 +- .../source/primitive3d/sdrcubeprimitive3d.cxx | 37 +- .../source/primitive3d/sdrdecompositiontools3d.cxx | 88 +++- .../source/primitive3d/sdrextrudeprimitive3d.cxx | 45 +- .../source/primitive3d/sdrlatheprimitive3d.cxx | 47 +- .../primitive3d/sdrpolypolygonprimitive3d.cxx | 44 +- drawinglayer/source/primitive3d/sdrprimitive3d.cxx | 16 +- .../source/primitive3d/sdrsphereprimitive3d.cxx | 38 +- .../source/primitive3d/textureprimitive3d.cxx | 28 +- .../source/processor2d/canvasprocessor.cxx | 139 +++--- .../source/processor2d/contourextractor2d.cxx | 10 +- .../source/processor2d/hittestprocessor2d.cxx | 29 +- .../source/processor2d/vclhelperbufferdevice.cxx | 4 +- .../source/processor2d/vclhelperbufferdevice.hxx | 2 +- .../source/processor2d/vclhelpergradient.cxx | 2 +- .../source/processor2d/vclhelpergradient.hxx | 3 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 260 +++++------ .../source/processor2d/vclpixelprocessor2d.cxx | 74 ++-- drawinglayer/source/processor2d/vclprocessor2d.cxx | 41 +- .../source/processor3d/cutfindprocessor3d.cxx | 50 ++- .../source/processor3d/defaultprocessor3d.cxx | 10 +- .../source/processor3d/geometry2dextractor.cxx | 4 +- .../source/processor3d/shadow3dextractor.cxx | 4 +- .../source/processor3d/zbufferprocessor3d.cxx | 2 +- drawinglayer/source/texture/texture3d.cxx | 1 - svx/inc/svx/scene3d.hxx | 2 + svx/inc/svx/sdr/attribute/sdrallattribute.hxx | 202 --------- svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx | 80 ++++ svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx | 66 ++- .../sdr/attribute/sdrformtextoutlineattribute.hxx | 30 +- .../attribute/sdrlinefillshadowtextattribute.hxx | 81 ++++ .../sdr/attribute/sdrlineshadowtextattribute.hxx | 79 ++++ .../svx/sdr/attribute/sdrshadowtextattribute.hxx | 76 ++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 107 +++-- svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx | 23 +- .../svx/sdr/contact/viewobjectcontactofgroup.hxx | 3 - .../svx/sdr/primitive2d/sdrattributecreator.hxx | 63 ++- .../svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrconnectorprimitive2d.hxx | 4 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.hxx | 6 +- .../svx/sdr/primitive2d/sdrdecompositiontools.hxx | 18 +- .../svx/sdr/primitive2d/sdrellipseprimitive2d.hxx | 2 +- svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx | 3 +- .../svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx | 3 +- svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx | 4 +- svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx | 5 - .../sdr/primitive2d/sdrrectangleprimitive2d.hxx | 4 +- svx/inc/svx/sdr/properties/oleproperties.hxx | 69 +++ svx/inc/svx/svdogrp.hxx | 1 + svx/prj/d.lst | 3 + svx/source/engine3d/dragmt3d.cxx | 27 +- svx/source/engine3d/scene3d.cxx | 6 + svx/source/engine3d/view3d.cxx | 6 +- svx/source/sdr/attribute/makefile.mk | 5 +- svx/source/sdr/attribute/sdrallattribute.cxx | 412 ------------------ svx/source/sdr/attribute/sdrfilltextattribute.cxx | 92 ++++ svx/source/sdr/attribute/sdrformtextattribute.cxx | 335 ++++++++++----- .../sdr/attribute/sdrformtextoutlineattribute.cxx | 143 ++++++- .../attribute/sdrlinefillshadowtextattribute.cxx | 95 +++++ .../sdr/attribute/sdrlineshadowtextattribute.cxx | 93 ++++ .../sdr/attribute/sdrshadowtextattribute.cxx | 85 ++++ svx/source/sdr/attribute/sdrtextattribute.cxx | 473 +++++++++++++++------ svx/source/sdr/contact/viewcontact.cxx | 3 +- svx/source/sdr/contact/viewcontactofe3d.cxx | 30 +- svx/source/sdr/contact/viewcontactofe3dcube.cxx | 17 +- svx/source/sdr/contact/viewcontactofe3dextrude.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dlathe.cxx | 24 +- svx/source/sdr/contact/viewcontactofe3dpolygon.cxx | 22 +- svx/source/sdr/contact/viewcontactofe3dscene.cxx | 117 ++--- svx/source/sdr/contact/viewcontactofe3dsphere.cxx | 20 +- svx/source/sdr/contact/viewcontactofgraphic.cxx | 236 +++++----- svx/source/sdr/contact/viewcontactofgroup.cxx | 26 +- .../contact/viewcontactofmasterpagedescriptor.cxx | 41 +- .../sdr/contact/viewcontactofsdrcaptionobj.cxx | 194 ++++----- svx/source/sdr/contact/viewcontactofsdrcircobj.cxx | 91 ++-- svx/source/sdr/contact/viewcontactofsdredgeobj.cxx | 43 +- .../sdr/contact/viewcontactofsdrmeasureobj.cxx | 149 ++++--- .../sdr/contact/viewcontactofsdrmediaobj.cxx | 13 +- .../sdr/contact/viewcontactofsdrobjcustomshape.cxx | 179 ++++---- svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 93 ++-- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 39 +- svx/source/sdr/contact/viewcontactofsdrpathobj.cxx | 163 ++++--- svx/source/sdr/contact/viewcontactofsdrrectobj.cxx | 105 ++--- svx/source/sdr/contact/viewcontactofunocontrol.cxx | 45 +- svx/source/sdr/contact/viewcontactofvirtobj.cxx | 41 +- svx/source/sdr/contact/viewobjectcontactofe3d.cxx | 1 - .../sdr/contact/viewobjectcontactofe3dscene.cxx | 11 - .../sdr/contact/viewobjectcontactofgroup.cxx | 14 - .../sdr/contact/viewobjectcontactofpageobj.cxx | 25 +- .../sdr/contact/viewobjectcontactofsdrole2obj.cxx | 8 +- svx/source/sdr/overlay/overlayobjectcell.cxx | 8 +- svx/source/sdr/overlay/overlayselection.cxx | 10 +- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 407 +++++++----------- .../sdr/primitive2d/sdrcaptionprimitive2d.cxx | 65 ++- .../sdr/primitive2d/sdrconnectorprimitive2d.cxx | 44 +- .../sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 27 +- .../sdr/primitive2d/sdrdecompositiontools.cxx | 58 +-- .../sdr/primitive2d/sdrellipseprimitive2d.cxx | 116 +++-- svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 66 ++- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 130 +++--- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 64 ++- .../sdr/primitive2d/sdrolecontentprimitive2d.cxx | 2 +- svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 63 ++- svx/source/sdr/primitive2d/sdrprimitivetools.cxx | 17 - .../sdr/primitive2d/sdrrectangleprimitive2d.cxx | 55 +-- .../sdr/primitive3d/sdrattributecreator3d.cxx | 5 +- svx/source/sdr/properties/oleproperties.cxx | 80 ++++ svx/source/svdraw/svddrgmt.cxx | 44 +- svx/source/svdraw/svdedtv.cxx | 97 ++++- svx/source/svdraw/svdocapt.cxx | 2 +- svx/source/svdraw/svdogrp.cxx | 6 + svx/source/svdraw/svdopath.cxx | 12 +- svx/source/svdraw/svdotextpathdecomposition.cxx | 78 ++-- svx/source/table/tablehandles.cxx | 7 +- svx/source/table/viewcontactoftableobj.cxx | 124 ++++-- 235 files changed, 10476 insertions(+), 5897 deletions(-) delete mode 100644 drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx create mode 100644 drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx create mode 100644 drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx delete mode 100644 drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx delete mode 100644 drawinglayer/source/attribute/fillattribute.cxx create mode 100644 drawinglayer/source/attribute/fillgradientattribute.cxx create mode 100644 drawinglayer/source/attribute/fillhatchattribute.cxx delete mode 100644 drawinglayer/source/attribute/sdrattribute.cxx delete mode 100644 drawinglayer/source/attribute/sdrattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrfillattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrlightattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrlightingattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrlineattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrlinestartendattribute.cxx create mode 100644 drawinglayer/source/attribute/sdrobjectattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrsceneattribute3d.cxx create mode 100644 drawinglayer/source/attribute/sdrshadowattribute.cxx delete mode 100644 drawinglayer/source/primitive2d/alphaprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx delete mode 100644 drawinglayer/source/primitive2d/hittestprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx create mode 100644 drawinglayer/source/primitive2d/transparenceprimitive2d.cxx delete mode 100644 drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx create mode 100644 drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx create mode 100644 drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx delete mode 100644 drawinglayer/source/primitive3d/hittestprimitive3d.cxx delete mode 100644 svx/inc/svx/sdr/attribute/sdrallattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx create mode 100644 svx/inc/svx/sdr/properties/oleproperties.hxx delete mode 100644 svx/source/sdr/attribute/sdrallattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrfilltextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx create mode 100644 svx/source/sdr/attribute/sdrshadowtextattribute.cxx create mode 100644 svx/source/sdr/properties/oleproperties.cxx diff --git a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx deleted file mode 100644 index e50a636e8a83..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/fillattribute.hxx +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fillattribute.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines -class XHatch; - -namespace drawinglayer -{ - namespace attribute - { - enum GradientStyle - { - GRADIENTSTYLE_LINEAR, - GRADIENTSTYLE_AXIAL, - GRADIENTSTYLE_RADIAL, - GRADIENTSTYLE_ELLIPTICAL, - GRADIENTSTYLE_SQUARE, - GRADIENTSTYLE_RECT - }; - - enum HatchStyle - { - HATCHSTYLE_SINGLE, - HATCHSTYLE_DOUBLE, - HATCHSTYLE_TRIPLE - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillGradientAttribute - { - basegfx::BColor maStartColor; - basegfx::BColor maEndColor; - double mfBorder; - double mfOffsetX; - double mfOffsetY; - double mfAngle; - GradientStyle meStyle; - sal_uInt16 mnSteps; - - public: - FillGradientAttribute( - GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps); - bool operator==(const FillGradientAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getStartColor() const { return maStartColor; } - const basegfx::BColor& getEndColor() const { return maEndColor; } - double getBorder() const { return mfBorder; } - double getOffsetX() const { return mfOffsetX; } - double getOffsetY() const { return mfOffsetY; } - double getAngle() const { return mfAngle; } - GradientStyle getStyle() const { return meStyle; } - sal_uInt16 getSteps() const { return mnSteps; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class FillHatchAttribute - { - double mfDistance; - double mfAngle; - basegfx::BColor maColor; - HatchStyle meStyle; - - // bitfield - unsigned mbFillBackground : 1; - - public: - FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground); - bool operator==(const FillHatchAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getAngle() const { return mfAngle; } - const basegfx::BColor& getColor() const { return maColor; } - HatchStyle getStyle() const { return meStyle; } - bool isFillBackground() const { return mbFillBackground; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx index 376e1d626927..04d1a9298eb5 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fillbitmapattribute.hxx @@ -36,18 +36,22 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX -#include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +class BitmapEx; + namespace basegfx { - class B2DRange; - class BColor; + class B2DPoint; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -56,26 +60,32 @@ namespace drawinglayer { class FillBitmapAttribute { - BitmapEx maBitmapEx; - basegfx::B2DPoint maTopLeft; - basegfx::B2DVector maSize; - - // bitfield - unsigned mbTiling : 1; + private: + ImpFillBitmapAttribute* mpFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling); + FillBitmapAttribute(); + FillBitmapAttribute(const FillBitmapAttribute& rCandidate); + FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate); + ~FillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const FillBitmapAttribute& rCandidate) const; - // data access - const BitmapEx& getBitmapEx() const { return maBitmapEx; } - const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } - const basegfx::B2DVector& getSize() const { return maSize; } - bool getTiling() const { return mbTiling; } + // data read access + const BitmapEx& getBitmapEx() const; + const basegfx::B2DPoint& getTopLeft() const; + const basegfx::B2DVector& getSize() const; + bool getTiling() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx new file mode 100644 index 000000000000..f7bddbfe0f89 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillgradientattribute.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillGradientAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum GradientStyle + { + GRADIENTSTYLE_LINEAR, + GRADIENTSTYLE_AXIAL, + GRADIENTSTYLE_RADIAL, + GRADIENTSTYLE_ELLIPTICAL, + GRADIENTSTYLE_SQUARE, + GRADIENTSTYLE_RECT + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillGradientAttribute + { + private: + ImpFillGradientAttribute* mpFillGradientAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps); + FillGradientAttribute(); + FillGradientAttribute(const FillGradientAttribute& rCandidate); + FillGradientAttribute& operator=(const FillGradientAttribute& rCandidate); + ~FillGradientAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillGradientAttribute& rCandidate) const; + + // data read access + GradientStyle getStyle() const; + double getBorder() const; + double getOffsetX() const; + double getOffsetY() const; + double getAngle() const; + const basegfx::BColor& getStartColor() const; + const basegfx::BColor& getEndColor() const; + sal_uInt16 getSteps() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx new file mode 100644 index 000000000000..9f147b36ef34 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpFillHatchAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// +// declarations + +namespace drawinglayer +{ + namespace attribute + { + enum HatchStyle + { + HATCHSTYLE_SINGLE, + HATCHSTYLE_DOUBLE, + HATCHSTYLE_TRIPLE + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class FillHatchAttribute + { + private: + ImpFillHatchAttribute* mpFillHatchAttribute; + + public: + /// constructors/assignmentoperator/destructor + FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground); + FillHatchAttribute(); + FillHatchAttribute(const FillHatchAttribute& rCandidate); + FillHatchAttribute& operator=(const FillHatchAttribute& rCandidate); + ~FillHatchAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const FillHatchAttribute& rCandidate) const; + + // data read access + HatchStyle getStyle() const; + double getDistance() const; + double getAngle() const; + const basegfx::BColor& getColor() const; + bool isFillBackground() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx index d8eed659f5e7..6a6cbe26be11 100644 --- a/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/fontattribute.hxx @@ -36,9 +36,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX -#include #include -#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class String; + +namespace drawinglayer { namespace attribute { + class ImpFontAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -54,22 +61,11 @@ namespace drawinglayer class FontAttribute { private: - /// core data - String maFamilyName; // Font Family Name - String maStyleName; // Font Style Name - sal_uInt16 mnWeight; // Font weight - - /// bitfield - unsigned mbSymbol : 1; // Symbol Font Flag - unsigned mbVertical : 1; // Vertical Text Flag - unsigned mbItalic : 1; // Italic Flag - unsigned mbOutline : 1; // Outline Flag - unsigned mbRTL : 1; // RTL Flag - unsigned mbBiDiStrong : 1; // BiDi Flag - // TODO: pair kerning and CJK kerning + ImpFontAttribute* mpFontAttribute; public: - /// constructor + /// constructors/assignmentoperator/destructor + /// TODO: pair kerning and CJK kerning FontAttribute( const String& rFamilyName, const String& rStyleName, @@ -79,45 +75,28 @@ namespace drawinglayer bool bItalic = false, bool bOutline = false, bool bRTL = false, - bool bBiDiStrong = false) - : maFamilyName(rFamilyName), - maStyleName(rStyleName), - mnWeight(nWeight), - mbSymbol(bSymbol), - mbVertical(bVertical), - mbItalic(bItalic), - mbOutline(bOutline), - mbRTL(bRTL), - mbBiDiStrong(bBiDiStrong) - { - } + bool bBiDiStrong = false); + FontAttribute(); + FontAttribute(const FontAttribute& rCandidate); + FontAttribute& operator=(const FontAttribute& rCandidate); + ~FontAttribute(); - FontAttribute() - : maFamilyName(), - maStyleName(), - mnWeight(0), - mbSymbol(false), - mbVertical(false), - mbItalic(false), - mbOutline(false), - mbRTL(false), - mbBiDiStrong(false) - { - } + // checks if the incarnation is default constructed + bool isDefault() const; - /// compare operator - bool operator==(const FontAttribute& rCompare) const; + // compare operator + bool operator==(const FontAttribute& rCandidate) const; /// data read access - const String& getFamilyName() const { return maFamilyName; } - const String& getStyleName() const { return maStyleName; } - sal_uInt16 getWeight() const { return mnWeight; } - bool getSymbol() const { return mbSymbol; } - bool getVertical() const { return mbVertical; } - bool getItalic() const { return mbItalic; } - bool getOutline() const { return mbOutline; } - bool getRTL() const { return mbRTL; } - bool getBiDiStrong() const { return mbBiDiStrong; } + const String& getFamilyName() const; + const String& getStyleName() const; + sal_uInt16 getWeight() const; + bool getSymbol() const; + bool getVertical() const; + bool getItalic() const; + bool getOutline() const; + bool getRTL() const; + bool getBiDiStrong() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx index b4bdabe8d646..3ef055355bd5 100644 --- a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx @@ -36,13 +36,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX -#include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpLineAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -52,50 +58,29 @@ namespace drawinglayer class LineAttribute { private: - basegfx::BColor maColor; // color - double mfWidth; // absolute line width - basegfx::B2DLineJoin meLineJoin; // type of LineJoin + ImpLineAttribute* mpLineAttribute; public: + /// constructors/assignmentoperator/destructor LineAttribute( const basegfx::BColor& rColor, double fWidth = 0.0, - basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND) - : maColor(rColor), - mfWidth(fWidth), - meLineJoin(aB2DLineJoin) - { - } - - LineAttribute(const LineAttribute& rCandidate) - { - *this = rCandidate; - } - - LineAttribute& operator=(const LineAttribute& rCandidate) - { - maColor = rCandidate.maColor; - mfWidth = rCandidate.mfWidth; - meLineJoin = rCandidate.meLineJoin; - return *this; - } + basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND); + LineAttribute(); + LineAttribute(const LineAttribute& rCandidate); + LineAttribute& operator=(const LineAttribute& rCandidate); + ~LineAttribute(); - ~LineAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && mfWidth == rCandidate.mfWidth - && meLineJoin == rCandidate.meLineJoin); - } + bool operator==(const LineAttribute& rCandidate) const; - // data access - const basegfx::BColor& getColor() const { return maColor; } - double getWidth() const { return mfWidth; } - basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + // data read access + const basegfx::BColor& getColor() const; + double getWidth() const; + basegfx::B2DLineJoin getLineJoin() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx index dbd12c90c9d8..151e059559ec 100644 --- a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx @@ -36,12 +36,19 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -51,35 +58,29 @@ namespace drawinglayer class LineStartEndAttribute { private: - double mfWidth; // absolute line StartEndGeometry base width - basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon - - // bitfield - unsigned mbCentered : 1; // use centered to ineStart/End point? + ImpLineStartEndAttribute* mpLineStartEndAttribute; public: + /// constructors/assignmentoperator/destructor LineStartEndAttribute( double fWidth, const basegfx::B2DPolyPolygon& rPolyPolygon, - bool bCentered) - : mfWidth(fWidth), - maPolyPolygon(rPolyPolygon), - mbCentered(bCentered) - { - } + bool bCentered); + LineStartEndAttribute(); + LineStartEndAttribute(const LineStartEndAttribute& rCandidate); + LineStartEndAttribute& operator=(const LineStartEndAttribute& rCandidate); + ~LineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const LineStartEndAttribute& rCandidate) const - { - return (basegfx::fTools::equal(mfWidth, rCandidate.mfWidth) - && maPolyPolygon == rCandidate.maPolyPolygon - && mbCentered == rCandidate.mbCentered); - } + bool operator==(const LineStartEndAttribute& rCandidate) const; - // data access - double getWidth() const { return mfWidth; } - const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } - bool isCentered() const { return mbCentered; } + // data read access + double getWidth() const; + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const; + bool isCentered() const; bool isActive() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx index 392f1b0a9113..1941770b9af3 100644 --- a/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/materialattribute3d.hxx @@ -62,7 +62,11 @@ namespace drawinglayer public: // constructors/destructor - MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity); + MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity); MaterialAttribute3D(const basegfx::BColor& rColor); MaterialAttribute3D(); MaterialAttribute3D(const MaterialAttribute3D& rCandidate); @@ -71,11 +75,13 @@ namespace drawinglayer // assignment operator MaterialAttribute3D& operator=(const MaterialAttribute3D& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; + // compare operator bool operator==(const MaterialAttribute3D& rCandidate) const; - bool operator!=(const MaterialAttribute3D& rCandidate) const { return !operator==(rCandidate); } - // data access + // data read access const basegfx::BColor& getColor() const; const basegfx::BColor& getSpecular() const; const basegfx::BColor& getEmission() const; diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx index 0763c2129f0d..c034a5fcc7a2 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrallattribute3d.hxx @@ -36,57 +36,53 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX +#include +#include +#include +#include +#include +#include + ////////////////////////////////////////////////////////////////////////////// // predefines -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; -}} - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { - class SdrLineFillShadowAttribute + class SdrLineFillShadowAttribute3D { - // shadow, line, lineStartEnd, fill, transGradient and compound3D attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) + private: + const SdrLineAttribute maLine; + const SdrFillAttribute maFill; + const SdrLineStartEndAttribute maLineStartEnd; + const SdrShadowAttribute maShadow; + const FillGradientAttribute maFillFloatTransGradient; public: - SdrLineFillShadowAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0); - ~SdrLineFillShadowAttribute(); + /// constructors/assignmentoperator/destructor + SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient); + SdrLineFillShadowAttribute3D(); - // copy constructor and assigment operator - SdrLineFillShadowAttribute(const SdrLineFillShadowAttribute& rCandidate); - SdrLineFillShadowAttribute& operator=(const SdrLineFillShadowAttribute& rCandidate); + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const SdrLineFillShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || mpLine); } + bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const; - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } + // data read access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrFillAttribute& getFill() const { return maFill; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + const SdrShadowAttribute& getShadow() const { return maShadow; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } }; } // end of namespace overlay } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx deleted file mode 100644 index a22d453c1657..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx +++ /dev/null @@ -1,223 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute.hxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines -class SdrTextObj; - -namespace drawinglayer { namespace attribute { - class SdrFillBitmapAttribute; - class FillHatchAttribute; - class FillGradientAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineAttribute - { - // line definitions - basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines - double mfWidth; // 1/100th mm, 0.0==hair - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of line - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) - - public: - SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen); - ~SdrLineAttribute(); - - // constructor to create a line attribute for a colored hairline - SdrLineAttribute(const basegfx::BColor& rColor); - - // compare operator - bool operator==(const SdrLineAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - bool isDashed() const { return (0L != maDotDashArray.size()); } - - // data access - basegfx::B2DLineJoin getJoin() const { return meJoin; } - double getWidth() const { return mfWidth; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } - double getFullDotDashLen() const { return mfFullDotDashLen; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineStartEndAttribute - { - // line arrow definitions - basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon - basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon - double mfStartWidth; // 1/100th mm - double mfEndWidth; // 1/100th mm - - // bitfield - unsigned mbStartActive : 1L; // start of Line is active - unsigned mbEndActive : 1L; // end of Line is active - unsigned mbStartCentered : 1L; // Line is centered on line start point - unsigned mbEndCentered : 1L; // Line is centered on line end point - - public: - SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered); - ~SdrLineStartEndAttribute(); - - // compare operator - bool operator==(const SdrLineStartEndAttribute& rCandidate) const; - - // bool access - bool isStartActive() const { return mbStartActive; } - bool isEndActive() const { return mbEndActive; } - bool isStartCentered() const { return mbStartCentered; } - bool isEndCentered() const { return mbEndCentered; } - bool isVisible() const { return (isStartActive() || isEndActive()); } - - // data access - const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } - const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } - double getStartWidth() const { return mfStartWidth; } - double getEndWidth() const { return mfEndWidth; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowAttribute - { - // shadow definitions - basegfx::B2DVector maOffset; // shadow offset 1/100th mm - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // color of shadow - - public: - SdrShadowAttribute( - const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor); - ~SdrShadowAttribute(); - - // compare operator - bool operator==(const SdrShadowAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - const basegfx::B2DVector& getOffset() const { return maOffset; } - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillAttribute - { - // fill definitions - double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. - basegfx::BColor maColor; // fill color - FillGradientAttribute* mpGradient; // fill gradient (if used) - FillHatchAttribute* mpHatch; // fill hatch (if used) - SdrFillBitmapAttribute* mpBitmap; // fill bitmap (if used) - - public: - SdrFillAttribute( - double fTransparence, const basegfx::BColor& rColor, FillGradientAttribute* pGradient = 0L, - FillHatchAttribute* pHatch = 0L, SdrFillBitmapAttribute* pBitmap = 0L); - ~SdrFillAttribute(); - - // copy constructor and assigment operator - SdrFillAttribute(const SdrFillAttribute& rCandidate); - SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillAttribute& rCandidate) const; - - // bool access - bool isGradient() const { return (0L != mpGradient); } - bool isHatch() const { return (0L != mpHatch); } - bool isBitmap() const { return (0L != mpBitmap); } - bool isColor() const { return (!mpGradient && !mpHatch && !mpBitmap); } - bool isVisible() const { return (1.0 != mfTransparence); } - - // data access - double getTransparence() const { return mfTransparence; } - const basegfx::BColor& getColor() const { return maColor; } - const FillGradientAttribute* getGradient() const { return mpGradient; } - const FillHatchAttribute* getHatch() const { return mpHatch; } - const SdrFillBitmapAttribute* getBitmap() const { return mpBitmap; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx deleted file mode 100644 index fd72f09c00f1..000000000000 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute3d.hxx +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute3d.hxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX -#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DObjectAttribute - { - // 3D object attribute definitions - ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) - ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) - ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) - ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) - MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity - - // bitfield - unsigned mbNormalsInvert : 1; // invert normals - unsigned mbDoubleSided : 1; // surfaces are double sided - unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene - unsigned mbTextureFilter : 1; // filter texture to make more smooth - unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) - - public: - Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry); - - // compare operator - bool operator==(const Sdr3DObjectAttribute& rCandidate) const; - - // data access - ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } - ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } - ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } - ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } - const MaterialAttribute3D& getMaterial() const { return maMaterial; } - bool getNormalsInvert() const { return mbNormalsInvert; } - bool getDoubleSided() const { return mbDoubleSided; } - bool getShadow3D() const { return mbShadow3D; } - bool getTextureFilter() const { return mbTextureFilter; } - bool getReducedLineGeometry() const { return mbReducedLineGeometry; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class Sdr3DLightAttribute - { - // 3D light attribute definitions - basegfx::BColor maColor; - basegfx::B3DVector maDirection; - - // bitfield - unsigned mbSpecular : 1; - - public: - Sdr3DLightAttribute( - const basegfx::BColor& rColor, - const basegfx::B3DVector& rDirection, - bool bSpecular); - - // compare operator - bool operator==(const Sdr3DLightAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::B3DVector& getDirection() const { return maDirection; } - bool getSpecular() const { return mbSpecular; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLightingAttribute - { - // 3D light attribute definitions - basegfx::BColor maAmbientLight; - ::std::vector< Sdr3DLightAttribute > maLightVector; - - public: - SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector); - - // compare operator - bool operator==(const SdrLightingAttribute& rCandidate) const; - - // data access - const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } - const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } - - // color model solver - basegfx::BColor solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrSceneAttribute - { - // 3D scene attribute definitions - double mfDistance; - double mfShadowSlant; - ::com::sun::star::drawing::ProjectionMode maProjectionMode; - ::com::sun::star::drawing::ShadeMode maShadeMode; - - // bitfield - unsigned mbTwoSidedLighting : 1; - - public: - SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting); - - // compare operator - bool operator==(const SdrSceneAttribute& rCandidate) const; - - // data access - double getDistance() const { return mfDistance; } - double getShadowSlant() const { return mfShadowSlant; } - ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } - ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } - bool getTwoSidedLighting() const { return mbTwoSidedLighting; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRATTRIBUTE3D_HXX - -// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx new file mode 100644 index 000000000000..6ae2084d1d30 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillattribute.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrFillAttribute; + class FillGradientAttribute; + class FillHatchAttribute; + class SdrFillBitmapAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillAttribute + { + private: + ImpSdrFillAttribute* mpSdrFillAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap); + SdrFillAttribute(); + SdrFillAttribute(const SdrFillAttribute& rCandidate); + SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate); + ~SdrFillAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillAttribute& rCandidate) const; + + // data read access + double getTransparence() const; + const basegfx::BColor& getColor() const; + const FillGradientAttribute& getGradient() const; + const FillHatchAttribute& getHatch() const; + const SdrFillBitmapAttribute& getBitmap() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx index 67fef6ea7e3d..ce9d9e23a086 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrfillbitmapattribute.hxx @@ -36,21 +36,23 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines -class SfxItemSet; -namespace drawinglayer { namespace attribute { - class FillBitmapAttribute; -}} +class Bitmap; namespace basegfx { class B2DRange; + class B2DVector; } +namespace drawinglayer { namespace attribute { + class FillBitmapAttribute; + class ImpSdrFillBitmapAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -59,27 +61,42 @@ namespace drawinglayer { class SdrFillBitmapAttribute { - Bitmap maBitmap; - basegfx::B2DVector maSize; - basegfx::B2DVector maOffset; - basegfx::B2DVector maOffsetPosition; - basegfx::B2DVector maRectPoint; - - // bitfield - unsigned mbTiling : 1; - unsigned mbStretch : 1; - unsigned mbLogSize : 1; + private: + ImpSdrFillBitmapAttribute* mpSdrFillBitmapAttribute; public: + /// constructors/assignmentoperator/destructor SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize); + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize); + SdrFillBitmapAttribute(); + SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate); + SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate); + ~SdrFillBitmapAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator bool operator==(const SdrFillBitmapAttribute& rCandidate) const; - // data access - const Bitmap& getBitmap() const { return maBitmap; } - bool getTiling() const { return mbTiling; } + // data read access + const Bitmap& getBitmap() const; + const basegfx::B2DVector& getSize() const; + const basegfx::B2DVector& getOffset() const; + const basegfx::B2DVector& getOffsetPosition() const; + const basegfx::B2DVector& getRectPoint() const; + bool getTiling() const; + bool getStretch() const; + bool getLogSize() const; + + // FillBitmapAttribute generator FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx new file mode 100644 index 000000000000..aad8c6ff62ec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightattribute3d.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DLightAttribute + { + private: + ImpSdr3DLightAttribute* mpSdr3DLightAttribute; + + public: + // constructors/destructor + Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular); + Sdr3DLightAttribute(const basegfx::BColor& rColor); + Sdr3DLightAttribute(); + Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate); + ~Sdr3DLightAttribute(); + + // assignment operator + Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DLightAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getColor() const; + const basegfx::B3DVector& getDirection() const; + bool getSpecular() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx new file mode 100644 index 000000000000..b4c84d7cc1b0 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B3DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLightingAttribute; + class Sdr3DLightAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLightingAttribute + { + private: + ImpSdrLightingAttribute* mpSdrLightingAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector); + SdrLightingAttribute(); + SdrLightingAttribute(const SdrLightingAttribute& rCandidate); + SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate); + ~SdrLightingAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLightingAttribute& rCandidate) const; + + // data read access + const basegfx::BColor& getAmbientLight() const; + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const; + + // color model solver + basegfx::BColor solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx new file mode 100644 index 000000000000..5df511995e9f --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlineattribute.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineAttribute + { + private: + ImpSdrLineAttribute* mpSdrLineAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen); + SdrLineAttribute(const basegfx::BColor& rColor); + SdrLineAttribute(); + SdrLineAttribute(const SdrLineAttribute& rCandidate); + SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate); + ~SdrLineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineAttribute& rCandidate) const; + + // data access + basegfx::B2DLineJoin getJoin() const; + double getWidth() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + const ::std::vector< double >& getDotDashArray() const; + double getFullDotDashLen() const; + + // bool access + bool isDashed() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx new file mode 100644 index 000000000000..76bd836ac770 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrlinestartendattribute.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrLineStartEndAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineStartEndAttribute + { + private: + ImpSdrLineStartEndAttribute* mpSdrLineStartEndAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered); + SdrLineStartEndAttribute(); + SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate); + SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute& rCandidate); + ~SdrLineStartEndAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineStartEndAttribute& rCandidate) const; + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const; + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const; + double getStartWidth() const; + double getEndWidth() const; + bool isStartActive() const; + bool isEndActive() const; + bool isStartCentered() const; + bool isEndCentered() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx new file mode 100644 index 000000000000..d5ee84e8cfec --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrobjectattribute3d.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdr3DObjectAttribute; + class MaterialAttribute3D; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class Sdr3DObjectAttribute + { + private: + ImpSdr3DObjectAttribute* mpSdr3DObjectAttribute; + + public: + // constructors/destructor + Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry); + Sdr3DObjectAttribute(); + Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate); + ~Sdr3DObjectAttribute(); + + // assignment operator + Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const Sdr3DObjectAttribute& rCandidate) const; + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const; + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const; + ::com::sun::star::drawing::TextureKind2 getTextureKind() const; + ::com::sun::star::drawing::TextureMode getTextureMode() const; + const MaterialAttribute3D& getMaterial() const; + bool getNormalsInvert() const; + bool getDoubleSided() const; + bool getShadow3D() const; + bool getTextureFilter() const; + bool getReducedLineGeometry() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx new file mode 100644 index 000000000000..7b25b6c48666 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrsceneattribute3d.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrSceneAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrSceneAttribute + { + private: + ImpSdrSceneAttribute* mpSdrSceneAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting); + SdrSceneAttribute(); + SdrSceneAttribute(const SdrSceneAttribute& rCandidate); + SdrSceneAttribute& operator=(const SdrSceneAttribute& rCandidate); + ~SdrSceneAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrSceneAttribute& rCandidate) const; + + // data read access + double getDistance() const; + double getShadowSlant() const; + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const; + ::com::sun::star::drawing::ShadeMode getShadeMode() const; + bool getTwoSidedLighting() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx new file mode 100644 index 000000000000..72bdcd2af2c2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/sdrshadowattribute.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.hxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; + class B2DVector; +} + +namespace drawinglayer { namespace attribute { + class ImpSdrShadowAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowAttribute + { + private: + ImpSdrShadowAttribute* mpSdrShadowAttribute; + + public: + /// constructors/assignmentoperator/destructor + SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor); + SdrShadowAttribute(); + SdrShadowAttribute(const SdrShadowAttribute& rCandidate); + SdrShadowAttribute& operator=(const SdrShadowAttribute& rCandidate); + ~SdrShadowAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowAttribute& rCandidate) const; + + // data access + const basegfx::B2DVector& getOffset() const; + double getTransparence() const; + const basegfx::BColor& getColor() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx index efe59d1eb9e5..e24ad09d3d6a 100644 --- a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx @@ -36,13 +36,16 @@ #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX -#include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// // predefines +namespace drawinglayer { namespace attribute { + class ImpStrokeAttribute; +}} + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -52,49 +55,26 @@ namespace drawinglayer class StrokeAttribute { private: - ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern - double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + ImpStrokeAttribute* mpStrokeAttribute; public: + /// constructors/assignmentoperator/destructor StrokeAttribute( const ::std::vector< double >& rDotDashArray, - double fFullDotDashLen = 0.0) - : maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - StrokeAttribute() - : maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - StrokeAttribute(const StrokeAttribute& rCandidate) - { - *this = rCandidate; - } - - StrokeAttribute& operator=(const StrokeAttribute& rCandidate) - { - maDotDashArray = rCandidate.maDotDashArray; - mfFullDotDashLen = rCandidate.mfFullDotDashLen; - return *this; - } + double fFullDotDashLen = 0.0); + StrokeAttribute(); + StrokeAttribute(const StrokeAttribute& rCandidate); + StrokeAttribute& operator=(const StrokeAttribute& rCandidate); + ~StrokeAttribute(); - ~StrokeAttribute() - { - } + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator - bool operator==(const StrokeAttribute& rCandidate) const - { - return (mfFullDotDashLen == rCandidate.mfFullDotDashLen - && maDotDashArray == rCandidate.maDotDashArray); - } + bool operator==(const StrokeAttribute& rCandidate) const; - // data access - const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + // data read access + const ::std::vector< double >& getDotDashArray() const; double getFullDotDashLen() const; }; } // end of namespace attribute diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx index 0a87b268c8b1..c7cd87df6ffd 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation2d.hxx @@ -122,12 +122,18 @@ namespace drawinglayer */ ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation2D(); + /// copy constructor ViewInformation2D(const ViewInformation2D& rCandidate); /// destructor ~ViewInformation2D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation2D& operator=(const ViewInformation2D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx index 605c26733cf3..a76ee2e21226 100644 --- a/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx +++ b/drawinglayer/inc/drawinglayer/geometry/viewinformation3d.hxx @@ -127,12 +127,18 @@ namespace drawinglayer */ ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters); + /// default (empty) constructor + ViewInformation3D(); + /// copy constructor ViewInformation3D(const ViewInformation3D& rCandidate); /// destructor ~ViewInformation3D(); + // checks if the incarnation is default constructed + bool isDefault() const; + /// assignment operator ViewInformation3D& operator=(const ViewInformation3D& rCandidate); diff --git a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx deleted file mode 100644 index 10288b70bd1b..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/alphaprimitive2d.hxx +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: alphaprimitive2d.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** AlphaPrimitive2D class - - This is the basic primitive for applying freely defined transparence - to freely defined content. The basic idea is to associate a content - which is defined as a sequence of primitives and hold as child content - in the GroupPrimitive2D with an alpha channel also defined as a sequence - of primitives and hold in the Alpha member. - - The basic definition is to use the Alpha content as Alpha-Mask by - interpreting the Alpha-content not as RGB, but as Luminance alpha mask - using the common RGB_to_luminance definition as e.g. used by VCL. - - The defining geometry is the Range of the child primitive sequence, - this means the renderers will/shall use this geometric information for - rendering, not the alpha one. The alpha one should/will be clipped - accordingly. - */ - class AlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// The Alpha-Mask who's RGB-Values are interpreted as Luminance - Primitive2DSequence maAlpha; - - public: - /** constructor - - @param rChildren - The content which is defined to have a transparency. The - range of this primitive is defined by this content - - @param rAlpha - The definition of the Alpha-channel for this primitive. It - will be interpreted as mask by interpreting as gray values - using the common RGB_to_luminance definitions - */ - AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha); - - /// data read access - const Primitive2DSequence& getAlpha() const { return maAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx index 6cf45ffefe54..254d535f9060 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/baseprimitive2d.hxx @@ -110,14 +110,16 @@ namespace drawinglayer Current Basic 2D Primitives are: - - BitmapPrimitive2D (bitmap data, evtl. with alpha) - - MetafilePrimitive2D (VCL Metafile, currently no decomposition, but planned, so may vanish) + - BitmapPrimitive2D (bitmap data, evtl. with transparence) - PointArrayPrimitive2D (single points) - PolygonHairlinePrimitive2D (hairline curves/polygons) - PolyPolygonColorPrimitive2D (colored polygons) + UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since + it is implemented with the integration of CWS aw078 into DV300m69. + All other implemented primitives have a defined decomposition and can thus be - decomposed downt to this small set. + decomposed down to this small set. A renderer implementing support for this minimal set of primitives can completely render primitive-based visualisations. Of course, he also has to take states into account diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index d287482389b5..88848207dae4 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -48,7 +48,7 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE2D_ID_ALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0) #define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1) #define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2) #define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3) @@ -83,7 +83,7 @@ #define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32) #define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33) #define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34) -#define PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) +#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35) #define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36) #define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37) #define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38) @@ -101,14 +101,14 @@ #define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) #define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) #define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) -#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) -#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) -#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) -#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) -#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) -#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) -#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) -#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) +#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) +#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54) +#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55) +#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56) +#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57) +#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58) +#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59) +#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx index 0fd084c6fad0..0c6a28f29b41 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillgradientprimitive2d.hxx @@ -37,7 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX #include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index 1df3bb103eb0..a6640d67b877 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -37,7 +37,8 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // FillHatchPrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx index 4ba83fc75c88..2dee07dd6de9 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/gridprimitive2d.hxx @@ -74,7 +74,7 @@ namespace drawinglayer /// Grid color for single-pixel grid points basegfx::BColor maBColor; - /// The Bitmap (with alpha) for grid cross points + /// The Bitmap (with transparence) for grid cross points BitmapEx maCrossMarker; /** the last used object to view transformtion and the last Viewport, diff --git a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx index 89b49420a3e7..0fe7c1903815 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/groupprimitive2d.hxx @@ -71,7 +71,7 @@ namespace drawinglayer Current Basic 2D StatePrimitives are: - - AlphaPrimitive2D (objects with freely defined transparence) + - TransparencePrimitive2D (objects with freely defined transparence) - InvertPrimitive2D (for XOR) - MaskPrimitive2D (for masking) - ModifiedColorPrimitive2D (for a stack of color modifications) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx new file mode 100644 index 000000000000..08ddd8237688 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a PresObj's outline. To still be able to use primitives for HitTest + // functionality, the 2d decompositions will produce an as much as possible + // simplified line geometry encapsulated in this primtive when there is no + // line geometry. In a further enchanced version this may change to 'if neither + // filled nor lines' creation criteria. The whole primitive decomposes to nothing, + // so no one not knowing it will be influenced. Only helper processors for hit test + // (and maybe BoundRect extractors) will use it and it's children subcontent. + class HiddenGeometryPrimitive2D : public GroupPrimitive2D + { + public: + HiddenGeometryPrimitive2D(const Primitive2DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// local decomposition. Implementation will return empty Primitive2DSequence + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx deleted file mode 100644 index 3b69c685c985..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/hittestprimitive2d.hxx +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.hxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** HitTestPrimitive2D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a PresObj's outline. To still be able to use primitives for HitTest - functionality, the 2d decompositions will produce an as much as possible - simplified line geometry encapsulated in this primtive when there is no - line geometry. In a further enchanced version this may change to 'if neither - filled nor lines' creation criteria. The whole primitive decomposes to nothing, - so no one not knowing it will be influenced. Only helper processors for hit test - (and maybe BoundRect extractors) will use it and it's children subcontent. - */ - class HitTestPrimitive2D : public GroupPrimitive2D - { - public: - /// constructor - HitTestPrimitive2D(const Primitive2DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive2DSequence - since this is no visualisation data - */ - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HITTESTPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx index 85f1c6510c5a..b7c47268dd5d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/invertprimitive2d.hxx @@ -2,7 +2,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unifiedalphaprimitive2d.hxx,v $ + * $RCSfile: UnifiedTransparencePrimitive2D.hxx,v $ * * $Revision: 1.3 $ * diff --git a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx index cc4c054f8bb3..0e525ef691d3 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/markerarrayprimitive2d.hxx @@ -55,7 +55,7 @@ namespace drawinglayer invariant, so that the bitmap is always visualized unscaled and unrotated. It is used e.g. for grid position visualisation. The given Bitmap - (with alpha) is defined to be visible centered at each of the given + (with transparence) is defined to be visible centered at each of the given positions. It decomposes to the needed number of BitmapPrimitive2D's, so it would be efficient to handle it directly in a renderer. diff --git a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx index 0cbd7e4628cb..0f25ce069021 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/metafileprimitive2d.hxx @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - /** MediaPrimitive2D class + /** MetafilePrimitive2D class This is the MetaFile representing primitive. It's geometry is defined by MetaFileTransform. The content (defined by MetaFile) will be scaled diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 4c6f5b49bf01..2ffa1b01e243 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -41,6 +41,8 @@ #include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// // PolygonHairlinePrimitive2D class diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 187e89f42e97..07e6849ff1fc 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -37,12 +37,14 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // PolyPolygonHairlinePrimitive2D class @@ -409,7 +411,7 @@ namespace drawinglayer /** PolyPolygonBitmapPrimitive2D class This primitive defines a PolyPolygon filled with bitmap data - (including alpha). The decomosition will create a MaskPrimitive2D + (including transparence). The decomosition will create a MaskPrimitive2D containing a FillBitmapPrimitive2D. */ class PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 65d2bdf67f92..96d58cc0ca10 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -38,10 +38,12 @@ #include #include -#include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx new file mode 100644 index 000000000000..e27a3b2b7725 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.hxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:18 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class B2DPolyPolygon; + class B2DHomMatrix; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // helpers to create HitTestPrimitives Line + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix); + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolygon, + const basegfx::B2DHomMatrix& rMatrix); + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx new file mode 100644 index 000000000000..85032d0bd202 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/transparenceprimitive2d.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** TransparencePrimitive2D class + + This is the basic primitive for applying freely defined transparence + to freely defined content. The basic idea is to associate a content + which is defined as a sequence of primitives and hold as child content + in the GroupPrimitive2D with a transparence channel also defined as a sequence + of primitives and hold in the transparence member. + + The basic definition is to use the transparence content as transparence-Mask by + interpreting the transparence-content not as RGB, but as Luminance transparence mask + using the common RGB_to_luminance definition as e.g. used by VCL. + + The defining geometry is the Range of the child primitive sequence, + this means the renderers will/shall use this geometric information for + rendering, not the transparent one. The transparent one should/will be clipped + accordingly. + */ + class TransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// The transparence-Mask who's RGB-Values are interpreted as Luminance + Primitive2DSequence maTransparence; + + public: + /** constructor + + @param rChildren + The content which is defined to have a transparency. The + range of this primitive is defined by this content + + @param rTransparence + The definition of the Transparence-channel for this primitive. It + will be interpreted as mask by interpreting as gray values + using the common RGB_to_luminance definitions + */ + TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence); + + /// data read access + const Primitive2DSequence& getTransparence() const { return maTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx deleted file mode 100644 index 6e8970e7bee5..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unifiedalphaprimitive2d.hxx,v $ - * - * $Revision: 1.3 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - /** UnifiedAlphaPrimitive2D class - - This primitive encapsualtes a child hierarchy and defines - that it shall be visualized with the given transparency. That - transparency is unique for all contained geometry, so that - e.g. overlapping polygons in the child geometry will not show - regions of combined transparency, but be all rendered with the - defined, single transparency. - */ - class UnifiedAlphaPrimitive2D : public GroupPrimitive2D - { - private: - /// the unified alpha transparence - double mfAlpha; - - public: - /// constructor - UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha); - - /// data read access - double getAlpha() const { return mfAlpha; } - - /// compare operator - virtual bool operator==(const BasePrimitive2D& rPrimitive) const; - - /// create decomposition - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive2DIDBlock() - }; - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDALPHAPRIMITIVE2D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx new file mode 100644 index 000000000000..52f3747ddba2 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.hxx,v $ + * + * $Revision: 1.3 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:17 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + /** UnifiedTransparencePrimitive2D class + + This primitive encapsualtes a child hierarchy and defines + that it shall be visualized with the given transparency. That + transparency is unique for all contained geometry, so that + e.g. overlapping polygons in the child geometry will not show + regions of combined transparency, but be all rendered with the + defined, single transparency. + */ + class UnifiedTransparencePrimitive2D : public GroupPrimitive2D + { + private: + /// the unified transparence + double mfTransparence; + + public: + /// constructor + UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence); + + /// data read access + double getTransparence() const { return mfTransparence; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// own getB2DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// create decomposition + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx index f5a851b0b053..f5d6a92cff68 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx @@ -45,25 +45,25 @@ ////////////////////////////////////////////////////////////////////////////// // local primitives -#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) -#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) -#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) -#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) -#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) -#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) -#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) -#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) -#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) -#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) -#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) -#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) -#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) -#define PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) -#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) -#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) -#define PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) -#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) -#define PRIMITIVE3D_ID_HITTESTPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) +#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0) +#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1) +#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2) +#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3) +#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4) +#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5) +#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6) +#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7) +#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8) +#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9) +#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10) +#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11) +#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12) +#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13) +#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14) +#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15) +#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16) +#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17) +#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx index 69e406c75d67..8e7004be5b51 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/groupprimitive3d.hxx @@ -59,7 +59,7 @@ namespace drawinglayer - TexturePrimitive3D (with the following variations) - GradientTexturePrimitive3D (for 3D gradient fill) - BitmapTexturePrimitive3D (for 3D Bitmap fill) - - AlphaTexturePrimitive3D (for 3D transparence) + - TransparenceTexturePrimitive3D (for 3D transparence) - HatchTexturePrimitive3D (for 3D hatch fill) - TransformPrimitive3D (for a transformation stack) */ diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx index 2675a1284779..d63125d8cc29 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx @@ -37,6 +37,7 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX #include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx new file mode 100644 index 000000000000..287bfcc689e4 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.hxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + // This primitive is used to represent geometry for non-visible objects, + // e.g. a 3D cube without fill attributes. To still be able to use + // primitives for HitTest functionality, the 3d decompositions produce + // an as much as possible simplified fill geometry encapsulated in this + // primtive when there is no fill geometry. Currently, the 3d hit test + // uses only areas, so maybe in a further enchanced version this will change + // to 'if neither filled nor lines' creation criteria. The whole primitive + // decomposes to nothing, so no one not knowing it will be influenced. Only + // helper processors for hit test (and maybe BoundRect extractors) will + // use it and it's children subcontent. + class HiddenGeometryPrimitive3D : public GroupPrimitive3D + { + public: + HiddenGeometryPrimitive3D(const Primitive3DSequence& rChildren); + + // despite returning an empty decomposition since it's no visualisation data, + // range calculation is intended to use hidden geometry, so + // the local implementation will return the children's range + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + + /// The default implementation returns an empty sequence + virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive3DIDBlock() + }; + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx deleted file mode 100644 index 4779241033b0..000000000000 --- a/drawinglayer/inc/drawinglayer/primitive3d/hittestprimitive3d.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.hxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/24 14:27:39 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX -#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - /** HitTestPrimitive3D class - - This primitive is used to represent geometry for non-visible objects, - e.g. a 3D cube without fill attributes. To still be able to use - primitives for HitTest functionality, the 3d decompositions produce - an as much as possible simplified fill geometry encapsulated in this - primtive when there is no fill geometry. Currently, the 3d hit test - uses only areas, so maybe in a further enchanced version this will change - to 'if neither filled nor lines' creation criteria. The whole primitive - decomposes to nothing, so no one not knowing it will be influenced. Only - helper processors for hit test (and maybe BoundRect extractors) will - use it and it's children subcontent. - */ - class HitTestPrimitive3D : public GroupPrimitive3D - { - public: - /// constructor - HitTestPrimitive3D(const Primitive3DSequence& rChildren); - - /** despite returning an empty decomposition since it's no visualisation data, - range calculation is intended to use invisible replacement geometry, so - the local implementation will return the children's range - */ - virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; - - /** local decomposition. Implementation will return empty Primitive3DSequence - since this is no visualisation data - */ - virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; - - /// provide unique ID - DeclPrimitrive3DIDBlock() - }; - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HITTESTPRIMITIVE3D_HXX - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx index b3a57f2677dc..8d0e5512f8fa 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx @@ -61,7 +61,7 @@ namespace drawinglayer SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx index 5b793a6928f8..f9710b4b70a7 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx @@ -89,13 +89,20 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive3DSequence createShadowPrimitive3D( const Primitive3DSequence& rSource, const attribute::SdrShadowAttribute& rShadow, bool bShadow3D); - } // end of namespace overlay + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute); + + } // end of namespace primitive3d } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx index a810e0f5ec8e..9531e5ffa0b9 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx @@ -95,7 +95,7 @@ namespace drawinglayer SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx index 084ce5bce35e..5e429e595d7f 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx @@ -109,7 +109,7 @@ namespace drawinglayer SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx index a6c68bd16da8..6c1a677675a0 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx @@ -70,7 +70,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data access diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx index 4dd620848387..0a4301d2c00d 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrprimitive3d.hxx @@ -40,8 +40,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ namespace drawinglayer /// object surface attributes basegfx::B3DHomMatrix maTransform; basegfx::B2DVector maTextureSize; - attribute::SdrLineFillShadowAttribute maSdrLFSAttribute; + attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute; attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute; protected: @@ -80,13 +80,13 @@ namespace drawinglayer SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute); /// data read access const basegfx::B3DHomMatrix& getTransform() const { return maTransform; } const basegfx::B2DVector& getTextureSize() const { return maTextureSize; } - const attribute::SdrLineFillShadowAttribute& getSdrLFSAttribute() const { return maSdrLFSAttribute; } + const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; } const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; } /// compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx index 52e646e6b4dc..0bd1cf7f3e17 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx @@ -66,7 +66,7 @@ namespace drawinglayer SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments); diff --git a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx index f8b81e357ea5..8825c76f6d6c 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx @@ -37,9 +37,10 @@ #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX #include -#include #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -91,13 +92,13 @@ namespace drawinglayer { namespace primitive3d { - /** UnifiedAlphaTexturePrimitive3D class + /** UnifiedTransparenceTexturePrimitive3D class This 3D primitive expands TexturePrimitive3D to a unified - alpha (transparence) texture definition. All 3D primitives + transparence texture definition. All 3D primitives embedded here will be shown with the given transparency. */ - class UnifiedAlphaTexturePrimitive3D : public TexturePrimitive3D + class UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D { private: /// transparency definition @@ -105,7 +106,7 @@ namespace drawinglayer public: /// constructor - UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren); @@ -115,6 +116,9 @@ namespace drawinglayer /// compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; + /// own getB3DRange implementation to include transparent geometries to BoundRect calculations + virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const; + /// local decomposition. virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const; @@ -208,18 +212,18 @@ namespace drawinglayer { namespace primitive3d { - /** AlphaTexturePrimitive3D class + /** TransparenceTexturePrimitive3D class - This 3D primitive expands TexturePrimitive3D to a alpha texture - definition. For alpha definition, a gradient is used. The values in - that gradient will be interpreted as luminance Alpha-Values. All 3D + This 3D primitive expands TexturePrimitive3D to a transparence texture + definition. For transparence definition, a gradient is used. The values in + that gradient will be interpreted as luminance Transparence-Values. All 3D primitives embedded here will be shown with the defined transparence. */ - class AlphaTexturePrimitive3D : public GradientTexturePrimitive3D + class TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D { public: /// constructor - AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize); diff --git a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx index fceae8dbeb31..58b5601f6242 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/baseprocessor2d.hxx @@ -45,30 +45,159 @@ namespace drawinglayer { namespace processor2d { + /** BaseProcessor2D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Instances which process primitives can be renderers, but also stuff + for HitTests, BoundRect calculations and/or animation processing. The + main usage are renderers, but they are supposed to handle any primitive + processing. + + The base implementation is constructed with a ViewInformation2D which + is accessible throughout the processor implementations. The idea is + to construct any processor with a given ViewInformation2D. To be able + to handle primitives which need to change the current transformation + (as e.g. TransformPrimitive2D) it is allowed for the processor implementation + to change tis local value using updateViewInformation. + + The basic processing method is process(..) which gets handed over the + sequence of primitives to process. For convenience of the C++ implementations, + the default implementation of process(..) maps all accesses to primitives to + single calls to processBasePrimitive2D(..) where the primitive in question is + already casted to the C++ implementation class. + + The process(..) implementation makes a complete iteration over the given + sequence of primitives. If the Primitive is not derived from BasePrimitive2D + and thus not part of the C++ implementations, it converts ViewInformation2D + to the corresponding API implementation (an uno::Sequence< beans::PropertyValue >) + and recursively calls the method process(..) at the primitive with the decomposition + derived from that primitive. This is the preparation to handle unknown implementations + of the com::sun::star::graphic::XPrimitive2D interface in the future. + + So, to implement a basic processor, it is necessary to overload and implement the + processBasePrimitive2D(..) method. A minimal renderer has to support the + Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see + groupprimitive2d.hxx). These are (currently): + + Basic Primitives: + + - BitmapPrimitive2D (bitmap data, evtl. with transparence) + - PointArrayPrimitive2D (single points) + - PolygonHairlinePrimitive2D (hairline curves/polygons) + - PolyPolygonColorPrimitive2D (colored polygons) + + Grouping Primitives: + + - TransparencePrimitive2D (objects with freely defined transparence) + - InvertPrimitive2D (for XOR) + - MaskPrimitive2D (for masking) + - ModifiedColorPrimitive2D (for a stack of color modifications) + - TransformPrimitive2D (for a transformation stack) + + A processor doing so is a minimal processor. Of course a processor may + handle any higher-level prmitive (that has a decomposition implementation) + for more direct data access or performance reasons, too. + + The main part of a processBasePrimitive2D implementation is a switch..case + construct, looking like the following: + + void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate) + { + switch(rCandidate.getPrimitive2DID()) + { + case PRIMITIVE2D_ID_??? : + { + // process PRIMITIVE2D_ID_??? here... + + ... + + break; + } + + ... + + default : + { + // process recursively + process(rCandidate.get2DDecomposition(getViewInformation2D())); + break; + } + } + } + + The default case makes the processor work with all complex primitives + by recursively using their decomposition. + + You can also add a case for ignoring primitives by using: + + case PRIMITIVE2D_ID_...IGNORE.A.. : + case PRIMITIVE2D_ID_...IGNORE.B.. : + case PRIMITIVE2D_ID_...IGNORE.C.. : + { + // ignore these primitives by neither processing nor + // recursively processing their decomposition + break; + } + + Another useful case is embedding the processing of a complex primitive by + bracketing it with some actions: + + case PRIMITIVE2D_ID_SOME_TEXT : + { + // encapsulate e.g. with changing local varibles, e.g. + // sometimes it's good to know if a basic primitive is + // part of a text, especially when not handling the text + // self but by purpose want to handle the decomposed + // geometries in the processor + startText(); + process(rCandidate.get2DDecomposition(getViewInformation2D())); + endText(); + break; + } + + As an example a processor collecting the outlines of a sequence of primitives + only needs to handle some Basic Primitives and create outline and collect + outline polygons e.g. for primitives with area like BitmapPrimitive2D (a + rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping + Primitives MaskPrimitive2D (e.g. ignoring it's content, using the mask polyPolygon) + and TransformPrimitive2D (to have the correct local transformation), a processor + creating the outline can be written using just four (4) primitives. As a tipp, it can + be helpful to add many for the purpose not interesting higher level primitives + to not force their decomposition to be created and/or parsed. + */ class BaseProcessor2D { private: + /// The ViewInformation2D itself. It's private to isolate accesses to it geometry::ViewInformation2D maViewInformation2D; protected: + /* access method to allow the implementations to change the current + ViewInformation2D if needed. This allows isolating these accesses + later if needed + */ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D) { maViewInformation2D = rViewInformation2D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive2D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive2D-based. + Default implementation does nothing + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: + /// constructor/destructor BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation); virtual ~BaseProcessor2D(); - // the central processing method + /// the central processing method virtual void process(const primitive2d::Primitive2DSequence& rSource); - // data access + /// data read access const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; } }; } // end of namespace processor2d @@ -76,6 +205,44 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +namespace drawinglayer +{ + namespace processor2d + { + /** CollectingProcessor2D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive2DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ + class CollectingProcessor2D : public BaseProcessor2D + { + private: + primitive2d::Primitive2DSequence maPrimitive2DSequence; + + public: + CollectingProcessor2D(const geometry::ViewInformation2D& rViewInformation); + virtual ~CollectingProcessor2D(); + + /// the central processing method + virtual void process(const primitive2d::Primitive2DSequence& rSource); + + /// helpers for adding to local sequence + void appendPrimitive2DReference(const primitive2d::Primitive2DReference& rSource) + { + primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, rSource); + } + + /// data access and reset + const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } + void reset() { maPrimitive2DSequence = primitive2d::Primitive2DSequence(); } + }; + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + #endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX // eof diff --git a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx index 0c356e731169..13f1d540c239 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/canvasprocessor.hxx @@ -64,10 +64,10 @@ namespace drawinglayer { namespace primitive2d { class MetafilePrimitive2D; class TextSimplePortionPrimitive2D; class BitmapPrimitive2D; - class AlphaPrimitive2D; + class TransparencePrimitive2D; class PolygonStrokePrimitive2D; class FillBitmapPrimitive2D; - class UnifiedAlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; }} ////////////////////////////////////////////////////////////////////////////// @@ -76,6 +76,11 @@ namespace drawinglayer { namespace processor2d { + /** canvasProcessor2D class + + A basic implementation of a renderer for com::sun::star::rendering::XCanvas + as a target + */ class canvasProcessor2D : public BaseProcessor2D { private: @@ -111,10 +116,10 @@ namespace drawinglayer void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate); void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate); void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate); - void impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate); + void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate); void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive); void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D); - void impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate); + void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate); public: canvasProcessor2D( diff --git a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx index dbe85fab07c5..9d4dd48f8dff 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/contourextractor2d.hxx @@ -46,13 +46,18 @@ namespace drawinglayer { namespace processor2d { + /** ContourExtractor2D class + + A processor who extracts the contour of the primtives feeded to it + in the single local PolyPolygon + */ class ContourExtractor2D : public BaseProcessor2D { private: - // the extracted contour + /// the extracted contour std::vector< basegfx::B2DPolyPolygon > maExtractedContour; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx index c0ab33052883..640ec11260c3 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/hittestprocessor2d.hxx @@ -51,29 +51,36 @@ namespace drawinglayer { namespace processor2d { + /** HitTestProcessor2D class + + This processor implements a HitTest with the feeded primitives, + given tolerance and extras + */ class HitTestProcessor2D : public BaseProcessor2D { private: - // discrete HitTest position + /// discrete HitTest position basegfx::B2DPoint maDiscreteHitPosition; - // discrete HitTolerance + /// discrete HitTolerance double mfDiscreteHitTolerance; - // bitfield + /// bitfield unsigned mbHit : 1; unsigned mbHitToleranceUsed : 1; - // this flag decides if primitives of type HitTestPrimitive2D - // will be taken into account for HitTesting or not. Those primitives - // are created for objects which are else completely invisible and normally - // their content exists of hairline primitives describing the object's contour - unsigned mbUseHitTestPrimitiveContent : 1; + /* this flag decides if primitives which are embedded to an + UnifiedTransparencePrimitive2D and are invisible will be taken into account for + HitTesting or not. Those primitives are created for objects which are else + completely invisible and normally their content exists of hairline + primitives describing the object's contour + */ + unsigned mbUseInvisiblePrimitiveContent : 1; - // flag to concentraze on text hits only + /// flag to concentraze on text hits only unsigned mbHitTextOnly : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); bool checkHairlineHitWithTolerance( const basegfx::B2DPolygon& rPolygon, @@ -91,18 +98,18 @@ namespace drawinglayer bool bHitTextOnly); virtual ~HitTestProcessor2D(); - // data write access - void setUseHitTestPrimitiveContent(bool bNew) + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) { - if((bool)mbUseHitTestPrimitiveContent != bNew) mbUseHitTestPrimitiveContent = bNew; + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; } - // data read access + /// data read access const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; } double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; } bool getHit() const { return mbHit; } bool getHitToleranceUsed() const { return mbHitToleranceUsed; } - bool getUseHitTestPrimitiveContent() const { return mbUseHitTestPrimitiveContent;} + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} bool getHitTextOnly() const { return mbHitTextOnly; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx index b2697abece66..8162bb0934f4 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -45,16 +45,21 @@ namespace drawinglayer { namespace processor2d { + /** LineGeometryExtractor2D class + + This processor can extract the line geometry from feeded primpitives. The + hairlines and the fille geometry from fat lines are separated. + */ class LineGeometryExtractor2D : public BaseProcessor2D { private: std::vector< basegfx::B2DPolygon > maExtractedHairlines; std::vector< basegfx::B2DPolyPolygon > maExtractedLineFills; - // bitfield + /// bitfield unsigned mbInLineGeometry : 1; - // tooling methods + /// tooling methods void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: diff --git a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx index 88d9416b612a..77fa9432539d 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx @@ -48,7 +48,7 @@ namespace drawinglayer { namespace processor2d { - // helper data structure for returning the result + /// helper data structure for returning the result struct TextAsPolygonDataNode { private: @@ -73,9 +73,13 @@ namespace drawinglayer bool getIsFilled() const { return mbIsFilled; } }; - // typedef for a vector of that helper data + /// typedef for a vector of that helper data typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector; + /** TextAsPolygonExtractor2D class + + This processor extracts text in the feeded primitives to filled polygons + */ class TextAsPolygonExtractor2D : public BaseProcessor2D { private: diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index 38e7e5143b8a..66af45a7c6ce 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -47,6 +47,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class GDIMetaFile; class Rectangle; class Gradient; @@ -70,10 +71,22 @@ namespace drawinglayer { namespace processor2d { + /** VclMetafileProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a classical VCL-Metafile, including all over the + time grown extra data in comments and PDF exception data creations. Also + printing needs some exception stuff. + + All in all it is needed to emulate the old ::paint output from the old + Drawinglayer as long as exporters and/or filters still use the Metafile + and the extra-data added to it (which can be seen mostly as 'extensions' + or simply as 'hacks'). + */ class VclMetafileProcessor2D : public VclProcessor2D { private: - // local helper(s) + /// local helper(s) Rectangle impDumpToMetaFile( const primitive2d::Primitive2DSequence& rContent, GDIMetaFile& o_rContentMetafile); @@ -93,42 +106,47 @@ namespace drawinglayer void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); - // the current clipping PolyPolygon from MaskPrimitive2D + /// the current clipping PolyPolygon from MaskPrimitive2D basegfx::B2DPolyPolygon maClipPolyPolygon; - // the target MetaFile + /// the target MetaFile GDIMetaFile* mpMetaFile; - // do not allow embedding SvtGraphicFills into each other, - // use a counter to prevent that + /* do not allow embedding SvtGraphicFills into each other, + use a counter to prevent that + */ sal_uInt32 mnSvtGraphicFillCount; - // same for SvtGraphicStroke + /// same for SvtGraphicStroke sal_uInt32 mnSvtGraphicStrokeCount; - // hold the last unified transparence value to have it handy - // on SvtGraphicStroke creation + /* hold the last unified transparence value to have it handy + on SvtGraphicStroke creation + */ double mfCurrentUnifiedTransparence; - // break iterator support - // made static so it only needs to be fetched once, even with many single - // constructed VclMetafileProcessor2D. It's still incarnated on demand, - // but exists for OOo runtime now by purpose. + /* break iterator support + made static so it only needs to be fetched once, even with many single + constructed VclMetafileProcessor2D. It's still incarnated on demand, + but exists for OOo runtime now by purpose. + */ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator; - // vcl::PDFExtOutDevData support - // For the first step, some extra actions at vcl::PDFExtOutDevData need to - // be emulated with the VclMetafileProcessor2D. These are potentially temporarily - // since PDF export may use PrimitiveSequences one day directly. + /* vcl::PDFExtOutDevData support + For the first step, some extra actions at vcl::PDFExtOutDevData need to + be emulated with the VclMetafileProcessor2D. These are potentially temporarily + since PDF export may use PrimitiveSequences one day directly. + */ vcl::PDFExtOutDevData* mpPDFExtOutDevData; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclMetafileProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx index 836a097ae4d9..0d277325129b 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx @@ -39,35 +39,40 @@ #include #include -////////////////////////////////////////////////////////////////////////////// -// predefines - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace processor2d { + /** VclPixelProcessor2D class + + This processor derived from VclProcessor2D is the base class for rendering + all feeded primitives to a VCL Window. It is the currently used renderer + for all VCL editing output from the DrawingLayer. + */ class VclPixelProcessor2D : public VclProcessor2D { private: - // The Pixel renderer resets the original MapMode from the OutputDevice. - // For some situations it is necessary to get it again, so it is rescued here + /* The Pixel renderer resets the original MapMode from the OutputDevice. + For some situations it is necessary to get it again, so it is rescued here + */ MapMode maOriginalMapMode; protected: - // the local processor for BasePrinitive2D-Implementation based primitives, - // called from the common process()-implementation + /* the local processor for BasePrinitive2D-Implementation based primitives, + called from the common process()-implementation + */ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate); public: - // constructor/destructor + /// constructor/destructor VclPixelProcessor2D( const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev); virtual ~VclPixelProcessor2D(); - // data access + /// data read access const MapMode& getOriginalMapMode() const { return maOriginalMapMode; } }; } // end of namespace processor2d diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index ff77cc3fd5d0..0cef3da7a8ee 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -55,8 +55,8 @@ namespace drawinglayer { namespace primitive2d { class PolyPolygonColorPrimitive2D; class MetafilePrimitive2D; class MaskPrimitive2D; - class UnifiedAlphaPrimitive2D; - class AlphaPrimitive2D; + class UnifiedTransparencePrimitive2D; + class TransparencePrimitive2D; class TransformPrimitive2D; class MarkerArrayPrimitive2D; class PointArrayPrimitive2D; @@ -73,6 +73,11 @@ namespace drawinglayer { namespace processor2d { + /** VclProcessor2D class + + This processor is the base class for VCL-Based processors. It has no + processBasePrimitive2D implementation and thus is not usable directly. + */ class VclProcessor2D : public BaseProcessor2D { protected: @@ -107,8 +112,8 @@ namespace drawinglayer void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate); void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate); - void RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate); - void RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate); + void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate); + void RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate); void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate); void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate); void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate); diff --git a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx index effc509d9981..f6e0b53d4362 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/baseprocessor3d.hxx @@ -45,6 +45,13 @@ namespace drawinglayer { namespace processor3d { + /** BaseProcessor3D class + + Baseclass for all C++ implementations of instances which process + primitives. + + Please have a look at baseprocessor2d.hxx for more comments. + */ class BaseProcessor3D { private: @@ -56,9 +63,10 @@ namespace drawinglayer maViewInformation3D = rViewInformation3D; } - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. - // Default implementation does nothing + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + Default implementation does nothing + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -80,6 +88,13 @@ namespace drawinglayer { namespace processor3d { + /** CollectingProcessor3D class + + A processor which just collects all primitives given to it in + process(..) calls to maPrimitive3DSequence. This can e.g. be used to + hand around as instance over various methods where every called + method can add graphic content to it. + */ class CollectingProcessor3D : public BaseProcessor3D { private: @@ -89,16 +104,16 @@ namespace drawinglayer CollectingProcessor3D(const geometry::ViewInformation3D& rViewInformation); virtual ~CollectingProcessor3D(); - // the central processing method + /// the central processing method virtual void process(const primitive3d::Primitive3DSequence& rSource); - // helpers for adding to local sequence + /// helpers for adding to local sequence void appendPrimitive3DReference(const primitive3d::Primitive3DReference& rSource) { primitive3d::appendPrimitive3DReferenceToPrimitive3DSequence(maPrimitive3DSequence, rSource); } - // data access and reset + /// data access and reset const primitive3d::Primitive3DSequence& getPrimitive3DSequence() const { return maPrimitive3DSequence; } void reset() { maPrimitive3DSequence = primitive3d::Primitive3DSequence(); } }; diff --git a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx index 8a800d6d24b1..72552ea00e9c 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/cutfindprocessor3d.hxx @@ -44,26 +44,38 @@ namespace drawinglayer { namespace processor3d { + /** CutFindProcessor class + + This processor extracts all cuts of 3D plane geometries in the feeded primitives + with the given cut vector, based on the ViewInformation3D given. + */ class CutFindProcessor : public BaseProcessor3D { private: - // the start and stop point for the cut vector + /// the start and stop point for the cut vector basegfx::B3DPoint maFront; basegfx::B3DPoint maBack; - // the found cut points + /// the found cut points ::std::vector< basegfx::B3DPoint > maResult; - // #i102956# the transformation change from TransformPrimitive3D processings - // needs to be remembered to be able to transform found cuts to the - // basic coordinate system the processor starts with + /* #i102956# the transformation change from TransformPrimitive3D processings + needs to be remembered to be able to transform found cuts to the + basic coordinate system the processor starts with + */ basegfx::B3DHomMatrix maCombinedTransform; - // bitfield + /// bitfield bool mbAnyHit : 1; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* this flag decides if primitives which are invisible will be taken into account for + HitTesting or not. + */ + bool mbUseInvisiblePrimitiveContent : 1; + + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -72,9 +84,16 @@ namespace drawinglayer const basegfx::B3DPoint& rBack, bool bAnyHit); - // data access + /// data write access + void setUseInvisiblePrimitiveContent(bool bNew) + { + if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew; + } + + /// data read access const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; } bool getAnyHit() const { return mbAnyHit; } + bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;} }; } // end of namespace processor3d } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx index d0f886cca703..89fbdaafa251 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -45,6 +45,7 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + namespace basegfx { class BZPixelRaster; class B3DPolygon; @@ -77,38 +78,49 @@ namespace drawinglayer { namespace processor3d { + /** DefaultProcessor3D class + + This processor renders all feeded primitives to a 2D raster where for all + primitives the two basic methods rasterconvertB3DPolygon for hairlines and + rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to + e.g. base a Z-Buffer supported renderer on the 3D primitive processing. + */ class DefaultProcessor3D : public BaseProcessor3D { protected: - // render information - const attribute::SdrSceneAttribute& mrSdrSceneAttribute; // read-only scene infos (normal handling, etc...) - const attribute::SdrLightingAttribute& mrSdrLightingAttribute; // read-only light infos (lights, etc...) + /// read-only scene infos (normal handling, etc...) + const attribute::SdrSceneAttribute& mrSdrSceneAttribute; + + /// read-only light infos (lights, etc...) + const attribute::SdrLightingAttribute& mrSdrLightingAttribute; - // renderer range. Need to be correctly set by the derived implementations - basegfx::B2DRange maRasterRange; // the (0, 0, W, H) range from mpBZPixelRaster + /// renderer range. Need to be correctly set by the derived implementations + /// normally the (0, 0, W, H) range from mpBZPixelRaster + basegfx::B2DRange maRasterRange; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // the current active texture + /// the current active texture boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx; - // the current active transparence texture + /// the current active transparence texture boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx; - // SvtOptionsDrawinglayer incarnation to react on diverse settings + /// SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; - // counter for entered transparence textures + /// counter for entered transparence textures sal_uInt32 mnTransparenceCounter; - // bitfield + /// bitfield unsigned mbModulate : 1; unsigned mbFilter : 1; unsigned mbSimpleTextureActive : 1; ////////////////////////////////////////////////////////////////////////////// // rendering support + void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence); void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive); void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive); @@ -120,6 +132,7 @@ namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons. These NEED to be // implemented from derivations + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0; @@ -133,11 +146,11 @@ namespace drawinglayer const attribute::SdrLightingAttribute& rSdrLightingAttribute); virtual ~DefaultProcessor3D(); - // data read access + /// data read access const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; } - // data read access renderer stuff + /// data read access renderer stuff const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; } const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; } @@ -146,7 +159,7 @@ namespace drawinglayer bool getFilter() const { return mbFilter; } bool getSimpleTextureActive() const { return mbSimpleTextureActive; } - // access to Drawinglayer configuration options + /// access to Drawinglayer configuration options const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; } }; } // end of namespace processor3d diff --git a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx index 457ede952ccd..cf25c8813c13 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/geometry2dextractor.hxx @@ -48,20 +48,27 @@ namespace drawinglayer { namespace processor3d { + /** Geometry2DExtractingProcessor class + + This processor extracts the 2D geometry (projected geometry) of all feeded primitives. + It is e.g. used as sub-processor for contour extraction where 3D geometry is only + useful as 2D projected geometry. + */ class Geometry2DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) + /// result holding vector (2D) primitive2d::Primitive2DSequence maPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // the modifiedColorPrimitive stack + /// the modifiedColorPrimitive stack basegfx::BColorModifierStack maBColorModifierStack; - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -69,7 +76,7 @@ namespace drawinglayer const geometry::ViewInformation3D& rViewInformation, const basegfx::B2DHomMatrix& rObjectTransformation); - // data access + // data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx index abb92693a037..977cd8327d94 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/shadow3dextractor.hxx @@ -52,17 +52,24 @@ namespace drawinglayer { namespace processor3d { + /** Shadow3DExtractingProcessor class + + This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives. + It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite + some data to do so since we do not only offer flat projected 2D shadow, but also projections + dependent on the light source + */ class Shadow3DExtractingProcessor : public BaseProcessor3D { private: - // result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) + /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence) primitive2d::Primitive2DSequence maPrimitive2DSequence; primitive2d::Primitive2DSequence* mpPrimitive2DSequence; - // object transformation for scene for 2d definition + /// object transformation for scene for 2d definition basegfx::B2DHomMatrix maObjectTransformation; - // prepared data (transformations) for 2D/3D shadow calculations + /// prepared data (transformations) for 2D/3D shadow calculations basegfx::B3DHomMatrix maWorldToEye; basegfx::B3DHomMatrix maEyeToView; basegfx::B3DVector maLightNormal; @@ -70,26 +77,28 @@ namespace drawinglayer basegfx::B3DPoint maPlanePoint; double mfLightPlaneScalar; - // the shadow color used for sub-primitives. Can stay at black since - // the encapsulating 2d shadow primitive will contain the color + /* the shadow color used for sub-primitives. Can stay at black since + the encapsulating 2d shadow primitive will contain the color + */ basegfx::BColor maPrimitiveColor; - // bitfield - // flag if shadow plane projection preparation leaded to valid results + /// bitfield + /// flag if shadow plane projection preparation leaded to valid results unsigned mbShadowProjectionIsValid : 1; - // flag if conversion is switched on + /// flag if conversion is switched on unsigned mbConvert : 1; - // flag if conversion shall use projection + /// flag if conversion shall use projection unsigned mbUseProjection : 1; - // helpers + /// local helpers basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource); basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource); - // as tooling, the process() implementation takes over API handling and calls this - // virtual render method when the primitive implementation is BasePrimitive3D-based. + /* as tooling, the process() implementation takes over API handling and calls this + virtual render method when the primitive implementation is BasePrimitive3D-based. + */ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate); public: @@ -100,7 +109,7 @@ namespace drawinglayer double fShadowSlant, const basegfx::B3DRange& rContained3DRange); - // data access + /// data read access const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; } diff --git a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx index b2e09205dba9..4d0968c6cd57 100644 --- a/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -66,28 +66,37 @@ namespace drawinglayer { namespace processor3d { + /** ZBufferProcessor3D class + + This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D + raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle + transparent content. + */ class ZBufferProcessor3D : public DefaultProcessor3D { private: - // the raster target, a Z-Buffer + /// the raster target, a Z-Buffer basegfx::BZPixelRaster* mpBZPixelRaster; - // inverse of EyeToView for rasterconversion with evtl. Phong shading + /// inverse of EyeToView for rasterconversion with evtl. Phong shading basegfx::B3DHomMatrix maInvEyeToView; - // The raster converter for Z-Buffer + /// The raster converter for Z-Buffer ZBufferRasterConverter3D* mpZBufferRasterConverter3D; - // AA value. Defines how many oversámples will be used in X and Y. Values 0, 1 - // will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + /* AA value. Defines how many oversámples will be used in X and Y. Values 0, 1 + will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create + */ sal_uInt16 mnAntiAlialize; - // remembered RasterPrimitive3D's which need to be painted back to front - // for transparent 3D parts + /* remembered RasterPrimitive3D's which need to be painted back to front + for transparent 3D parts + */ std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds; ////////////////////////////////////////////////////////////////////////////// // rasterconversions for filled and non-filled polygons + virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const; virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const; @@ -105,7 +114,7 @@ namespace drawinglayer void finish(); - // get the result as bitmapEx + /// get the result as bitmapEx BitmapEx getBitmapEx() const; }; } // end of namespace processor3d diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index ee5b96d98a03..7ae13f8ebe33 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -8,7 +8,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\drawinglayer_primitivetypes2d.hxx -..\inc\drawinglayer\primitive2d\alphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\alphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\transparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\animatedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\animatedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\backgroundcolorprimitive2d.hxx ..\inc\drawinglayer\primitive2d\baseprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\baseprimitive2d.hxx @@ -24,7 +24,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\gridprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\gridprimitive2d.hxx ..\inc\drawinglayer\primitive2d\groupprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\groupprimitive2d.hxx ..\inc\drawinglayer\primitive2d\helplineprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\helplineprimitive2d.hxx -..\inc\drawinglayer\primitive2d\hittestprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hittestprimitive2d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive2d.hxx ..\inc\drawinglayer\primitive2d\invertprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\invertprimitive2d.hxx ..\inc\drawinglayer\primitive2d\markerarrayprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\markerarrayprimitive2d.hxx ..\inc\drawinglayer\primitive2d\maskprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\maskprimitive2d.hxx @@ -36,6 +36,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\polygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\polypolygonprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\polypolygonprimitive2d.hxx ..\inc\drawinglayer\primitive2d\primitivetools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\primitivetools2d.hxx +..\inc\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sdrdecompositiontools2d.hxx ..\inc\drawinglayer\primitive2d\sceneprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\sceneprimitive2d.hxx ..\inc\drawinglayer\primitive2d\shadowprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\shadowprimitive2d.hxx ..\inc\drawinglayer\primitive2d\structuretagprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\structuretagprimitive2d.hxx @@ -46,7 +47,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive2d ..\inc\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\textdecoratedprimitive2d.hxx ..\inc\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\texthierarchyprimitive2d.hxx ..\inc\drawinglayer\primitive2d\transformprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\transformprimitive2d.hxx -..\inc\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedalphaprimitive2d.hxx +..\inc\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\unifiedtransparenceprimitive2d.hxx ..\inc\drawinglayer\primitive2d\wrongspellprimitive2d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\wrongspellprimitive2d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d @@ -54,7 +55,7 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\primitive3d ..\inc\drawinglayer\primitive3d\baseprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\baseprimitive3d.hxx ..\inc\drawinglayer\primitive3d\groupprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\groupprimitive3d.hxx ..\inc\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hatchtextureprimitive3d.hxx -..\inc\drawinglayer\primitive3d\hittestprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\hittestprimitive3d.hxx +..\inc\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive2d\hiddengeometryprimitive3d.hxx ..\inc\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\modifiedcolorprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygonprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygonprimitive3d.hxx ..\inc\drawinglayer\primitive3d\polygontubeprimitive3d.hxx %_DEST%\inc%_EXT%\drawinglayer\primitive3d\polygontubeprimitive3d.hxx @@ -97,13 +98,20 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\processor3d ..\inc\drawinglayer\processor3d\tbufferprocessor3d.hxx %_DEST%\inc%_EXT%\drawinglayer\processor3d\tbufferprocessor3d.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute -..\inc\drawinglayer\attribute\fillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillattribute.hxx +..\inc\drawinglayer\attribute\fillgradientattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillgradientattribute.hxx +..\inc\drawinglayer\attribute\fillhatchattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillhatchattribute.hxx ..\inc\drawinglayer\attribute\fillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fillbitmapattribute.hxx ..\inc\drawinglayer\attribute\fontattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\fontattribute.hxx ..\inc\drawinglayer\attribute\materialattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\materialattribute3d.hxx ..\inc\drawinglayer\attribute\sdrallattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrallattribute3d.hxx -..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx -..\inc\drawinglayer\attribute\sdrattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlineattribute.hxx +..\inc\drawinglayer\attribute\sdrlinestartendattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlinestartendattribute.hxx +..\inc\drawinglayer\attribute\sdrshadowattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrshadowattribute.hxx +..\inc\drawinglayer\attribute\sdrfillattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillattribute.hxx +..\inc\drawinglayer\attribute\sdrobjectattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrobjectattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightattribute3d.hxx +..\inc\drawinglayer\attribute\sdrlightingattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrlightingattribute3d.hxx +..\inc\drawinglayer\attribute\sdrsceneattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrsceneattribute3d.hxx ..\inc\drawinglayer\attribute\sdrfillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillbitmapattribute.hxx ..\inc\drawinglayer\attribute\strokeattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\strokeattribute.hxx ..\inc\drawinglayer\attribute\lineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\lineattribute.hxx diff --git a/drawinglayer/source/attribute/fillattribute.cxx b/drawinglayer/source/attribute/fillattribute.cxx deleted file mode 100644 index 12741e40c5c3..000000000000 --- a/drawinglayer/source/attribute/fillattribute.cxx +++ /dev/null @@ -1,102 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: fillattribute.cxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillGradientAttribute::FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY, double fAngle, - const basegfx::BColor& rStartColor, const basegfx::BColor& rEndColor, sal_uInt16 nSteps) - : maStartColor(rStartColor), - maEndColor(rEndColor), - mfBorder(fBorder), - mfOffsetX(fOffsetX), - mfOffsetY(fOffsetY), - mfAngle(fAngle), - meStyle(eStyle), - mnSteps(nSteps) - { - } - - bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && maStartColor == rCandidate.maStartColor - && maEndColor == rCandidate.maEndColor - && mfBorder == rCandidate.mfBorder - && mfOffsetX == rCandidate.mfOffsetX - && mfOffsetY == rCandidate.mfOffsetY - && mfAngle == rCandidate.mfAngle - && mnSteps == rCandidate.mnSteps); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - FillHatchAttribute::FillHatchAttribute(HatchStyle eStyle, double fDistance, double fAngle, const basegfx::BColor& rColor, bool bFillBackground) - : mfDistance(fDistance), - mfAngle(fAngle), - maColor(rColor), - meStyle(eStyle), - mbFillBackground(bFillBackground) - { - } - - bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const - { - return (meStyle == rCandidate.meStyle - && mfDistance == rCandidate.mfDistance - && mfAngle == rCandidate.mfAngle - && maColor == rCandidate.maColor - && mbFillBackground == rCandidate.mbFillBackground); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/fillbitmapattribute.cxx b/drawinglayer/source/attribute/fillbitmapattribute.cxx index 99afb234bda5..becd43c24a13 100644 --- a/drawinglayer/source/attribute/fillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/fillbitmapattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,25 +45,161 @@ namespace drawinglayer { namespace attribute { + class ImpFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + BitmapEx maBitmapEx; + basegfx::B2DPoint maTopLeft; + basegfx::B2DVector maSize; + + // bitfield + unsigned mbTiling : 1; + + ImpFillBitmapAttribute( + const BitmapEx& rBitmapEx, + const basegfx::B2DPoint& rTopLeft, + const basegfx::B2DVector& rSize, + bool bTiling) + : mnRefCount(0), + maBitmapEx(rBitmapEx), + maTopLeft(rTopLeft), + maSize(rSize), + mbTiling(bTiling) + { + } + + bool operator==(const ImpFillBitmapAttribute& rCandidate) const + { + return (maBitmapEx == rCandidate.maBitmapEx + && maTopLeft == rCandidate.maTopLeft + && maSize == rCandidate.maSize + && mbTiling == rCandidate.mbTiling); + } + + // data read access + const BitmapEx& getBitmapEx() const { return maBitmapEx; } + const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; } + const basegfx::B2DVector& getSize() const { return maSize; } + bool getTiling() const { return mbTiling; } + + static ImpFillBitmapAttribute* get_global_default() + { + static ImpFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillBitmapAttribute( + BitmapEx(), + basegfx::B2DPoint(), + basegfx::B2DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + FillBitmapAttribute::FillBitmapAttribute( const BitmapEx& rBitmapEx, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize, bool bTiling) - : maBitmapEx(rBitmapEx), - maTopLeft(rTopLeft), - maSize(rSize), - mbTiling(bTiling) + : mpFillBitmapAttribute(new ImpFillBitmapAttribute( + rBitmapEx, rTopLeft, rSize, bTiling)) { } + FillBitmapAttribute::FillBitmapAttribute() + : mpFillBitmapAttribute(ImpFillBitmapAttribute::get_global_default()) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::FillBitmapAttribute(const FillBitmapAttribute& rCandidate) + : mpFillBitmapAttribute(rCandidate.mpFillBitmapAttribute) + { + mpFillBitmapAttribute->mnRefCount++; + } + + FillBitmapAttribute::~FillBitmapAttribute() + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + } + + bool FillBitmapAttribute::isDefault() const + { + return mpFillBitmapAttribute == ImpFillBitmapAttribute::get_global_default(); + } + + FillBitmapAttribute& FillBitmapAttribute::operator=(const FillBitmapAttribute& rCandidate) + { + if(rCandidate.mpFillBitmapAttribute != mpFillBitmapAttribute) + { + if(mpFillBitmapAttribute->mnRefCount) + { + mpFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpFillBitmapAttribute; + } + + mpFillBitmapAttribute = rCandidate.mpFillBitmapAttribute; + mpFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool FillBitmapAttribute::operator==(const FillBitmapAttribute& rCandidate) const { - return (getBitmapEx() == rCandidate.getBitmapEx() - && getTopLeft() == rCandidate.getTopLeft() - && getSize() == rCandidate.getSize() - && getTiling() == rCandidate.getTiling()); + if(rCandidate.mpFillBitmapAttribute == mpFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillBitmapAttribute == *mpFillBitmapAttribute); + } + + const BitmapEx& FillBitmapAttribute::getBitmapEx() const + { + return mpFillBitmapAttribute->getBitmapEx(); } + + const basegfx::B2DPoint& FillBitmapAttribute::getTopLeft() const + { + return mpFillBitmapAttribute->getTopLeft(); + } + + const basegfx::B2DVector& FillBitmapAttribute::getSize() const + { + return mpFillBitmapAttribute->getSize(); + } + + bool FillBitmapAttribute::getTiling() const + { + return mpFillBitmapAttribute->getTiling(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx new file mode 100644 index 000000000000..17e0cd6c098b --- /dev/null +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillGradientAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + GradientStyle meStyle; + double mfBorder; + double mfOffsetX; + double mfOffsetY; + double mfAngle; + basegfx::BColor maStartColor; + basegfx::BColor maEndColor; + sal_uInt16 mnSteps; + + ImpFillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mnRefCount(0), + meStyle(eStyle), + mfBorder(fBorder), + mfOffsetX(fOffsetX), + mfOffsetY(fOffsetY), + mfAngle(fAngle), + maStartColor(rStartColor), + maEndColor(rEndColor), + mnSteps(nSteps) + { + } + + // data read access + GradientStyle getStyle() const { return meStyle; } + double getBorder() const { return mfBorder; } + double getOffsetX() const { return mfOffsetX; } + double getOffsetY() const { return mfOffsetY; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getStartColor() const { return maStartColor; } + const basegfx::BColor& getEndColor() const { return maEndColor; } + sal_uInt16 getSteps() const { return mnSteps; } + + bool operator==(const ImpFillGradientAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getBorder() == rCandidate.getBorder() + && getOffsetX() == rCandidate.getOffsetX() + && getOffsetY() == rCandidate.getOffsetY() + && getAngle() == rCandidate.getAngle() + && getStartColor() == rCandidate.getStartColor() + && getEndColor() == rCandidate.getEndColor() + && getSteps() == rCandidate.getSteps()); + } + + static ImpFillGradientAttribute* get_global_default() + { + static ImpFillGradientAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillGradientAttribute( + GRADIENTSTYLE_LINEAR, + 0.0, 0.0, 0.0, 0.0, + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillGradientAttribute::FillGradientAttribute( + GradientStyle eStyle, + double fBorder, + double fOffsetX, + double fOffsetY, + double fAngle, + const basegfx::BColor& rStartColor, + const basegfx::BColor& rEndColor, + sal_uInt16 nSteps) + : mpFillGradientAttribute(new ImpFillGradientAttribute( + eStyle, fBorder, fOffsetX, fOffsetY, fAngle, rStartColor, rEndColor, nSteps)) + { + } + + FillGradientAttribute::FillGradientAttribute() + : mpFillGradientAttribute(ImpFillGradientAttribute::get_global_default()) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::FillGradientAttribute(const FillGradientAttribute& rCandidate) + : mpFillGradientAttribute(rCandidate.mpFillGradientAttribute) + { + mpFillGradientAttribute->mnRefCount++; + } + + FillGradientAttribute::~FillGradientAttribute() + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + } + + bool FillGradientAttribute::isDefault() const + { + return mpFillGradientAttribute == ImpFillGradientAttribute::get_global_default(); + } + + FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute& rCandidate) + { + if(rCandidate.mpFillGradientAttribute != mpFillGradientAttribute) + { + if(mpFillGradientAttribute->mnRefCount) + { + mpFillGradientAttribute->mnRefCount--; + } + else + { + delete mpFillGradientAttribute; + } + + mpFillGradientAttribute = rCandidate.mpFillGradientAttribute; + mpFillGradientAttribute->mnRefCount++; + } + + return *this; + } + + bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const + { + if(rCandidate.mpFillGradientAttribute == mpFillGradientAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillGradientAttribute == *mpFillGradientAttribute); + } + + const basegfx::BColor& FillGradientAttribute::getStartColor() const + { + return mpFillGradientAttribute->getStartColor(); + } + + const basegfx::BColor& FillGradientAttribute::getEndColor() const + { + return mpFillGradientAttribute->getEndColor(); + } + + double FillGradientAttribute::getBorder() const + { + return mpFillGradientAttribute->getBorder(); + } + + double FillGradientAttribute::getOffsetX() const + { + return mpFillGradientAttribute->getOffsetX(); + } + + double FillGradientAttribute::getOffsetY() const + { + return mpFillGradientAttribute->getOffsetY(); + } + + double FillGradientAttribute::getAngle() const + { + return mpFillGradientAttribute->getAngle(); + } + + GradientStyle FillGradientAttribute::getStyle() const + { + return mpFillGradientAttribute->getStyle(); + } + + sal_uInt16 FillGradientAttribute::getSteps() const + { + return mpFillGradientAttribute->getSteps(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx new file mode 100644 index 000000000000..4a82ef5594ab --- /dev/null +++ b/drawinglayer/source/attribute/fillhatchattribute.cxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: fillattribute.cxx,v $ + * + * $Revision: 1.4 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpFillHatchAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + HatchStyle meStyle; + double mfDistance; + double mfAngle; + basegfx::BColor maColor; + + // bitfield + unsigned mbFillBackground : 1; + + ImpFillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mnRefCount(0), + meStyle(eStyle), + mfDistance(fDistance), + mfAngle(fAngle), + maColor(rColor), + mbFillBackground(bFillBackground) + { + } + + // data read access + HatchStyle getStyle() const { return meStyle; } + double getDistance() const { return mfDistance; } + double getAngle() const { return mfAngle; } + const basegfx::BColor& getColor() const { return maColor; } + bool isFillBackground() const { return mbFillBackground; } + + bool operator==(const ImpFillHatchAttribute& rCandidate) const + { + return (getStyle() == rCandidate.getStyle() + && getDistance() == rCandidate.getDistance() + && getAngle() == rCandidate.getAngle() + && getColor() == rCandidate.getColor() + && isFillBackground() == rCandidate.isFillBackground()); + } + + static ImpFillHatchAttribute* get_global_default() + { + static ImpFillHatchAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFillHatchAttribute( + HATCHSTYLE_SINGLE, + 0.0, 0.0, + basegfx::BColor(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FillHatchAttribute::FillHatchAttribute( + HatchStyle eStyle, + double fDistance, + double fAngle, + const basegfx::BColor& rColor, + bool bFillBackground) + : mpFillHatchAttribute(new ImpFillHatchAttribute( + eStyle, fDistance, fAngle, rColor, bFillBackground)) + { + } + + FillHatchAttribute::FillHatchAttribute() + : mpFillHatchAttribute(ImpFillHatchAttribute::get_global_default()) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::FillHatchAttribute(const FillHatchAttribute& rCandidate) + : mpFillHatchAttribute(rCandidate.mpFillHatchAttribute) + { + mpFillHatchAttribute->mnRefCount++; + } + + FillHatchAttribute::~FillHatchAttribute() + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + } + + bool FillHatchAttribute::isDefault() const + { + return mpFillHatchAttribute == ImpFillHatchAttribute::get_global_default(); + } + + FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute& rCandidate) + { + if(rCandidate.mpFillHatchAttribute != mpFillHatchAttribute) + { + if(mpFillHatchAttribute->mnRefCount) + { + mpFillHatchAttribute->mnRefCount--; + } + else + { + delete mpFillHatchAttribute; + } + + mpFillHatchAttribute = rCandidate.mpFillHatchAttribute; + mpFillHatchAttribute->mnRefCount++; + } + + return *this; + } + + bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const + { + if(rCandidate.mpFillHatchAttribute == mpFillHatchAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFillHatchAttribute == *mpFillHatchAttribute); + } + + // data read access + HatchStyle FillHatchAttribute::getStyle() const + { + return mpFillHatchAttribute->getStyle(); + } + + double FillHatchAttribute::getDistance() const + { + return mpFillHatchAttribute->getDistance(); + } + + double FillHatchAttribute::getAngle() const + { + return mpFillHatchAttribute->getAngle(); + } + + const basegfx::BColor& FillHatchAttribute::getColor() const + { + return mpFillHatchAttribute->getColor(); + } + + bool FillHatchAttribute::isFillBackground() const + { + return mpFillHatchAttribute->isFillBackground(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx index 5163e2f6a59a..2439d9894a70 100644 --- a/drawinglayer/source/attribute/fontattribute.cxx +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,18 +45,215 @@ namespace drawinglayer { namespace attribute { - bool FontAttribute::operator==(const FontAttribute& rCompare) const - { - return (getFamilyName() == rCompare.getFamilyName() - && getStyleName() == rCompare.getStyleName() - && getWeight() == rCompare.getWeight() - && getSymbol() == rCompare.getSymbol() - && getVertical() == rCompare.getVertical() - && getItalic() == rCompare.getItalic() - && getOutline() == rCompare.getOutline() - && getRTL() == rCompare.getRTL() - && getBiDiStrong() == rCompare.getBiDiStrong()); + class ImpFontAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + /// core data + String maFamilyName; // Font Family Name + String maStyleName; // Font Style Name + sal_uInt16 mnWeight; // Font weight + + /// bitfield + unsigned mbSymbol : 1; // Symbol Font Flag + unsigned mbVertical : 1; // Vertical Text Flag + unsigned mbItalic : 1; // Italic Flag + unsigned mbOutline : 1; // Outline Flag + unsigned mbRTL : 1; // RTL Flag + unsigned mbBiDiStrong : 1; // BiDi Flag + + ImpFontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mnRefCount(0), + maFamilyName(rFamilyName), + maStyleName(rStyleName), + mnWeight(nWeight), + mbSymbol(bSymbol), + mbVertical(bVertical), + mbItalic(bItalic), + mbOutline(bOutline), + mbRTL(bRTL), + mbBiDiStrong(bBiDiStrong) + { + } + + // data read access + const String& getFamilyName() const { return maFamilyName; } + const String& getStyleName() const { return maStyleName; } + sal_uInt16 getWeight() const { return mnWeight; } + bool getSymbol() const { return mbSymbol; } + bool getVertical() const { return mbVertical; } + bool getItalic() const { return mbItalic; } + bool getOutline() const { return mbOutline; } + bool getRTL() const { return mbRTL; } + bool getBiDiStrong() const { return mbBiDiStrong; } + + bool operator==(const ImpFontAttribute& rCompare) const + { + return (getFamilyName() == rCompare.getFamilyName() + && getStyleName() == rCompare.getStyleName() + && getWeight() == rCompare.getWeight() + && getSymbol() == rCompare.getSymbol() + && getVertical() == rCompare.getVertical() + && getItalic() == rCompare.getItalic() + && getOutline() == rCompare.getOutline() + && getRTL() == rCompare.getRTL() + && getBiDiStrong() == rCompare.getBiDiStrong()); + } + + static ImpFontAttribute* get_global_default() + { + static ImpFontAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpFontAttribute( + String(), String(), + 0, + false, false, false, false, false, false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + FontAttribute::FontAttribute( + const String& rFamilyName, + const String& rStyleName, + sal_uInt16 nWeight, + bool bSymbol, + bool bVertical, + bool bItalic, + bool bOutline, + bool bRTL, + bool bBiDiStrong) + : mpFontAttribute(new ImpFontAttribute( + rFamilyName, rStyleName, nWeight, bSymbol, bVertical, bItalic, bOutline, bRTL, bBiDiStrong)) + { + } + + FontAttribute::FontAttribute() + : mpFontAttribute(ImpFontAttribute::get_global_default()) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::FontAttribute(const FontAttribute& rCandidate) + : mpFontAttribute(rCandidate.mpFontAttribute) + { + mpFontAttribute->mnRefCount++; + } + + FontAttribute::~FontAttribute() + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + } + + bool FontAttribute::isDefault() const + { + return mpFontAttribute == ImpFontAttribute::get_global_default(); + } + + FontAttribute& FontAttribute::operator=(const FontAttribute& rCandidate) + { + if(rCandidate.mpFontAttribute != mpFontAttribute) + { + if(mpFontAttribute->mnRefCount) + { + mpFontAttribute->mnRefCount--; + } + else + { + delete mpFontAttribute; + } + + mpFontAttribute = rCandidate.mpFontAttribute; + mpFontAttribute->mnRefCount++; + } + + return *this; + } + + bool FontAttribute::operator==(const FontAttribute& rCandidate) const + { + if(rCandidate.mpFontAttribute == mpFontAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpFontAttribute == *mpFontAttribute); + } + + const String& FontAttribute::getFamilyName() const + { + return mpFontAttribute->getFamilyName(); + } + + const String& FontAttribute::getStyleName() const + { + return mpFontAttribute->getStyleName(); + } + + sal_uInt16 FontAttribute::getWeight() const + { + return mpFontAttribute->getWeight(); } + + bool FontAttribute::getSymbol() const + { + return mpFontAttribute->getSymbol(); + } + + bool FontAttribute::getVertical() const + { + return mpFontAttribute->getVertical(); + } + + bool FontAttribute::getItalic() const + { + return mpFontAttribute->getItalic(); + } + + bool FontAttribute::getOutline() const + { + return mpFontAttribute->getOutline(); + } + + bool FontAttribute::getRTL() const + { + return mpFontAttribute->getRTL(); + } + + bool FontAttribute::getBiDiStrong() const + { + return mpFontAttribute->getBiDiStrong(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx index 5ab44b73db82..2a346599db8f 100644 --- a/drawinglayer/source/attribute/lineattribute.cxx +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -37,6 +37,7 @@ #include "precompiled_drawinglayer.hxx" #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -44,6 +45,147 @@ namespace drawinglayer { namespace attribute { + class ImpLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + basegfx::BColor maColor; // color + double mfWidth; // absolute line width + basegfx::B2DLineJoin meLineJoin; // type of LineJoin + + ImpLineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mnRefCount(0), + maColor(rColor), + mfWidth(fWidth), + meLineJoin(aB2DLineJoin) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + double getWidth() const { return mfWidth; } + basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + + bool operator==(const ImpLineAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getWidth() == rCandidate.getWidth() + && getLineJoin() == rCandidate.getLineJoin()); + } + + static ImpLineAttribute* get_global_default() + { + static ImpLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineAttribute( + basegfx::BColor(), + 0.0, + basegfx::B2DLINEJOIN_ROUND); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineAttribute::LineAttribute( + const basegfx::BColor& rColor, + double fWidth, + basegfx::B2DLineJoin aB2DLineJoin) + : mpLineAttribute(new ImpLineAttribute( + rColor, fWidth, aB2DLineJoin)) + { + } + + LineAttribute::LineAttribute() + : mpLineAttribute(ImpLineAttribute::get_global_default()) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::LineAttribute(const LineAttribute& rCandidate) + : mpLineAttribute(rCandidate.mpLineAttribute) + { + mpLineAttribute->mnRefCount++; + } + + LineAttribute::~LineAttribute() + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + } + + bool LineAttribute::isDefault() const + { + return mpLineAttribute == ImpLineAttribute::get_global_default(); + } + + LineAttribute& LineAttribute::operator=(const LineAttribute& rCandidate) + { + if(rCandidate.mpLineAttribute != mpLineAttribute) + { + if(mpLineAttribute->mnRefCount) + { + mpLineAttribute->mnRefCount--; + } + else + { + delete mpLineAttribute; + } + + mpLineAttribute = rCandidate.mpLineAttribute; + mpLineAttribute->mnRefCount++; + } + + return *this; + } + + bool LineAttribute::operator==(const LineAttribute& rCandidate) const + { + if(rCandidate.mpLineAttribute == mpLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineAttribute == *mpLineAttribute); + } + + const basegfx::BColor& LineAttribute::getColor() const + { + return mpLineAttribute->getColor(); + } + + double LineAttribute::getWidth() const + { + return mpLineAttribute->getWidth(); + } + + basegfx::B2DLineJoin LineAttribute::getLineJoin() const + { + return mpLineAttribute->getLineJoin(); + } + } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx index 785819870114..3d93a6471cb7 100644 --- a/drawinglayer/source/attribute/linestartendattribute.cxx +++ b/drawinglayer/source/attribute/linestartendattribute.cxx @@ -38,6 +38,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -45,11 +46,154 @@ namespace drawinglayer { namespace attribute { + class ImpLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + double mfWidth; // absolute line StartEndGeometry base width + basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon + + // bitfield + unsigned mbCentered : 1; // use centered to ineStart/End point? + + ImpLineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mnRefCount(0), + mfWidth(fWidth), + maPolyPolygon(rPolyPolygon), + mbCentered(bCentered) + { + } + + // data read access + double getWidth() const { return mfWidth; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + bool isCentered() const { return mbCentered; } + + bool operator==(const ImpLineStartEndAttribute& rCandidate) const + { + return (basegfx::fTools::equal(getWidth(), rCandidate.getWidth()) + && getB2DPolyPolygon() == rCandidate.getB2DPolyPolygon() + && isCentered() == rCandidate.isCentered()); + } + + static ImpLineStartEndAttribute* get_global_default() + { + static ImpLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpLineStartEndAttribute( + 0.0, + basegfx::B2DPolyPolygon(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + LineStartEndAttribute::LineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mpLineStartEndAttribute(new ImpLineStartEndAttribute( + fWidth, rPolyPolygon, bCentered)) + { + } + + LineStartEndAttribute::LineStartEndAttribute() + : mpLineStartEndAttribute(ImpLineStartEndAttribute::get_global_default()) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::LineStartEndAttribute(const LineStartEndAttribute& rCandidate) + : mpLineStartEndAttribute(rCandidate.mpLineStartEndAttribute) + { + mpLineStartEndAttribute->mnRefCount++; + } + + LineStartEndAttribute::~LineStartEndAttribute() + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + } + + bool LineStartEndAttribute::isDefault() const + { + return mpLineStartEndAttribute == ImpLineStartEndAttribute::get_global_default(); + } + + LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute& rCandidate) + { + if(rCandidate.mpLineStartEndAttribute != mpLineStartEndAttribute) + { + if(mpLineStartEndAttribute->mnRefCount) + { + mpLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpLineStartEndAttribute; + } + + mpLineStartEndAttribute = rCandidate.mpLineStartEndAttribute; + mpLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpLineStartEndAttribute == *mpLineStartEndAttribute); + } + + double LineStartEndAttribute::getWidth() const + { + return mpLineStartEndAttribute->getWidth(); + } + + const basegfx::B2DPolyPolygon& LineStartEndAttribute::getB2DPolyPolygon() const + { + return mpLineStartEndAttribute->getB2DPolyPolygon(); + } + + bool LineStartEndAttribute::isCentered() const + { + return mpLineStartEndAttribute->isCentered(); + } + bool LineStartEndAttribute::isActive() const { return (0.0 != getWidth() - && 0.0 != getB2DPolyPolygon().count() - && 0.0 != getB2DPolyPolygon().getB2DPolygon(0L).count()); + && 0 != getB2DPolyPolygon().count() + && 0 != getB2DPolyPolygon().getB2DPolygon(0).count()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk index 65f899f67177..83eaa193bb4e 100644 --- a/drawinglayer/source/attribute/makefile.mk +++ b/drawinglayer/source/attribute/makefile.mk @@ -45,16 +45,23 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/fillattribute.obj \ - $(SLO)$/fillbitmapattribute.obj \ - $(SLO)$/fontattribute.obj \ - $(SLO)$/materialattribute3d.obj \ - $(SLO)$/sdrallattribute3d.obj \ - $(SLO)$/sdrattribute.obj \ - $(SLO)$/sdrattribute3d.obj \ - $(SLO)$/sdrfillbitmapattribute.obj \ - $(SLO)$/lineattribute.obj \ - $(SLO)$/linestartendattribute.obj \ + $(SLO)$/fillgradientattribute.obj \ + $(SLO)$/fillhatchattribute.obj \ + $(SLO)$/fillbitmapattribute.obj \ + $(SLO)$/fontattribute.obj \ + $(SLO)$/materialattribute3d.obj \ + $(SLO)$/sdrallattribute3d.obj \ + $(SLO)$/sdrlineattribute.obj \ + $(SLO)$/sdrlinestartendattribute.obj \ + $(SLO)$/sdrshadowattribute.obj \ + $(SLO)$/sdrfillattribute.obj \ + $(SLO)$/sdrobjectattribute3d.obj \ + $(SLO)$/sdrlightattribute3d.obj \ + $(SLO)$/sdrlightingattribute3d.obj \ + $(SLO)$/sdrsceneattribute3d.obj \ + $(SLO)$/sdrfillbitmapattribute.obj \ + $(SLO)$/lineattribute.obj \ + $(SLO)$/linestartendattribute.obj \ $(SLO)$/strokeattribute.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx index bc3e8f3b317b..27bd5d5a1b1a 100644 --- a/drawinglayer/source/attribute/materialattribute3d.cxx +++ b/drawinglayer/source/attribute/materialattribute3d.cxx @@ -48,74 +48,87 @@ namespace drawinglayer class ImpMaterialAttribute3D { public: + // refcounter + sal_uInt32 mnRefCount; + // materialAttribute3D definitions basegfx::BColor maColor; // object color basegfx::BColor maSpecular; // material specular color basegfx::BColor maEmission; // material emissive color - sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] - - // refcounter - sal_uInt32 mnRefCount; + sal_uInt16 mnSpecularIntensity; // material specular intensity [0..128] ImpMaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(rSpecular), maEmission(rEmission), - mnSpecularIntensity(nSpecularIntensity), - mnRefCount(0L) + mnSpecularIntensity(nSpecularIntensity) { } ImpMaterialAttribute3D(const basegfx::BColor& rColor) - : maColor(rColor), + : mnRefCount(0), + maColor(rColor), maSpecular(1.0, 1.0, 1.0), maEmission(), - mnSpecularIntensity(15), - mnRefCount(0L) + mnSpecularIntensity(15) { } - ImpMaterialAttribute3D() - : mnSpecularIntensity(0), - mnRefCount(0L) - { - } + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::BColor& getSpecular() const { return maSpecular; } + const basegfx::BColor& getEmission() const { return maEmission; } + sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } bool operator==(const ImpMaterialAttribute3D& rCandidate) const { - return (maColor == rCandidate.maColor - && maSpecular == rCandidate.maSpecular - && maEmission == rCandidate.maEmission - && mnSpecularIntensity == rCandidate.mnSpecularIntensity); + return (getColor() == rCandidate.getColor() + && getSpecular() == rCandidate.getSpecular() + && getEmission() == rCandidate.getEmission() + && getSpecularIntensity() == rCandidate.getSpecularIntensity()); } - const basegfx::BColor& getColor() const { return maColor; } - const basegfx::BColor& getSpecular() const { return maSpecular; } - const basegfx::BColor& getEmission() const { return maEmission; } - sal_uInt16 getSpecularIntensity() const { return mnSpecularIntensity; } - }; - } // end of anonymous namespace -} // end of namespace drawinglayer + static ImpMaterialAttribute3D* get_global_default() + { + static ImpMaterialAttribute3D* pDefault = 0; -////////////////////////////////////////////////////////////////////////////// + if(!pDefault) + { + pDefault = new ImpMaterialAttribute3D( + basegfx::BColor(), + basegfx::BColor(), + basegfx::BColor(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } -namespace drawinglayer -{ - namespace attribute - { - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) - : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor, rSpecular, rEmission, nSpecularIntensity)) + return pDefault; + } + }; + + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor, + const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, + sal_uInt16 nSpecularIntensity) + : mpMaterialAttribute3D(new ImpMaterialAttribute3D( + rColor, rSpecular, rEmission, nSpecularIntensity)) { } - MaterialAttribute3D::MaterialAttribute3D(const basegfx::BColor& rColor) + MaterialAttribute3D::MaterialAttribute3D( + const basegfx::BColor& rColor) : mpMaterialAttribute3D(new ImpMaterialAttribute3D(rColor)) { } MaterialAttribute3D::MaterialAttribute3D() - : mpMaterialAttribute3D(new ImpMaterialAttribute3D()) + : mpMaterialAttribute3D(ImpMaterialAttribute3D::get_global_default()) { + mpMaterialAttribute3D->mnRefCount++; } MaterialAttribute3D::MaterialAttribute3D(const MaterialAttribute3D& rCandidate) @@ -136,6 +149,11 @@ namespace drawinglayer } } + bool MaterialAttribute3D::isDefault() const + { + return mpMaterialAttribute3D == ImpMaterialAttribute3D::get_global_default(); + } + MaterialAttribute3D& MaterialAttribute3D::operator=(const MaterialAttribute3D& rCandidate) { if(rCandidate.mpMaterialAttribute3D != mpMaterialAttribute3D) @@ -163,6 +181,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpMaterialAttribute3D == *mpMaterialAttribute3D); } diff --git a/drawinglayer/source/attribute/sdrallattribute3d.cxx b/drawinglayer/source/attribute/sdrallattribute3d.cxx index 264d8d0432d1..379e38f0e6ed 100644 --- a/drawinglayer/source/attribute/sdrallattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrallattribute3d.cxx @@ -37,12 +37,6 @@ #include "precompiled_drawinglayer.hxx" #include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) ////////////////////////////////////////////////////////////////////////////// @@ -50,150 +44,47 @@ namespace drawinglayer { namespace attribute { - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - SdrLineAttribute* pLine, - SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient) - : mpShadow(pShadow), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowAttribute::SdrLineFillShadowAttribute( - const SdrLineFillShadowAttribute& rCandidate) - : mpShadow(0), - mpLine(0), - mpLineStartEnd(0), - mpFill(0), - mpFillFloatTransGradient(0) + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient) + : maLine(rLine), + maFill(rFill), + maLineStartEnd(rLineStartEnd), + maShadow(rShadow), + maFillFloatTransGradient(rFillFloatTransGradient) { - *this = rCandidate; } - SdrLineFillShadowAttribute::~SdrLineFillShadowAttribute() + SdrLineFillShadowAttribute3D::SdrLineFillShadowAttribute3D() + : maLine(), + maFill(), + maLineStartEnd(), + maShadow(), + maFillFloatTransGradient() { - delete mpShadow; - delete mpLine; - delete mpLineStartEnd; - delete mpFill; - delete mpFillFloatTransGradient; } - SdrLineFillShadowAttribute& SdrLineFillShadowAttribute::operator=(const SdrLineFillShadowAttribute& rCandidate) + bool SdrLineFillShadowAttribute3D::isDefault() const { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; + return(getLine().isDefault() + && getFill().isDefault() + && getLineStartEnd().isDefault() + && getShadow().isDefault() + && getFillFloatTransGradient().isDefault()); } - bool SdrLineFillShadowAttribute::operator==(const SdrLineFillShadowAttribute& rCandidate) const + bool SdrLineFillShadowAttribute3D::operator==(const SdrLineFillShadowAttribute3D& rCandidate) const { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; + return(getLine() == rCandidate.getLine() + && getFill() == rCandidate.getFill() + && getLineStartEnd() == rCandidate.getLineStartEnd() + && getShadow() == rCandidate.getShadow() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); } - } // end of namespace attribute + } // end of namespace overlay } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx deleted file mode 100644 index 8e55afa6751e..000000000000 --- a/drawinglayer/source/attribute/sdrattribute.cxx +++ /dev/null @@ -1,293 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineAttribute::SdrLineAttribute( - basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, - const ::std::vector< double >& rDotDashArray, double fFullDotDashLen) - : meJoin(eJoin), - mfWidth(fWidth), - mfTransparence(fTransparence), - maColor(rColor), - maDotDashArray(rDotDashArray), - mfFullDotDashLen(fFullDotDashLen) - { - } - - SdrLineAttribute::SdrLineAttribute(const basegfx::BColor& rColor) - : meJoin(basegfx::B2DLINEJOIN_NONE), - mfWidth(0.0), - mfTransparence(0.0), - maColor(rColor), - maDotDashArray(), - mfFullDotDashLen(0.0) - { - } - - SdrLineAttribute::~SdrLineAttribute() - { - } - - bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const - { - return (meJoin == rCandidate.meJoin - && mfWidth == rCandidate.mfWidth - && mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maDotDashArray == rCandidate.maDotDashArray); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineStartEndAttribute::SdrLineStartEndAttribute( - const basegfx::B2DPolyPolygon& rStartPolyPolygon, const basegfx::B2DPolyPolygon& rEndPolyPolygon, - double fStartWidth, double fEndWidth, bool bStartActive, bool bEndActive, bool bStartCentered, bool bEndCentered) - : maStartPolyPolygon(rStartPolyPolygon), - maEndPolyPolygon(rEndPolyPolygon), - mfStartWidth(fStartWidth), - mfEndWidth(fEndWidth), - mbStartActive(bStartActive), - mbEndActive(bEndActive), - mbStartCentered(bStartCentered), - mbEndCentered(bEndCentered) - { - } - - SdrLineStartEndAttribute::~SdrLineStartEndAttribute() - { - } - - bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const - { - return (mbStartActive == rCandidate.mbStartActive - && mbEndActive == rCandidate.mbEndActive - && mbStartCentered == rCandidate.mbStartCentered - && mbEndCentered == rCandidate.mbEndCentered - && mfStartWidth == rCandidate.mfStartWidth - && mfEndWidth == rCandidate.mfEndWidth - && maStartPolyPolygon == rCandidate.maStartPolyPolygon - && maEndPolyPolygon == rCandidate.maEndPolyPolygon); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowAttribute::SdrShadowAttribute(const basegfx::B2DVector& rOffset, double fTransparence, const basegfx::BColor& rColor) - : maOffset(rOffset), - mfTransparence(fTransparence), - maColor(rColor) - { - } - - SdrShadowAttribute::~SdrShadowAttribute() - { - } - - bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const - { - return (mfTransparence == rCandidate.mfTransparence - && maColor == rCandidate.maColor - && maOffset == rCandidate.maOffset); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillAttribute::SdrFillAttribute( - double fTransparence, - const basegfx::BColor& rColor, - FillGradientAttribute* pGradient, - FillHatchAttribute* pHatch, - SdrFillBitmapAttribute* pBitmap) - : mfTransparence(fTransparence), - maColor(rColor), - mpGradient(pGradient), - mpHatch(pHatch), - mpBitmap(pBitmap) - { - } - - SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) - : mfTransparence(1.0), - mpGradient(0L), - mpHatch(0L), - mpBitmap(0L) - { - if(!(*this == rCandidate)) - { - *this = rCandidate; - } - } - - SdrFillAttribute::~SdrFillAttribute() - { - delete mpGradient; - delete mpHatch; - delete mpBitmap; - } - - SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) - { - // copy data - mfTransparence = rCandidate.mfTransparence; - maColor = rCandidate.maColor; - - // handle mpGradient - { - // delete local mpGradient if necessary - if(mpGradient && ((!rCandidate.mpGradient) || (!(*mpGradient == *rCandidate.mpGradient)))) - { - delete mpGradient; - mpGradient = 0L; - } - - // copy mpGradient if necessary - if(!mpGradient && rCandidate.mpGradient) - { - mpGradient = new FillGradientAttribute(*rCandidate.mpGradient); - } - } - - // handle mpHatch - { - // delete local mpHatch if necessary - if(mpHatch && ((!rCandidate.mpHatch) || (!(*mpHatch == *rCandidate.mpHatch)))) - { - delete mpHatch; - mpHatch = 0L; - } - - // copy mpHatch if necessary - if(!mpHatch && rCandidate.mpHatch) - { - mpHatch = new FillHatchAttribute(*rCandidate.mpHatch); - } - } - - // handle mpBitmap - { - // delete local mpBitmap if necessary - if(mpBitmap && ((!rCandidate.mpBitmap) || (!(*mpBitmap == *rCandidate.mpBitmap)))) - { - delete mpBitmap; - mpBitmap = 0L; - } - - // copy mpBitmap if necessary - if(!mpBitmap && rCandidate.mpBitmap) - { - mpBitmap = new SdrFillBitmapAttribute(*rCandidate.mpBitmap); - } - } - - return *this; - } - - bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const - { - if(mfTransparence != rCandidate.mfTransparence) - return false; - - if(mpGradient) - { - if(!rCandidate.mpGradient) - return false; - - if(!(*mpGradient == *rCandidate.mpGradient)) - return false; - } - else if(mpHatch) - { - if(!rCandidate.mpHatch) - return false; - - if(!(*mpHatch == *rCandidate.mpHatch)) - return false; - - if(mpHatch->isFillBackground() && !(maColor == rCandidate.maColor)) - return false; - } - else if(mpBitmap) - { - if(!rCandidate.mpBitmap) - return false; - - if(!(*mpBitmap == *rCandidate.mpBitmap)) - return false; - } - else - { - if(!rCandidate.isColor()) - return false; - - if(!(maColor == rCandidate.maColor)) - return false; - } - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrattribute3d.cxx b/drawinglayer/source/attribute/sdrattribute3d.cxx deleted file mode 100644 index c130675b9c97..000000000000 --- a/drawinglayer/source/attribute/sdrattribute3d.cxx +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrattribute3d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DObjectAttribute::Sdr3DObjectAttribute( - ::com::sun::star::drawing::NormalsKind aNormalsKind, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, - ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, - ::com::sun::star::drawing::TextureKind2 aTextureKind, - ::com::sun::star::drawing::TextureMode aTextureMode, - const MaterialAttribute3D& rMaterial, - bool bNormalsInvert, - bool bDoubleSided, - bool bShadow3D, - bool bTextureFilter, - bool bReducedLineGeometry) - : maNormalsKind(aNormalsKind), - maTextureProjectionX(aTextureProjectionX), - maTextureProjectionY(aTextureProjectionY), - maTextureKind(aTextureKind), - maTextureMode(aTextureMode), - maMaterial(rMaterial), - mbNormalsInvert(bNormalsInvert), - mbDoubleSided(bDoubleSided), - mbShadow3D(bShadow3D), - mbTextureFilter(bTextureFilter), - mbReducedLineGeometry(bReducedLineGeometry) - { - } - - bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const - { - return (maNormalsKind == rCandidate.maNormalsKind - && maTextureProjectionX == rCandidate.maTextureProjectionX - && maTextureProjectionY == rCandidate.maTextureProjectionY - && maTextureKind == rCandidate.maTextureKind - && maTextureMode == rCandidate.maTextureMode - && maMaterial == rCandidate.maMaterial - && mbNormalsInvert == rCandidate.mbNormalsInvert - && mbDoubleSided == rCandidate.mbDoubleSided - && mbShadow3D == rCandidate.mbShadow3D - && mbTextureFilter == rCandidate.mbTextureFilter - && mbReducedLineGeometry == rCandidate.mbReducedLineGeometry); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - Sdr3DLightAttribute::Sdr3DLightAttribute(const basegfx::BColor& rColor, const basegfx::B3DVector& rDirection, bool bSpecular) - : maColor(rColor), - maDirection(rDirection), - mbSpecular(bSpecular) - { - } - - bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const - { - return (maColor == rCandidate.maColor - && maDirection == rCandidate.maDirection - && mbSpecular == rCandidate.mbSpecular); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLightingAttribute::SdrLightingAttribute( - const basegfx::BColor& rAmbientLight, - const ::std::vector< Sdr3DLightAttribute >& rLightVector) - : maAmbientLight(rAmbientLight), - maLightVector(rLightVector) - { - } - - bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const - { - return (maAmbientLight == rCandidate.maAmbientLight - && maLightVector == rCandidate.maLightVector); - } - - // color model solver - basegfx::BColor SdrLightingAttribute::solveColorModel( - const basegfx::B3DVector& rNormalInEyeCoordinates, - const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, - const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const - { - // initialize with emissive color - basegfx::BColor aRetval(rEmission); - - // take care of global ambient light - aRetval += getAmbientLight() * rColor; - - // prepare light access. Is there a light? - const sal_uInt32 nLightCount(maLightVector.size()); - - if(nLightCount && !rNormalInEyeCoordinates.equalZero()) - { - // prepare normal - basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); - aEyeNormal.normalize(); - - for(sal_uInt32 a(0L); a < nLightCount; a++) - { - const Sdr3DLightAttribute& rLight(maLightVector[a]); - const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac, 0.0)) - { - aRetval += ((rLight.getColor() * rColor) * fCosFac); - - if(rLight.getSpecular()) - { - // expand by (0.0, 0.0, 1.0) in Z - basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); - aSpecularNormal.normalize(); - double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); - - if(basegfx::fTools::more(fCosFac2, 0.0)) - { - fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); - aRetval += (rSpecular * fCosFac2); - } - } - } - } - } - - // clamp to color space before usage - aRetval.clamp(); - - return aRetval; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrSceneAttribute::SdrSceneAttribute( - double fDistance, - double fShadowSlant, - ::com::sun::star::drawing::ProjectionMode aProjectionMode, - ::com::sun::star::drawing::ShadeMode aShadeMode, - bool bTwoSidedLighting) - : mfDistance(fDistance), - mfShadowSlant(fShadowSlant), - maProjectionMode(aProjectionMode), - maShadeMode(aShadeMode), - mbTwoSidedLighting(bTwoSidedLighting) - { - } - - bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const - { - return (mfDistance == rCandidate.mfDistance - && mfShadowSlant == rCandidate.mfShadowSlant - && maProjectionMode == rCandidate.maProjectionMode - && maShadeMode == rCandidate.maShadeMode - && mbTwoSidedLighting == rCandidate.mbTwoSidedLighting); - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx new file mode 100644 index 000000000000..bd99ba2c4ba4 --- /dev/null +++ b/drawinglayer/source/attribute/sdrfillattribute.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrFillAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // fill definitions + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // fill color + FillGradientAttribute maGradient; // fill gradient (if used) + FillHatchAttribute maHatch; // fill hatch (if used) + SdrFillBitmapAttribute maBitmap; // fill bitmap (if used) + + public: + ImpSdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mnRefCount(0), + mfTransparence(fTransparence), + maColor(rColor), + maGradient(rGradient), + maHatch(rHatch), + maBitmap(rBitmap) + { + } + + // data read access + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const FillGradientAttribute& getGradient() const { return maGradient; } + const FillHatchAttribute& getHatch() const { return maHatch; } + const SdrFillBitmapAttribute& getBitmap() const { return maBitmap; } + + // compare operator + bool operator==(const ImpSdrFillAttribute& rCandidate) const + { + return(getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getGradient() == rCandidate.getGradient() + && getHatch() == rCandidate.getHatch() + && getBitmap() == rCandidate.getBitmap()); + } + + static ImpSdrFillAttribute* get_global_default() + { + static ImpSdrFillAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillAttribute( + 0.0, + basegfx::BColor(), + FillGradientAttribute(), + FillHatchAttribute(), + SdrFillBitmapAttribute()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrFillAttribute::SdrFillAttribute( + double fTransparence, + const basegfx::BColor& rColor, + const FillGradientAttribute& rGradient, + const FillHatchAttribute& rHatch, + const SdrFillBitmapAttribute& rBitmap) + : mpSdrFillAttribute(new ImpSdrFillAttribute( + fTransparence, rColor, rGradient, rHatch, rBitmap)) + { + } + + SdrFillAttribute::SdrFillAttribute() + : mpSdrFillAttribute(ImpSdrFillAttribute::get_global_default()) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::SdrFillAttribute(const SdrFillAttribute& rCandidate) + : mpSdrFillAttribute(rCandidate.mpSdrFillAttribute) + { + mpSdrFillAttribute->mnRefCount++; + } + + SdrFillAttribute::~SdrFillAttribute() + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + } + + bool SdrFillAttribute::isDefault() const + { + return mpSdrFillAttribute == ImpSdrFillAttribute::get_global_default(); + } + + SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute& rCandidate) + { + if(rCandidate.mpSdrFillAttribute != mpSdrFillAttribute) + { + if(mpSdrFillAttribute->mnRefCount) + { + mpSdrFillAttribute->mnRefCount--; + } + else + { + delete mpSdrFillAttribute; + } + + mpSdrFillAttribute = rCandidate.mpSdrFillAttribute; + mpSdrFillAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const + { + if(rCandidate.mpSdrFillAttribute == mpSdrFillAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillAttribute == *mpSdrFillAttribute); + } + + double SdrFillAttribute::getTransparence() const + { + return mpSdrFillAttribute->getTransparence(); + } + + const basegfx::BColor& SdrFillAttribute::getColor() const + { + return mpSdrFillAttribute->getColor(); + } + + const FillGradientAttribute& SdrFillAttribute::getGradient() const + { + return mpSdrFillAttribute->getGradient(); + } + + const FillHatchAttribute& SdrFillAttribute::getHatch() const + { + return mpSdrFillAttribute->getHatch(); + } + + const SdrFillBitmapAttribute& SdrFillAttribute::getBitmap() const + { + return mpSdrFillAttribute->getBitmap(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx index d7e9090b0f62..8d46fac4a20e 100644 --- a/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillbitmapattribute.cxx @@ -38,8 +38,7 @@ #include #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -47,37 +46,213 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFillBitmapAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + Bitmap maBitmap; + basegfx::B2DVector maSize; + basegfx::B2DVector maOffset; + basegfx::B2DVector maOffsetPosition; + basegfx::B2DVector maRectPoint; + + // bitfield + unsigned mbTiling : 1; + unsigned mbStretch : 1; + unsigned mbLogSize : 1; + + ImpSdrFillBitmapAttribute( + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mnRefCount(0), + maBitmap(rBitmap), + maSize(rSize), + maOffset(rOffset), + maOffsetPosition(rOffsetPosition), + maRectPoint(rRectPoint), + mbTiling(bTiling), + mbStretch(bStretch), + mbLogSize(bLogSize) + { + } + + // data read access + const Bitmap& getBitmap() const { return maBitmap; } + const basegfx::B2DVector& getSize() const { return maSize; } + const basegfx::B2DVector& getOffset() const { return maOffset; } + const basegfx::B2DVector& getOffsetPosition() const { return maOffsetPosition; } + const basegfx::B2DVector& getRectPoint() const { return maRectPoint; } + bool getTiling() const { return mbTiling; } + bool getStretch() const { return mbStretch; } + bool getLogSize() const { return mbLogSize; } + + bool operator==(const ImpSdrFillBitmapAttribute& rCandidate) const + { + return (getBitmap() == rCandidate.getBitmap() + && getSize() == rCandidate.getSize() + && getOffset() == rCandidate.getOffset() + && getOffsetPosition() == rCandidate.getOffsetPosition() + && getRectPoint() == rCandidate.getRectPoint() + && getTiling() == rCandidate.getTiling() + && getStretch() == rCandidate.getStretch() + && getLogSize() == rCandidate.getLogSize()); + } + + static ImpSdrFillBitmapAttribute* get_global_default() + { + static ImpSdrFillBitmapAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFillBitmapAttribute( + Bitmap(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + basegfx::B2DVector(), + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFillBitmapAttribute::SdrFillBitmapAttribute( - const Bitmap& rBitmap, const basegfx::B2DVector& rSize, const basegfx::B2DVector& rOffset, - const basegfx::B2DVector& rOffsetPosition, const basegfx::B2DVector& rRectPoint, - bool bTiling, bool bStretch, bool bLogSize) - : maBitmap(rBitmap), - maSize(rSize), - maOffset(rOffset), - maOffsetPosition(rOffsetPosition), - maRectPoint(rRectPoint), - mbTiling(bTiling), - mbStretch(bStretch), - mbLogSize(bLogSize) + const Bitmap& rBitmap, + const basegfx::B2DVector& rSize, + const basegfx::B2DVector& rOffset, + const basegfx::B2DVector& rOffsetPosition, + const basegfx::B2DVector& rRectPoint, + bool bTiling, + bool bStretch, + bool bLogSize) + : mpSdrFillBitmapAttribute(new ImpSdrFillBitmapAttribute( + rBitmap, rSize, rOffset, rOffsetPosition, rRectPoint, bTiling, bStretch, bLogSize)) { } + SdrFillBitmapAttribute::SdrFillBitmapAttribute() + : mpSdrFillBitmapAttribute(ImpSdrFillBitmapAttribute::get_global_default()) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate) + : mpSdrFillBitmapAttribute(rCandidate.mpSdrFillBitmapAttribute) + { + mpSdrFillBitmapAttribute->mnRefCount++; + } + + SdrFillBitmapAttribute::~SdrFillBitmapAttribute() + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + } + + bool SdrFillBitmapAttribute::isDefault() const + { + return mpSdrFillBitmapAttribute == ImpSdrFillBitmapAttribute::get_global_default(); + } + + SdrFillBitmapAttribute& SdrFillBitmapAttribute::operator=(const SdrFillBitmapAttribute& rCandidate) + { + if(rCandidate.mpSdrFillBitmapAttribute != mpSdrFillBitmapAttribute) + { + if(mpSdrFillBitmapAttribute->mnRefCount) + { + mpSdrFillBitmapAttribute->mnRefCount--; + } + else + { + delete mpSdrFillBitmapAttribute; + } + + mpSdrFillBitmapAttribute = rCandidate.mpSdrFillBitmapAttribute; + mpSdrFillBitmapAttribute->mnRefCount++; + } + + return *this; + } + bool SdrFillBitmapAttribute::operator==(const SdrFillBitmapAttribute& rCandidate) const { - return (maBitmap == rCandidate.maBitmap - && maSize == rCandidate.maSize - && maOffset == rCandidate.maOffset - && maOffsetPosition == rCandidate.maOffsetPosition - && maRectPoint == rCandidate.maRectPoint - && mbTiling == rCandidate.mbTiling - && mbStretch == rCandidate.mbStretch - && mbLogSize == rCandidate.mbLogSize); + if(rCandidate.mpSdrFillBitmapAttribute == mpSdrFillBitmapAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFillBitmapAttribute == *mpSdrFillBitmapAttribute); + } + + const Bitmap& SdrFillBitmapAttribute::getBitmap() const + { + return mpSdrFillBitmapAttribute->getBitmap(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getSize() const + { + return mpSdrFillBitmapAttribute->getSize(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffset() const + { + return mpSdrFillBitmapAttribute->getOffset(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getOffsetPosition() const + { + return mpSdrFillBitmapAttribute->getOffsetPosition(); + } + + const basegfx::B2DVector& SdrFillBitmapAttribute::getRectPoint() const + { + return mpSdrFillBitmapAttribute->getRectPoint(); + } + + bool SdrFillBitmapAttribute::getTiling() const + { + return mpSdrFillBitmapAttribute->getTiling(); + } + + bool SdrFillBitmapAttribute::getStretch() const + { + return mpSdrFillBitmapAttribute->getStretch(); + } + + bool SdrFillBitmapAttribute::getLogSize() const + { + return mpSdrFillBitmapAttribute->getLogSize(); } FillBitmapAttribute SdrFillBitmapAttribute::getFillBitmapAttribute(const basegfx::B2DRange& rRange) const { // get logical size of bitmap (before expanding eventually) - Bitmap aBitmap(maBitmap); + Bitmap aBitmap(getBitmap()); const basegfx::B2DVector aLogicalSize(aBitmap.GetPrefSize().getWidth(), aBitmap.GetPrefSize().getHeight()); // get hor/ver shiftings and apply them eventually to the bitmap, but only @@ -85,17 +260,17 @@ namespace drawinglayer bool bExpandWidth(false); bool bExpandHeight(false); - if(mbTiling) + if(getTiling()) { - if(0.0 != maOffset.getX() || 0.0 != maOffset.getY()) + if(0.0 != getOffset().getX() || 0.0 != getOffset().getY()) { const sal_uInt32 nWidth(aBitmap.GetSizePixel().getWidth()); const sal_uInt32 nHeight(aBitmap.GetSizePixel().getHeight()); - if(0.0 != maOffset.getX()) + if(0.0 != getOffset().getX()) { bExpandHeight = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * maOffset.getX()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nWidth * getOffset().getX()) / 100.0)); aBitmap.Expand(0L, nHeight); const Size aSizeA(nOffset, nHeight); @@ -111,7 +286,7 @@ namespace drawinglayer else { bExpandWidth = true; - const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * maOffset.getY()) / 100.0)); + const sal_uInt32 nOffset(basegfx::fround(((double)nHeight * getOffset().getY()) / 100.0)); aBitmap.Expand(nWidth, 0L); const Size aSize(nWidth, nHeight); @@ -137,7 +312,7 @@ namespace drawinglayer basegfx::B2DVector aBitmapTopLeft(0.0, 0.0); // are canges needed? - if(mbTiling || !mbStretch) + if(getTiling() || !getStretch()) { // init values with range sizes const double fRangeWidth(0.0 != rRange.getWidth() ? rRange.getWidth() : 1.0); @@ -145,15 +320,15 @@ namespace drawinglayer aBitmapSize = basegfx::B2DPoint(fRangeWidth, fRangeHeight); // size changes - if(0.0 != maSize.getX()) + if(0.0 != getSize().getX()) { - if(maSize.getX() < 0.0) + if(getSize().getX() < 0.0) { - aBitmapSize.setX(aBitmapSize.getX() * (maSize.getX() * -0.01)); + aBitmapSize.setX(aBitmapSize.getX() * (getSize().getX() * -0.01)); } else { - aBitmapSize.setX(maSize.getX()); + aBitmapSize.setX(getSize().getX()); } } else @@ -161,15 +336,15 @@ namespace drawinglayer aBitmapSize.setX(aLogicalSize.getX()); } - if(0.0 != maSize.getY()) + if(0.0 != getSize().getY()) { - if(maSize.getY() < 0.0) + if(getSize().getY() < 0.0) { - aBitmapSize.setY(aBitmapSize.getY() * (maSize.getY() * -0.01)); + aBitmapSize.setY(aBitmapSize.getY() * (getSize().getY() * -0.01)); } else { - aBitmapSize.setY(maSize.getY()); + aBitmapSize.setY(getSize().getY()); } } else @@ -178,7 +353,7 @@ namespace drawinglayer } // get values, force to centered if necessary - const basegfx::B2DVector aRectPoint(mbTiling ? maRectPoint : basegfx::B2DVector(0.0, 0.0)); + const basegfx::B2DVector aRectPoint(getTiling() ? getRectPoint() : basegfx::B2DVector(0.0, 0.0)); // position changes X if(0.0 == aRectPoint.getX()) @@ -190,9 +365,9 @@ namespace drawinglayer aBitmapTopLeft.setX(fRangeWidth - aBitmapSize.getX()); } - if(mbTiling && 0.0 != maOffsetPosition.getX()) + if(getTiling() && 0.0 != getOffsetPosition().getX()) { - aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (maOffsetPosition.getX() * 0.01))); + aBitmapTopLeft.setX(aBitmapTopLeft.getX() + (aBitmapSize.getX() * (getOffsetPosition().getX() * 0.01))); } // position changes Y @@ -205,9 +380,9 @@ namespace drawinglayer aBitmapTopLeft.setY(fRangeHeight - aBitmapSize.getY()); } - if(mbTiling && 0.0 != maOffsetPosition.getY()) + if(getTiling() && 0.0 != getOffsetPosition().getY()) { - aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (maOffsetPosition.getY() * 0.01))); + aBitmapTopLeft.setY(aBitmapTopLeft.getY() + (aBitmapSize.getY() * (getOffsetPosition().getY() * 0.01))); } // apply expand @@ -228,7 +403,7 @@ namespace drawinglayer aBitmapSize.setY(aBitmapSize.getY() / fRangeHeight); } - return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, mbTiling); + return FillBitmapAttribute(BitmapEx(aBitmap), aBitmapTopLeft, aBitmapSize, getTiling()); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx new file mode 100644 index 000000000000..bc22d0a5f183 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DLightAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maColor; + basegfx::B3DVector maDirection; + + // bitfield + unsigned mbSpecular : 1; + + ImpSdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mnRefCount(0), + maColor(rColor), + maDirection(rDirection), + mbSpecular(bSpecular) + { + } + + // data read access + const basegfx::BColor& getColor() const { return maColor; } + const basegfx::B3DVector& getDirection() const { return maDirection; } + bool getSpecular() const { return mbSpecular; } + + bool operator==(const ImpSdr3DLightAttribute& rCandidate) const + { + return (getColor() == rCandidate.getColor() + && getDirection() == rCandidate.getDirection() + && getSpecular() == rCandidate.getSpecular()); + } + + static ImpSdr3DLightAttribute* get_global_default() + { + static ImpSdr3DLightAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DLightAttribute( + basegfx::BColor(), + basegfx::B3DVector(), + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DLightAttribute::Sdr3DLightAttribute( + const basegfx::BColor& rColor, + const basegfx::B3DVector& rDirection, + bool bSpecular) + : mpSdr3DLightAttribute(new ImpSdr3DLightAttribute( + rColor, rDirection, bSpecular)) + { + } + + Sdr3DLightAttribute::Sdr3DLightAttribute() + : mpSdr3DLightAttribute(ImpSdr3DLightAttribute::get_global_default()) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate) + : mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute) + { + mpSdr3DLightAttribute->mnRefCount++; + } + + Sdr3DLightAttribute::~Sdr3DLightAttribute() + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + } + + bool Sdr3DLightAttribute::isDefault() const + { + return mpSdr3DLightAttribute == ImpSdr3DLightAttribute::get_global_default(); + } + + Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute& rCandidate) + { + if(rCandidate.mpSdr3DLightAttribute != mpSdr3DLightAttribute) + { + if(mpSdr3DLightAttribute->mnRefCount) + { + mpSdr3DLightAttribute->mnRefCount--; + } + else + { + delete mpSdr3DLightAttribute; + } + + mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute; + mpSdr3DLightAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DLightAttribute == *mpSdr3DLightAttribute); + } + + const basegfx::BColor& Sdr3DLightAttribute::getColor() const + { + return mpSdr3DLightAttribute->getColor(); + } + + const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const + { + return mpSdr3DLightAttribute->getDirection(); + } + + bool Sdr3DLightAttribute::getSpecular() const + { + return mpSdr3DLightAttribute->getSpecular(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx new file mode 100644 index 000000000000..25407d52f282 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLightingAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D light attribute definitions + basegfx::BColor maAmbientLight; + ::std::vector< Sdr3DLightAttribute > maLightVector; + + ImpSdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mnRefCount(0), + maAmbientLight(rAmbientLight), + maLightVector(rLightVector) + { + } + + // data read access + const basegfx::BColor& getAmbientLight() const { return maAmbientLight; } + const ::std::vector< Sdr3DLightAttribute >& getLightVector() const { return maLightVector; } + + bool operator==(const ImpSdrLightingAttribute& rCandidate) const + { + return (getAmbientLight() == rCandidate.getAmbientLight() + && getLightVector() == rCandidate.getLightVector()); + } + + static ImpSdrLightingAttribute* get_global_default() + { + static ImpSdrLightingAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLightingAttribute( + basegfx::BColor(), + std::vector< Sdr3DLightAttribute >()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLightingAttribute::SdrLightingAttribute( + const basegfx::BColor& rAmbientLight, + const ::std::vector< Sdr3DLightAttribute >& rLightVector) + : mpSdrLightingAttribute(new ImpSdrLightingAttribute( + rAmbientLight, rLightVector)) + { + } + + SdrLightingAttribute::SdrLightingAttribute() + : mpSdrLightingAttribute(ImpSdrLightingAttribute::get_global_default()) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::SdrLightingAttribute(const SdrLightingAttribute& rCandidate) + : mpSdrLightingAttribute(rCandidate.mpSdrLightingAttribute) + { + mpSdrLightingAttribute->mnRefCount++; + } + + SdrLightingAttribute::~SdrLightingAttribute() + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + } + + bool SdrLightingAttribute::isDefault() const + { + return mpSdrLightingAttribute == ImpSdrLightingAttribute::get_global_default(); + } + + SdrLightingAttribute& SdrLightingAttribute::operator=(const SdrLightingAttribute& rCandidate) + { + if(rCandidate.mpSdrLightingAttribute != mpSdrLightingAttribute) + { + if(mpSdrLightingAttribute->mnRefCount) + { + mpSdrLightingAttribute->mnRefCount--; + } + else + { + delete mpSdrLightingAttribute; + } + + mpSdrLightingAttribute = rCandidate.mpSdrLightingAttribute; + mpSdrLightingAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const + { + if(rCandidate.mpSdrLightingAttribute == mpSdrLightingAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLightingAttribute == *mpSdrLightingAttribute); + } + + const basegfx::BColor& SdrLightingAttribute::getAmbientLight() const + { + return mpSdrLightingAttribute->getAmbientLight(); + } + + const ::std::vector< Sdr3DLightAttribute >& SdrLightingAttribute::getLightVector() const + { + return mpSdrLightingAttribute->getLightVector(); + } + + // color model solver + basegfx::BColor SdrLightingAttribute::solveColorModel( + const basegfx::B3DVector& rNormalInEyeCoordinates, + const basegfx::BColor& rColor, const basegfx::BColor& rSpecular, + const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const + { + // initialize with emissive color + basegfx::BColor aRetval(rEmission); + + // take care of global ambient light + aRetval += mpSdrLightingAttribute->getAmbientLight() * rColor; + + // prepare light access. Is there a light? + const sal_uInt32 nLightCount(mpSdrLightingAttribute->getLightVector().size()); + + if(nLightCount && !rNormalInEyeCoordinates.equalZero()) + { + // prepare normal + basegfx::B3DVector aEyeNormal(rNormalInEyeCoordinates); + aEyeNormal.normalize(); + + for(sal_uInt32 a(0L); a < nLightCount; a++) + { + const Sdr3DLightAttribute& rLight(mpSdrLightingAttribute->getLightVector()[a]); + const double fCosFac(rLight.getDirection().scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac, 0.0)) + { + aRetval += ((rLight.getColor() * rColor) * fCosFac); + + if(rLight.getSpecular()) + { + // expand by (0.0, 0.0, 1.0) in Z + basegfx::B3DVector aSpecularNormal(rLight.getDirection().getX(), rLight.getDirection().getY(), rLight.getDirection().getZ() + 1.0); + aSpecularNormal.normalize(); + double fCosFac2(aSpecularNormal.scalar(aEyeNormal)); + + if(basegfx::fTools::more(fCosFac2, 0.0)) + { + fCosFac2 = pow(fCosFac2, (double)nSpecularIntensity); + aRetval += (rSpecular * fCosFac2); + } + } + } + } + } + + // clamp to color space before usage + aRetval.clamp(); + + return aRetval; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx new file mode 100644 index 000000000000..1850d919069f --- /dev/null +++ b/drawinglayer/source/attribute/sdrlineattribute.cxx @@ -0,0 +1,250 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line definitions + basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines + double mfWidth; // 1/100th mm, 0.0==hair + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of line + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpSdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + meJoin(eJoin), + mfWidth(fWidth), + mfTransparence(fTransparence), + maColor(rColor), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + ImpSdrLineAttribute(const basegfx::BColor& rColor) + : mnRefCount(0), + meJoin(basegfx::B2DLINEJOIN_NONE), + mfWidth(0.0), + mfTransparence(0.0), + maColor(rColor), + maDotDashArray(), + mfFullDotDashLen(0.0) + { + } + + // data read access + basegfx::B2DLineJoin getJoin() const { return meJoin; } + double getWidth() const { return mfWidth; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const { return mfFullDotDashLen; } + + bool operator==(const ImpSdrLineAttribute& rCandidate) const + { + return (getJoin() == rCandidate.getJoin() + && getWidth() == rCandidate.getWidth() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor() + && getDotDashArray() == rCandidate.getDotDashArray()); + } + + static ImpSdrLineAttribute* get_global_default() + { + static ImpSdrLineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineAttribute( + basegfx::B2DLINEJOIN_ROUND, + 0.0, + 0.0, + basegfx::BColor(), + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineAttribute::SdrLineAttribute( + basegfx::B2DLineJoin eJoin, + double fWidth, + double fTransparence, + const basegfx::BColor& rColor, + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpSdrLineAttribute(new ImpSdrLineAttribute( + eJoin, fWidth, fTransparence, rColor, rDotDashArray, fFullDotDashLen)) + { + } + + SdrLineAttribute::SdrLineAttribute( + const basegfx::BColor& rColor) + : mpSdrLineAttribute(new ImpSdrLineAttribute(rColor)) + { + } + + SdrLineAttribute::SdrLineAttribute() + : mpSdrLineAttribute(ImpSdrLineAttribute::get_global_default()) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::SdrLineAttribute(const SdrLineAttribute& rCandidate) + : mpSdrLineAttribute(rCandidate.mpSdrLineAttribute) + { + mpSdrLineAttribute->mnRefCount++; + } + + SdrLineAttribute::~SdrLineAttribute() + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + } + + bool SdrLineAttribute::isDefault() const + { + return mpSdrLineAttribute == ImpSdrLineAttribute::get_global_default(); + } + + SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute& rCandidate) + { + if(rCandidate.mpSdrLineAttribute != mpSdrLineAttribute) + { + if(mpSdrLineAttribute->mnRefCount) + { + mpSdrLineAttribute->mnRefCount--; + } + else + { + delete mpSdrLineAttribute; + } + + mpSdrLineAttribute = rCandidate.mpSdrLineAttribute; + mpSdrLineAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineAttribute == mpSdrLineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineAttribute == *mpSdrLineAttribute); + } + + basegfx::B2DLineJoin SdrLineAttribute::getJoin() const + { + return mpSdrLineAttribute->getJoin(); + } + + double SdrLineAttribute::getWidth() const + { + return mpSdrLineAttribute->getWidth(); + } + + double SdrLineAttribute::getTransparence() const + { + return mpSdrLineAttribute->getTransparence(); + } + + const basegfx::BColor& SdrLineAttribute::getColor() const + { + return mpSdrLineAttribute->getColor(); + } + + const ::std::vector< double >& SdrLineAttribute::getDotDashArray() const + { + return mpSdrLineAttribute->getDotDashArray(); + } + + double SdrLineAttribute::getFullDotDashLen() const + { + return mpSdrLineAttribute->getFullDotDashLen(); + } + + bool SdrLineAttribute::isDashed() const + { + return (0L != getDotDashArray().size()); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx new file mode 100644 index 000000000000..ce85bdff5678 --- /dev/null +++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrLineStartEndAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // line arrow definitions + basegfx::B2DPolyPolygon maStartPolyPolygon; // start Line PolyPolygon + basegfx::B2DPolyPolygon maEndPolyPolygon; // end Line PolyPolygon + double mfStartWidth; // 1/100th mm + double mfEndWidth; // 1/100th mm + + // bitfield + unsigned mbStartActive : 1L; // start of Line is active + unsigned mbEndActive : 1L; // end of Line is active + unsigned mbStartCentered : 1L; // Line is centered on line start point + unsigned mbEndCentered : 1L; // Line is centered on line end point + + ImpSdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mnRefCount(0), + maStartPolyPolygon(rStartPolyPolygon), + maEndPolyPolygon(rEndPolyPolygon), + mfStartWidth(fStartWidth), + mfEndWidth(fEndWidth), + mbStartActive(bStartActive), + mbEndActive(bEndActive), + mbStartCentered(bStartCentered), + mbEndCentered(bEndCentered) + { + } + + // data read access + const basegfx::B2DPolyPolygon& getStartPolyPolygon() const { return maStartPolyPolygon; } + const basegfx::B2DPolyPolygon& getEndPolyPolygon() const { return maEndPolyPolygon; } + double getStartWidth() const { return mfStartWidth; } + double getEndWidth() const { return mfEndWidth; } + bool isStartActive() const { return mbStartActive; } + bool isEndActive() const { return mbEndActive; } + bool isStartCentered() const { return mbStartCentered; } + bool isEndCentered() const { return mbEndCentered; } + + bool operator==(const ImpSdrLineStartEndAttribute& rCandidate) const + { + return (getStartPolyPolygon() == rCandidate.getStartPolyPolygon() + && getEndPolyPolygon() == rCandidate.getEndPolyPolygon() + && getStartWidth() == rCandidate.getStartWidth() + && getEndWidth() == rCandidate.getEndWidth() + && isStartActive() == rCandidate.isStartActive() + && isEndActive() == rCandidate.isEndActive() + && isStartCentered() == rCandidate.isStartCentered() + && isEndCentered() == rCandidate.isEndCentered()); + } + + static ImpSdrLineStartEndAttribute* get_global_default() + { + static ImpSdrLineStartEndAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrLineStartEndAttribute( + basegfx::B2DPolyPolygon(), + basegfx::B2DPolyPolygon(), + 0.0, + 0.0, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrLineStartEndAttribute::SdrLineStartEndAttribute( + const basegfx::B2DPolyPolygon& rStartPolyPolygon, + const basegfx::B2DPolyPolygon& rEndPolyPolygon, + double fStartWidth, + double fEndWidth, + bool bStartActive, + bool bEndActive, + bool bStartCentered, + bool bEndCentered) + : mpSdrLineStartEndAttribute(new ImpSdrLineStartEndAttribute( + rStartPolyPolygon, rEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered)) + { + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute() + : mpSdrLineStartEndAttribute(ImpSdrLineStartEndAttribute::get_global_default()) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate) + : mpSdrLineStartEndAttribute(rCandidate.mpSdrLineStartEndAttribute) + { + mpSdrLineStartEndAttribute->mnRefCount++; + } + + SdrLineStartEndAttribute::~SdrLineStartEndAttribute() + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + } + + bool SdrLineStartEndAttribute::isDefault() const + { + return mpSdrLineStartEndAttribute == ImpSdrLineStartEndAttribute::get_global_default(); + } + + SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute& rCandidate) + { + if(rCandidate.mpSdrLineStartEndAttribute != mpSdrLineStartEndAttribute) + { + if(mpSdrLineStartEndAttribute->mnRefCount) + { + mpSdrLineStartEndAttribute->mnRefCount--; + } + else + { + delete mpSdrLineStartEndAttribute; + } + + mpSdrLineStartEndAttribute = rCandidate.mpSdrLineStartEndAttribute; + mpSdrLineStartEndAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const + { + if(rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrLineStartEndAttribute == *mpSdrLineStartEndAttribute); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getStartPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getStartPolyPolygon(); + } + + const basegfx::B2DPolyPolygon& SdrLineStartEndAttribute::getEndPolyPolygon() const + { + return mpSdrLineStartEndAttribute->getEndPolyPolygon(); + } + + double SdrLineStartEndAttribute::getStartWidth() const + { + return mpSdrLineStartEndAttribute->getStartWidth(); + } + + double SdrLineStartEndAttribute::getEndWidth() const + { + return mpSdrLineStartEndAttribute->getEndWidth(); + } + + bool SdrLineStartEndAttribute::isStartActive() const + { + return mpSdrLineStartEndAttribute->isStartActive(); + } + + bool SdrLineStartEndAttribute::isEndActive() const + { + return mpSdrLineStartEndAttribute->isEndActive(); + } + + bool SdrLineStartEndAttribute::isStartCentered() const + { + return mpSdrLineStartEndAttribute->isStartCentered(); + } + + bool SdrLineStartEndAttribute::isEndCentered() const + { + return mpSdrLineStartEndAttribute->isEndCentered(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx new file mode 100644 index 000000000000..a51e333236bc --- /dev/null +++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx @@ -0,0 +1,292 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdr3DObjectAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D object attribute definitions + ::com::sun::star::drawing::NormalsKind maNormalsKind; // normals type (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionX; // texture projection type X (0..2) + ::com::sun::star::drawing::TextureProjectionMode maTextureProjectionY; // texture projection type Y (0..2) + ::com::sun::star::drawing::TextureKind2 maTextureKind; // texture kind (see uno API) + ::com::sun::star::drawing::TextureMode maTextureMode; // texture kind (see uno API) + MaterialAttribute3D maMaterial; // object, specular and emissive colors, SpecularIntensity + + // bitfield + unsigned mbNormalsInvert : 1; // invert normals + unsigned mbDoubleSided : 1; // surfaces are double sided + unsigned mbShadow3D : 1; // display shadow in 3D (if on), params for that are at scene + unsigned mbTextureFilter : 1; // filter texture to make more smooth + unsigned mbReducedLineGeometry : 1; // use reduced line geometry (object specific) + + ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mnRefCount(0), + maNormalsKind(aNormalsKind), + maTextureProjectionX(aTextureProjectionX), + maTextureProjectionY(aTextureProjectionY), + maTextureKind(aTextureKind), + maTextureMode(aTextureMode), + maMaterial(rMaterial), + mbNormalsInvert(bNormalsInvert), + mbDoubleSided(bDoubleSided), + mbShadow3D(bShadow3D), + mbTextureFilter(bTextureFilter), + mbReducedLineGeometry(bReducedLineGeometry) + { + } + + // data read access + ::com::sun::star::drawing::NormalsKind getNormalsKind() const { return maNormalsKind; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const { return maTextureProjectionX; } + ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const { return maTextureProjectionY; } + ::com::sun::star::drawing::TextureKind2 getTextureKind() const { return maTextureKind; } + ::com::sun::star::drawing::TextureMode getTextureMode() const { return maTextureMode; } + const MaterialAttribute3D& getMaterial() const { return maMaterial; } + bool getNormalsInvert() const { return mbNormalsInvert; } + bool getDoubleSided() const { return mbDoubleSided; } + bool getShadow3D() const { return mbShadow3D; } + bool getTextureFilter() const { return mbTextureFilter; } + bool getReducedLineGeometry() const { return mbReducedLineGeometry; } + + bool operator==(const ImpSdr3DObjectAttribute& rCandidate) const + { + return (getNormalsKind() == rCandidate.getNormalsKind() + && getTextureProjectionX() == rCandidate.getTextureProjectionX() + && getTextureProjectionY() == rCandidate.getTextureProjectionY() + && getTextureKind() == rCandidate.getTextureKind() + && getTextureMode() == rCandidate.getTextureMode() + && getMaterial() == rCandidate.getMaterial() + && getNormalsInvert() == rCandidate.getNormalsInvert() + && getDoubleSided() == rCandidate.getDoubleSided() + && getShadow3D() == rCandidate.getShadow3D() + && getTextureFilter() == rCandidate.getTextureFilter() + && getReducedLineGeometry() == rCandidate.getReducedLineGeometry()); + } + + static ImpSdr3DObjectAttribute* get_global_default() + { + static ImpSdr3DObjectAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind_SPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC, + ::com::sun::star::drawing::TextureKind2_LUMINANCE, + ::com::sun::star::drawing::TextureMode_REPLACE, + MaterialAttribute3D(), + false, + false, + false, + false, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + Sdr3DObjectAttribute::Sdr3DObjectAttribute( + ::com::sun::star::drawing::NormalsKind aNormalsKind, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX, + ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY, + ::com::sun::star::drawing::TextureKind2 aTextureKind, + ::com::sun::star::drawing::TextureMode aTextureMode, + const MaterialAttribute3D& rMaterial, + bool bNormalsInvert, + bool bDoubleSided, + bool bShadow3D, + bool bTextureFilter, + bool bReducedLineGeometry) + : mpSdr3DObjectAttribute(new ImpSdr3DObjectAttribute( + aNormalsKind, aTextureProjectionX, aTextureProjectionY, aTextureKind, aTextureMode, + rMaterial, bNormalsInvert, bDoubleSided, bShadow3D, bTextureFilter, bReducedLineGeometry)) + { + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute() + : mpSdr3DObjectAttribute(ImpSdr3DObjectAttribute::get_global_default()) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate) + : mpSdr3DObjectAttribute(rCandidate.mpSdr3DObjectAttribute) + { + mpSdr3DObjectAttribute->mnRefCount++; + } + + Sdr3DObjectAttribute::~Sdr3DObjectAttribute() + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + } + + bool Sdr3DObjectAttribute::isDefault() const + { + return mpSdr3DObjectAttribute == ImpSdr3DObjectAttribute::get_global_default(); + } + + Sdr3DObjectAttribute& Sdr3DObjectAttribute::operator=(const Sdr3DObjectAttribute& rCandidate) + { + if(rCandidate.mpSdr3DObjectAttribute != mpSdr3DObjectAttribute) + { + if(mpSdr3DObjectAttribute->mnRefCount) + { + mpSdr3DObjectAttribute->mnRefCount--; + } + else + { + delete mpSdr3DObjectAttribute; + } + + mpSdr3DObjectAttribute = rCandidate.mpSdr3DObjectAttribute; + mpSdr3DObjectAttribute->mnRefCount++; + } + + return *this; + } + + bool Sdr3DObjectAttribute::operator==(const Sdr3DObjectAttribute& rCandidate) const + { + if(rCandidate.mpSdr3DObjectAttribute == mpSdr3DObjectAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdr3DObjectAttribute == *mpSdr3DObjectAttribute); + } + + ::com::sun::star::drawing::NormalsKind Sdr3DObjectAttribute::getNormalsKind() const + { + return mpSdr3DObjectAttribute->getNormalsKind(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionX() const + { + return mpSdr3DObjectAttribute->getTextureProjectionX(); + } + + ::com::sun::star::drawing::TextureProjectionMode Sdr3DObjectAttribute::getTextureProjectionY() const + { + return mpSdr3DObjectAttribute->getTextureProjectionY(); + } + + ::com::sun::star::drawing::TextureKind2 Sdr3DObjectAttribute::getTextureKind() const + { + return mpSdr3DObjectAttribute->getTextureKind(); + } + + ::com::sun::star::drawing::TextureMode Sdr3DObjectAttribute::getTextureMode() const + { + return mpSdr3DObjectAttribute->getTextureMode(); + } + + const MaterialAttribute3D& Sdr3DObjectAttribute::getMaterial() const + { + return mpSdr3DObjectAttribute->getMaterial(); + } + + bool Sdr3DObjectAttribute::getNormalsInvert() const + { + return mpSdr3DObjectAttribute->getNormalsInvert(); + } + + bool Sdr3DObjectAttribute::getDoubleSided() const + { + return mpSdr3DObjectAttribute->getDoubleSided(); + } + + bool Sdr3DObjectAttribute::getShadow3D() const + { + return mpSdr3DObjectAttribute->getShadow3D(); + } + + bool Sdr3DObjectAttribute::getTextureFilter() const + { + return mpSdr3DObjectAttribute->getTextureFilter(); + } + + bool Sdr3DObjectAttribute::getReducedLineGeometry() const + { + return mpSdr3DObjectAttribute->getReducedLineGeometry(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx new file mode 100644 index 000000000000..141f4c904873 --- /dev/null +++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute3d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrSceneAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // 3D scene attribute definitions + double mfDistance; + double mfShadowSlant; + ::com::sun::star::drawing::ProjectionMode maProjectionMode; + ::com::sun::star::drawing::ShadeMode maShadeMode; + + // bitfield + unsigned mbTwoSidedLighting : 1; + + public: + ImpSdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mnRefCount(0), + mfDistance(fDistance), + mfShadowSlant(fShadowSlant), + maProjectionMode(aProjectionMode), + maShadeMode(aShadeMode), + mbTwoSidedLighting(bTwoSidedLighting) + { + } + + // data read access + double getDistance() const { return mfDistance; } + double getShadowSlant() const { return mfShadowSlant; } + ::com::sun::star::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; } + ::com::sun::star::drawing::ShadeMode getShadeMode() const { return maShadeMode; } + bool getTwoSidedLighting() const { return mbTwoSidedLighting; } + + bool operator==(const ImpSdrSceneAttribute& rCandidate) const + { + return (getDistance() == rCandidate.getDistance() + && getShadowSlant() == rCandidate.getShadowSlant() + && getProjectionMode() == rCandidate.getProjectionMode() + && getShadeMode() == rCandidate.getShadeMode() + && getTwoSidedLighting() == rCandidate.getTwoSidedLighting()); + } + + static ImpSdrSceneAttribute* get_global_default() + { + static ImpSdrSceneAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrSceneAttribute( + 0.0, 0.0, + ::com::sun::star::drawing::ProjectionMode_PARALLEL, + ::com::sun::star::drawing::ShadeMode_FLAT, + false); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrSceneAttribute::SdrSceneAttribute( + double fDistance, + double fShadowSlant, + ::com::sun::star::drawing::ProjectionMode aProjectionMode, + ::com::sun::star::drawing::ShadeMode aShadeMode, + bool bTwoSidedLighting) + : mpSdrSceneAttribute(new ImpSdrSceneAttribute( + fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting)) + { + } + + SdrSceneAttribute::SdrSceneAttribute() + : mpSdrSceneAttribute(ImpSdrSceneAttribute::get_global_default()) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute& rCandidate) + : mpSdrSceneAttribute(rCandidate.mpSdrSceneAttribute) + { + mpSdrSceneAttribute->mnRefCount++; + } + + SdrSceneAttribute::~SdrSceneAttribute() + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + } + + bool SdrSceneAttribute::isDefault() const + { + return mpSdrSceneAttribute == ImpSdrSceneAttribute::get_global_default(); + } + + SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute& rCandidate) + { + if(rCandidate.mpSdrSceneAttribute != mpSdrSceneAttribute) + { + if(mpSdrSceneAttribute->mnRefCount) + { + mpSdrSceneAttribute->mnRefCount--; + } + else + { + delete mpSdrSceneAttribute; + } + + mpSdrSceneAttribute = rCandidate.mpSdrSceneAttribute; + mpSdrSceneAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const + { + if(rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrSceneAttribute == *mpSdrSceneAttribute); + } + + double SdrSceneAttribute::getDistance() const + { + return mpSdrSceneAttribute->getDistance(); + } + + double SdrSceneAttribute::getShadowSlant() const + { + return mpSdrSceneAttribute->getShadowSlant(); + } + + ::com::sun::star::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const + { + return mpSdrSceneAttribute->getProjectionMode(); + } + + ::com::sun::star::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const + { + return mpSdrSceneAttribute->getShadeMode(); + } + + bool SdrSceneAttribute::getTwoSidedLighting() const + { + return mpSdrSceneAttribute->getTwoSidedLighting(); + } + + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx new file mode 100644 index 000000000000..9b31b5c6d348 --- /dev/null +++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrattribute.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class ImpSdrShadowAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // shadow definitions + basegfx::B2DVector maOffset; // shadow offset 1/100th mm + double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. + basegfx::BColor maColor; // color of shadow + + ImpSdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mnRefCount(0), + maOffset(rOffset), + mfTransparence(fTransparence), + maColor(rColor) + { + } + + // data read access + const basegfx::B2DVector& getOffset() const { return maOffset; } + double getTransparence() const { return mfTransparence; } + const basegfx::BColor& getColor() const { return maColor; } + + bool operator==(const ImpSdrShadowAttribute& rCandidate) const + { + return (getOffset() == rCandidate.getOffset() + && getTransparence() == rCandidate.getTransparence() + && getColor() == rCandidate.getColor()); + } + + static ImpSdrShadowAttribute* get_global_default() + { + static ImpSdrShadowAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrShadowAttribute( + basegfx::B2DVector(), + 0.0, + basegfx::BColor()); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + SdrShadowAttribute::SdrShadowAttribute( + const basegfx::B2DVector& rOffset, + double fTransparence, + const basegfx::BColor& rColor) + : mpSdrShadowAttribute(new ImpSdrShadowAttribute( + rOffset, fTransparence, rColor)) + { + } + + SdrShadowAttribute::SdrShadowAttribute() + : mpSdrShadowAttribute(ImpSdrShadowAttribute::get_global_default()) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute& rCandidate) + : mpSdrShadowAttribute(rCandidate.mpSdrShadowAttribute) + { + mpSdrShadowAttribute->mnRefCount++; + } + + SdrShadowAttribute::~SdrShadowAttribute() + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + } + + bool SdrShadowAttribute::isDefault() const + { + return mpSdrShadowAttribute == ImpSdrShadowAttribute::get_global_default(); + } + + SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute& rCandidate) + { + if(rCandidate.mpSdrShadowAttribute != mpSdrShadowAttribute) + { + if(mpSdrShadowAttribute->mnRefCount) + { + mpSdrShadowAttribute->mnRefCount--; + } + else + { + delete mpSdrShadowAttribute; + } + + mpSdrShadowAttribute = rCandidate.mpSdrShadowAttribute; + mpSdrShadowAttribute->mnRefCount++; + } + + return *this; + } + + bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const + { + if(rCandidate.mpSdrShadowAttribute == mpSdrShadowAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrShadowAttribute == *mpSdrShadowAttribute); + } + + const basegfx::B2DVector& SdrShadowAttribute::getOffset() const + { + return mpSdrShadowAttribute->getOffset(); + } + + double SdrShadowAttribute::getTransparence() const + { + return mpSdrShadowAttribute->getTransparence(); + } + + const basegfx::BColor& SdrShadowAttribute::getColor() const + { + return mpSdrShadowAttribute->getColor(); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx index f3eb4797b832..da1239e53211 100644 --- a/drawinglayer/source/attribute/strokeattribute.cxx +++ b/drawinglayer/source/attribute/strokeattribute.cxx @@ -45,16 +45,143 @@ namespace drawinglayer { namespace attribute { - double StrokeAttribute::getFullDotDashLen() const + class ImpStrokeAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // data definitions + ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern + double mfFullDotDashLen; // sum of maDotDashArray (for convenience) + + ImpStrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mnRefCount(0), + maDotDashArray(rDotDashArray), + mfFullDotDashLen(fFullDotDashLen) + { + } + + // data read access + const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } + double getFullDotDashLen() const + { + if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + { + // calculate length on demand + const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); + const_cast< ImpStrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + } + + return mfFullDotDashLen; + } + + bool operator==(const ImpStrokeAttribute& rCandidate) const + { + return (getDotDashArray() == rCandidate.getDotDashArray() + && getFullDotDashLen() == rCandidate.getFullDotDashLen()); + } + + static ImpStrokeAttribute* get_global_default() + { + static ImpStrokeAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpStrokeAttribute( + std::vector< double >(), + 0.0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + + StrokeAttribute::StrokeAttribute( + const ::std::vector< double >& rDotDashArray, + double fFullDotDashLen) + : mpStrokeAttribute(new ImpStrokeAttribute( + rDotDashArray, fFullDotDashLen)) + { + } + + StrokeAttribute::StrokeAttribute() + : mpStrokeAttribute(ImpStrokeAttribute::get_global_default()) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::StrokeAttribute(const StrokeAttribute& rCandidate) + : mpStrokeAttribute(rCandidate.mpStrokeAttribute) + { + mpStrokeAttribute->mnRefCount++; + } + + StrokeAttribute::~StrokeAttribute() + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + } + + bool StrokeAttribute::isDefault() const + { + return mpStrokeAttribute == ImpStrokeAttribute::get_global_default(); + } + + StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute& rCandidate) + { + if(rCandidate.mpStrokeAttribute != mpStrokeAttribute) + { + if(mpStrokeAttribute->mnRefCount) + { + mpStrokeAttribute->mnRefCount--; + } + else + { + delete mpStrokeAttribute; + } + + mpStrokeAttribute = rCandidate.mpStrokeAttribute; + mpStrokeAttribute->mnRefCount++; + } + + return *this; + } + + bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const { - if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + if(rCandidate.mpStrokeAttribute == mpStrokeAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) { - // calculate length on demand - const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); - const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + return false; } - return mfFullDotDashLen; + return (*rCandidate.mpStrokeAttribute == *mpStrokeAttribute); + } + + const ::std::vector< double >& StrokeAttribute::getDotDashArray() const + { + return mpStrokeAttribute->getDotDashArray(); + } + + double StrokeAttribute::getFullDotDashLen() const + { + return mpStrokeAttribute->getFullDotDashLen(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index 3a3fd68831db..0f808e69b205 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -313,6 +313,22 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation2D() + : mnRefCount(0), + maObjectTransformation(), + maViewTransformation(), + maObjectToViewTransformation(), + maInverseObjectToViewTransformation(), + maViewport(), + maDiscreteViewport(), + mxVisualizedPage(), + mfViewTime(), + mbReducedDisplayQuality(false), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; @@ -410,6 +426,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation2D* get_global_default() + { + static ImpViewInformation2D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation2D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -442,6 +473,12 @@ namespace drawinglayer { } + ViewInformation2D::ViewInformation2D() + : mpViewInformation2D(ImpViewInformation2D::get_global_default()) + { + mpViewInformation2D->mnRefCount++; + } + ViewInformation2D::ViewInformation2D(const ViewInformation2D& rCandidate) : mpViewInformation2D(rCandidate.mpViewInformation2D) { @@ -463,6 +500,11 @@ namespace drawinglayer } } + bool ViewInformation2D::isDefault() const + { + return mpViewInformation2D == ImpViewInformation2D::get_global_default(); + } + ViewInformation2D& ViewInformation2D::operator=(const ViewInformation2D& rCandidate) { ::osl::Mutex m_mutex; @@ -489,6 +531,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation2D == *mpViewInformation2D); } diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx index a47384485ee7..62388adad37c 100644 --- a/drawinglayer/source/geometry/viewinformation3d.cxx +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -395,6 +395,18 @@ namespace drawinglayer impInterpretPropertyValues(rViewParameters); } + ImpViewInformation3D() + : mnRefCount(0), + maObjectTransformation(), + maOrientation(), + maProjection(), + maDeviceToView(), + mfViewTime(), + mxViewInformation(), + mxExtendedInformation() + { + } + const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; } const basegfx::B3DHomMatrix& getProjection() const { return maProjection; } @@ -440,6 +452,21 @@ namespace drawinglayer && mfViewTime == rCandidate.mfViewTime && mxExtendedInformation == rCandidate.mxExtendedInformation); } + + static ImpViewInformation3D* get_global_default() + { + static ImpViewInformation3D* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpViewInformation3D(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } }; } // end of anonymous namespace } // end of namespace drawinglayer @@ -457,7 +484,9 @@ namespace drawinglayer const basegfx::B3DHomMatrix& rDeviceToView, double fViewTime, const uno::Sequence< beans::PropertyValue >& rExtendedParameters) - : mpViewInformation3D(new ImpViewInformation3D(rObjectObjectTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters)) + : mpViewInformation3D(new ImpViewInformation3D( + rObjectObjectTransformation, rOrientation, rProjection, + rDeviceToView, fViewTime, rExtendedParameters)) { } @@ -466,6 +495,12 @@ namespace drawinglayer { } + ViewInformation3D::ViewInformation3D() + : mpViewInformation3D(ImpViewInformation3D::get_global_default()) + { + mpViewInformation3D->mnRefCount++; + } + ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate) : mpViewInformation3D(rCandidate.mpViewInformation3D) { @@ -487,6 +522,11 @@ namespace drawinglayer } } + bool ViewInformation3D::isDefault() const + { + return mpViewInformation3D == ImpViewInformation3D::get_global_default(); + } + ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate) { ::osl::Mutex m_mutex; @@ -513,6 +553,11 @@ namespace drawinglayer return true; } + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + return (*rCandidate.mpViewInformation3D == *mpViewInformation3D); } diff --git a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx b/drawinglayer/source/primitive2d/alphaprimitive2d.cxx deleted file mode 100644 index a503c2979c41..000000000000 --- a/drawinglayer/source/primitive2d/alphaprimitive2d.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: alphaprimitive2d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - AlphaPrimitive2D::AlphaPrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rAlpha) - : GroupPrimitive2D(rChildren), - maAlpha(rAlpha) - { - } - - bool AlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const AlphaPrimitive2D& rCompare = (AlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - - // provide unique ID - ImplPrimitrive2DIDBlock(AlphaPrimitive2D, PRIMITIVE2D_ID_ALPHAPRIMITIVE2D) - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx index ab9e9d19f6d2..aa5ede25314c 100644 --- a/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillbitmapprimitive2d.cxx @@ -56,46 +56,54 @@ namespace drawinglayer { Primitive2DSequence FillBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); Primitive2DSequence aRetval; - // is there a tile with some size at all? - if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + if(!getFillBitmap().isDefault()) { - if(getFillBitmap().getTiling()) - { - // get object range and create tiling matrices - ::std::vector< basegfx::B2DHomMatrix > aMatrices; - texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); - aTiling.appendTransformations(aMatrices); - - // resize result - aRetval.realloc(aMatrices.size()); + const Size aTileSizePixel(getFillBitmap().getBitmapEx().GetSizePixel()); - // create one primitive for each matrix - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + // is there a tile with some size at all? + if(aTileSizePixel.getWidth() && aTileSizePixel.getHeight()) + { + if(getFillBitmap().getTiling()) { - basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; - aNewMatrix *= getTransformation(); - - // create bitmap primitive and add to result - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); - aRetval[a] = xRef; + // get object range and create tiling matrices + ::std::vector< basegfx::B2DHomMatrix > aMatrices; + texture::GeoTexSvxTiled aTiling(getFillBitmap().getTopLeft(), getFillBitmap().getSize()); + aTiling.appendTransformations(aMatrices); + + // resize result + aRetval.realloc(aMatrices.size()); + + // create one primitive for each matrix + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + basegfx::B2DHomMatrix aNewMatrix = aMatrices[a]; + aNewMatrix *= getTransformation(); + + // create bitmap primitive and add to result + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aNewMatrix)); + + aRetval[a] = xRef; + } + } + else + { + // create new object transform + basegfx::B2DHomMatrix aObjectTransform; + aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); + aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); + aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); + aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); + aObjectTransform *= getTransformation(); + + // create bitmap primitive and add exclusive to decomposition (hand over ownership) + const Primitive2DReference xRef( + new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); + + aRetval = Primitive2DSequence(&xRef, 1L); } - } - else - { - // create new object transform - basegfx::B2DHomMatrix aObjectTransform; - aObjectTransform.set(0L, 0L, getFillBitmap().getSize().getX()); - aObjectTransform.set(1L, 1L, getFillBitmap().getSize().getY()); - aObjectTransform.set(0L, 2L, getFillBitmap().getTopLeft().getX()); - aObjectTransform.set(1L, 2L, getFillBitmap().getTopLeft().getY()); - aObjectTransform *= getTransformation(); - - // create bitmap primitive and add exclusive to decomposition (hand over ownership) - const Primitive2DReference xRef(new BitmapPrimitive2D(getFillBitmap().getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DSequence(&xRef, 1L); } } @@ -127,7 +135,7 @@ namespace drawinglayer basegfx::B2DRange FillBitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const { // return range of it - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(getTransformation()); return basegfx::tools::getRange(aPolygon); } diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 625dae6cb93a..7df93f9defce 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -62,10 +62,10 @@ namespace drawinglayer rColors.clear(); // make sure steps is not too high/low - const basegfx::BColor aStart(maFillGradient.getStartColor()); - const basegfx::BColor aEnd(maFillGradient.getEndColor()); + const basegfx::BColor aStart(getFillGradient().getStartColor()); + const basegfx::BColor aEnd(getFillGradient().getEndColor()); const sal_uInt32 nMaxSteps(sal_uInt32((aStart.getMaximumDistance(aEnd) * 127.5) + 0.5)); - sal_uInt32 nSteps(maFillGradient.getSteps()); + sal_uInt32 nSteps(getFillGradient().getSteps()); if(nSteps == 0) { @@ -82,46 +82,46 @@ namespace drawinglayer nSteps = nMaxSteps; } - switch(maFillGradient.getStyle()) + switch(getFillGradient().getStyle()) { case attribute::GRADIENTSTYLE_LINEAR: { - texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientLinear aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_AXIAL: { - texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientAxial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RADIAL: { - texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY()); + texture::GeoTexSvxGradientRadial aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_ELLIPTICAL: { - texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientElliptical aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_SQUARE: { - texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientSquare aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; } case attribute::GRADIENTSTYLE_RECT: { - texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, maFillGradient.getBorder(), maFillGradient.getOffsetX(), maFillGradient.getOffsetY(), -maFillGradient.getAngle()); + texture::GeoTexSvxGradientRect aGradient(getObjectRange(), aStart, aEnd, nSteps, getFillGradient().getBorder(), getFillGradient().getOffsetX(), getFillGradient().getOffsetY(), -getFillGradient().getAngle()); aGradient.appendTransformations(rMatrices); aGradient.appendColors(rColors); break; @@ -218,15 +218,15 @@ namespace drawinglayer // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; - if(attribute::GRADIENTSTYLE_RADIAL == maFillGradient.getStyle() - || attribute::GRADIENTSTYLE_ELLIPTICAL == maFillGradient.getStyle()) + if(attribute::GRADIENTSTYLE_RADIAL == getFillGradient().getStyle() + || attribute::GRADIENTSTYLE_ELLIPTICAL == getFillGradient().getStyle()) { const basegfx::B2DPoint aCircleCenter(0.5, 0.5); aUnitPolygon = basegfx::tools::createPolygonFromEllipse(aCircleCenter, 0.5, 0.5); } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // get the transform matrices and colors (where colors @@ -253,7 +253,15 @@ namespace drawinglayer // that the rings will not overlap. This is useful fir the old XOR-paint // 'trick' of VCL which is recorded in Metafiles; so this version may be // used from the MetafilePrimitive2D in it's decomposition. - return createFill(true); + + if(!getFillGradient().isDefault()) + { + return createFill(true); + } + else + { + return Primitive2DSequence(); + } } FillGradientPrimitive2D::FillGradientPrimitive2D( @@ -272,7 +280,7 @@ namespace drawinglayer const FillGradientPrimitive2D& rCompare = (FillGradientPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillGradient == rCompare.maFillGradient); + && getFillGradient() == rCompare.getFillGradient()); } return false; diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 9e6e69516d43..e042019eb64b 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -57,65 +57,73 @@ namespace drawinglayer { Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create hatch - const basegfx::BColor aHatchColor(maFillHatch.getColor()); - const double fAngle(-maFillHatch.getAngle()); - ::std::vector< basegfx::B2DHomMatrix > aMatrices; + Primitive2DSequence aRetval; - // get hatch transformations - switch(maFillHatch.getStyle()) + if(!getFillHatch().isDefault()) { - case attribute::HATCHSTYLE_TRIPLE: - { - // rotated 45 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI4); - aHatch.appendTransformations(aMatrices); + // create hatch + const basegfx::BColor aHatchColor(getFillHatch().getColor()); + const double fAngle(-getFillHatch().getAngle()); + ::std::vector< basegfx::B2DHomMatrix > aMatrices; - // fall-through by purpose - } - case attribute::HATCHSTYLE_DOUBLE: + // get hatch transformations + switch(getFillHatch().getStyle()) { - // rotated 90 degrees - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle + F_PI2); - aHatch.appendTransformations(aMatrices); - - // fall-through by purpose + case attribute::HATCHSTYLE_TRIPLE: + { + // rotated 45 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI4); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_DOUBLE: + { + // rotated 90 degrees + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle + F_PI2); + aHatch.appendTransformations(aMatrices); + + // fall-through by purpose + } + case attribute::HATCHSTYLE_SINGLE: + { + // angle as given + texture::GeoTexSvxHatch aHatch(getObjectRange(), getFillHatch().getDistance(), fAngle); + aHatch.appendTransformations(aMatrices); + } } - case attribute::HATCHSTYLE_SINGLE: - { - // angle as given - texture::GeoTexSvxHatch aHatch(getObjectRange(), maFillHatch.getDistance(), fAngle); - aHatch.appendTransformations(aMatrices); - } - } - // prepare return value - const bool bFillBackground(maFillHatch.isFillBackground()); - Primitive2DSequence aRetval(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); + // prepare return value + const bool bFillBackground(getFillHatch().isFillBackground()); + aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); - // evtl. create filled background - if(bFillBackground) - { - // create primitive for background - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getObjectRange())), maBColor)); - aRetval[0L] = xRef; - } + // evtl. create filled background + if(bFillBackground) + { + // create primitive for background + const Primitive2DReference xRef( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(getObjectRange())), getBColor())); + aRetval[0] = xRef; + } - // create primitives - const basegfx::B2DPoint aStart(0.0, 0.0); - const basegfx::B2DPoint aEnd(1.0, 0.0); + // create primitives + const basegfx::B2DPoint aStart(0.0, 0.0); + const basegfx::B2DPoint aEnd(1.0, 0.0); - for(sal_uInt32 a(0L); a < aMatrices.size(); a++) - { - const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; - basegfx::B2DPolygon aNewLine; + for(sal_uInt32 a(0L); a < aMatrices.size(); a++) + { + const basegfx::B2DHomMatrix& rMatrix = aMatrices[a]; + basegfx::B2DPolygon aNewLine; - aNewLine.append(rMatrix * aStart); - aNewLine.append(rMatrix * aEnd); + aNewLine.append(rMatrix * aStart); + aNewLine.append(rMatrix * aEnd); - // create hairline - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); - aRetval[bFillBackground ? (a + 1L) : a] = xRef; + // create hairline + const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); + aRetval[bFillBackground ? (a + 1) : a] = xRef; + } } return aRetval; @@ -139,8 +147,8 @@ namespace drawinglayer const FillHatchPrimitive2D& rCompare = (FillHatchPrimitive2D&)rPrimitive; return (getObjectRange() == rCompare.getObjectRange() - && maFillHatch == rCompare.maFillHatch - && maBColor == rCompare.maBColor); + && getFillHatch() == rCompare.getFillHatch() + && getBColor() == rCompare.getBColor()); } return false; diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 6d1540594dc9..2176a45341ec 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -772,9 +772,7 @@ namespace drawinglayer { // clipping needed. Embed to MaskPrimitive2D. Create childs and mask polygon const primitive2d::Primitive2DSequence aChildContent(&xPrimitive, 1); - basegfx::B2DPolygon aMaskPolygon( - basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aMaskPolygon(basegfx::tools::createUnitPolygon()); aMaskPolygon.transform(aTransform); xPrimitive = Primitive2DReference( @@ -880,7 +878,7 @@ namespace drawinglayer else { // cropped got bigger, mask it with original object's bounds - basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::tools::createUnitPolygon()); aMaskPolyPolygon.transform(getTransform()); // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx new file mode 100644 index 000000000000..2b3afeb0f8ed --- /dev/null +++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + HiddenGeometryPrimitive2D::HiddenGeometryPrimitive2D( + const Primitive2DSequence& rChildren) + : GroupPrimitive2D(rChildren) + { + } + + basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + return Primitive2DSequence(); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(HiddenGeometryPrimitive2D, PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx b/drawinglayer/source/primitive2d/hittestprimitive2d.cxx deleted file mode 100644 index 137f8cf8ad5c..000000000000 --- a/drawinglayer/source/primitive2d/hittestprimitive2d.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.cxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - HitTestPrimitive2D::HitTestPrimitive2D( - const Primitive2DSequence& rChildren) - : GroupPrimitive2D(rChildren) - { - } - - basegfx::B2DRange HitTestPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const - { - return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); - } - - Primitive2DSequence HitTestPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive2DSequence(); - } - - // provide unique ID - ImplPrimitrive2DIDBlock(HitTestPrimitive2D, PRIMITIVE2D_ID_HITTESTPRIMITIVE2D) - - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/invertprimitive2d.cxx b/drawinglayer/source/primitive2d/invertprimitive2d.cxx index 374ec578113d..6faf4f2cf0ad 100644 --- a/drawinglayer/source/primitive2d/invertprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/invertprimitive2d.cxx @@ -2,7 +2,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unifiedalphaprimitive2d.cxx,v $ + * $RCSfile: UnifiedTransparencePrimitive2D.cxx,v $ * * $Revision: 1.5 $ * diff --git a/drawinglayer/source/primitive2d/makefile.mk b/drawinglayer/source/primitive2d/makefile.mk index c9a3cc191a35..078142b673b2 100644 --- a/drawinglayer/source/primitive2d/makefile.mk +++ b/drawinglayer/source/primitive2d/makefile.mk @@ -45,50 +45,51 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/alphaprimitive2d.obj \ - $(SLO)$/animatedprimitive2d.obj \ - $(SLO)$/baseprimitive2d.obj \ - $(SLO)$/backgroundcolorprimitive2d.obj \ - $(SLO)$/bitmapprimitive2d.obj \ - $(SLO)$/borderlineprimitive2d.obj \ - $(SLO)$/chartprimitive2d.obj \ - $(SLO)$/controlprimitive2d.obj \ - $(SLO)$/discretebitmapprimitive2d.obj \ - $(SLO)$/embedded3dprimitive2d.obj \ - $(SLO)$/epsprimitive2d.obj \ - $(SLO)$/fillbitmapprimitive2d.obj \ - $(SLO)$/fillgradientprimitive2d.obj \ - $(SLO)$/fillhatchprimitive2d.obj \ - $(SLO)$/graphicprimitive2d.obj \ - $(SLO)$/gridprimitive2d.obj \ - $(SLO)$/groupprimitive2d.obj \ - $(SLO)$/helplineprimitive2d.obj \ - $(SLO)$/hittestprimitive2d.obj \ - $(SLO)$/invertprimitive2d.obj \ - $(SLO)$/markerarrayprimitive2d.obj \ - $(SLO)$/pointarrayprimitive2d.obj \ - $(SLO)$/maskprimitive2d.obj \ - $(SLO)$/mediaprimitive2d.obj \ - $(SLO)$/metafileprimitive2d.obj \ - $(SLO)$/modifiedcolorprimitive2d.obj \ - $(SLO)$/pagepreviewprimitive2d.obj \ - $(SLO)$/polypolygonprimitive2d.obj \ - $(SLO)$/polygonprimitive2d.obj \ - $(SLO)$/primitivetools2d.obj \ - $(SLO)$/sceneprimitive2d.obj \ - $(SLO)$/shadowprimitive2d.obj \ - $(SLO)$/structuretagprimitive2d.obj \ - $(SLO)$/texteffectprimitive2d.obj \ - $(SLO)$/textenumsprimitive2d.obj \ - $(SLO)$/textlayoutdevice.obj \ - $(SLO)$/textlineprimitive2d.obj \ - $(SLO)$/textprimitive2d.obj \ - $(SLO)$/textstrikeoutprimitive2d.obj \ - $(SLO)$/textdecoratedprimitive2d.obj \ - $(SLO)$/texthierarchyprimitive2d.obj \ - $(SLO)$/transformprimitive2d.obj \ - $(SLO)$/unifiedalphaprimitive2d.obj \ - $(SLO)$/wallpaperprimitive2d.obj \ + $(SLO)$/transparenceprimitive2d.obj \ + $(SLO)$/animatedprimitive2d.obj \ + $(SLO)$/baseprimitive2d.obj \ + $(SLO)$/backgroundcolorprimitive2d.obj \ + $(SLO)$/bitmapprimitive2d.obj \ + $(SLO)$/borderlineprimitive2d.obj \ + $(SLO)$/chartprimitive2d.obj \ + $(SLO)$/controlprimitive2d.obj \ + $(SLO)$/discretebitmapprimitive2d.obj \ + $(SLO)$/embedded3dprimitive2d.obj \ + $(SLO)$/epsprimitive2d.obj \ + $(SLO)$/fillbitmapprimitive2d.obj \ + $(SLO)$/fillgradientprimitive2d.obj \ + $(SLO)$/fillhatchprimitive2d.obj \ + $(SLO)$/graphicprimitive2d.obj \ + $(SLO)$/gridprimitive2d.obj \ + $(SLO)$/groupprimitive2d.obj \ + $(SLO)$/helplineprimitive2d.obj \ + $(SLO)$/hiddengeometryprimitive2d.obj \ + $(SLO)$/invertprimitive2d.obj \ + $(SLO)$/markerarrayprimitive2d.obj \ + $(SLO)$/pointarrayprimitive2d.obj \ + $(SLO)$/maskprimitive2d.obj \ + $(SLO)$/mediaprimitive2d.obj \ + $(SLO)$/metafileprimitive2d.obj \ + $(SLO)$/modifiedcolorprimitive2d.obj \ + $(SLO)$/pagepreviewprimitive2d.obj \ + $(SLO)$/polypolygonprimitive2d.obj \ + $(SLO)$/polygonprimitive2d.obj \ + $(SLO)$/primitivetools2d.obj \ + $(SLO)$/sceneprimitive2d.obj \ + $(SLO)$/sdrdecompositiontools2d.obj \ + $(SLO)$/shadowprimitive2d.obj \ + $(SLO)$/structuretagprimitive2d.obj \ + $(SLO)$/texteffectprimitive2d.obj \ + $(SLO)$/textenumsprimitive2d.obj \ + $(SLO)$/textlayoutdevice.obj \ + $(SLO)$/textlineprimitive2d.obj \ + $(SLO)$/textprimitive2d.obj \ + $(SLO)$/textstrikeoutprimitive2d.obj \ + $(SLO)$/textdecoratedprimitive2d.obj \ + $(SLO)$/texthierarchyprimitive2d.obj \ + $(SLO)$/transformprimitive2d.obj \ + $(SLO)$/unifiedtransparenceprimitive2d.obj \ + $(SLO)$/wallpaperprimitive2d.obj \ $(SLO)$/wrongspellprimitive2d.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index ba8f81448968..f99508be03e6 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -46,6 +46,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -58,9 +59,12 @@ namespace drawinglayer Primitive2DSequence xRetval(1); // create background object - basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createUnitPolygon()); aBackgroundPolygon.transform(getTransform()); - const Primitive2DReference xRefBackground(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aBackgroundPolygon), getBackgroundColor())); + const Primitive2DReference xRefBackground( + new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aBackgroundPolygon), + getBackgroundColor())); xRetval[0] = xRefBackground; // try to get graphic snapshot @@ -87,10 +91,13 @@ namespace drawinglayer basegfx::B2DRange aDestRange(aSourceRange); aDestRange.grow(-0.5 * fDiscreteSize); - if(::basegfx::fTools::equalZero(aDestRange.getWidth()) || ::basegfx::fTools::equalZero(aDestRange.getHeight())) + if(basegfx::fTools::equalZero(aDestRange.getWidth()) || basegfx::fTools::equalZero(aDestRange.getHeight())) { - // shrunk primitive has no content (zero size in X or Y), nothing to display, nothing to return - xRetval = Primitive2DSequence(); + // shrunk primitive has no content (zero size in X or Y), nothing to display. Still create + // invisible content for HitTest and BoundRect + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(xRetval)); + + xRetval = Primitive2DSequence(&xHiddenLines, 1); } else { diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 2fb3d119d4bd..4bb123380ee6 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -53,10 +53,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include #include @@ -589,7 +589,14 @@ namespace drawinglayer Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition( const geometry::ViewInformation2D& /*rViewInformation*/) const { - return createFill(false); + if(!getFillGradient().isDefault()) + { + return createFill(false); + } + else + { + return Primitive2DSequence(); + } } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -841,7 +848,7 @@ namespace } /** helper to create a regular BotmapEx from a MaskAction (definitions - which use a bitmap without alpha but define one of the colors as + which use a bitmap without transparence but define one of the colors as transparent) */ BitmapEx createMaskBmpEx(const Bitmap& rBitmap, const Color& rMaskColor) @@ -2728,7 +2735,7 @@ namespace if(aSubContent.hasElements()) { rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aSubContent, nTransparence * 0.01)); } @@ -2839,9 +2846,9 @@ namespace if(aAttribute.getStartColor() == aAttribute.getEndColor()) { - // not really a gradient; create UnifiedAlphaPrimitive2D + // not really a gradient; create UnifiedTransparencePrimitive2D rTargetHolders.Current().append( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( xSubContent, aAttribute.getStartColor().luminance())); } @@ -2853,17 +2860,17 @@ namespace aTargetRectangle.Right(), aTargetRectangle.Bottom()); aRange.transform(rPropertyHolders.Current().getTransformation()); - // prepare gradient for alpha content - const drawinglayer::primitive2d::Primitive2DReference xAlpha( + // prepare gradient for transparent content + const drawinglayer::primitive2d::Primitive2DReference xTransparence( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aAttribute)); - // create alpha primitive + // create transparence primitive rTargetHolders.Current().append( - new drawinglayer::primitive2d::AlphaPrimitive2D( + new drawinglayer::primitive2d::TransparencePrimitive2D( xSubContent, - drawinglayer::primitive2d::Primitive2DSequence(&xAlpha, 1))); + drawinglayer::primitive2d::Primitive2DSequence(&xTransparence, 1))); } } } diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index b747c79ee0c7..ec23791a7230 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -77,7 +77,10 @@ namespace drawinglayer if(!aAllowedContentRange.isInside(aRealContentRange)) { - const Primitive2DReference xReferenceA(new MaskPrimitive2D(basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); + const Primitive2DReference xReferenceA( + new MaskPrimitive2D( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); aContent = Primitive2DSequence(&xReferenceA, 1); } diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 69cbd046efd2..c9108b58b000 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -43,6 +43,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -243,7 +244,7 @@ namespace drawinglayer const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon())); basegfx::B2DPolyPolygon aHairLinePolyPolygon; - if(0.0 == getStrokeAttribute().getFullDotDashLen()) + if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen()) { // no line dashing, just copy aHairLinePolyPolygon.append(aB2DPolygon); @@ -251,12 +252,14 @@ namespace drawinglayer else { // apply LineStyle - basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); + basegfx::tools::applyLineDashing( + aB2DPolygon, getStrokeAttribute().getDotDashArray(), + &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } const sal_uInt32 nCount(aHairLinePolyPolygon.count()); - if(getLineAttribute().getWidth()) + if(!getLineAttribute().isDefault() && getLineAttribute().getWidth()) { // create fat line data const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); @@ -293,7 +296,11 @@ namespace drawinglayer else { // prepare return value - const Primitive2DReference xRef(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon, getLineAttribute().getColor())); + const Primitive2DReference xRef( + new PolyPolygonHairlinePrimitive2D( + aHairLinePolyPolygon, + getLineAttribute().getColor())); + return Primitive2DSequence(&xRef, 1); } } @@ -519,7 +526,7 @@ namespace drawinglayer double fStart(0.0); double fEnd(0.0); - if(getStart().isActive()) + if(!getStart().isDefault() && getStart().isActive()) { // create start arrow primitive and consume aArrowA = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -530,7 +537,7 @@ namespace drawinglayer fStart *= 0.8; } - if(getEnd().isActive()) + if(!getEnd().isDefault() && getEnd().isActive()) { // create end arrow primitive and consume aArrowB = basegfx::tools::createAreaGeometryForLineStartEnd( @@ -553,18 +560,24 @@ namespace drawinglayer sal_uInt32 nInd(0L); // add shaft - const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute())); + const Primitive2DReference xRefShaft(new + PolygonStrokePrimitive2D( + aLocalPolygon, getLineAttribute(), getStrokeAttribute())); aRetval[nInd++] = xRefShaft; if(aArrowA.count()) { - const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor())); + const Primitive2DReference xRefA( + new PolyPolygonColorPrimitive2D( + aArrowA, getLineAttribute().getColor())); aRetval[nInd++] = xRefA; } if(aArrowB.count()) { - const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor())); + const Primitive2DReference xRefB( + new PolyPolygonColorPrimitive2D( + aArrowB, getLineAttribute().getColor())); aRetval[nInd++] = xRefB; } diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 55c334434c70..0a7236a59127 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -196,7 +196,9 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D( + aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); } return aRetval; @@ -284,11 +286,14 @@ namespace drawinglayer if(aPolygon.isClosed()) { // no need for PolygonStrokeArrowPrimitive2D when polygon is closed - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); + aRetval[a] = Primitive2DReference( + new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); } else { - aRetval[a] = Primitive2DReference(new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute(), getStart(), getEnd())); + aRetval[a] = Primitive2DReference( + new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), + getStrokeAttribute(), getStart(), getEnd())); } } @@ -406,16 +411,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillGradientPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); - const Primitive2DReference xSubRef(pNewGradient); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillGradient().isDefault()) + { + // create SubSequence with FillGradientPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient()); + const Primitive2DReference xSubRef(pNewGradient); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( @@ -453,16 +466,24 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillHatchPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); - const Primitive2DReference xSubRef(pNewHatch); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillHatch().isDefault()) + { + // create SubSequence with FillHatchPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch()); + const Primitive2DReference xSubRef(pNewHatch); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( @@ -503,21 +524,29 @@ namespace drawinglayer { Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - // create SubSequence with FillBitmapPrimitive2D - const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); - basegfx::B2DHomMatrix aNewObjectTransform; - aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); - aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); - aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); - aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); - FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); - const Primitive2DReference xSubRef(pNewBitmap); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); - - // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1L); + if(!getFillBitmap().isDefault()) + { + // create SubSequence with FillBitmapPrimitive2D + const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); + basegfx::B2DHomMatrix aNewObjectTransform; + aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); + aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); + aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); + aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); + FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); + const Primitive2DReference xSubRef(pNewBitmap); + const Primitive2DSequence aSubSequence(&xSubRef, 1L); + + // create mask primitive + MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); + const Primitive2DReference xRef(pNewMask); + + return Primitive2DSequence(&xRef, 1); + } + else + { + return Primitive2DSequence(); + } } PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D( diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 0223fb85d23e..48946810ee5f 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -156,8 +156,10 @@ namespace drawinglayer if(impGetShadow3D(rViewInformation)) { // test visibility - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); - const basegfx::B2DRange aViewRange(rViewInformation.getViewport()); + const basegfx::B2DRange aShadow2DRange( + getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aViewRange( + rViewInformation.getViewport()); if(aViewRange.isEmpty() || aShadow2DRange.overlaps(aViewRange)) { @@ -170,6 +172,7 @@ namespace drawinglayer basegfx::B2DRange aDiscreteRange; basegfx::B2DRange aVisibleDiscreteRange; basegfx::B2DRange aUnitVisibleRange; + calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); if(!aVisibleDiscreteRange.isEmpty()) @@ -263,7 +266,7 @@ namespace drawinglayer if(bAddOutlineToCreated3DSceneRepresentation) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(aNew2DTransform); const Primitive2DReference xRef2(new PolygonHairlinePrimitive2D(aOutline, basegfx::BColor(1.0, 0.0, 0.0))); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef2); diff --git a/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx new file mode 100644 index 000000000000..9d90c35103d9 --- /dev/null +++ b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrdecompositiontools3d.cxx,v $ + * + * $Revision: 1.7 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:21 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + return createHiddenGeometryPrimitives2D( + bFilled, + basegfx::B2DPolyPolygon(aUnitOutline), + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rPolyPolygon, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange) + { + return createHiddenGeometryPrimitives2D( + bFilled, + rRange, + basegfx::B2DHomMatrix()); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DRange& rRange, + const basegfx::B2DHomMatrix& rMatrix) + { + const basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(rRange)); + + return createHiddenGeometryPrimitives2D( + bFilled, + aOutline, + rMatrix); + } + + Primitive2DReference createHiddenGeometryPrimitives2D( + bool bFilled, + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::B2DHomMatrix& rMatrix) + { + // create fill or line primitive + Primitive2DReference xReference; + basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon); + aScaledOutline.transform(rMatrix); + + if(bFilled) + { + xReference = new PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aScaledOutline), + basegfx::BColor(0.0, 0.0, 0.0)); + } + else + { + const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); + + xReference = new PolyPolygonHairlinePrimitive2D( + aScaledOutline, + aGrayTone); + } + + // create HiddenGeometryPrimitive2D + return Primitive2DReference( + new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1))); + } + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index b6ce7dc3248d..7d8abd5490fb 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx new file mode 100644 index 000000000000..cfe1e184e89e --- /dev/null +++ b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: alphaprimitive2d.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + TransparencePrimitive2D::TransparencePrimitive2D( + const Primitive2DSequence& rChildren, + const Primitive2DSequence& rTransparence) + : GroupPrimitive2D(rChildren), + maTransparence(rTransparence) + { + } + + bool TransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const TransparencePrimitive2D& rCompare = (TransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + // provide unique ID + ImplPrimitrive2DIDBlock(TransparencePrimitive2D, PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D) + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx deleted file mode 100644 index a66ac0f3a539..000000000000 --- a/drawinglayer/source/primitive2d/unifiedalphaprimitive2d.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: unifiedalphaprimitive2d.cxx,v $ - * - * $Revision: 1.5 $ - * - * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive2d - { - UnifiedAlphaPrimitive2D::UnifiedAlphaPrimitive2D( - const Primitive2DSequence& rChildren, - double fAlpha) - : GroupPrimitive2D(rChildren), - mfAlpha(fAlpha) - { - } - - bool UnifiedAlphaPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const - { - if(GroupPrimitive2D::operator==(rPrimitive)) - { - const UnifiedAlphaPrimitive2D& rCompare = (UnifiedAlphaPrimitive2D&)rPrimitive; - - return (getAlpha() == rCompare.getAlpha()); - } - - return false; - } - - Primitive2DSequence UnifiedAlphaPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const - { - if(0.0 == getAlpha()) - { - // no transparence used, so just use the content - return getChildren(); - } - else if(getAlpha() > 0.0 && getAlpha() < 1.0) - { - // The idea is to create a AlphaPrimitive2D with alpha content using a fill color - // corresponding to the alpha value. Problem is that in most systems, the right - // and bottom pixel array is not filled when filling polygons, thus this would not - // always produce a complete alpha bitmap. There are some solutions: - // - // - Grow the used polygon range by one discrete unit in X and Y. This - // will make the decomposition view-dependent. - // - // - For all filled polygon renderings, dra wthe polygon outline extra. This - // would lead to unwanted side effects when using concatenated polygons. - // - // - At this decomposition, add a filled polygon and a hairline polygon. This - // solution stays view-independent. - // - // I will take the last one here. The small overhead of two primitives will only be - // used when UnifiedAlphaPrimitive2D is not handled directly. - const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); - const basegfx::BColor aGray(getAlpha(), getAlpha(), getAlpha()); - Primitive2DSequence aAlphaContent(2); - - aAlphaContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); - aAlphaContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); - - // create sub-transparence group with a gray-colored rectangular fill polygon - const Primitive2DReference xRefB(new AlphaPrimitive2D(getChildren(), aAlphaContent)); - return Primitive2DSequence(&xRefB, 1L); - } - else - { - // completely transparent or invalid definition, add nothing - return Primitive2DSequence(); - } - } - - // provide unique ID - ImplPrimitrive2DIDBlock(UnifiedAlphaPrimitive2D, PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D) - - } // end of namespace primitive2d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx new file mode 100644 index 000000000000..b0905b2adf39 --- /dev/null +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UnifiedTransparencePrimitive2D.cxx,v $ + * + * $Revision: 1.5 $ + * + * last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + UnifiedTransparencePrimitive2D::UnifiedTransparencePrimitive2D( + const Primitive2DSequence& rChildren, + double fTransparence) + : GroupPrimitive2D(rChildren), + mfTransparence(fTransparence) + { + } + + bool UnifiedTransparencePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(GroupPrimitive2D::operator==(rPrimitive)) + { + const UnifiedTransparencePrimitive2D& rCompare = (UnifiedTransparencePrimitive2D&)rPrimitive; + + return (getTransparence() == rCompare.getTransparence()); + } + + return false; + } + + basegfx::B2DRange UnifiedTransparencePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + } + + Primitive2DSequence UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + { + if(0.0 == getTransparence()) + { + // no transparence used, so just use the content + return getChildren(); + } + else if(getTransparence() > 0.0 && getTransparence() < 1.0) + { + // The idea is to create a TransparencePrimitive2D with transparent content using a fill color + // corresponding to the transparence value. Problem is that in most systems, the right + // and bottom pixel array is not filled when filling polygons, thus this would not + // always produce a complete transparent bitmap. There are some solutions: + // + // - Grow the used polygon range by one discrete unit in X and Y. This + // will make the decomposition view-dependent. + // + // - For all filled polygon renderings, dra wthe polygon outline extra. This + // would lead to unwanted side effects when using concatenated polygons. + // + // - At this decomposition, add a filled polygon and a hairline polygon. This + // solution stays view-independent. + // + // I will take the last one here. The small overhead of two primitives will only be + // used when UnifiedTransparencePrimitive2D is not handled directly. + const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); + const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); + Primitive2DSequence aTransparenceContent(2); + + aTransparenceContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); + aTransparenceContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); + + // create sub-transparence group with a gray-colored rectangular fill polygon + const Primitive2DReference xRefB(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); + return Primitive2DSequence(&xRefB, 1L); + } + else + { + // completely transparent or invalid definition, add nothing + return Primitive2DSequence(); + } + } + + // provide unique ID + ImplPrimitrive2DIDBlock(UnifiedTransparencePrimitive2D, PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index 621b0b25ad98..dfa29c9260eb 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -223,7 +223,8 @@ namespace drawinglayer if(bNeedsClipping) { // embed to clipping; this is necessary for tiled fills - const basegfx::B2DPolyPolygon aPolyPolygon(basegfx::tools::createPolygonFromRect(getLocalObjectRange())); + const basegfx::B2DPolyPolygon aPolyPolygon( + basegfx::tools::createPolygonFromRect(getLocalObjectRange())); const drawinglayer::primitive2d::Primitive2DReference xClippedFill( new drawinglayer::primitive2d::MaskPrimitive2D( aPolyPolygon, diff --git a/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx new file mode 100644 index 000000000000..e94eeb99f764 --- /dev/null +++ b/drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: hittestprimitive3d.cxx,v $ + * + * $Revision: 1.1.2.1 $ + * + * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_drawinglayer.hxx" + +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive3d + { + HiddenGeometryPrimitive3D::HiddenGeometryPrimitive3D( + const Primitive3DSequence& rChildren) + : GroupPrimitive3D(rChildren) + { + } + + basegfx::B3DRange HiddenGeometryPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence HiddenGeometryPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + { + // return empty sequence + return Primitive3DSequence(); + } + + // provide unique ID + ImplPrimitrive3DIDBlock(HiddenGeometryPrimitive3D, PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D) + + } // end of namespace primitive3d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx b/drawinglayer/source/primitive3d/hittestprimitive3d.cxx deleted file mode 100644 index 65aede8142aa..000000000000 --- a/drawinglayer/source/primitive3d/hittestprimitive3d.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************* - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: hittestprimitive3d.cxx,v $ - * - * $Revision: 1.1.2.1 $ - * - * last change: $Author: aw $ $Date: 2008/09/25 17:12:14 $ - * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. - * - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_drawinglayer.hxx" - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace com::sun::star; - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace primitive3d - { - HitTestPrimitive3D::HitTestPrimitive3D( - const Primitive3DSequence& rChildren) - : GroupPrimitive3D(rChildren) - { - } - - basegfx::B3DRange HitTestPrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const - { - return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); - } - - Primitive3DSequence HitTestPrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const - { - // return empty sequence - return Primitive3DSequence(); - } - - // provide unique ID - ImplPrimitrive3DIDBlock(HitTestPrimitive3D, PRIMITIVE3D_ID_HITTESTPRIMITIVE3D) - - } // end of namespace primitive3d -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/drawinglayer/source/primitive3d/makefile.mk b/drawinglayer/source/primitive3d/makefile.mk index fb160fb9bfa7..31c0c911bf0e 100644 --- a/drawinglayer/source/primitive3d/makefile.mk +++ b/drawinglayer/source/primitive3d/makefile.mk @@ -48,7 +48,7 @@ SLOFILES= \ $(SLO)$/baseprimitive3d.obj \ $(SLO)$/groupprimitive3d.obj \ $(SLO)$/hatchtextureprimitive3d.obj \ - $(SLO)$/hittestprimitive3d.obj \ + $(SLO)$/hiddengeometryprimitive3d.obj \ $(SLO)$/modifiedcolorprimitive3d.obj \ $(SLO)$/polypolygonprimitive3d.obj \ $(SLO)$/polygonprimitive3d.obj \ diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index de28e3ad74e5..23277a6eb91d 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -65,7 +65,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineTubeSegments || rMaterial != aLineMaterial) + if(nSegments != nLineTubeSegments || !(rMaterial == aLineMaterial)) { nLineTubeSegments = nSegments; aLineMaterial = rMaterial; @@ -126,7 +126,7 @@ namespace drawinglayer // may exclusively change static data, use mutex ::osl::Mutex m_mutex; - if(nSegments != nLineCapSegments || rMaterial != aLineMaterial) + if(nSegments != nLineCapSegments || !(rMaterial == aLineMaterial)) { nLineCapSegments = nSegments; aLineMaterial = rMaterial; diff --git a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx index 739914562071..307ee3a0db82 100644 --- a/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx @@ -43,8 +43,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -63,7 +64,7 @@ namespace drawinglayer basegfx::B3DPolyPolygon aFill(basegfx::tools::createCubeFillPolyPolygonFromB3DRange(aUnitRange)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPECIFIC == getSdr3DObjectAttribute().getNormalsKind() || ::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) @@ -81,7 +82,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -153,7 +154,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -161,39 +162,33 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(basegfx::tools::createCubePolyPolygonFromB3DRange(aUnitRange)); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -203,7 +198,7 @@ namespace drawinglayer SdrCubePrimitive3D::SdrCubePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute) { diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index df682ab04e6f..210fed49065d 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -39,14 +39,11 @@ #include #include #include -#include #include #include #include #include -#include #include -#include #include #include #include @@ -55,8 +52,12 @@ #include #include #include -#include #include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -175,8 +176,8 @@ namespace drawinglayer if(0.0 != rLine.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D, add created primitives and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rLine.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D, add created primitives and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rLine.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } @@ -189,7 +190,7 @@ namespace drawinglayer const basegfx::B2DVector& rTextureSize, const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { Primitive3DSequence aRetval; @@ -217,27 +218,45 @@ namespace drawinglayer } // look for and evtl. build texture sub-group primitive - if(rFill.isGradient() || rFill.isHatch() || rFill.isBitmap()) + if(!rFill.getGradient().isDefault() + || !rFill.getHatch().isDefault() + || !rFill.getBitmap().isDefault()) { bool bModulate(::com::sun::star::drawing::TextureMode_MODULATE == aSdr3DObjectAttribute.getTextureMode()); bool bFilter(aSdr3DObjectAttribute.getTextureFilter()); - BasePrimitive3D* pNewTexturePrimitive3D = 0L; + BasePrimitive3D* pNewTexturePrimitive3D = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { // create gradientTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new GradientTexturePrimitive3D(*rFill.getGradient(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new GradientTexturePrimitive3D( + rFill.getGradient(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { // create hatchTexture3D with sublist, add to local aRetval - pNewTexturePrimitive3D = new HatchTexturePrimitive3D(*rFill.getHatch(), aRetval, rTextureSize, bModulate, bFilter); + pNewTexturePrimitive3D = new HatchTexturePrimitive3D( + rFill.getHatch(), + aRetval, + rTextureSize, + bModulate, + bFilter); } - else // if(rFill.isBitmap()) + else // if(!rFill.getBitmap().isDefault()) { // create bitmapTexture3D with sublist, add to local aRetval basegfx::B2DRange aTexRange(0.0, 0.0, rTextureSize.getX(), rTextureSize.getY()); - pNewTexturePrimitive3D = new BitmapTexturePrimitive3D(rFill.getBitmap()->getFillBitmapAttribute(aTexRange), aRetval, rTextureSize, bModulate, bFilter); + + pNewTexturePrimitive3D = new BitmapTexturePrimitive3D( + rFill.getBitmap().getFillBitmapAttribute(aTexRange), + aRetval, + rTextureSize, + bModulate, + bFilter); } // exchange aRetval content with texture group @@ -255,14 +274,14 @@ namespace drawinglayer if(0.0 != rFill.getTransparence()) { - // create UnifiedAlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new UnifiedAlphaTexturePrimitive3D(rFill.getTransparence(), aRetval)); + // create UnifiedTransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new UnifiedTransparenceTexturePrimitive3D(rFill.getTransparence(), aRetval)); aRetval = Primitive3DSequence(&xRef, 1L); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { - // create AlphaTexturePrimitive3D with sublist and exchange - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(*pFillGradient, aRetval, rTextureSize)); + // create TransparenceTexturePrimitive3D with sublist and exchange + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(rFillGradient, aRetval, rTextureSize)); aRetval = Primitive3DSequence(&xRef, 1L); } } @@ -292,6 +311,35 @@ namespace drawinglayer return Primitive3DSequence(); } } + + Primitive3DSequence createHiddenGeometryPrimitives3D( + const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector, + const basegfx::B3DHomMatrix& rObjectTransform, + const basegfx::B2DVector& rTextureSize, + const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute) + { + // create hidden sub-geometry which can be used for HitTest + // and BoundRect calculations, but will not be visualized + const attribute::SdrFillAttribute aSimplifiedFillAttribute( + 0.0, + basegfx::BColor(), + attribute::FillGradientAttribute(), + attribute::FillHatchAttribute(), + attribute::SdrFillBitmapAttribute()); + + const Primitive3DReference aHidden( + new HiddenGeometryPrimitive3D( + create3DPolyPolygonFillPrimitives( + r3DPolyPolygonVector, + rObjectTransform, + rTextureSize, + aSdr3DObjectAttribute, + aSimplifiedFillAttribute, + attribute::FillGradientAttribute()))); + + return Primitive3DSequence(&aHidden, 1); + } + } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx index 3554e9266ec1..87d5d3a50283 100644 --- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx @@ -44,8 +44,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -76,7 +77,7 @@ namespace drawinglayer double fRelativeTextureWidth(1.0); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { const basegfx::B2DPolygon aFirstPolygon(maCorrectedPolyPolygon.getB2DPolygon(0L)); const double fFrontLength(basegfx::tools::getLength(aFirstPolygon)); @@ -106,7 +107,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -124,7 +125,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -134,7 +135,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -142,29 +143,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -349,7 +342,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -360,19 +354,22 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -409,7 +406,7 @@ namespace drawinglayer SdrExtrudePrimitive3D::SdrExtrudePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, double fDepth, diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx index 5e6c34e644de..0ee8fb1593e5 100644 --- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx @@ -44,8 +44,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,7 +78,8 @@ namespace drawinglayer const bool bCreateTextureCoordiantesY(::com::sun::star::drawing::TextureProjectionMode_OBJECTSPECIFIC == getSdr3DObjectAttribute().getTextureProjectionY()); basegfx::B2DHomMatrix aTexTransform; - if(getSdrLFSAttribute().getFill() && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) + if(!getSdrLFSAttribute().getFill().isDefault() + && (bCreateTextureCoordiantesX || bCreateTextureCoordiantesY)) { aTexTransform.set(0, 0, 0.0); aTexTransform.set(0, 1, 1.0); @@ -99,7 +101,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == eNormalsKind) { @@ -117,7 +119,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -127,7 +129,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -135,29 +137,21 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { if(getSdr3DObjectAttribute().getReducedLineGeometry()) { @@ -191,7 +185,8 @@ namespace drawinglayer if(aNewLineGeometry.count()) { - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aNewLineGeometry, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aNewLineGeometry, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } } @@ -202,19 +197,23 @@ namespace drawinglayer const basegfx::B3DPolyPolygon aVerLine(extractVerticalLinesFromSlice(rSliceVector)); // add horizontal lines - const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives(aHorLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aHorLines(create3DPolyPolygonLinePrimitives( + aHorLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aHorLines); // add vertical lines - const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives(aVerLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aVerLines(create3DPolyPolygonLinePrimitives( + aVerLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aVerLines); } } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -262,7 +261,7 @@ namespace drawinglayer SdrLathePrimitive3D::SdrLathePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, const basegfx::B2DPolyPolygon& rPolyPolygon, sal_uInt32 nHorizontalSegments, diff --git a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx index 69049fb7b24d..51f37be5b35b 100644 --- a/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx @@ -40,8 +40,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -66,7 +67,7 @@ namespace drawinglayer const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill)); // #i98295# normal creation - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind()) { @@ -84,7 +85,7 @@ namespace drawinglayer } // #i98314# texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { applyTextureTo3DGeometry( getSdr3DObjectAttribute().getTextureProjectionX(), @@ -94,7 +95,7 @@ namespace drawinglayer getTextureSize()); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -102,41 +103,36 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( aFill, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aLine(getPolyPolygon3D()); aLine.clearNormals(); aLine.clearTextureCoordinates(); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aLine, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aLine, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } } @@ -148,7 +144,7 @@ namespace drawinglayer const basegfx::B3DPolyPolygon& rPolyPolygon3D, const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute), maPolyPolygon3D(rPolyPolygon3D) @@ -181,11 +177,11 @@ namespace drawinglayer aRetval = basegfx::tools::getRange(getPolyPolygon3D()); aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index f8489b6418ff..53d7f7c9e96a 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -37,9 +37,9 @@ #include "precompiled_drawinglayer.hxx" #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -56,11 +56,11 @@ namespace drawinglayer basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); aUnitRange.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by hald LineWidth as tube radius aUnitRange.grow(rLine.getWidth() / 2.0); @@ -83,11 +83,11 @@ namespace drawinglayer aRetval.transform(getTransform()); - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { - const attribute::SdrLineAttribute& rLine = *getSdrLFSAttribute().getLine(); + const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); - if(rLine.isVisible() && !basegfx::fTools::equalZero(rLine.getWidth())) + if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) { // expand by half LineWidth as tube radius aRetval.grow(rLine.getWidth() / 2.0); @@ -101,7 +101,7 @@ namespace drawinglayer SdrPrimitive3D::SdrPrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) : BufferedDecompositionPrimitive3D(), maTransform(rTransform), diff --git a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx index 663ae6ad0d37..d993f5117d3a 100644 --- a/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx @@ -43,8 +43,9 @@ #include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,7 +69,7 @@ namespace drawinglayer getHorizontalSegments(), getVerticalSegments(), bCreateNormals)); // normal inversion - if(getSdrLFSAttribute().getFill() + if(!getSdrLFSAttribute().getFill().isDefault() && bCreateNormals && getSdr3DObjectAttribute().getNormalsInvert() && aFill.areNormalsUsed()) @@ -78,7 +79,7 @@ namespace drawinglayer } // texture coordinates - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // handle texture coordinates X const bool bParallelX(::com::sun::star::drawing::TextureProjectionMode_PARALLEL == getSdr3DObjectAttribute().getTextureProjectionX()); @@ -142,7 +143,7 @@ namespace drawinglayer a3DPolyPolygonVector.push_back(basegfx::B3DPolyPolygon(aFill.getB3DPolygon(a))); } - if(getSdrLFSAttribute().getFill()) + if(!getSdrLFSAttribute().getFill().isDefault()) { // add fill aRetval = create3DPolyPolygonFillPrimitives( @@ -150,39 +151,34 @@ namespace drawinglayer getTransform(), getTextureSize(), getSdr3DObjectAttribute(), - *getSdrLFSAttribute().getFill(), + getSdrLFSAttribute().getFill(), getSdrLFSAttribute().getFillFloatTransGradient()); } else { // create simplified 3d hit test geometry - const attribute::SdrFillAttribute aSimplifiedFillAttribute(0.0, basegfx::BColor(), 0, 0, 0); - - aRetval = create3DPolyPolygonFillPrimitives( + aRetval = createHiddenGeometryPrimitives3D( a3DPolyPolygonVector, getTransform(), getTextureSize(), - getSdr3DObjectAttribute(), - aSimplifiedFillAttribute, - 0); - - // encapsulate in HitTestPrimitive3D and add - const Primitive3DReference xRef(new HitTestPrimitive3D(aRetval)); - aRetval = Primitive3DSequence(&xRef, 1L); + getSdr3DObjectAttribute()); } // add line - if(getSdrLFSAttribute().getLine()) + if(!getSdrLFSAttribute().getLine().isDefault()) { basegfx::B3DPolyPolygon aSphere(basegfx::tools::createSpherePolyPolygonFromB3DRange(aUnitRange, getHorizontalSegments(), getVerticalSegments())); - const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(aSphere, getTransform(), *getSdrLFSAttribute().getLine())); + const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives( + aSphere, getTransform(), getSdrLFSAttribute().getLine())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines); } // add shadow - if(getSdrLFSAttribute().getShadow() && aRetval.hasElements()) + if(!getSdrLFSAttribute().getShadow().isDefault() + && aRetval.hasElements()) { - const Primitive3DSequence aShadow(createShadowPrimitive3D(aRetval, *getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); + const Primitive3DSequence aShadow(createShadowPrimitive3D( + aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D())); appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow); } @@ -192,7 +188,7 @@ namespace drawinglayer SdrSpherePrimitive3D::SdrSpherePrimitive3D( const basegfx::B3DHomMatrix& rTransform, const basegfx::B2DVector& rTextureSize, - const attribute::SdrLineFillShadowAttribute& rSdrLFSAttribute, + const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute, sal_uInt32 nHorizontalSegments, sal_uInt32 nVerticalSegments) diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx b/drawinglayer/source/primitive3d/textureprimitive3d.cxx index deeed95a71fd..9ba2c70ae074 100644 --- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx @@ -38,6 +38,7 @@ #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,7 +82,7 @@ namespace drawinglayer { namespace primitive3d { - UnifiedAlphaTexturePrimitive3D::UnifiedAlphaTexturePrimitive3D( + UnifiedTransparenceTexturePrimitive3D::UnifiedTransparenceTexturePrimitive3D( double fTransparence, const Primitive3DSequence& rChildren) : TexturePrimitive3D(rChildren, basegfx::B2DVector(), false, false), @@ -89,11 +90,11 @@ namespace drawinglayer { } - bool UnifiedAlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool UnifiedTransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { if(TexturePrimitive3D::operator==(rPrimitive)) { - const UnifiedAlphaTexturePrimitive3D& rCompare = (UnifiedAlphaTexturePrimitive3D&)rPrimitive; + const UnifiedTransparenceTexturePrimitive3D& rCompare = (UnifiedTransparenceTexturePrimitive3D&)rPrimitive; return (getTransparence() == rCompare.getTransparence()); } @@ -101,7 +102,14 @@ namespace drawinglayer return false; } - Primitive3DSequence UnifiedAlphaTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const + basegfx::B3DRange UnifiedTransparenceTexturePrimitive3D::getB3DRange(const geometry::ViewInformation3D& rViewInformation) const + { + // do not use the fallback to decomposition here since for a correct BoundRect we also + // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition + return getB3DRangeFromPrimitive3DSequence(getChildren(), rViewInformation); + } + + Primitive3DSequence UnifiedTransparenceTexturePrimitive3D::get3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const { if(0.0 == getTransparence()) { @@ -110,10 +118,10 @@ namespace drawinglayer } else if(getTransparence() > 0.0 && getTransparence() < 1.0) { - // create AlphaTexturePrimitive3D with fixed transparence as replacement + // create TransparenceTexturePrimitive3D with fixed transparence as replacement const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); const attribute::FillGradientAttribute aFillGradient(attribute::GRADIENTSTYLE_LINEAR, 0.0, 0.0, 0.0, 0.0, aGray, aGray, 1); - const Primitive3DReference xRef(new AlphaTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); + const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize())); return Primitive3DSequence(&xRef, 1L); } else @@ -124,7 +132,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive3DIDBlock(UnifiedAlphaTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(UnifiedTransparenceTexturePrimitive3D, PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer @@ -204,7 +212,7 @@ namespace drawinglayer { namespace primitive3d { - AlphaTexturePrimitive3D::AlphaTexturePrimitive3D( + TransparenceTexturePrimitive3D::TransparenceTexturePrimitive3D( const attribute::FillGradientAttribute& rGradient, const Primitive3DSequence& rChildren, const basegfx::B2DVector& rTextureSize) @@ -212,13 +220,13 @@ namespace drawinglayer { } - bool AlphaTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const + bool TransparenceTexturePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { return (GradientTexturePrimitive3D::operator==(rPrimitive)); } // provide unique ID - ImplPrimitrive3DIDBlock(AlphaTexturePrimitive3D, PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D) + ImplPrimitrive3DIDBlock(TransparenceTexturePrimitive3D, PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D) } // end of namespace primitive3d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index 8eb713258b25..d089e6a440de 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include #include #include @@ -388,7 +388,7 @@ using namespace com::sun::star; // slightly inside), slightly enlarge the // gradient: // - // y/2 sin(alpha) + x/2 cos(alpha) + // y/2 sin(transparence) + x/2 cos(transparence) // // (values to change are not actual // gradient scales, but original bound @@ -603,8 +603,7 @@ using namespace com::sun::star; } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // create geometries @@ -977,10 +976,10 @@ using namespace com::sun::star; // paint content to it process(rSubList); - // TODO(F3): render transparent list to alpha + // TODO(F3): render transparent list to transparence // channel. Note that the OutDev implementation has a // shortcoming, in that nested transparency groups - // don't work - alpha is not combined properly. + // don't work - transparence is not combined properly. // process(rTransCandidate.getTransparenceList()); @@ -988,7 +987,7 @@ using namespace com::sun::star; mxCanvas = xLastCanvas; setWorldToView(aLastWorldToView); - // DUMMY: add alpha modulation value to DeviceColor + // DUMMY: add transparence modulation value to DeviceColor // TODO(F3): color management canvas::tools::setDeviceColor( maRenderState, 1.0, 1.0, 1.0, 0.5 ); @@ -1307,7 +1306,7 @@ namespace drawinglayer { // there are principally two methods for implementing the mask primitive. One // is to set a clip polygon at the canvas, the other is to create and use a - // alpha-using XBitmap for content and draw the mask as alpha. Both have their + // transparence-using XBitmap for content and draw the mask as transparence. Both have their // advantages and disadvantages, so here are both with a bool allowing simple // change if(bUseMaskBitmapMethod) @@ -1380,8 +1379,8 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.GetCanvas()->fillPolyPolygon( + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.GetCanvas()->fillPolyPolygon( basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), aMask), maViewState, maRenderState); } @@ -1586,7 +1585,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1619,12 +1618,12 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rAlphaCandidate) + void canvasProcessor2D::impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate) { - const primitive2d::Primitive2DSequence& rChildren = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence& rAlpha = rAlphaCandidate.getAlpha(); + const primitive2d::Primitive2DSequence& rChildren = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence& rTransparence = rTransparenceCandidate.getTransparence(); - if(rChildren.hasElements() && rAlpha.hasElements()) + if(rChildren.hasElements() && rTransparence.hasElements()) { // get logic range of transparent part and clip with ViewRange basegfx::B2DRange aLogicRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rChildren, getViewInformation2D())); @@ -1688,16 +1687,16 @@ namespace drawinglayer process(rChildren); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); mxCanvas = mpOutputDevice->GetCanvas(); canvas::tools::setViewStateTransform(maViewState, getViewInformation2D().getViewTransformation()); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rAlpha); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransparence); // back to old color stack, OutDev, Canvas and ViewTransform maBColorModifierStack = aLastBColorModifierStack; @@ -1801,7 +1800,7 @@ namespace drawinglayer { // replace with color filled polygon const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); maRenderState.DeviceColor = aModifiedColor.colorToDoubleSequence(mxCanvas->getDevice()); canvas::tools::setRenderStateTransform(maRenderState, @@ -1832,7 +1831,7 @@ namespace drawinglayer aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; // canvas needs a polygon to fill, create unit rectangle polygon - const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aOutlineRectangle(basegfx::tools::createUnitPolygon()); // set primitive's transformation as render state transform canvas::tools::setRenderStateTransform(maRenderState, @@ -1860,52 +1859,60 @@ namespace drawinglayer } } - void canvasProcessor2D::impRenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate) + void canvasProcessor2D::impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate) { - const primitive2d::Primitive2DSequence rChildren = rUniAlphaCandidate.getChildren(); - - if(rChildren.hasElements()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, directly use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - bool bOutputDone(false); + const primitive2d::Primitive2DSequence rChildren = rUniTransparenceCandidate.getChildren(); - // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, - // use the fillPolyPolygon method with correctly set alpha. This is a often used - // case, so detectiong it is valuable - if(1 == rChildren.getLength()) + if(rChildren.hasElements()) { - const primitive2d::Primitive2DReference xReference(rChildren[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + bool bOutputDone(false); - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, + // use the fillPolyPolygon method with correctly set transparence. This is a often used + // case, so detectiong it is valuable + if(1 == rChildren.getLength()) { - // direct draw of PolyPolygon with color and transparence - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - - // add alpha modulation value to DeviceColor - uno::Sequence< double > aColor(4); - - aColor[0] = aPolygonColor.getRed(); - aColor[1] = aPolygonColor.getGreen(); - aColor[2] = aPolygonColor.getBlue(); - aColor[3] = 1.0 - rUniAlphaCandidate.getAlpha(); - maRenderState.DeviceColor = aColor; - - canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); - mxCanvas->fillPolyPolygon( - basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), - maViewState, maRenderState); - bOutputDone = true; + const primitive2d::Primitive2DReference xReference(rChildren[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // direct draw of PolyPolygon with color and transparence + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + + // add transparence modulation value to DeviceColor + uno::Sequence< double > aColor(4); + + aColor[0] = aPolygonColor.getRed(); + aColor[1] = aPolygonColor.getGreen(); + aColor[2] = aPolygonColor.getBlue(); + aColor[3] = 1.0 - rUniTransparenceCandidate.getTransparence(); + maRenderState.DeviceColor = aColor; + + canvas::tools::setRenderStateTransform(maRenderState, getViewInformation2D().getObjectTransformation()); + mxCanvas->fillPolyPolygon( + basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(mxCanvas->getDevice(), pPoPoColor->getB2DPolyPolygon()), + maViewState, maRenderState); + bOutputDone = true; + } } - } - if(!bOutputDone) - { - // process decomposition. This will be decomposed to an AlphaPrimitive2D - // with the same child context and a single polygon for alpha context. This could be - // directly handled here with known VCL-buffer technology, but would only - // make a small difference compared to directly rendering the AlphaPrimitive2D - // using impRenderAlphaPrimitive2D above. - process(rUniAlphaCandidate.get2DDecomposition(getViewInformation2D())); + if(!bOutputDone) + { + // process decomposition. This will be decomposed to an TransparencePrimitive2D + // with the same child context and a single polygon for transparent context. This could be + // directly handled here with known VCL-buffer technology, but would only + // make a small difference compared to directly rendering the TransparencePrimitive2D + // using impRenderTransparencePrimitive2D above. + process(rUniTransparenceCandidate.get2DDecomposition(getViewInformation2D())); + } } } } @@ -2063,10 +2070,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { - // Alpha primitive - impRenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + // Transparence primitive + impRenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } @@ -2084,10 +2091,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { - // UnifiedAlphaPrimitive2D - impRenderUnifiedAlphaPrimitive2D(static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate)); + // UnifiedTransparencePrimitive2D + impRenderUnifiedTransparencePrimitive2D(static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate)); break; } diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 3225651a6754..6c80c0dc4efc 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -103,7 +103,7 @@ namespace drawinglayer // extract BoundRect from bitmaps in world coordinates const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rBitmapCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; @@ -113,15 +113,15 @@ namespace drawinglayer // extract BoundRect from MetaFiles in world coordinates const primitive2d::MetafilePrimitive2D& rMetaCandidate(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate)); basegfx::B2DHomMatrix aLocalTransform(getViewInformation2D().getObjectTransformation() * rMetaCandidate.getTransform()); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); maExtractedContour.push_back(basegfx::B2DPolyPolygon(aPolygon)); break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Look at children - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); process(rTransCandidate.getChildren()); break; } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index b10e10706520..e699f1ae8ea4 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -43,13 +43,13 @@ #include #include #include -#include +#include #include #include -#include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -66,7 +66,7 @@ namespace drawinglayer mfDiscreteHitTolerance(0.0), mbHit(false), mbHitToleranceUsed(false), - mbUseHitTestPrimitiveContent(true), + mbUseInvisiblePrimitiveContent(true), mbHitTextOnly(bHitTextOnly) { // init hit tolerance @@ -247,7 +247,7 @@ namespace drawinglayer if(!getHit()) { // empty 3D scene; Check for border hit - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rCandidate.getObjectTransformation()); mbHit = checkHairlineHitWithTolerance(aOutline, getDiscreteHitTolerance()); @@ -420,10 +420,10 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group - const primitive2d::AlphaPrimitive2D& rTransCandidate(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + const primitive2d::TransparencePrimitive2D& rTransCandidate(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); // Currently the transparence content is not taken into account; only // the children are recursively checked for hit. This may be refined for @@ -499,7 +499,7 @@ namespace drawinglayer // will be used for HitTest currently. // // This may be refined in the future, e.g: - // - For Bitamps, the mask and/or alpha information may be used + // - For Bitamps, the mask and/or transparence information may be used // - For MetaFiles, the MetaFile content may be used const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); @@ -512,15 +512,20 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : { - // HitTest primitive; the default decomposition would return an empty seqence, + // HiddenGeometryPrimitive2D; the default decomposition would return an empty seqence, // so force this primitive to process it's children directly if the switch is set // (which is the default). Else, ignore invisible content - if(getUseHitTestPrimitiveContent()) + const primitive2d::HiddenGeometryPrimitive2D& rHiddenGeometry(static_cast< const primitive2d::HiddenGeometryPrimitive2D& >(rCandidate)); + const primitive2d::Primitive2DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) { - const primitive2d::HitTestPrimitive2D& rHitTestCandidate(static_cast< const primitive2d::HitTestPrimitive2D& >(rCandidate)); - process(rHitTestCandidate.getChildren()); + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } } break; diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 9d63bd5c7df6..a1e6373f1557 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -123,7 +123,7 @@ namespace drawinglayer if(bDoSaveForVisualControl) { - SvFileStream aNew((const String&)String(ByteString( "c:\\alpha.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); + SvFileStream aNew((const String&)String(ByteString( "c:\\transparence.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC); aNew << aAlphaMask.GetBitmap(); } @@ -170,7 +170,7 @@ namespace drawinglayer return *mpMask; } - VirtualDevice& impBufferDevice::getAlpha() + VirtualDevice& impBufferDevice::getTransparence() { if(!mpAlpha) { diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx index f987585249ad..02a0faffa06c 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx @@ -67,7 +67,7 @@ namespace drawinglayer bool isVisible() const { return !maDestPixel.IsEmpty(); } VirtualDevice& getContent() { return maContent; } VirtualDevice& getMask(); - VirtualDevice& getAlpha(); + VirtualDevice& getTransparence(); }; } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclhelpergradient.cxx b/drawinglayer/source/processor2d/vclhelpergradient.cxx index 25d7513006fa..753ccfd7140d 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.cxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.cxx @@ -225,7 +225,7 @@ namespace drawinglayer } else { - aUnitPolygon = basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)); + aUnitPolygon = basegfx::tools::createUnitPolygon(); } // make sure steps is not too high/low diff --git a/drawinglayer/source/processor2d/vclhelpergradient.hxx b/drawinglayer/source/processor2d/vclhelpergradient.hxx index e1671dbb87b2..a86256105c90 100644 --- a/drawinglayer/source/processor2d/vclhelpergradient.hxx +++ b/drawinglayer/source/processor2d/vclhelpergradient.hxx @@ -36,7 +36,8 @@ #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERGRADIENT_HXX -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a99115a095c4..687bb751ca20 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -52,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -73,8 +72,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // for PDFExtOutDevData Graphic support @@ -160,7 +159,7 @@ namespace drawinglayer { if(bIsTransparenceGradient) { - // it's about alpha channel intensities (black/white), do not use color modifier + // it's about transparence channel intensities (black/white), do not use color modifier o_rVCLGradient.SetStartColor(Color(rFiGrAtt.getStartColor())); o_rVCLGradient.SetEndColor(Color(rFiGrAtt.getEndColor())); } @@ -444,13 +443,13 @@ namespace drawinglayer fills. Thus, users have the choice to use the SvtGraphicFill info or the created output actions. Even for XFillTransparenceItem it is used, thus it may need to be supported in - UnifiedAlphaPrimitive2D, too, when interpreted as normally filled PolyPolygon. + UnifiedTransparencePrimitive2D, too, when interpreted as normally filled PolyPolygon. Implemented for: PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D, - and for PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D when detected unified alpha + and for PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D when detected unified transparence XPATHSTROKE_SEQ_BEGIN, XPATHSTROKE_SEQ_END: @@ -1483,138 +1482,166 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D : + { + // HiddenGeometryPrimitive2D; to rebuilt the old MetaFile creation, it is necessary to + // not ignore them (as it was thought), but to add a MetaFile entry for them. + basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aInvisibleRange.isEmpty()) + { + aInvisibleRange.transform(maCurrentTransformation); + const Rectangle aRectLogic( + (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), + (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); + + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(); + mpOutputDevice->DrawRect(aRectLogic); + } + + break; + } + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // - uses DrawTransparent for single PolyPoylgons directly. Can be detected by // checking the content for single PolyPolygonColorPrimitive2D - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); if(rContent.hasElements()) { - // try to identify a single PolyPolygonColorPrimitive2D in the - // content part of the alpha primitive - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; - static bool bForceToMetafile(false); - - if(!bForceToMetafile && 1 == rContent.getLength()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); } - - // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and - // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. - // Check also for correct ID to exclude derived implementations - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); - - // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support - SvtGraphicFill* pSvtGraphicFill = 0; + // try to identify a single PolyPolygonColorPrimitive2D in the + // content part of the transparence primitive + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = 0; + static bool bForceToMetafile(false); - if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + if(!bForceToMetafile && 1 == rContent.getLength()) { - // setup simple color with transparence fill stuff like in impgrfll - pSvtGraphicFill = new SvtGraphicFill( - PolyPolygon(aLocalPolyPolygon), - Color(aPolygonColor), - rUniAlphaCandidate.getAlpha(), - SvtGraphicFill::fillEvenOdd, - SvtGraphicFill::fillSolid, - SvtGraphicFill::Transform(), - false, - SvtGraphicFill::hatchSingle, - Color(), - SvtGraphicFill::gradientLinear, - Color(), - Color(), - 0, - Graphic()); + const primitive2d::Primitive2DReference xReference(rContent[0]); + pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); } - // set line and fill color - const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniAlphaCandidate.getAlpha() * 100.0)); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + // PolyPolygonGradientPrimitive2D, PolyPolygonHatchPrimitive2D and + // PolyPolygonBitmapPrimitive2D are derived from PolyPolygonColorPrimitive2D. + // Check also for correct ID to exclude derived implementations + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); - // call VCL directly; encapsulate with SvtGraphicFill - impStartSvtGraphicFill(pSvtGraphicFill); - mpOutputDevice->DrawTransparent( - PolyPolygon(aLocalPolyPolygon), - nTransPercentVcl); - impEndSvtGraphicFill(pSvtGraphicFill); - } - else - { - // svae old mfCurrentUnifiedTransparence and set new one - // so that contained SvtGraphicStroke may use the current one - const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); - // #i105377# paint the content metafile opaque as the transparency gets - // split of into the gradient below - // mfCurrentUnifiedTransparence = rUniAlphaCandidate.getAlpha(); - mfCurrentUnifiedTransparence = 0; + // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support + SvtGraphicFill* pSvtGraphicFill = 0; - // various content, create content-metafile - GDIMetaFile aContentMetafile; - const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); - - // restore mfCurrentUnifiedTransparence; it may have been used - // while processing the sub-content in impDumpToMetaFile - mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) + { + // setup simple color with transparence fill stuff like in impgrfll + pSvtGraphicFill = new SvtGraphicFill( + PolyPolygon(aLocalPolyPolygon), + Color(aPolygonColor), + rUniTransparenceCandidate.getTransparence(), + SvtGraphicFill::fillEvenOdd, + SvtGraphicFill::fillSolid, + SvtGraphicFill::Transform(), + false, + SvtGraphicFill::hatchSingle, + Color(), + SvtGraphicFill::gradientLinear, + Color(), + Color(), + 0, + Graphic()); + } - // create uniform VCL gradient for uniform transparency - Gradient aVCLGradient; - const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniAlphaCandidate.getAlpha() * 255.0)); - const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); - - aVCLGradient.SetStyle(GRADIENT_LINEAR); - aVCLGradient.SetStartColor(aTransColor); - aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); - aVCLGradient.SetBorder(0); - aVCLGradient.SetOfsX(0); - aVCLGradient.SetOfsY(0); - aVCLGradient.SetStartIntensity(100); - aVCLGradient.SetEndIntensity(100); - aVCLGradient.SetSteps(2); + // set line and fill color + const sal_uInt16 nTransPercentVcl((sal_uInt16)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 100.0)); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); - // render it to VCL - mpOutputDevice->DrawTransparent( - aContentMetafile, aPrimitiveRectangle.TopLeft(), - aPrimitiveRectangle.GetSize(), aVCLGradient); + // call VCL directly; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + mpOutputDevice->DrawTransparent( + PolyPolygon(aLocalPolyPolygon), + nTransPercentVcl); + impEndSvtGraphicFill(pSvtGraphicFill); + } + else + { + // svae old mfCurrentUnifiedTransparence and set new one + // so that contained SvtGraphicStroke may use the current one + const double fLastCurrentUnifiedTransparence(mfCurrentUnifiedTransparence); + // #i105377# paint the content metafile opaque as the transparency gets + // split of into the gradient below + // mfCurrentUnifiedTransparence = rUniTransparenceCandidate.getTransparence(); + mfCurrentUnifiedTransparence = 0; + + // various content, create content-metafile + GDIMetaFile aContentMetafile; + const Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, aContentMetafile)); + + // restore mfCurrentUnifiedTransparence; it may have been used + // while processing the sub-content in impDumpToMetaFile + mfCurrentUnifiedTransparence = fLastCurrentUnifiedTransparence; + + // create uniform VCL gradient for uniform transparency + Gradient aVCLGradient; + const sal_uInt8 nTransPercentVcl((sal_uInt8)basegfx::fround(rUniTransparenceCandidate.getTransparence() * 255.0)); + const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl); + + aVCLGradient.SetStyle(GRADIENT_LINEAR); + aVCLGradient.SetStartColor(aTransColor); + aVCLGradient.SetEndColor(aTransColor); + aVCLGradient.SetAngle(0); + aVCLGradient.SetBorder(0); + aVCLGradient.SetOfsX(0); + aVCLGradient.SetOfsY(0); + aVCLGradient.SetStartIntensity(100); + aVCLGradient.SetEndIntensity(100); + aVCLGradient.SetSteps(2); + + // render it to VCL + mpOutputDevice->DrawTransparent( + aContentMetafile, aPrimitiveRectangle.TopLeft(), + aPrimitiveRectangle.GetSize(), aVCLGradient); + } } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // for metafile: Need to examine what the pure vcl version is doing here actually // - uses DrawTransparent with metafile for content and a gradient // i can detect this here with checking the gradient part for a single // FillGradientPrimitive2D and reconstruct the gradient. - // If that detection goes wrong, i have to create an alpha-blended bitmap. Eventually - // do that in stripes, else RenderAlphaPrimitive2D may just be used - const primitive2d::AlphaPrimitive2D& rAlphaCandidate = static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rAlphaCandidate.getChildren(); - const primitive2d::Primitive2DSequence rAlpha = rAlphaCandidate.getAlpha(); + // If that detection goes wrong, i have to create an transparence-blended bitmap. Eventually + // do that in stripes, else RenderTransparencePrimitive2D may just be used + const primitive2d::TransparencePrimitive2D& rTransparenceCandidate = static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DSequence rTransparence = rTransparenceCandidate.getTransparence(); - if(rContent.hasElements() && rAlpha.hasElements()) + if(rContent.hasElements() && rTransparence.hasElements()) { // try to identify a single FillGradientPrimitive2D in the - // alpha part of the primitive + // transparence part of the primitive const primitive2d::FillGradientPrimitive2D* pFiGradient = 0; static bool bForceToBigTransparentVDev(false); - if(!bForceToBigTransparentVDev && 1 == rAlpha.getLength()) + if(!bForceToBigTransparentVDev && 1 == rTransparence.getLength()) { - const primitive2d::Primitive2DReference xReference(rAlpha[0]); + const primitive2d::Primitive2DReference xReference(rTransparence[0]); pFiGradient = dynamic_cast< const primitive2d::FillGradientPrimitive2D* >(xReference.get()); } @@ -1646,7 +1673,7 @@ namespace drawinglayer // Okay, basic implementation finished and tested. The DPI stuff was hard // and not easy to find out that it's needed. // Since this will not yet happen normally (as long as noone constructs - // alpha primitives with non-trivial alpha content) i will for now not + // transparence primitives with non-trivial transparence content) i will for now not // refine to tiling here. basegfx::B2DRange aViewRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); @@ -1697,9 +1724,9 @@ namespace drawinglayer aBufferProcessor.process(rContent); const Bitmap aBmContent(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); - // draw alpha using pixel renderer + // draw transparence using pixel renderer aBufferDevice.Erase(); - aBufferProcessor.process(rAlpha); + aBufferProcessor.process(rTransparence); const AlphaMask aBmAlpha(aBufferDevice.GetBitmap(aEmptyPoint, aSizePixel)); #ifdef DBG_UTIL @@ -1785,27 +1812,6 @@ namespace drawinglayer break; } - case PRIMITIVE2D_ID_HITTESTPRIMITIVE2D : - { - // #i99123# - // invisible primitive; to rebuilt the old MetaFile creation, it is necessary to - // not ignore them (as it was thought), but to add a MetaFile entry for them. - basegfx::B2DRange aInvisibleRange(rCandidate.getB2DRange(getViewInformation2D())); - - if(!aInvisibleRange.isEmpty()) - { - aInvisibleRange.transform(maCurrentTransformation); - const Rectangle aRectLogic( - (sal_Int32)floor(aInvisibleRange.getMinX()), (sal_Int32)floor(aInvisibleRange.getMinY()), - (sal_Int32)ceil(aInvisibleRange.getMaxX()), (sal_Int32)ceil(aInvisibleRange.getMaxY())); - - mpOutputDevice->SetFillColor(); - mpOutputDevice->SetLineColor(); - mpOutputDevice->DrawRect(aRectLogic); - } - - break; - } case PRIMITIVE2D_ID_EPSPRIMITIVE2D : { RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 5a74b0471b7f..aed085a0bc9a 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -47,14 +47,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include @@ -264,50 +264,62 @@ namespace drawinglayer RenderModifiedColorPrimitive2D(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); break; } - case PRIMITIVE2D_ID_UNIFIEDALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D : { // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, // use the faster OutputDevice::DrawTransparent method - const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); - bool bDrawTransparentUsed(false); + const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); + const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); - // since DEV300 m33 DrawTransparent is supported in VCL (for some targets - // natively), so i am now enabling this shortcut - static bool bAllowUsingDrawTransparent(true); - - if(bAllowUsingDrawTransparent && rContent.hasElements() && 1 == rContent.getLength()) + if(rContent.hasElements()) { - const primitive2d::Primitive2DReference xReference(rContent[0]); - const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); - - if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + if(0.0 == rUniTransparenceCandidate.getTransparence()) + { + // not transparent at all, use content + process(rUniTransparenceCandidate.getChildren()); + } + else if(rUniTransparenceCandidate.getTransparence() > 0.0 && rUniTransparenceCandidate.getTransparence() < 1.0) { - // single transparent PolyPolygon identified, use directly - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); - mpOutputDevice->SetFillColor(Color(aPolygonColor)); - mpOutputDevice->SetLineColor(); + bool bDrawTransparentUsed(false); - basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); + // since DEV300 m33 DrawTransparent is supported in VCL (for some targets + // natively), so i am now enabling this shortcut + static bool bAllowUsingDrawTransparent(true); - mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniAlphaCandidate.getAlpha()); - bDrawTransparentUsed = true; - } - } + if(bAllowUsingDrawTransparent && 1 == rContent.getLength()) + { + const primitive2d::Primitive2DReference xReference(rContent[0]); + const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); + + if(pPoPoColor && PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D == pPoPoColor->getPrimitive2DID()) + { + // single transparent PolyPolygon identified, use directly + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); + mpOutputDevice->SetFillColor(Color(aPolygonColor)); + mpOutputDevice->SetLineColor(); + + basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + aLocalPolyPolygon.transform(maCurrentTransformation); + + mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniTransparenceCandidate.getTransparence()); + bDrawTransparentUsed = true; + } + } - if(!bDrawTransparentUsed) - { - // unified sub-transparence. Draw to VDev first. - RenderUnifiedAlphaPrimitive2D(rUniAlphaCandidate); + if(!bDrawTransparentUsed) + { + // unified sub-transparence. Draw to VDev first. + RenderUnifiedTransparencePrimitive2D(rUniTransparenceCandidate); + } + } } break; } - case PRIMITIVE2D_ID_ALPHAPRIMITIVE2D : + case PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D : { // sub-transparence group. Draw to VDev first. - RenderAlphaPrimitive2D(static_cast< const primitive2d::AlphaPrimitive2D& >(rCandidate)); + RenderTransparencePrimitive2D(static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate)); break; } case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D : diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index e9de4199026b..1c1865c13f75 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -52,8 +51,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -380,7 +379,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -454,7 +453,7 @@ namespace drawinglayer { // color gets completely replaced, get it const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(basegfx::BColor())); - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aLocalTransform); mpOutputDevice->SetFillColor(Color(aModifiedColor)); @@ -610,7 +609,7 @@ namespace drawinglayer else { // try to catch cases where the bitmap will be color-modified to a single - // color (e.g. shadow). This would NOT be optimizable with an alpha channel + // color (e.g. shadow). This would NOT be optimizable with an transparence channel // at the Bitmap which we do not have here. When this should change, this // optimization has to be reworked accordingly. const sal_uInt32 nBColorModifierStackCount(maBColorModifierStack.count()); @@ -883,10 +882,10 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing()) { // with AA, use 8bit AlphaMask to get nice borders - VirtualDevice& rAlpha = aBufferDevice.getAlpha(); - rAlpha.SetLineColor(); - rAlpha.SetFillColor(COL_BLACK); - rAlpha.DrawPolyPolygon(aMask); + VirtualDevice& rTransparence = aBufferDevice.getTransparence(); + rTransparence.SetLineColor(); + rTransparence.SetFillColor(COL_BLACK); + rTransparence.DrawPolyPolygon(aMask); // dump buffer to outdev aBufferDevice.paint(); @@ -919,7 +918,7 @@ namespace drawinglayer } // unified sub-transparence. Draw to VDev first. - void VclProcessor2D::RenderUnifiedAlphaPrimitive2D(const primitive2d::UnifiedAlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate) { static bool bForceToDecomposition(false); @@ -932,14 +931,14 @@ namespace drawinglayer } else { - if(0.0 == rTransCandidate.getAlpha()) + if(0.0 == rTransCandidate.getTransparence()) { // no transparence used, so just use the content process(rTransCandidate.getChildren()); } - else if(rTransCandidate.getAlpha() > 0.0 && rTransCandidate.getAlpha() < 1.0) + else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0) { - // alpha is in visible range + // transparence is in visible range basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); aRange.transform(maCurrentTransformation); impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); @@ -956,8 +955,8 @@ namespace drawinglayer // back to old OutDev mpOutputDevice = pLastOutputDevice; - // dump buffer to outdev using given alpha - aBufferDevice.paint(rTransCandidate.getAlpha()); + // dump buffer to outdev using given transparence + aBufferDevice.paint(rTransCandidate.getTransparence()); } } } @@ -965,7 +964,7 @@ namespace drawinglayer } // sub-transparence group. Draw to VDev first. - void VclProcessor2D::RenderAlphaPrimitive2D(const primitive2d::AlphaPrimitive2D& rTransCandidate) + void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate) { if(rTransCandidate.getChildren().hasElements()) { @@ -983,14 +982,14 @@ namespace drawinglayer process(rTransCandidate.getChildren()); // set to mask - mpOutputDevice = &aBufferDevice.getAlpha(); + mpOutputDevice = &aBufferDevice.getTransparence(); - // when painting alpha masks, reset the color stack + // when painting transparence masks, reset the color stack basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it (always with alpha intensities, evtl. with AA) - process(rTransCandidate.getAlpha()); + // paint mask to it (always with transparence intensities, evtl. with AA) + process(rTransCandidate.getTransparence()); // back to old color stack maBColorModifierStack = aLastBColorModifierStack; diff --git a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx index 42e2e1565803..305a575a50d9 100644 --- a/drawinglayer/source/processor3d/cutfindprocessor3d.cxx +++ b/drawinglayer/source/processor3d/cutfindprocessor3d.cxx @@ -40,11 +40,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,8 @@ namespace drawinglayer maBack(rBack), maResult(), maCombinedTransform(), - mbAnyHit(bAnyHit) + mbAnyHit(bAnyHit), + mbUseInvisiblePrimitiveContent(true) { } @@ -132,13 +133,46 @@ namespace drawinglayer process(rPrimitive.getChildren()); break; } - case PRIMITIVE3D_ID_HITTESTPRIMITIVE3D : + case PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D : { - // HitTestPrimitive3D, force usage due to we are doing a hit test and this - // primitive only gets generated on 3d objects without fill, exactly for this - // purpose - const primitive3d::HitTestPrimitive3D& rPrimitive = static_cast< const primitive3d::HitTestPrimitive3D& >(rCandidate); - process(rPrimitive.getChildren()); + // HiddenGeometryPrimitive3D; the default decomposition would return an empty seqence, + // so force this primitive to process it's children directly if the switch is set + // (which is the default). Else, ignore invisible content + const primitive3d::HiddenGeometryPrimitive3D& rHiddenGeometry(static_cast< const primitive3d::HiddenGeometryPrimitive3D& >(rCandidate)); + const primitive3d::Primitive3DSequence& rChildren = rHiddenGeometry.getChildren(); + + if(rChildren.hasElements()) + { + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + + break; + } + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : + { + const primitive3d::UnifiedTransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::UnifiedTransparenceTexturePrimitive3D& >(rCandidate); + const primitive3d::Primitive3DSequence rChildren = rPrimitive.getChildren(); + + if(rChildren.getLength()) + { + if(1.0 <= rPrimitive.getTransparence()) + { + // not visible, but use for HitTest + if(getUseInvisiblePrimitiveContent()) + { + process(rChildren); + } + } + else if(rPrimitive.getTransparence() >= 0.0 && rPrimitive.getTransparence() < 1.0) + { + // visible; use content + process(rChildren); + } + } + break; } case PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D : diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx index 509a8e5db2ba..da179b546cf9 100644 --- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx +++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx @@ -48,9 +48,11 @@ #include #include #include -#include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -493,10 +495,10 @@ namespace drawinglayer impRenderBitmapTexturePrimitive3D(rPrimitive); break; } - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : { - // AlphaTexturePrimitive3D - const primitive3d::AlphaTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::AlphaTexturePrimitive3D& >(rBasePrimitive); + // TransparenceTexturePrimitive3D + const primitive3d::TransparenceTexturePrimitive3D& rPrimitive = static_cast< const primitive3d::TransparenceTexturePrimitive3D& >(rBasePrimitive); mnTransparenceCounter++; impRenderGradientTexturePrimitive3D(rPrimitive, true); mnTransparenceCounter--; diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx index c2e1c73b5181..29ff433c5af8 100644 --- a/drawinglayer/source/processor3d/geometry2dextractor.cxx +++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx @@ -135,8 +135,8 @@ namespace drawinglayer case PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D : case PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_ALPHATEXTUREPRIMITIVE3D : - case PRIMITIVE3D_ID_UNIFIEDALPHATEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D : + case PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D : { // TexturePrimitive3D: Process children, do not try to decompose const primitive3d::TexturePrimitive3D& rTexturePrimitive = static_cast< const primitive3d::TexturePrimitive3D& >(rCandidate); diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 5e6678fc3a8e..6e7b6a587b1e 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ namespace drawinglayer { // create simpleTransparencePrimitive, add created primitives const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1L); - const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedAlphaPrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); + const primitive2d::Primitive2DReference xRef2(new primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, rPrimitive.getShadowTransparence())); primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(*mpPrimitive2DSequence, xRef2); } else diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx index 9346958f6b69..4ccefddcb100 100644 --- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx +++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -51,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/texture/texture3d.cxx b/drawinglayer/source/texture/texture3d.cxx index 0e103ad385c9..d11dc5978d47 100644 --- a/drawinglayer/source/texture/texture3d.cxx +++ b/drawinglayer/source/texture/texture3d.cxx @@ -38,7 +38,6 @@ #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index 718225aa990b..a4cd8c497cd6 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -111,6 +111,8 @@ public: E3dScene(E3dDefaultAttributes& rDefault); virtual ~E3dScene(); + virtual void SetBoundRectDirty(); + // access to cleanup of depth mapper void Cleanup3DDepthMapper() { ImpCleanup3DDepthMapper(); } diff --git a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx b/svx/inc/svx/sdr/attribute/sdrallattribute.hxx deleted file mode 100644 index a699c7f9a198..000000000000 --- a/svx/inc/svx/sdr/attribute/sdrallattribute.hxx +++ /dev/null @@ -1,202 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.hxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX -#define _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -#include - -////////////////////////////////////////////////////////////////////////////// -// predefines - -namespace drawinglayer { namespace attribute { - class SdrLineAttribute; - class SdrFillAttribute; - class SdrLineStartEndAttribute; - class SdrShadowAttribute; - class FillGradientAttribute; - class SdrTextAttribute; -}} - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrShadowTextAttribute - { - // shadow and text attributes - SdrShadowAttribute* mpShadow; // shadow attributes (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrShadowTextAttribute( - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrShadowTextAttribute(); - - // copy constructor and assigment operator - SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); - SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (0 != mpTextAttribute); } - - // data access - const SdrShadowAttribute* getShadow() const { return mpShadow; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrFillTextAttribute - { - // shadow and text attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - SdrTextAttribute* mpTextAttribute; // text and text attributes (if used) - - public: - SdrFillTextAttribute( - SdrFillAttribute* pFill = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrFillTextAttribute(); - - // copy constructor and assigment operator - SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); - SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrFillTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return ((mpTextAttribute) || (mpFill)); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - const SdrTextAttribute* getText() const { return mpTextAttribute; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineShadowTextAttribute : public SdrShadowTextAttribute - { - // line, shadow, lineStartEnd and text attributes - SdrLineAttribute* mpLine; // line attributes (if used) - SdrLineStartEndAttribute* mpLineStartEnd; // line start end (if used) - - public: - SdrLineShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); - SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpLine || (SdrShadowTextAttribute::isVisible())); } - - // data access - const SdrLineAttribute* getLine() const { return mpLine; } - const SdrLineStartEndAttribute* getLineStartEnd() const { return mpLineStartEnd; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute - { - // add fill and transGradient attributes - SdrFillAttribute* mpFill; // fill attributes (if used) - FillGradientAttribute* mpFillFloatTransGradient; // fill float transparence gradient (if used) - - public: - SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine = 0, - SdrFillAttribute* pFill = 0, - SdrLineStartEndAttribute* pLineStartEnd = 0, - SdrShadowAttribute* pShadow = 0, - FillGradientAttribute* pFillFloatTransGradient = 0, - SdrTextAttribute* pTextAttribute = 0); - ~SdrLineFillShadowTextAttribute(); - - // copy constructor and assigment operator - SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); - SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); - - // compare operator - bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; - - // bool access - bool isVisible() const { return (mpFill || (SdrLineShadowTextAttribute::isVisible())); } - - // data access - const SdrFillAttribute* getFill() const { return mpFill; } - const FillGradientAttribute* getFillFloatTransGradient() const { return mpFillFloatTransGradient; } - }; - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // _SDR_ATTRIBUTE_SDRALLATTRIBUTE_HXX - -// eof diff --git a/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx new file mode 100644 index 000000000000..df8ee7c666a9 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrfilltextattribute.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrFillTextAttribute + { + // shadow and text attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrFillTextAttribute(); + SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate); + SdrFillTextAttribute& operator=(const SdrFillTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrFillTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRFILLTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx index 77273bd9cb03..449c8cb8fcf6 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextattribute.hxx @@ -38,8 +38,13 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SfxItemSet; -namespace drawinglayer { namespace attribute { class SdrFormTextOutlineAttribute; }} + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextAttribute; + class SdrFormTextOutlineAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -50,53 +55,36 @@ namespace drawinglayer class SdrFormTextAttribute { private: - // FormText (FontWork) Attributes - sal_Int32 mnFormTextDistance; // distance from line in upright direction - sal_Int32 mnFormTextStart; // shift from polygon start - sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees - sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling - sal_uInt16 mnFormTextShdwTransp; // shadow transparence - XFormTextStyle meFormTextStyle; // on/off and char orientation - XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale - XFormTextShadow meFormTextShadow; // shadow mode - Color maFormTextShdwColor; // shadow color - - // outline attributes; used when getFormTextOutline() is true and (for - // shadow) when getFormTextShadow() != XFTSHADOW_NONE - SdrFormTextOutlineAttribute* mpOutline; - SdrFormTextOutlineAttribute* mpShadowOutline; - - // bitfield - unsigned mbFormTextMirror : 1; // change orientation - unsigned mbFormTextOutline : 1; // show contour of objects + ImpSdrFormTextAttribute* mpSdrFormTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextAttribute(const SfxItemSet& rSet); - ~SdrFormTextAttribute(); - - // copy constructor and assigment operator + SdrFormTextAttribute(); SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate); SdrFormTextAttribute& operator=(const SdrFormTextAttribute& rCandidate); + ~SdrFormTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextAttribute& rCandidate) const; - // data access - sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } - sal_Int32 getFormTextStart() const { return mnFormTextStart; } - sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } - sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } - sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } - XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } - XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } - XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } - Color getFormTextShdwColor() const { return maFormTextShdwColor; } - - const SdrFormTextOutlineAttribute* getOutline() const { return mpOutline; } - const SdrFormTextOutlineAttribute* getShadowOutline() const { return mpShadowOutline; } - - bool getFormTextMirror() const { return mbFormTextMirror; } - bool getFormTextOutline() const { return mbFormTextOutline; } + // data read access + sal_Int32 getFormTextDistance() const; + sal_Int32 getFormTextStart() const; + sal_Int32 getFormTextShdwXVal() const; + sal_Int32 getFormTextShdwYVal() const; + sal_uInt16 getFormTextShdwTransp() const; + XFormTextStyle getFormTextStyle() const; + XFormTextAdjust getFormTextAdjust() const; + XFormTextShadow getFormTextShadow() const; + Color getFormTextShdwColor() const; + const SdrFormTextOutlineAttribute& getOutline() const; + const SdrFormTextOutlineAttribute& getShadowOutline() const; + bool getFormTextMirror() const; + bool getFormTextOutline() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx index 8e11c97ed5c3..d13fe39232ff 100644 --- a/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrformtextoutlineattribute.hxx @@ -33,8 +33,15 @@ #define _SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX #include -#include -#include + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute; + class LineAttribute; + class StrokeAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -45,24 +52,29 @@ namespace drawinglayer class SdrFormTextOutlineAttribute { private: - // one set of attributes for FormText (FontWork) outline visualisation - LineAttribute maLineAttribute; - StrokeAttribute maStrokeAttribute; - sal_uInt8 mnTransparence; + ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute; public: + /// constructors/assignmentoperator/destructor SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence); + SdrFormTextOutlineAttribute(); + SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate); + SdrFormTextOutlineAttribute& operator=(const SdrFormTextOutlineAttribute& rCandidate); + ~SdrFormTextOutlineAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrFormTextOutlineAttribute& rCandidate) const; // data read access - const LineAttribute& getLineAttribute() const { return maLineAttribute; } - const StrokeAttribute getStrokeAttribute() const { return maStrokeAttribute; } - sal_uInt8 getTransparence() const { return mnTransparence; } + const LineAttribute& getLineAttribute() const; + const StrokeAttribute& getStrokeAttribute() const; + sal_uInt8 getTransparence() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx new file mode 100644 index 000000000000..c2fa9200dfe8 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineFillShadowTextAttribute : public SdrLineShadowTextAttribute + { + // add fill and transGradient attributes + SdrFillAttribute maFill; // fill attributes (if used) + FillGradientAttribute maFillFloatTransGradient; // fill float transparence gradient (if used) + + public: + SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute); + SdrLineFillShadowTextAttribute(); + SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate); + SdrLineFillShadowTextAttribute& operator=(const SdrLineFillShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineFillShadowTextAttribute& rCandidate) const; + + // data access + const SdrFillAttribute& getFill() const { return maFill; } + const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINEFILLSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx new file mode 100644 index 000000000000..e5d19cef5f4e --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrlineshadowtextattribute.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrLineShadowTextAttribute : public SdrShadowTextAttribute + { + // line, shadow, lineStartEnd and text attributes + SdrLineAttribute maLine; // line attributes (if used) + SdrLineStartEndAttribute maLineStartEnd; // line start end (if used) + + public: + SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrLineShadowTextAttribute(); + SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate); + SdrLineShadowTextAttribute& operator=(const SdrLineShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrLineShadowTextAttribute& rCandidate) const; + + // data access + const SdrLineAttribute& getLine() const { return maLine; } + const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRLINESHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx new file mode 100644 index 000000000000..f71a74d6a580 --- /dev/null +++ b/svx/inc/svx/sdr/attribute/sdrshadowtextattribute.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.hxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX +#define _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SdrShadowTextAttribute + { + // shadow and text attributes + SdrShadowAttribute maShadow; // shadow attributes (if used) + SdrTextAttribute maTextAttribute; // text and text attributes (if used) + + public: + SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute); + SdrShadowTextAttribute(); + SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate); + SdrShadowTextAttribute& operator=(const SdrShadowTextAttribute& rCandidate); + + // checks if the incarnation is default constructed + bool isDefault() const; + + // compare operator + bool operator==(const SdrShadowTextAttribute& rCandidate) const; + + // data access + const SdrShadowAttribute& getShadow() const { return maShadow; } + const SdrTextAttribute& getText() const { return maTextAttribute; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRSHADOWTEXTATTRIBUTE_HXX + +// eof diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx index f672086ea5cd..36a9c2591c43 100644 --- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx +++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx @@ -39,9 +39,20 @@ ////////////////////////////////////////////////////////////////////////////// // predefines + class SdrText; -namespace drawinglayer { namespace animation { class AnimationEntryList; }} -namespace drawinglayer { namespace attribute { class SdrFormTextAttribute; }} + +namespace drawinglayer { namespace animation { + class AnimationEntryList; +}} + +namespace drawinglayer { namespace attribute { + class SdrFormTextAttribute; +}} + +namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute; +}} ////////////////////////////////////////////////////////////////////////////// @@ -52,41 +63,13 @@ namespace drawinglayer class SdrTextAttribute { private: - // all-text attributes. The SdrText itself and a copy - // of te OPO - const SdrText* mpSdrText; - OutlinerParaObject maOutlinerParaObject; - - // Set when it's a FormText; contains all FormText attributes - SdrFormTextAttribute* mpSdrFormTextAttribute; - - // text distances - sal_Int32 maTextLeftDistance; - sal_Int32 maTextUpperDistance; - sal_Int32 maTextRightDistance; - sal_Int32 maTextLowerDistance; - - // #i101556# use versioning from text attributes to detect changes - sal_uInt32 maPropertiesVersion; - - // text alignments - SdrTextHorzAdjust maSdrTextHorzAdjust; - SdrTextVertAdjust maSdrTextVertAdjust; - - // bitfield - unsigned mbContour : 1; - unsigned mbFitToSize : 1; - unsigned mbHideContour : 1; - unsigned mbBlink : 1; - unsigned mbScroll : 1; - unsigned mbInEditMode : 1; - unsigned mbFixedCellHeight : 1; - unsigned mbWrongSpell : 1; + ImpSdrTextAttribute* mpSdrTextAttribute; public: + /// constructors/assignmentoperator/destructor SdrTextAttribute( const SdrText& rSdrText, - const OutlinerParaObject& rOutlinerParaObjectPtr, + const OutlinerParaObject& rOutlinerParaObject, XFormTextStyle eFormTextStyle, sal_Int32 aTextLeftDistance, sal_Int32 aTextUpperDistance, @@ -102,38 +85,44 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell); - ~SdrTextAttribute(); - - // copy constructor and assigment operator + SdrTextAttribute(); SdrTextAttribute(const SdrTextAttribute& rCandidate); SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate); + ~SdrTextAttribute(); + + // checks if the incarnation is default constructed + bool isDefault() const; // compare operator bool operator==(const SdrTextAttribute& rCandidate) const; - // data access - const SdrText& getSdrText() const { return *mpSdrText; } - const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } - bool isContour() const { return mbContour; } - bool isFitToSize() const { return mbFitToSize; } - bool isHideContour() const { return mbHideContour; } - bool isBlink() const { return mbBlink; } - bool isScroll() const { return mbScroll; } - bool isInEditMode() const { return mbInEditMode; } - bool isFixedCellHeight() const { return mbFixedCellHeight; } - bool isWrongSpell() const { return mbWrongSpell; } - const SdrFormTextAttribute* getSdrFormTextAttribute() const { return mpSdrFormTextAttribute; } - sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } - sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } - sal_Int32 getTextRightDistance() const { return maTextRightDistance; } - sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } - sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } - SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } - SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } - - // animation timing generation - void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const; - void getScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const; + // data read access + const SdrText& getSdrText() const; + const OutlinerParaObject& getOutlinerParaObject() const; + bool isContour() const; + bool isFitToSize() const; + bool isHideContour() const; + bool isBlink() const; + bool isScroll() const; + bool isInEditMode() const; + bool isFixedCellHeight() const; + bool isWrongSpell() const; + const SdrFormTextAttribute& getSdrFormTextAttribute() const; + sal_Int32 getTextLeftDistance() const; + sal_Int32 getTextUpperDistance() const; + sal_Int32 getTextRightDistance() const; + sal_Int32 getTextLowerDistance() const; + sal_uInt32 getPropertiesVersion() const; + SdrTextHorzAdjust getSdrTextHorzAdjust() const; + SdrTextVertAdjust getSdrTextVertAdjust() const; + + // helpers: animation timing generators + void getBlinkTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList) const; + void getScrollTextTiming( + drawinglayer::animation::AnimationEntryList& rAnimList, + double fFrameLength, + double fTextLength) const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx index 415526b07d77..49ba86d2bb69 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofe3dscene.hxx @@ -33,22 +33,16 @@ #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predeclarations class E3dScene; -namespace drawinglayer { - namespace geometry { - class ViewInformation3D; - } - namespace attribute { - class SdrSceneAttribute; - class SdrLightingAttribute; - } -} - namespace basegfx { class B3DRange; } @@ -70,7 +64,6 @@ namespace sdr public: // basic constructor, used from SdrObject. ViewContactOfE3dScene(E3dScene& rScene); - virtual ~ViewContactOfE3dScene(); // access to SdrObject E3dScene& GetE3dScene() const @@ -101,14 +94,14 @@ namespace sdr protected: // the 3d transformation stack - drawinglayer::geometry::ViewInformation3D* mpViewInformation3D; + drawinglayer::geometry::ViewInformation3D maViewInformation3D; // the object transformation - basegfx::B2DHomMatrix* mpObjectTransformation; + basegfx::B2DHomMatrix maObjectTransformation; // attributes - drawinglayer::attribute::SdrSceneAttribute* mpSdrSceneAttribute; - drawinglayer::attribute::SdrLightingAttribute* mpSdrLightingAttribute; + drawinglayer::attribute::SdrSceneAttribute maSdrSceneAttribute; + drawinglayer::attribute::SdrLightingAttribute maSdrLightingAttribute; // create methods for ViewInformation3D and ObjectTransformation void createViewInformation3D(const ::basegfx::B3DRange& rContentRange); diff --git a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx index 902ce95a9fc4..252906d55aa4 100644 --- a/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx +++ b/svx/inc/svx/sdr/contact/viewobjectcontactofgroup.hxx @@ -50,9 +50,6 @@ namespace sdr ViewObjectContactOfGroup(ObjectContact& rObjectContact, ViewContact& rViewContact); virtual ~ViewObjectContactOfGroup(); - // test this VOC for visibility concerning model-view stuff like e.g. Layer - virtual bool isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const; - // This method recursively paints the draw hierarchy. virtual drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const; }; diff --git a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx index e4a8fa01902f..638aae7ee7ef 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -50,7 +50,7 @@ namespace drawinglayer { namespace attribute { class SdrShadowTextAttribute; class SdrLineShadowTextAttribute; class SdrLineFillShadowTextAttribute; - class SdrLineFillShadowAttribute; + class SdrLineFillShadowAttribute3D; class SdrSceneAttribute; class SdrLightingAttribute; class SdrFillTextAttribute; @@ -67,13 +67,21 @@ namespace drawinglayer namespace primitive2d { // SdrAttribute creators - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet); - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth); - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet); - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet); + attribute::SdrLineAttribute createNewSdrLineAttribute( + const SfxItemSet& rSet); + + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth); + + attribute::SdrShadowAttribute createNewSdrShadowAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillAttribute createNewSdrFillAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft = 0, @@ -81,20 +89,37 @@ namespace drawinglayer const sal_Int32* pRight = 0, const sal_Int32* pLower = 0); - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet); - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet); - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute( + attribute::FillGradientAttribute createNewTransparenceGradientAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute( + const SfxItemSet& rSet); + + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( const SfxItemSet& rSet, - const SdrText& rText, + const SdrText* pText, bool bSuppressText); // #i98072# added option to suppress text on demand - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText); - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill); - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet); - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet); + + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( + const SfxItemSet& rSet, + bool bSuppressFill); + + attribute::SdrSceneAttribute createNewSdrSceneAttribute( + const SfxItemSet& rSet); + + attribute::SdrLightingAttribute createNewSdrLightingAttribute( + const SfxItemSet& rSet); // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, const SdrText* pSdrText, const sal_Int32* pLeft = 0, @@ -103,7 +128,11 @@ namespace drawinglayer const sal_Int32* pLower = 0); // helpers - void calculateRelativeCornerRadius(sal_Int32 nRadius, const ::basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY); + void calculateRelativeCornerRadius( + sal_Int32 nRadius, + const ::basegfx::B2DRange& rObjectRange, + double& rfCornerRadiusX, + double& rfCornerRadiusY); } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx index 177c42bfff17..e70cc4992e17 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx index 5523480f1f51..e5b8b4834e0f 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx index 72035eb99569..99d3fb180a25 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -33,8 +33,8 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines @@ -61,8 +61,8 @@ namespace drawinglayer // making exceptions with shadow generation unsigned mb3DShape : 1; - // #SJ# Allow text clipping against TextBox in special cases (used for SC) - unsigned mbForceTextClipToTextRange : 1; + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; protected: // local decomposition. diff --git a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx index 0f46c2809597..51171ec99f67 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -58,22 +58,22 @@ namespace drawinglayer namespace primitive2d { Primitive2DReference createPolyPolygonFillPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient = 0L); + const attribute::FillGradientAttribute& rFillGradient); Primitive2DReference createPolygonLinePrimitive( - const ::basegfx::B2DPolygon& rUnitPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke = 0L); + const attribute::SdrLineStartEndAttribute& rStroke); Primitive2DReference createTextPrimitive( - const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon, - const ::basegfx::B2DHomMatrix& rObjectTransform, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds); diff --git a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx index 1d11c27ede71..b4dae8aed62a 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx index 787c230d7b3d..c93d188177b2 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -34,9 +34,8 @@ #include #include -#include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx index 3e998f23fd2b..c5d5c31bd302 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -33,8 +33,7 @@ #define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx index 2deaf474e12e..658bbe3429f7 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -34,8 +34,7 @@ #include #include -#include -#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx index d6de666d901f..b95563c69741 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx index 2d419e9cd45d..766c4439e5be 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -40,7 +40,6 @@ namespace basegfx { class BColor; - class B2DHomMatrix; } ////////////////////////////////////////////////////////////////////////////// @@ -55,10 +54,6 @@ namespace drawinglayer // create a 7x7 gluepoint symbol in given colors as BitmapEx BitmapEx createDefaultGluepoint_7x7(const basegfx::BColor& rBColorA, const basegfx::BColor& rBColorB); - - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix); - } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx index 816956b188fe..18ca37872351 100644 --- a/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx +++ b/svx/inc/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -34,8 +34,8 @@ #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// // predefines diff --git a/svx/inc/svx/sdr/properties/oleproperties.hxx b/svx/inc/svx/sdr/properties/oleproperties.hxx new file mode 100644 index 000000000000..009c375dff99 --- /dev/null +++ b/svx/inc/svx/sdr/properties/oleproperties.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicproperties.hxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDR_PROPERTIES_OLEPROPERTIES_HXX +#define _SDR_PROPERTIES_OLEPROPERTIES_HXX + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + class OleProperties : public RectangleProperties + { + protected: + public: + // basic constructor + OleProperties(SdrObject& rObj); + + // constructor for copying, but using new object + OleProperties(const OleProperties& rProps, SdrObject& rObj); + + // destructor + virtual ~OleProperties(); + + // Clone() operator, normally just calls the local copy constructor + virtual BaseProperties& Clone(SdrObject& rObj) const; + + // force default attributes for a specific object type, called from + // DefaultProperties::GetObjectItemSet() if a new ItemSet is created + virtual void ForceDefaultAttributes(); + }; + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_PROPERTIES_OLEPROPERTIES_HXX + +// eof diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index 5f243d451f90..db799da81e1d 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -69,6 +69,7 @@ public: SdrObjGroup(); virtual ~SdrObjGroup(); + virtual void SetBoundRectDirty(); virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; virtual SdrLayerID GetLayer() const; diff --git a/svx/prj/d.lst b/svx/prj/d.lst index 8b4675feb3e9..7d2f508d9d21 100644 --- a/svx/prj/d.lst +++ b/svx/prj/d.lst @@ -637,6 +637,9 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\overlay ..\inc\svx\sdr\overlay\overlayselection.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlayselection.hxx ..\inc\svx\sdr\overlay\overlaytools.hxx %_DEST%\inc%_EXT%\svx\sdr\overlay\overlaytools.hxx +mkdir: %_DEST%\inc%_EXT%\svx\sdr\primitive2d +..\inc\svx\sdr\primitive2d\sdrprimitivetools.hxx %_DEST%\inc%_EXT%\svx\sdr\primitive2d\sdrprimitivetools.hxx + mkdir: %_DEST%\inc%_EXT%\svx\sdr\animation ..\inc\svx\sdr\animation\ainfographic.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfographic.hxx ..\inc\svx\sdr\animation\ainfoscrolltext.hxx %_DEST%\inc%_EXT%\svx\sdr\animation\ainfoscrolltext.hxx diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 3408108788c4..4c09e6720fe2 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -70,8 +70,33 @@ E3dDragMethod::E3dDragMethod ( // eine Unit anlegen const long nCnt(rMark.GetMarkCount()); static bool bDoInvalidate(false); + long nObjs(0); - for(long nObjs = 0;nObjs < nCnt;nObjs++) + if(mbMoveFull) + { + // for non-visible 3D objects fallback to wireframe interaction + bool bInvisibleObjects(false); + + for(nObjs = 0;!bInvisibleObjects && nObjs < nCnt;nObjs++) + { + E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); + + if(pE3dObj) + { + if(!pE3dObj->HasFillStyle() && !pE3dObj->HasLineStyle()) + { + bInvisibleObjects = true; + } + } + } + + if(bInvisibleObjects) + { + mbMoveFull = false; + } + } + + for(nObjs = 0;nObjs < nCnt;nObjs++) { E3dObject* pE3dObj = dynamic_cast< E3dObject* >(rMark.GetMark(nObjs)->GetMarkedSdrObj()); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 0e2b87be4ca7..171eda577a9c 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -337,6 +337,12 @@ UINT16 E3dScene::GetObjIdentifier() const return E3D_SCENE_ID; } +void E3dScene::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + /************************************************************************* |* |* SetSnapRect diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 3f89d202b6ba..e789da69d6e3 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include #include @@ -208,8 +208,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr // if we have full overlay from selected objects, embed with 50% transparence, the // transformation is added to the OverlayPrimitive2DSequenceObject - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aContent, 0.5)); - aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aContent, 0.5)); + aContent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayPrimitive2DSequenceObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aContent); diff --git a/svx/source/sdr/attribute/makefile.mk b/svx/source/sdr/attribute/makefile.mk index 44e161a3b503..33ef24169ab4 100644 --- a/svx/source/sdr/attribute/makefile.mk +++ b/svx/source/sdr/attribute/makefile.mk @@ -43,7 +43,10 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/sdrallattribute.obj \ + $(SLO)$/sdrfilltextattribute.obj \ + $(SLO)$/sdrlinefillshadowtextattribute.obj \ + $(SLO)$/sdrlineshadowtextattribute.obj \ + $(SLO)$/sdrshadowtextattribute.obj \ $(SLO)$/sdrtextattribute.obj \ $(SLO)$/sdrformtextattribute.obj \ $(SLO)$/sdrformtextoutlineattribute.obj diff --git a/svx/source/sdr/attribute/sdrallattribute.cxx b/svx/source/sdr/attribute/sdrallattribute.cxx deleted file mode 100644 index 9eee8dbccce8..000000000000 --- a/svx/source/sdr/attribute/sdrallattribute.cxx +++ /dev/null @@ -1,412 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sdrallattribute.cxx,v $ - * - * $Revision: 1.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "precompiled_svx.hxx" - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrShadowTextAttribute::SdrShadowTextAttribute( - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : mpShadow(pShadow), - mpTextAttribute(pTextAttribute) - { - } - - SdrShadowTextAttribute::SdrShadowTextAttribute( - const SdrShadowTextAttribute& rCandidate) - : mpShadow(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrShadowTextAttribute::~SdrShadowTextAttribute() - { - delete mpShadow; - delete mpTextAttribute; - } - - SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) - { - // handle mpShadow - { - // delete local mpShadow if necessary - if(mpShadow) - { - delete mpShadow; - mpShadow = 0; - } - - // copy mpShadow if necessary - if(rCandidate.mpShadow) - { - mpShadow = new SdrShadowAttribute(*rCandidate.mpShadow); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const - { - // handle mpShadow - if(!pointerOrContentEqual(mpShadow, rCandidate.mpShadow)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrFillTextAttribute::SdrFillTextAttribute( - SdrFillAttribute* pFill, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient), - mpTextAttribute(pTextAttribute) - { - } - - SdrFillTextAttribute::SdrFillTextAttribute( - const SdrFillTextAttribute& rCandidate) - : mpFill(0), - mpFillFloatTransGradient(0), - mpTextAttribute(0) - { - *this = rCandidate; - } - - SdrFillTextAttribute::~SdrFillTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - delete mpTextAttribute; - } - - SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) - { - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - // handle mpTextAttribute - { - // delete local mpTextAttribute if necessary - if(mpTextAttribute) - { - delete mpTextAttribute; - mpTextAttribute = 0; - } - - // copy mpTextAttribute if necessary - if(rCandidate.mpTextAttribute) - { - mpTextAttribute = new SdrTextAttribute(*rCandidate.mpTextAttribute); - } - } - - return *this; - } - - bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const - { - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - // handle mpTextAttribute - if(!pointerOrContentEqual(mpTextAttribute, rCandidate.mpTextAttribute)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - SdrLineAttribute* pLine, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - SdrTextAttribute* pTextAttribute) - : SdrShadowTextAttribute(pShadow, pTextAttribute), - mpLine(pLine), - mpLineStartEnd(pLineStartEnd) - { - } - - SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( - const SdrLineShadowTextAttribute& rCandidate) - : SdrShadowTextAttribute(0, 0), - mpLine(0), - mpLineStartEnd(0) - { - *this = rCandidate; - } - - SdrLineShadowTextAttribute::~SdrLineShadowTextAttribute() - { - delete mpLine; - delete mpLineStartEnd; - } - - SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) - { - // call parent - SdrShadowTextAttribute::operator=(rCandidate); - - // handle mpLine - { - // delete local mpLine if necessary - if(mpLine) - { - delete mpLine; - mpLine = 0; - } - - // copy mpLine if necessary - if(rCandidate.mpLine) - { - mpLine = new SdrLineAttribute(*rCandidate.mpLine); - } - } - - // handle mpLineStartEnd - { - // delete local mpLineStartEnd if necessary - if(mpLineStartEnd) - { - delete mpLineStartEnd; - mpLineStartEnd = 0; - } - - // copy mpLineStartEnd if necessary - if(rCandidate.mpLineStartEnd) - { - mpLineStartEnd = new SdrLineStartEndAttribute(*rCandidate.mpLineStartEnd); - } - } - - return *this; - } - - bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpLine - if(!pointerOrContentEqual(mpLine, rCandidate.mpLine)) - return false; - - // handle mpLineStartEnd - if(!pointerOrContentEqual(mpLineStartEnd, rCandidate.mpLineStartEnd)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -namespace drawinglayer -{ - namespace attribute - { - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - SdrLineAttribute* pLine, - attribute::SdrFillAttribute* pFill, - SdrLineStartEndAttribute* pLineStartEnd, - SdrShadowAttribute* pShadow, - FillGradientAttribute* pFillFloatTransGradient, - SdrTextAttribute* pTextAttribute) - : SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pTextAttribute), - mpFill(pFill), - mpFillFloatTransGradient(pFillFloatTransGradient) - { - } - - SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( - const SdrLineFillShadowTextAttribute& rCandidate) - : SdrLineShadowTextAttribute(0, 0, 0, 0), - mpFill(0), - mpFillFloatTransGradient(0) - { - *this = rCandidate; - } - - SdrLineFillShadowTextAttribute::~SdrLineFillShadowTextAttribute() - { - delete mpFill; - delete mpFillFloatTransGradient; - } - - SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) - { - // call parent - SdrLineShadowTextAttribute::operator=(rCandidate); - - // handle mpFill - { - // delete local mpFill if necessary - if(mpFill) - { - delete mpFill; - mpFill = 0; - } - - // copy mpFill if necessary - if(rCandidate.mpFill) - { - mpFill = new attribute::SdrFillAttribute(*rCandidate.mpFill); - } - } - - // handle mpFillFloatTransGradient - { - // delete local mpFillFloatTransGradient if necessary - if(mpFillFloatTransGradient) - { - delete mpFillFloatTransGradient; - mpFillFloatTransGradient = 0; - } - - // copy mpFillFloatTransGradient if necessary - if(rCandidate.mpFillFloatTransGradient) - { - mpFillFloatTransGradient = new FillGradientAttribute(*rCandidate.mpFillFloatTransGradient); - } - } - - return *this; - } - - bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const - { - // call parent - if(!(SdrLineShadowTextAttribute::operator==(rCandidate))) - return false; - - // handle mpFill - if(!pointerOrContentEqual(mpFill, rCandidate.mpFill)) - return false; - - // handle mpFillFloatTransGradient - if(!pointerOrContentEqual(mpFillFloatTransGradient, rCandidate.mpFillFloatTransGradient)) - return false; - - return true; - } - } // end of namespace attribute -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// -// eof diff --git a/svx/source/sdr/attribute/sdrfilltextattribute.cxx b/svx/source/sdr/attribute/sdrfilltextattribute.cxx new file mode 100644 index 000000000000..e281c77068c5 --- /dev/null +++ b/svx/source/sdr/attribute/sdrfilltextattribute.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrFillTextAttribute::SdrFillTextAttribute( + const SdrFillAttribute& rFill, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient), + maTextAttribute(rTextAttribute) + { + } + + SdrFillTextAttribute::SdrFillTextAttribute() + : maFill(), + maFillFloatTransGradient(), + maTextAttribute() + { + } + + SdrFillTextAttribute::SdrFillTextAttribute(const SdrFillTextAttribute& rCandidate) + : maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrFillTextAttribute& SdrFillTextAttribute::operator=(const SdrFillTextAttribute& rCandidate) + { + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrFillTextAttribute::isDefault() const + { + return(getFill().isDefault() + && getFillFloatTransGradient().isDefault() + && getText().isDefault()); + } + + bool SdrFillTextAttribute::operator==(const SdrFillTextAttribute& rCandidate) const + { + return(getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index a33ee3f7dfe4..5b6140cc3ea7 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -32,8 +32,8 @@ #include "precompiled_svx.hxx" #include +#include #include - #include #include #include @@ -44,11 +44,8 @@ #include #include #include - #include #include -#include -#include #include #include #include @@ -56,12 +53,10 @@ #include #include #include +#include +#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// // helper to get line, stroke and transparence attributes from SfxItemSet @@ -158,144 +153,272 @@ namespace drawinglayer { namespace attribute { - SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) - : mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), - mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), - mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), - mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), - mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), - meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), - meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), - meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), - maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), - mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) + class ImpSdrFormTextAttribute { - if(getFormTextOutline()) + public: + // refcounter + sal_uInt32 mnRefCount; + + // FormText (FontWork) Attributes + sal_Int32 mnFormTextDistance; // distance from line in upright direction + sal_Int32 mnFormTextStart; // shift from polygon start + sal_Int32 mnFormTextShdwXVal; // shadow distance or 10th degrees + sal_Int32 mnFormTextShdwYVal; // shadow distance or scaling + sal_uInt16 mnFormTextShdwTransp; // shadow transparence + XFormTextStyle meFormTextStyle; // on/off and char orientation + XFormTextAdjust meFormTextAdjust; // adjustment (left/right/center) and scale + XFormTextShadow meFormTextShadow; // shadow mode + Color maFormTextShdwColor; // shadow color + + // outline attributes; used when getFormTextOutline() is true and (for + // shadow) when getFormTextShadow() != XFTSHADOW_NONE + SdrFormTextOutlineAttribute maOutline; + SdrFormTextOutlineAttribute maShadowOutline; + + // bitfield + unsigned mbFormTextMirror : 1; // change orientation + unsigned mbFormTextOutline : 1; // show contour of objects + + ImpSdrFormTextAttribute(const SfxItemSet& rSet) + : mnRefCount(0), + mnFormTextDistance(((const XFormTextDistanceItem&)rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()), + mnFormTextStart(((const XFormTextStartItem&)rSet.Get(XATTR_FORMTXTSTART)).GetValue()), + mnFormTextShdwXVal(((const XFormTextShadowXValItem&)rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()), + mnFormTextShdwYVal(((const XFormTextShadowYValItem&)rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()), + mnFormTextShdwTransp(((const XFormTextShadowTranspItem&)rSet.Get(XATTR_FORMTXTSHDWTRANSP)).GetValue()), + meFormTextStyle(((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue()), + meFormTextAdjust(((const XFormTextAdjustItem&)rSet.Get(XATTR_FORMTXTADJUST)).GetValue()), + meFormTextShadow(((const XFormTextShadowItem&)rSet.Get(XATTR_FORMTXTSHADOW)).GetValue()), + maFormTextShdwColor(((const XFormTextShadowColorItem&)rSet.Get(XATTR_FORMTXTSHDWCOLOR)).GetColorValue()), + maOutline(), + maShadowOutline(), + mbFormTextMirror(((const XFormTextMirrorItem&)rSet.Get(XATTR_FORMTXTMIRROR)).GetValue()), + mbFormTextOutline(((const XFormTextOutlineItem&)rSet.Get(XATTR_FORMTXTOUTLINE)).GetValue()) { - const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); - - // also need to prepare attributes for outlines + if(getFormTextOutline()) { - const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); - - mpOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); + const StrokeAttribute aStrokeAttribute(impGetStrokeAttribute(rSet)); + + // also need to prepare attributes for outlines + { + const LineAttribute aLineAttribute(impGetLineAttribute(false, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(false, rSet)); + + maOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } + + if(XFTSHADOW_NONE != getFormTextShadow()) + { + // also need to prepare attributes for shadow outlines + const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); + const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); + + maShadowOutline = SdrFormTextOutlineAttribute( + aLineAttribute, aStrokeAttribute, nTransparence); + } } + } - if(XFTSHADOW_NONE != getFormTextShadow()) - { - // also need to prepare attributes for shadow outlines - const LineAttribute aLineAttribute(impGetLineAttribute(true, rSet)); - const sal_uInt8 nTransparence(impGetStrokeTransparence(true, rSet)); - - mpShadowOutline = new SdrFormTextOutlineAttribute( - aLineAttribute, aStrokeAttribute, nTransparence); - } + ImpSdrFormTextAttribute() + : mnRefCount(0), + mnFormTextDistance(0), + mnFormTextStart(0), + mnFormTextShdwXVal(0), + mnFormTextShdwYVal(0), + mnFormTextShdwTransp(0), + meFormTextStyle(XFT_NONE), + meFormTextAdjust(XFT_CENTER), + meFormTextShadow(XFTSHADOW_NONE), + maFormTextShdwColor(), + maOutline(), + maShadowOutline(), + mbFormTextMirror(false), + mbFormTextOutline(false) + { } - } - SdrFormTextAttribute::~SdrFormTextAttribute() - { - if(mpOutline) + // data read access + sal_Int32 getFormTextDistance() const { return mnFormTextDistance; } + sal_Int32 getFormTextStart() const { return mnFormTextStart; } + sal_Int32 getFormTextShdwXVal() const { return mnFormTextShdwXVal; } + sal_Int32 getFormTextShdwYVal() const { return mnFormTextShdwYVal; } + sal_uInt16 getFormTextShdwTransp() const { return mnFormTextShdwTransp; } + XFormTextStyle getFormTextStyle() const { return meFormTextStyle; } + XFormTextAdjust getFormTextAdjust() const { return meFormTextAdjust; } + XFormTextShadow getFormTextShadow() const { return meFormTextShadow; } + Color getFormTextShdwColor() const { return maFormTextShdwColor; } + const SdrFormTextOutlineAttribute& getOutline() const { return maOutline; } + const SdrFormTextOutlineAttribute& getShadowOutline() const { return maShadowOutline; } + bool getFormTextMirror() const { return mbFormTextMirror; } + bool getFormTextOutline() const { return mbFormTextOutline; } + + // compare operator + bool operator==(const ImpSdrFormTextAttribute& rCandidate) const { - delete mpOutline; - mpOutline = 0; + return (getFormTextDistance() == rCandidate.getFormTextDistance() + && getFormTextStart() == rCandidate.getFormTextStart() + && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() + && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() + && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() + && getFormTextStyle() == rCandidate.getFormTextStyle() + && getFormTextAdjust() == rCandidate.getFormTextAdjust() + && getFormTextShadow() == rCandidate.getFormTextShadow() + && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() + && getOutline() == rCandidate.getOutline() + && getShadowOutline() == rCandidate.getShadowOutline() + && getFormTextMirror() == rCandidate.getFormTextMirror() + && getFormTextOutline() == rCandidate.getFormTextOutline()); } - if(mpShadowOutline) + static ImpSdrFormTextAttribute* get_global_default() { - delete mpShadowOutline; - mpShadowOutline = 0; + static ImpSdrFormTextAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; } + }; + + SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet) + : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet)) + { + } + + SdrFormTextAttribute::SdrFormTextAttribute() + : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default()) + { + mpSdrFormTextAttribute->mnRefCount++; } SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate) - : mnFormTextDistance(rCandidate.getFormTextDistance()), - mnFormTextStart(rCandidate.getFormTextStart()), - mnFormTextShdwXVal(rCandidate.getFormTextShdwXVal()), - mnFormTextShdwYVal(rCandidate.getFormTextShdwYVal()), - mnFormTextShdwTransp(rCandidate.getFormTextShdwTransp()), - meFormTextStyle(rCandidate.getFormTextStyle()), - meFormTextAdjust(rCandidate.getFormTextAdjust()), - meFormTextShadow(rCandidate.getFormTextShadow()), - maFormTextShdwColor(rCandidate.getFormTextShdwColor()), - mpOutline(0), - mpShadowOutline(0), - mbFormTextMirror(rCandidate.getFormTextMirror()), - mbFormTextOutline(rCandidate.getFormTextOutline()) + : mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute) { - if(rCandidate.getOutline()) + mpSdrFormTextAttribute->mnRefCount++; + } + + SdrFormTextAttribute::~SdrFormTextAttribute() + { + if(mpSdrFormTextAttribute->mnRefCount) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + mpSdrFormTextAttribute->mnRefCount--; } - - if(rCandidate.getShadowOutline()) + else { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); + delete mpSdrFormTextAttribute; } } + bool SdrFormTextAttribute::isDefault() const + { + return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default(); + } + SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate) { - mnFormTextDistance = rCandidate.getFormTextDistance(); - mnFormTextStart = rCandidate.getFormTextStart(); - mnFormTextShdwXVal = rCandidate.getFormTextShdwXVal(); - mnFormTextShdwYVal = rCandidate.getFormTextShdwYVal(); - mnFormTextShdwTransp = rCandidate.getFormTextShdwTransp(); - meFormTextStyle = rCandidate.getFormTextStyle(); - meFormTextAdjust = rCandidate.getFormTextAdjust(); - meFormTextShadow = rCandidate.getFormTextShadow(); - maFormTextShdwColor = rCandidate.getFormTextShdwColor(); - - if(mpOutline) + if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute) { - delete mpOutline; + if(mpSdrFormTextAttribute->mnRefCount) + { + mpSdrFormTextAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextAttribute; + } + + mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute; + mpSdrFormTextAttribute->mnRefCount++; } - mpOutline = 0; + return *this; + } - if(rCandidate.getOutline()) + bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute) { - mpOutline = new SdrFormTextOutlineAttribute(*rCandidate.getOutline()); + return true; } - if(mpShadowOutline) + if(rCandidate.isDefault() != isDefault()) { - delete mpShadowOutline; + return false; } - mpShadowOutline = 0; + return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute); + } - if(rCandidate.getShadowOutline()) - { - mpShadowOutline = new SdrFormTextOutlineAttribute(*rCandidate.getShadowOutline()); - } + sal_Int32 SdrFormTextAttribute::getFormTextDistance() const + { + return mpSdrFormTextAttribute->getFormTextDistance(); + } - mbFormTextMirror = rCandidate.getFormTextMirror(); - mbFormTextOutline = rCandidate.getFormTextOutline(); + sal_Int32 SdrFormTextAttribute::getFormTextStart() const + { + return mpSdrFormTextAttribute->getFormTextStart(); + } - return *this; + sal_Int32 SdrFormTextAttribute::getFormTextShdwXVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwXVal(); } - bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const + sal_Int32 SdrFormTextAttribute::getFormTextShdwYVal() const + { + return mpSdrFormTextAttribute->getFormTextShdwYVal(); + } + + sal_uInt16 SdrFormTextAttribute::getFormTextShdwTransp() const + { + return mpSdrFormTextAttribute->getFormTextShdwTransp(); + } + + XFormTextStyle SdrFormTextAttribute::getFormTextStyle() const + { + return mpSdrFormTextAttribute->getFormTextStyle(); + } + + XFormTextAdjust SdrFormTextAttribute::getFormTextAdjust() const + { + return mpSdrFormTextAttribute->getFormTextAdjust(); + } + + XFormTextShadow SdrFormTextAttribute::getFormTextShadow() const + { + return mpSdrFormTextAttribute->getFormTextShadow(); + } + + Color SdrFormTextAttribute::getFormTextShdwColor() const + { + return mpSdrFormTextAttribute->getFormTextShdwColor(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getOutline() const + { + return mpSdrFormTextAttribute->getOutline(); + } + + const SdrFormTextOutlineAttribute& SdrFormTextAttribute::getShadowOutline() const + { + return mpSdrFormTextAttribute->getShadowOutline(); + } + + bool SdrFormTextAttribute::getFormTextMirror() const + { + return mpSdrFormTextAttribute->getFormTextMirror(); + } + + bool SdrFormTextAttribute::getFormTextOutline() const { - return (getFormTextDistance() == rCandidate.getFormTextDistance() - && getFormTextStart() == rCandidate.getFormTextStart() - && getFormTextShdwXVal() == rCandidate.getFormTextShdwXVal() - && getFormTextShdwYVal() == rCandidate.getFormTextShdwYVal() - && getFormTextShdwTransp() == rCandidate.getFormTextShdwTransp() - && getFormTextStyle() == rCandidate.getFormTextStyle() - && getFormTextAdjust() == rCandidate.getFormTextAdjust() - && getFormTextShadow() == rCandidate.getFormTextShadow() - && getFormTextShdwColor() == rCandidate.getFormTextShdwColor() - && pointerOrContentEqual(getOutline(), rCandidate.getOutline()) - && pointerOrContentEqual(getShadowOutline(), rCandidate.getShadowOutline()) - && getFormTextMirror() == rCandidate.getFormTextMirror() - && getFormTextOutline() == rCandidate.getFormTextOutline()); + return mpSdrFormTextAttribute->getFormTextOutline(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx index db2fe20ae21b..fa225f1a0094 100644 --- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx @@ -32,10 +32,8 @@ #include "precompiled_svx.hxx" #include - -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -43,21 +41,146 @@ namespace drawinglayer { namespace attribute { + class ImpSdrFormTextOutlineAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // one set of attributes for FormText (FontWork) outline visualisation + LineAttribute maLineAttribute; + StrokeAttribute maStrokeAttribute; + sal_uInt8 mnTransparence; + + ImpSdrFormTextOutlineAttribute( + const LineAttribute& rLineAttribute, + const StrokeAttribute& rStrokeAttribute, + sal_uInt8 nTransparence) + : mnRefCount(0), + maLineAttribute(rLineAttribute), + maStrokeAttribute(rStrokeAttribute), + mnTransparence(nTransparence) + { + } + + // data read access + const LineAttribute& getLineAttribute() const { return maLineAttribute; } + const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } + sal_uInt8 getTransparence() const { return mnTransparence; } + + // compare operator + bool operator==(const ImpSdrFormTextOutlineAttribute& rCandidate) const + { + return (getLineAttribute() == rCandidate.getLineAttribute() + && getStrokeAttribute() == rCandidate.getStrokeAttribute() + && getTransparence() == rCandidate.getTransparence()); + } + + static ImpSdrFormTextOutlineAttribute* get_global_default() + { + static ImpSdrFormTextOutlineAttribute* pDefault = 0; + + if(!pDefault) + { + pDefault = new ImpSdrFormTextOutlineAttribute( + LineAttribute(), + StrokeAttribute(), + 0); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute( const LineAttribute& rLineAttribute, const StrokeAttribute& rStrokeAttribute, sal_uInt8 nTransparence) - : maLineAttribute(rLineAttribute), - maStrokeAttribute(rStrokeAttribute), - mnTransparence(nTransparence) + : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute( + rLineAttribute, rStrokeAttribute, nTransparence)) + { + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute() + : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default()) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate) + : mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute) + { + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute() + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + } + + bool SdrFormTextOutlineAttribute::isDefault() const + { + return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default(); + } + + SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate) { + if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute) + { + if(mpSdrFormTextOutlineAttribute->mnRefCount) + { + mpSdrFormTextOutlineAttribute->mnRefCount--; + } + else + { + delete mpSdrFormTextOutlineAttribute; + } + + mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute; + mpSdrFormTextOutlineAttribute->mnRefCount++; + } + + return *this; } bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const { - return (getLineAttribute() == rCandidate.getLineAttribute() - && getStrokeAttribute() == rCandidate.getStrokeAttribute() - && getTransparence() == rCandidate.getTransparence()); + if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute) + { + return true; + } + + if(rCandidate.isDefault() != isDefault()) + { + return false; + } + + return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute); + } + + const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const + { + return mpSdrFormTextOutlineAttribute->getLineAttribute(); + } + + const StrokeAttribute& SdrFormTextOutlineAttribute::getStrokeAttribute() const + { + return mpSdrFormTextOutlineAttribute->getStrokeAttribute(); + } + + sal_uInt8 SdrFormTextOutlineAttribute::getTransparence() const + { + return mpSdrFormTextOutlineAttribute->getTransparence(); } } // end of namespace attribute } // end of namespace drawinglayer diff --git a/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx new file mode 100644 index 000000000000..6d8356833829 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlinefillshadowtextattribute.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrFillAttribute& rFill, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const FillGradientAttribute& rFillFloatTransGradient, + const SdrTextAttribute& rTextAttribute) + : SdrLineShadowTextAttribute(rLine, rLineStartEnd, rShadow, rTextAttribute), + maFill(rFill), + maFillFloatTransGradient(rFillFloatTransGradient) + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute() + : SdrLineShadowTextAttribute(), + maFill(), + maFillFloatTransGradient() + { + } + + SdrLineFillShadowTextAttribute::SdrLineFillShadowTextAttribute(const SdrLineFillShadowTextAttribute& rCandidate) + : SdrLineShadowTextAttribute(rCandidate), + maFill(rCandidate.getFill()), + maFillFloatTransGradient(rCandidate.getFillFloatTransGradient()) + { + } + + SdrLineFillShadowTextAttribute& SdrLineFillShadowTextAttribute::operator=(const SdrLineFillShadowTextAttribute& rCandidate) + { + SdrLineShadowTextAttribute::operator=(rCandidate); + maFill = rCandidate.getFill(); + maFillFloatTransGradient = rCandidate.getFillFloatTransGradient(); + + return *this; + } + + bool SdrLineFillShadowTextAttribute::isDefault() const + { + return (SdrLineShadowTextAttribute::isDefault() + && getFill().isDefault() + && getFillFloatTransGradient().isDefault()); + } + + bool SdrLineFillShadowTextAttribute::operator==(const SdrLineFillShadowTextAttribute& rCandidate) const + { + return(SdrLineShadowTextAttribute::operator==(rCandidate) + && getFill() == rCandidate.getFill() + && getFillFloatTransGradient() == rCandidate.getFillFloatTransGradient()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx new file mode 100644 index 000000000000..6b863a11aa03 --- /dev/null +++ b/svx/source/sdr/attribute/sdrlineshadowtextattribute.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute( + const SdrLineAttribute& rLine, + const SdrLineStartEndAttribute& rLineStartEnd, + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : SdrShadowTextAttribute(rShadow, rTextAttribute), + maLine(rLine), + maLineStartEnd(rLineStartEnd) + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute() + : SdrShadowTextAttribute(), + maLine(), + maLineStartEnd() + { + } + + SdrLineShadowTextAttribute::SdrLineShadowTextAttribute(const SdrLineShadowTextAttribute& rCandidate) + : SdrShadowTextAttribute(rCandidate), + maLine(rCandidate.getLine()), + maLineStartEnd(rCandidate.getLineStartEnd()) + { + } + + SdrLineShadowTextAttribute& SdrLineShadowTextAttribute::operator=(const SdrLineShadowTextAttribute& rCandidate) + { + SdrShadowTextAttribute::operator=(rCandidate); + maLine = rCandidate.getLine(); + maLineStartEnd = rCandidate.getLineStartEnd(); + + return *this; + } + + bool SdrLineShadowTextAttribute::isDefault() const + { + return(SdrShadowTextAttribute::isDefault() + && getLine().isDefault() + && getLineStartEnd().isDefault()); + } + + bool SdrLineShadowTextAttribute::operator==(const SdrLineShadowTextAttribute& rCandidate) const + { + return(SdrShadowTextAttribute::operator==(rCandidate) + && getLine() == rCandidate.getLine() + && getLineStartEnd() == rCandidate.getLineStartEnd()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrshadowtextattribute.cxx b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx new file mode 100644 index 000000000000..34485b57399c --- /dev/null +++ b/svx/source/sdr/attribute/sdrshadowtextattribute.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sdrallattribute.cxx,v $ + * + * $Revision: 1.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_svx.hxx" + +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + SdrShadowTextAttribute::SdrShadowTextAttribute( + const SdrShadowAttribute& rShadow, + const SdrTextAttribute& rTextAttribute) + : maShadow(rShadow), + maTextAttribute(rTextAttribute) + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute() + : maShadow(), + maTextAttribute() + { + } + + SdrShadowTextAttribute::SdrShadowTextAttribute(const SdrShadowTextAttribute& rCandidate) + : maShadow(rCandidate.getShadow()), + maTextAttribute(rCandidate.getText()) + { + } + + SdrShadowTextAttribute& SdrShadowTextAttribute::operator=(const SdrShadowTextAttribute& rCandidate) + { + maShadow = rCandidate.getShadow(); + maTextAttribute = rCandidate.getText(); + + return *this; + } + + bool SdrShadowTextAttribute::isDefault() const + { + return (getShadow().isDefault() + && getText().isDefault()); + } + + bool SdrShadowTextAttribute::operator==(const SdrShadowTextAttribute& rCandidate) const + { + return (getShadow() == rCandidate.getShadow() + && getText() == rCandidate.getText()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx index 3afc03d1600d..0acc7cfc6c86 100644 --- a/svx/source/sdr/attribute/sdrtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrtextattribute.cxx @@ -34,21 +34,233 @@ #include #include #include -#include -#include -#include #include -////////////////////////////////////////////////////////////////////////////// -// pointer compare define -#define pointerOrContentEqual(p, q) ((p == q) || (p && q && *p == *q)) - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { namespace attribute { + class ImpSdrTextAttribute + { + public: + // refcounter + sal_uInt32 mnRefCount; + + // all-text attributes. The SdrText itself and a copy + // of te OPO + const SdrText* mpSdrText; + const OutlinerParaObject* mpOutlinerParaObject; + + // Set when it's a FormText; contains all FormText attributes + SdrFormTextAttribute maSdrFormTextAttribute; + + // text distances + sal_Int32 maTextLeftDistance; + sal_Int32 maTextUpperDistance; + sal_Int32 maTextRightDistance; + sal_Int32 maTextLowerDistance; + + // #i101556# use versioning from text attributes to detect changes + sal_uInt32 maPropertiesVersion; + + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + + // bitfield + unsigned mbContour : 1; + unsigned mbFitToSize : 1; + unsigned mbHideContour : 1; + unsigned mbBlink : 1; + unsigned mbScroll : 1; + unsigned mbInEditMode : 1; + unsigned mbFixedCellHeight : 1; + unsigned mbWrongSpell : 1; + + public: + ImpSdrTextAttribute( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObject, + XFormTextStyle eFormTextStyle, + sal_Int32 aTextLeftDistance, + sal_Int32 aTextUpperDistance, + sal_Int32 aTextRightDistance, + sal_Int32 aTextLowerDistance, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bContour, + bool bFitToSize, + bool bHideContour, + bool bBlink, + bool bScroll, + bool bInEditMode, + bool bFixedCellHeight, + bool bWrongSpell) + : mnRefCount(0), + mpSdrText(pSdrText), + mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)), + maSdrFormTextAttribute(), + maTextLeftDistance(aTextLeftDistance), + maTextUpperDistance(aTextUpperDistance), + maTextRightDistance(aTextRightDistance), + maTextLowerDistance(aTextLowerDistance), + maPropertiesVersion(0), + maSdrTextHorzAdjust(aSdrTextHorzAdjust), + maSdrTextVertAdjust(aSdrTextVertAdjust), + mbContour(bContour), + mbFitToSize(bFitToSize), + mbHideContour(bHideContour), + mbBlink(bBlink), + mbScroll(bScroll), + mbInEditMode(bInEditMode), + mbFixedCellHeight(bFixedCellHeight), + mbWrongSpell(bWrongSpell) + { + if(pSdrText) + { + if(XFT_NONE != eFormTextStyle) + { + // text on path. Create FormText attribute + const SfxItemSet& rSet = pSdrText->GetItemSet(); + maSdrFormTextAttribute = SdrFormTextAttribute(rSet); + } + + // #i101556# init with version number to detect changes of single text + // attribute and/or style sheets in primitive data without having to + // copy that data locally (which would be better from principle) + maPropertiesVersion = pSdrText->GetObject().GetProperties().getVersion(); + } + } + + ImpSdrTextAttribute() + : mnRefCount(0), + mpSdrText(0), + mpOutlinerParaObject(0), + maSdrFormTextAttribute(), + maTextLeftDistance(0), + maTextUpperDistance(0), + maTextRightDistance(0), + maTextLowerDistance(0), + maPropertiesVersion(0), + maSdrTextHorzAdjust(SDRTEXTHORZADJUST_LEFT), + maSdrTextVertAdjust(SDRTEXTVERTADJUST_TOP), + mbContour(false), + mbFitToSize(false), + mbHideContour(false), + mbBlink(false), + mbScroll(false), + mbInEditMode(false), + mbFixedCellHeight(false), + mbWrongSpell(false) + { + } + + ~ImpSdrTextAttribute() + { + if(mpOutlinerParaObject) + { + delete mpOutlinerParaObject; + } + } + + // data read access + const SdrText& getSdrText() const + { + OSL_ENSURE(mpSdrText, "Access to text of default version of ImpSdrTextAttribute (!)"); + return *mpSdrText; + } + const OutlinerParaObject& getOutlinerParaObject() const + { + OSL_ENSURE(mpOutlinerParaObject, "Access to OutlinerParaObject of default version of ImpSdrTextAttribute (!)"); + return *mpOutlinerParaObject; + } + bool isContour() const { return mbContour; } + bool isFitToSize() const { return mbFitToSize; } + bool isHideContour() const { return mbHideContour; } + bool isBlink() const { return mbBlink; } + bool isScroll() const { return mbScroll; } + bool isInEditMode() const { return mbInEditMode; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool isWrongSpell() const { return mbWrongSpell; } + const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } + sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; } + sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; } + sal_Int32 getTextRightDistance() const { return maTextRightDistance; } + sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; } + sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + + // compare operator + bool operator==(const ImpSdrTextAttribute& rCandidate) const + { + if(mpOutlinerParaObject != rCandidate.mpOutlinerParaObject) + { + if(mpOutlinerParaObject && rCandidate.mpOutlinerParaObject) + { + // compares OPO and it's contents, but traditionally not the RedLining + // which is not seen as model, but as temporary information + if(!(getOutlinerParaObject() == rCandidate.getOutlinerParaObject())) + { + return false; + } + + // #i102062# for primitive visualisation, the WrongList (SpellChecking) + // is important, too, so use isWrongListEqual since there is no WrongList + // comparison in the regular OutlinerParaObject compare (since it's + // not-persistent data) + if(!(getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()))) + { + return false; + } + } + else + { + // only one is zero; not equal + return false; + } + } + + return ( + getSdrFormTextAttribute() == rCandidate.getSdrFormTextAttribute() + && getTextLeftDistance() == rCandidate.getTextLeftDistance() + && getTextUpperDistance() == rCandidate.getTextUpperDistance() + && getTextRightDistance() == rCandidate.getTextRightDistance() + && getTextLowerDistance() == rCandidate.getTextLowerDistance() + && getPropertiesVersion() == rCandidate.getPropertiesVersion() + + && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() + && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() + + && isContour() == rCandidate.isContour() + && isFitToSize() == rCandidate.isFitToSize() + && isHideContour() == rCandidate.isHideContour() + && isBlink() == rCandidate.isBlink() + && isScroll() == rCandidate.isScroll() + && isInEditMode() == rCandidate.isInEditMode() + && isFixedCellHeight() == rCandidate.isFixedCellHeight() + && isWrongSpell() == rCandidate.isWrongSpell()); + } + + static ImpSdrTextAttribute* get_global_default() + { + static ImpSdrTextAttribute* pDefault = 0; + + if(!pDefault) + { + // use default constructor + pDefault = new ImpSdrTextAttribute(); + + // never delete; start with RefCount 1, not 0 + pDefault->mnRefCount++; + } + + return pDefault; + } + }; + SdrTextAttribute::SdrTextAttribute( const SdrText& rSdrText, const OutlinerParaObject& rOutlinerParaObject, @@ -67,149 +279,172 @@ namespace drawinglayer bool bInEditMode, bool bFixedCellHeight, bool bWrongSpell) - : mpSdrText(&rSdrText), - maOutlinerParaObject(rOutlinerParaObject), - mpSdrFormTextAttribute(0), - maTextLeftDistance(aTextLeftDistance), - maTextUpperDistance(aTextUpperDistance), - maTextRightDistance(aTextRightDistance), - maTextLowerDistance(aTextLowerDistance), - maPropertiesVersion(0), - maSdrTextHorzAdjust(aSdrTextHorzAdjust), - maSdrTextVertAdjust(aSdrTextVertAdjust), - mbContour(bContour), - mbFitToSize(bFitToSize), - mbHideContour(bHideContour), - mbBlink(bBlink), - mbScroll(bScroll), - mbInEditMode(bInEditMode), - mbFixedCellHeight(bFixedCellHeight), - mbWrongSpell(bWrongSpell) - { - if(XFT_NONE != eFormTextStyle) - { - // text on path. Create FormText attribute - const SfxItemSet& rSet = getSdrText().GetItemSet(); - mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet); - } + : mpSdrTextAttribute(new ImpSdrTextAttribute( + &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance, + aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, + bFitToSize, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell)) + { + } - // #i101556# init with version number to detect changes of single text - // attribute and/or style sheets in primitive data without having to - // copy that data locally (which would be better from principle) - maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion(); + SdrTextAttribute::SdrTextAttribute() + : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default()) + { + mpSdrTextAttribute->mnRefCount++; + } + + SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) + : mpSdrTextAttribute(rCandidate.mpSdrTextAttribute) + { + mpSdrTextAttribute->mnRefCount++; } SdrTextAttribute::~SdrTextAttribute() { - if(mpSdrFormTextAttribute) + if(mpSdrTextAttribute->mnRefCount) { - delete mpSdrFormTextAttribute; - mpSdrFormTextAttribute = 0; + mpSdrTextAttribute->mnRefCount--; } - } - - SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate) - : mpSdrText(&rCandidate.getSdrText()), - maOutlinerParaObject(rCandidate.getOutlinerParaObject()), - mpSdrFormTextAttribute(0), - maTextLeftDistance(rCandidate.getTextLeftDistance()), - maTextUpperDistance(rCandidate.getTextUpperDistance()), - maTextRightDistance(rCandidate.getTextRightDistance()), - maTextLowerDistance(rCandidate.getTextLowerDistance()), - maPropertiesVersion(rCandidate.getPropertiesVersion()), - maSdrTextHorzAdjust(rCandidate.getSdrTextHorzAdjust()), - maSdrTextVertAdjust(rCandidate.getSdrTextVertAdjust()), - mbContour(rCandidate.isContour()), - mbFitToSize(rCandidate.isFitToSize()), - mbHideContour(rCandidate.isHideContour()), - mbBlink(rCandidate.isBlink()), - mbScroll(rCandidate.isScroll()), - mbInEditMode(rCandidate.isInEditMode()), - mbFixedCellHeight(rCandidate.isFixedCellHeight()), - mbWrongSpell(rCandidate.isWrongSpell()) - { - if(rCandidate.getSdrFormTextAttribute()) + else { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + delete mpSdrTextAttribute; } } - SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + bool SdrTextAttribute::isDefault() const { - mpSdrText = &rCandidate.getSdrText(); - maOutlinerParaObject = rCandidate.getOutlinerParaObject(); + return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default(); + } - if(mpSdrFormTextAttribute) + SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate) + { + if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute) { - delete mpSdrFormTextAttribute; + if(mpSdrTextAttribute->mnRefCount) + { + mpSdrTextAttribute->mnRefCount--; + } + else + { + delete mpSdrTextAttribute; + } + + mpSdrTextAttribute = rCandidate.mpSdrTextAttribute; + mpSdrTextAttribute->mnRefCount++; } - mpSdrFormTextAttribute = 0; + return *this; + } + + bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + { + if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute) + { + return true; + } - if(rCandidate.getSdrFormTextAttribute()) + if(rCandidate.isDefault() != isDefault()) { - mpSdrFormTextAttribute = new SdrFormTextAttribute(*rCandidate.getSdrFormTextAttribute()); + return false; } - maTextLeftDistance = rCandidate.getTextLeftDistance(); - maTextUpperDistance = rCandidate.getTextUpperDistance(); - maTextRightDistance = rCandidate.getTextRightDistance(); - maTextLowerDistance = rCandidate.getTextLowerDistance(); - maPropertiesVersion = rCandidate.getPropertiesVersion(); + return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute); + } - maSdrTextHorzAdjust = rCandidate.getSdrTextHorzAdjust(); - maSdrTextVertAdjust = rCandidate.getSdrTextVertAdjust(); + const SdrText& SdrTextAttribute::getSdrText() const + { + return mpSdrTextAttribute->getSdrText(); + } - mbContour = rCandidate.isContour(); - mbFitToSize = rCandidate.isFitToSize(); - mbHideContour = rCandidate.isHideContour(); - mbBlink = rCandidate.isBlink(); - mbScroll = rCandidate.isScroll(); - mbInEditMode = rCandidate.isInEditMode(); - mbFixedCellHeight = rCandidate.isFixedCellHeight(); - mbWrongSpell = rCandidate.isWrongSpell(); + const OutlinerParaObject& SdrTextAttribute::getOutlinerParaObject() const + { + return mpSdrTextAttribute->getOutlinerParaObject(); + } - return *this; + bool SdrTextAttribute::isContour() const + { + return mpSdrTextAttribute->isContour(); } - bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const + bool SdrTextAttribute::isFitToSize() const + { + return mpSdrTextAttribute->isFitToSize(); + } + + bool SdrTextAttribute::isHideContour() const + { + return mpSdrTextAttribute->isHideContour(); + } + + bool SdrTextAttribute::isBlink() const + { + return mpSdrTextAttribute->isBlink(); + } + + bool SdrTextAttribute::isScroll() const + { + return mpSdrTextAttribute->isScroll(); + } + + bool SdrTextAttribute::isInEditMode() const + { + return mpSdrTextAttribute->isInEditMode(); + } + + bool SdrTextAttribute::isFixedCellHeight() const + { + return mpSdrTextAttribute->isFixedCellHeight(); + } + + bool SdrTextAttribute::isWrongSpell() const + { + return mpSdrTextAttribute->isWrongSpell(); + } + + const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const + { + return mpSdrTextAttribute->getSdrFormTextAttribute(); + } + + sal_Int32 SdrTextAttribute::getTextLeftDistance() const + { + return mpSdrTextAttribute->getTextLeftDistance(); + } + + sal_Int32 SdrTextAttribute::getTextUpperDistance() const + { + return mpSdrTextAttribute->getTextUpperDistance(); + } + + sal_Int32 SdrTextAttribute::getTextRightDistance() const + { + return mpSdrTextAttribute->getTextRightDistance(); + } + + sal_Int32 SdrTextAttribute::getTextLowerDistance() const + { + return mpSdrTextAttribute->getTextLowerDistance(); + } + + sal_uInt32 SdrTextAttribute::getPropertiesVersion() const + { + return mpSdrTextAttribute->getPropertiesVersion(); + } + + SdrTextHorzAdjust SdrTextAttribute::getSdrTextHorzAdjust() const + { + return mpSdrTextAttribute->getSdrTextHorzAdjust(); + } + + SdrTextVertAdjust SdrTextAttribute::getSdrTextVertAdjust() const { - return ( - // compares OPO and it's contents, but traditionally not the RedLining - // which is not seen as model, but as temporary information - getOutlinerParaObject() == rCandidate.getOutlinerParaObject() - - // #i102062# for primitive visualisation, the WrongList (SpellChecking) - // is important, too, so use isWrongListEqual since there is no WrongList - // comparison in the regular OutlinerParaObject compare (since it's - // not-persistent data) - && getOutlinerParaObject().isWrongListEqual(rCandidate.getOutlinerParaObject()) - - && pointerOrContentEqual(getSdrFormTextAttribute(), rCandidate.getSdrFormTextAttribute()) - && getTextLeftDistance() == rCandidate.getTextLeftDistance() - && getTextUpperDistance() == rCandidate.getTextUpperDistance() - && getTextRightDistance() == rCandidate.getTextRightDistance() - && getTextLowerDistance() == rCandidate.getTextLowerDistance() - && getPropertiesVersion() == rCandidate.getPropertiesVersion() - - && getSdrTextHorzAdjust() == rCandidate.getSdrTextHorzAdjust() - && getSdrTextVertAdjust() == rCandidate.getSdrTextVertAdjust() - - && isContour() == rCandidate.isContour() - && isFitToSize() == rCandidate.isFitToSize() - && isHideContour() == rCandidate.isHideContour() - && isBlink() == rCandidate.isBlink() - && isScroll() == rCandidate.isScroll() - && isInEditMode() == rCandidate.isInEditMode() - && isFixedCellHeight() == rCandidate.isFixedCellHeight() - && isWrongSpell() == rCandidate.isWrongSpell()); + return mpSdrTextAttribute->getSdrTextVertAdjust(); } void SdrTextAttribute::getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const { if(isBlink()) { - mpSdrText->GetObject().impGetBlinkTextTiming(rAnimList); + getSdrText().GetObject().impGetBlinkTextTiming(rAnimList); } } @@ -217,7 +452,7 @@ namespace drawinglayer { if(isScroll()) { - mpSdrText->GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); + getSdrText().GetObject().impGetScrollTextTiming(rAnimList, fFrameLength, fTextLength); } } } // end of namespace attribute diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index fa9bc88d8f73..4f78318a5b49 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -280,7 +280,8 @@ namespace sdr DBG_ERROR("ViewContact::createViewIndependentPrimitive2DSequence(): Never call the fallback base implementation, this is always an error (!)"); const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(1000.0, 1000.0, 5000.0, 3000.0))); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aYellow)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofe3d.cxx b/svx/source/sdr/contact/viewcontactofe3d.cxx index 77a5bf4dff3c..5a2b25010009 100644 --- a/svx/source/sdr/contact/viewcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewcontactofe3d.cxx @@ -37,10 +37,12 @@ #include #include #include -#include -#include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -128,13 +130,14 @@ namespace sdr // create embedded 2d primitive and add. LightNormal and ShadowSlant are needed for evtl. // 3D shadow extraction for correct B2DRange calculation (shadow is part of the object) - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::Embedded3DPrimitive2D( - rxContent3D, - pVCOfE3DScene->getObjectTransformation(), - aViewInformation3D, - aLightNormal, - fShadowSlant, - rAllContentRange)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::Embedded3DPrimitive2D( + rxContent3D, + pVCOfE3DScene->getObjectTransformation(), + aViewInformation3D, + aLightNormal, + fShadowSlant, + rAllContentRange)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -179,9 +182,12 @@ namespace sdr if(!rObjectTransform.isIdentity()) { - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::TransformPrimitive3D( - rObjectTransform, xRetval)); - return drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::TransformPrimitive3D( + rObjectTransform, + xRetval)); + + xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx b/svx/source/sdr/contact/viewcontactofe3dcube.cxx index 8626296cb42a..bccccd1d074d 100644 --- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dCubeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get cube geometry and use as traslation and scaling for unit cube basegfx::B3DRange aCubeRange; @@ -100,12 +92,13 @@ namespace sdr const basegfx::B2DVector aTextureSize(aCubeSize.getX(), aCubeSize.getY()); // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrCubePrimitive3D(aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrCubePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 815a9416c7de..501727aa9782 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon()); @@ -93,15 +85,15 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrExtrudePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, - bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrExtrudePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids, + bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 877ffaca2117..8bea766cbdfe 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -58,16 +58,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dLatheObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get extrude geometry const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D()); @@ -107,16 +99,16 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrLathePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - aPolyPolygon, nHorizontalSegments, nVerticalSegments, - fDiagonal, fBackScale, fRotation, - bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrLathePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + aPolyPolygon, nHorizontalSegments, nVerticalSegments, + fDiagonal, fBackScale, fRotation, + bSmoothNormals, true, bSmoothLids, bCharacterMode, bCloseFront, bCloseBack)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx index 9ae265d29362..b69d1d6a8ced 100644 --- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx @@ -60,23 +60,15 @@ namespace sdr drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dPolygonObj().GetMergedItemSet(); const bool bSuppressFill(GetE3dPolygonObj().GetLineOnly()); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, bSuppressFill)); // get extrude geometry basegfx::B3DPolyPolygon aPolyPolygon3D(GetE3dPolygonObj().GetPolyPolygon3D()); const basegfx::B3DPolyPolygon aPolyNormals3D(GetE3dPolygonObj().GetPolyNormals3D()); const basegfx::B2DPolyPolygon aPolyTexture2D(GetE3dPolygonObj().GetPolyTexture2D()); - const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); - const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); + const bool bNormals(aPolyNormals3D.count() && aPolyNormals3D.count() == aPolyPolygon3D.count()); + const bool bTexture(aPolyTexture2D.count() && aPolyTexture2D.count() == aPolyPolygon3D.count()); if(bNormals || bTexture) { @@ -181,13 +173,13 @@ namespace sdr // create primitive and add const basegfx::B3DHomMatrix aWorldTransform; - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( - aPolyPolygon3D, aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrPolyPolygonPrimitive3D( + aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofe3dscene.cxx b/svx/source/sdr/contact/viewcontactofe3dscene.cxx index 9c5885d2bf95..ca6168c4aafb 100644 --- a/svx/source/sdr/contact/viewcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dscene.cxx @@ -41,11 +41,11 @@ #include #include #include -#include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -167,21 +167,13 @@ namespace sdr ViewContactOfE3dScene::ViewContactOfE3dScene(E3dScene& rScene) : ViewContactOfSdrObj(rScene), - mpViewInformation3D(0), - mpObjectTransformation(0), - mpSdrSceneAttribute(0), - mpSdrLightingAttribute(0) + maViewInformation3D(), + maObjectTransformation(), + maSdrSceneAttribute(), + maSdrLightingAttribute() { } - ViewContactOfE3dScene::~ViewContactOfE3dScene() - { - delete mpViewInformation3D; - delete mpObjectTransformation; - delete mpSdrSceneAttribute; - delete mpSdrLightingAttribute; - } - void ViewContactOfE3dScene::createViewInformation3D(const basegfx::B3DRange& rContentRange) { basegfx::B3DHomMatrix aTransformation; @@ -265,34 +257,36 @@ namespace sdr } const uno::Sequence< beans::PropertyValue > aEmptyProperties; - mpViewInformation3D = new drawinglayer::geometry::ViewInformation3D(aTransformation, aOrientation, aProjection, aDeviceToView, 0.0, aEmptyProperties); + maViewInformation3D = drawinglayer::geometry::ViewInformation3D( + aTransformation, aOrientation, aProjection, + aDeviceToView, 0.0, aEmptyProperties); } void ViewContactOfE3dScene::createObjectTransformation() { // create 2d Object Transformation from relative point in 2d scene to world - mpObjectTransformation = new basegfx::B2DHomMatrix; const Rectangle& rRectangle = GetE3dScene().GetSnapRect(); - mpObjectTransformation->set(0, 0, rRectangle.getWidth()); - mpObjectTransformation->set(1, 1, rRectangle.getHeight()); - mpObjectTransformation->set(0, 2, rRectangle.Left()); - mpObjectTransformation->set(1, 2, rRectangle.Top()); + maObjectTransformation.set(0, 0, rRectangle.getWidth()); + maObjectTransformation.set(1, 1, rRectangle.getHeight()); + maObjectTransformation.set(0, 2, rRectangle.Left()); + maObjectTransformation.set(1, 2, rRectangle.Top()); } void ViewContactOfE3dScene::createSdrSceneAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); + maSdrSceneAttribute = drawinglayer::primitive2d::createNewSdrSceneAttribute(rItemSet); } void ViewContactOfE3dScene::createSdrLightingAttribute() { const SfxItemSet& rItemSet = GetE3dScene().GetMergedItemSet(); - mpSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); + maSdrLightingAttribute = drawinglayer::primitive2d::createNewSdrLightingAttribute(rItemSet); } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence(const SetOfByte* pLayerVisibility) const + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfE3dScene::createScenePrimitive2DSequence( + const SetOfByte* pLayerVisibility) const { drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_uInt32 nChildrenCount(GetObjectCount()); @@ -332,19 +326,27 @@ namespace sdr // on identity and the time on 0.0. const uno::Sequence< beans::PropertyValue > aEmptyProperties; const drawinglayer::geometry::ViewInformation3D aNeutralViewInformation3D(aEmptyProperties); - const basegfx::B3DRange aContentRange(drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); + const basegfx::B3DRange aContentRange( + drawinglayer::primitive3d::getB3DRangeFromPrimitive3DSequence(aAllSequence, aNeutralViewInformation3D)); // create 2d primitive 3dscene with generated sub-list from collector - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ScenePrimitive2D( - bTestVisibility ? aVisibleSequence : aAllSequence, - getSdrSceneAttribute(), - getSdrLightingAttribute(), - getObjectTransformation(), - getViewInformation3D(aContentRange))); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::ScenePrimitive2D( + bTestVisibility ? aVisibleSequence : aAllSequence, + getSdrSceneAttribute(), + getSdrLightingAttribute(), + getObjectTransformation(), + getViewInformation3D(aContentRange))); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, getObjectTransformation())); + return xRetval; } @@ -358,27 +360,7 @@ namespace sdr xRetval = createScenePrimitive2DSequence(0); } - if(xRetval.hasElements()) - { - return xRetval; - } - else - { - // create a gray placeholder hairline polygon in object size as empty 3D scene marker. Use object size - // model information directly, NOT getBoundRect()/getSnapRect() since these will - // be using the geometry data we get just asked for. AFAIK for empty 3D Scenes, the model data - // is SdrObject::aOutRect which i can access directly using GetLastBoundRect() here - const Rectangle aEmptySceneGeometry(GetE3dScene().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aEmptySceneGeometry.Left(), aEmptySceneGeometry.Top(), - aEmptySceneGeometry.Right(), aEmptySceneGeometry.Bottom()))); - const double fGrayTone(0xc0 / 255.0); - const basegfx::BColor aGrayTone(fGrayTone, fGrayTone, fGrayTone); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); - - // The replacement object may also get a text like 'empty 3D Scene' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + return xRetval; } void ViewContactOfE3dScene::ActionChanged() @@ -387,22 +369,15 @@ namespace sdr ViewContactOfSdrObj::ActionChanged(); // mark locally cached values as invalid - delete mpViewInformation3D; - mpViewInformation3D = 0; - - delete mpObjectTransformation; - mpObjectTransformation = 0; - - delete mpSdrSceneAttribute; - mpSdrSceneAttribute = 0; - - delete mpSdrLightingAttribute; - mpSdrLightingAttribute = 0; + maViewInformation3D = drawinglayer::geometry::ViewInformation3D(); + maObjectTransformation.identity(); + maSdrSceneAttribute = drawinglayer::attribute::SdrSceneAttribute(); + maSdrLightingAttribute = drawinglayer::attribute::SdrLightingAttribute(); } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D() const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { // this version will create the content range on demand locally and thus is less // performant than the other one. Since the information is buffered the planned @@ -421,47 +396,47 @@ namespace sdr const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(aContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const drawinglayer::geometry::ViewInformation3D& ViewContactOfE3dScene::getViewInformation3D(const basegfx::B3DRange& rContentRange) const { - if(!mpViewInformation3D) + if(maViewInformation3D.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createViewInformation3D(rContentRange); } - return *mpViewInformation3D; + return maViewInformation3D; } const basegfx::B2DHomMatrix& ViewContactOfE3dScene::getObjectTransformation() const { - if(!mpObjectTransformation) + if(maObjectTransformation.isIdentity()) { const_cast < ViewContactOfE3dScene* >(this)->createObjectTransformation(); } - return *mpObjectTransformation; + return maObjectTransformation; } const drawinglayer::attribute::SdrSceneAttribute& ViewContactOfE3dScene::getSdrSceneAttribute() const { - if(!mpSdrSceneAttribute) + if(maSdrSceneAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrSceneAttribute(); } - return *mpSdrSceneAttribute; + return maSdrSceneAttribute; } const drawinglayer::attribute::SdrLightingAttribute& ViewContactOfE3dScene::getSdrLightingAttribute() const { - if(!mpSdrLightingAttribute) + if(maSdrLightingAttribute.isDefault()) { const_cast < ViewContactOfE3dScene* >(this)->createSdrLightingAttribute(); } - return *mpSdrLightingAttribute; + return maSdrLightingAttribute; } drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dScene::getAllPrimitive3DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx index e175416d7552..cb234138d8f7 100644 --- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx @@ -57,16 +57,8 @@ namespace sdr { drawinglayer::primitive3d::Primitive3DSequence xRetval; const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false); - - // for 3D Objects, always create a primitive even when not visible. This is necessary ATM - // since e.g. chart geometries rely on the occupied space of non-visible objects - if(!pAttribute) - { - pAttribute = new drawinglayer::attribute::SdrLineFillShadowAttribute( - impCreateFallbackLineAttribute(basegfx::BColor(0.0, 1.0, 0.0)), - 0, 0, 0, 0); - } + const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false)); // get sphere center and size for geometry basegfx::B3DRange aSphereRange; @@ -92,14 +84,14 @@ namespace sdr F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d // create primitive and add - const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::SdrSpherePrimitive3D( - aWorldTransform, aTextureSize, *pAttribute, *pSdr3DObjectAttribute, - nHorizontalSegments, nVerticalSegments)); + const drawinglayer::primitive3d::Primitive3DReference xReference( + new drawinglayer::primitive3d::SdrSpherePrimitive3D( + aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute, + nHorizontalSegments, nVerticalSegments)); xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1); // delete 3D Object Attributes delete pSdr3DObjectAttribute; - delete pAttribute; return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index fcac5f68056e..b7663fc30dcf 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -42,7 +41,6 @@ #endif #include -#include #include #include #include @@ -62,6 +60,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -151,10 +150,9 @@ namespace sdr * aSmallerMatrix; const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0); const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D( aSmallerMatrix, - aEmptyAttributes, + drawinglayer::attribute::SdrLineFillShadowTextAttribute(), rGraphicObject, rLocalGrafInfo)); @@ -180,14 +178,12 @@ namespace sdr aEmptyGraphicAttr)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1); - if(!rAttribute.getLine()) + if(rAttribute.getLine().isDefault()) { // create a surrounding frame when no linestyle given const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor()); const basegfx::BColor aBColor(aColor.getBColor()); - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(rObjectMatrix); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, @@ -317,127 +313,123 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetGrafObject().getText(0); - - if(pSdrText) + const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); + drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetGrafObject().getText(0))); + + // create and fill GraphicAttr + GraphicAttr aLocalGrafInfo; + const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); + const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); + aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); + aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); + aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); + aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); + aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); + aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); + aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); + aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); + aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); + aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); + + if(aAttribute.isDefault() && 255L != aLocalGrafInfo.GetTransparency()) { - const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - bool bVisible(pAttribute && pAttribute->isVisible()); - - // create and fill GraphicAttr - GraphicAttr aLocalGrafInfo; - const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue()); - const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP)); - aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue()); - aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue()); - aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue()); - aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue()); - aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue()); - aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((BYTE)::basegfx::fround(Min(nTrans, (USHORT)100) * 2.55)); - aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue()); - aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue()); - aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); - - if(!bVisible && 255L != aLocalGrafInfo.GetTransparency()) + // no fill, no line, no text (invisible), but the graphic content is visible. + // Create evtl. shadow for content which was not created by createNewSdrLineFillShadowTextAttribute yet + const drawinglayer::attribute::SdrShadowAttribute aShadow( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet)); + + if(!aShadow.isDefault()) { - // content is visible, so force some fill stuff - delete pAttribute; - bVisible = true; + // create new attribute set if indeed shadow is used + aAttribute = drawinglayer::attribute::SdrLineFillShadowTextAttribute( + aAttribute.getLine(), + aAttribute.getFill(), + aAttribute.getLineStartEnd(), + aShadow, + aAttribute.getFillFloatTransGradient(), + aAttribute.getText()); + } + } - // check shadow - drawinglayer::attribute::SdrShadowAttribute* pShadow = drawinglayer::primitive2d::createNewSdrShadowAttribute(rItemSet); + // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() + // which will use the primitive data we just create in the near future + const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // look for mirroring + const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); + const sal_Int32 nDrehWink(rGeoStat.nDrehWink); + const bool bRota180(18000 == nDrehWink); + const bool bMirrored(GetGrafObject().IsMirrored()); + const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); + bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); + bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); + + // set mirror flags at LocalGrafInfo. Take into account that the geometry in + // aObjectRange is already changed and rotated when bRota180 is used. To rebuild + // that old behaviour (as long as part of the model data), correct the H/V flags + // accordingly. The created bitmapPrimitive WILL use the rotation, too. + if(bRota180) + { + // if bRota180 which is used for vertical mirroring, the graphic will already be rotated + // by 180 degrees. To correct, switch off VMirror and invert HMirroring. + bHMirr = !bHMirr; + bVMirr = false; + } - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + if(bHMirr || bVMirr) + { + aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); + } - // create new attribute set - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0L, 0L, 0L, pShadow, 0L, 0L); - } + // fill object matrix + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); - if(pAttribute) - { - if(pAttribute->isVisible() || bVisible) - { - // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect() - // which will use the primitive data we just create in the near future - const Rectangle& rRectangle = GetGrafObject().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // look for mirroring - const GeoStat& rGeoStat(GetGrafObject().GetGeoStat()); - const sal_Int32 nDrehWink(rGeoStat.nDrehWink); - const bool bRota180(18000 == nDrehWink); - const bool bMirrored(GetGrafObject().IsMirrored()); - const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1)); - bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase)); - bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase)); - - // set mirror flags at LocalGrafInfo. Take into account that the geometry in - // aObjectRange is already changed and rotated when bRota180 is used. To rebuild - // that old behaviour (as long as part of the model data), correct the H/V flags - // accordingly. The created bitmapPrimitive WILL use the rotation, too. - if(bRota180) - { - // if bRota180 which is used for vertical mirroring, the graphic will already be rotated - // by 180 degrees. To correct, switch off VMirror and invert HMirroring. - bHMirr = !bHMirr; - bVMirr = false; - } - - if(bHMirr || bVMirr) - { - aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0)); - } - - // fill object matrix - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // get the current, unchenged graphic obect from SdrGrafObj - const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); - - if(visualisationUsesPresObj()) - { - // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one - // with the content which is the placeholder graphic - xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo); - } - else if(visualisationUsesDraft()) - { - // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism - // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious - // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent - // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster - // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages - xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute); - } - else - { - // create primitive. Info: Calling the copy-constructor of GraphicObject in this - // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - *pAttribute, - rGraphicObject, - aLocalGrafInfo)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // get the current, unchenged graphic obect from SdrGrafObj + const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false); + + if(visualisationUsesPresObj()) + { + // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one + // with the content which is the placeholder graphic + xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute, aLocalGrafInfo); + } + else if(visualisationUsesDraft()) + { + // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism + // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious + // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent + // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster + // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages + xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute); } + else + { + // create primitive. Info: Calling the copy-constructor of GraphicObject in this + // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic + const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + + // always append an invisible outline for the cases where no visible content exists + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); return xRetval; } diff --git a/svx/source/sdr/contact/viewcontactofgroup.cxx b/svx/source/sdr/contact/viewcontactofgroup.cxx index 3dd2b4bd4388..00e9ad8cb684 100644 --- a/svx/source/sdr/contact/viewcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewcontactofgroup.cxx @@ -39,6 +39,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -81,25 +82,22 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, aCandSeq); } } - - if(xRetval.hasElements()) - { - return xRetval; - } else { - // create a gray placeholder hairline polygon in object size. Use the model data directly. For empty groups, - // this is SdrObject::aOutRect, as can be seen in SdrObjGroup::GetSnapRect(). Access that using GetLastBoundRect() - // to not execute anything. + // append an invisible outline for the cases where no visible content exists const Rectangle aCurrentBoundRect(GetSdrObjGroup().GetLastBoundRect()); - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange( - aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()))); - const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aOutline, aGrayTone)); + const basegfx::B2DRange aCurrentRange( + aCurrentBoundRect.Left(), aCurrentBoundRect.Top(), + aCurrentBoundRect.Right(), aCurrentBoundRect.Bottom()); - // The replacement object may also get a text like 'empty group' here later - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aCurrentRange)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + + return xRetval; } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 748d5c083a65..84f6c7c9bfe2 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -41,12 +41,14 @@ #include #include #include -#include #include #include #include #include #include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -68,26 +70,27 @@ namespace sdr { // build primitive from pBackgroundCandidate's attributes const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx index 337681e4d391..57e7ec69485b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -70,107 +69,108 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence xRetval; const SdrCaptionObj& rCaptionObj(GetCaptionObj()); const SfxItemSet& rItemSet = rCaptionObj.GetMergedItemSet(); - SdrText* pSdrText = rCaptionObj.getText(0); - - if(pSdrText) + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + rCaptionObj.getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius( + rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // create primitive. Always create one (even if invisible) to let the decomposition + // of SdrCaptionPrimitive2D create needed invisible elements for HitTest and BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCaptionPrimitive2D( + aObjectMatrix, + aAttribute, + rCaptionObj.getTailPolygon(), + fCornerRadiusX, + fCornerRadiusY)); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + + if(!aAttribute.isDefault() && rCaptionObj.GetSpecialTextBoxShadow()) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) + // for SC, the caption object may have a specialized shadow. The usual object shadow is off + // and a specialized shadow gets created here (see old paint) + const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); + const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); + const Color aShadCol(rShadColItem.GetColorValue()); + const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); + + // Create own ItemSet and modify as needed + // Always hide lines for special calc shadow + SfxItemSet aSet(rItemSet); + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_HATCH == eStyle) + { + // #41666# Hatch color is set hard to shadow color + XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); + aHatch.SetColor(aShadCol); + aSet.Put(XFillHatchItem(String(),aHatch)); + } + else { - if(pAttribute->isVisible()) + if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = rCaptionObj.GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(rCaptionObj.GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(rCaptionObj.GetEckenradius(), aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrCaptionPrimitive2D( - aObjectMatrix, *pAttribute, rCaptionObj.getTailPolygon(), fCornerRadiusX, fCornerRadiusY)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - - if(rCaptionObj.GetSpecialTextBoxShadow()) - { - // for SC, the caption object may have a specialized shadow. The usual object shadow is off - // and a specialized shadow gets created here (see old paint) - const SdrShadowColorItem& rShadColItem = (SdrShadowColorItem&)(rItemSet.Get(SDRATTR_SHADOWCOLOR)); - const sal_uInt16 nTransp(((SdrShadowTransparenceItem&)(rItemSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue()); - const Color aShadCol(rShadColItem.GetColorValue()); - const XFillStyle eStyle = ((XFillStyleItem&)(rItemSet.Get(XATTR_FILLSTYLE))).GetValue(); - - // Create own ItemSet and modify as needed - // Always hide lines for special calc shadow - SfxItemSet aSet(rItemSet); - aSet.Put(XLineStyleItem(XLINE_NONE)); - - if(XFILL_HATCH == eStyle) - { - // #41666# Hatch color is set hard to shadow color - XHatch aHatch = ((XFillHatchItem&)(rItemSet.Get(XATTR_FILLHATCH))).GetHatchValue(); - aHatch.SetColor(aShadCol); - aSet.Put(XFillHatchItem(String(),aHatch)); - } - else - { - if(XFILL_NONE != eStyle && XFILL_SOLID != eStyle) - { - // force fill to solid (for Gradient and Bitmap) - aSet.Put(XFillStyleItem(XFILL_SOLID)); - } - - aSet.Put(XFillColorItem(String(),aShadCol)); - aSet.Put(XFillTransparenceItem(nTransp)); - } - - // crete FillAttribute from modified ItemSet - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(aSet); - drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; - - if(pFill) - { - if(pFill->isVisible()) - { - // add shadow offset to object matrix - const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); - const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); - aObjectMatrix.translate(nXDist, nYDist); - - // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); - - // create the specialized shadow primitive - xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), aObjectMatrix, *pFill); - } - - delete pFill; - } - - if(xSpecialShadow.is()) - { - // if we really got a special shadow, create a two-element retval with the shadow - // behind the standard object's geometry - xRetval.realloc(2); - - xRetval[0] = xSpecialShadow; - xRetval[1] = xReference; - } - } + // force fill to solid (for Gradient and Bitmap) + aSet.Put(XFillStyleItem(XFILL_SOLID)); } - delete pAttribute; + aSet.Put(XFillColorItem(String(),aShadCol)); + aSet.Put(XFillTransparenceItem(nTransp)); + } + + // crete FillAttribute from modified ItemSet + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(aSet)); + drawinglayer::primitive2d::Primitive2DReference xSpecialShadow; + + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) + { + // add shadow offset to object matrix + const sal_uInt32 nXDist(((SdrShadowXDistItem&)(rItemSet.Get(SDRATTR_SHADOWXDIST))).GetValue()); + const sal_uInt32 nYDist(((SdrShadowYDistItem&)(rItemSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); + aObjectMatrix.translate(nXDist, nYDist); + + // create unit outline polygon as geometry (see SdrCaptionPrimitive2D::create2DDecomposition) + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, 1.0, 1.0), fCornerRadiusX, fCornerRadiusY)); + + // create the specialized shadow primitive + xSpecialShadow = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + aObjectMatrix, + aFill, + drawinglayer::attribute::FillGradientAttribute()); + } + + if(xSpecialShadow.is()) + { + // if we really got a special shadow, create a two-element retval with the shadow + // behind the standard object's geometry + xRetval.realloc(2); + + xRetval[0] = xSpecialShadow; + xRetval[1] = xReference; } } diff --git a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx index 047685dc14f2..2ff6a48686e9 100644 --- a/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrcircobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -58,56 +57,62 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrCircObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCircObj().GetMergedItemSet(); - SdrText* pSdrText = GetCircObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetCircObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetCircObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetCircObj().GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetCircObj().GetGeoStat()); - // fill object matrix - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); + // fill object matrix + const basegfx::B2DHomMatrix aObjectMatrix( + basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); - // create primitive data - const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); + // create primitive data + const sal_uInt16 nIdentifier(GetCircObj().GetObjIdentifier()); - if(OBJ_CIRC == nIdentifier) - { - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipsePrimitive2D(aObjectMatrix, *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - else - { - const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); - const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); - const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); - const bool bCloseSegment(OBJ_CARC != nIdentifier); - const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D(aObjectMatrix, *pAttribute, fStart, fEnd, bCloseSegment, bCloseUsingCenter)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } + // always create primitives to allow the decomposition of SdrEllipsePrimitive2D + // or SdrEllipseSegmentPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + if(OBJ_CIRC == nIdentifier) + { + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipsePrimitive2D( + aObjectMatrix, + aAttribute)); - delete pAttribute; - } + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + const sal_Int32 nNewStart(((SdrCircStartAngleItem&)rItemSet.Get(SDRATTR_CIRCSTARTANGLE)).GetValue()); + const sal_Int32 nNewEnd(((SdrCircEndAngleItem&)rItemSet.Get(SDRATTR_CIRCENDANGLE)).GetValue()); + const double fStart(((36000 - nNewEnd) % 36000) * F_PI18000); + const double fEnd(((36000 - nNewStart) % 36000) * F_PI18000); + const bool bCloseSegment(OBJ_CARC != nIdentifier); + const bool bCloseUsingCenter(OBJ_SECT == nIdentifier); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrEllipseSegmentPrimitive2D( + aObjectMatrix, + aAttribute, + fStart, + fEnd, + bCloseSegment, + bCloseUsingCenter)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx index 10b63f8044bf..df0151d65615 100644 --- a/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdredgeobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -55,35 +54,27 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrEdgeObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - ::basegfx::B2DPolygon aEdgeTrack(GetEdgeObj().getEdgeTrack()); + const basegfx::B2DPolygon& rEdgeTrack = GetEdgeObj().getEdgeTrack(); - // base visualisation on EdgeTrack - if(aEdgeTrack.count()) - { - // ckeck attributes - const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); - SdrText* pSdrText = GetEdgeObj().getText(0); + // what to do when no EdgeTrack is provided (HitTest and selectability) ? + OSL_ENSURE(0 != rEdgeTrack.count(), "Connectors with no geometry are not allowed (!)"); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // ckeck attributes + const SfxItemSet& rItemSet = GetEdgeObj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetEdgeObj().getText(0))); - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrConnectorPrimitive2D(*pAttribute, aEdgeTrack)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + // create primitive. Always create primitives to allow the decomposition of + // SdrConnectorPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrConnectorPrimitive2D( + aAttribute, + rEdgeTrack)); - delete pAttribute; - } - } - } - - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx index 18a82377d582..a129882686c8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmeasureobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -61,91 +60,85 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrMeasureObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetMeasureObj().GetMergedItemSet(); - SdrText* pSdrText = GetMeasureObj().getText(0); + const drawinglayer::attribute::SdrLineShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute( + rItemSet, + GetMeasureObj().getText(0))); - if(pSdrText) - { - drawinglayer::attribute::SdrLineShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineShadowTextAttribute(rItemSet, *pSdrText); + // take properties which are the model data. + const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); + const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); + const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); + const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); + const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); + const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); + const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); + const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); + const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); + const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); + drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); + drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - if(pAttribute) + switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) + { + case SDRMEASURE_TEXTLEFTOUTSIDE : { - if(pAttribute->isVisible()) - { - // take properties which are the model data. - const ::basegfx::B2DPoint aStart(GetMeasureObj().GetPoint(0).X(), GetMeasureObj().GetPoint(0).Y()); - const ::basegfx::B2DPoint aEnd(GetMeasureObj().GetPoint(1).X(), GetMeasureObj().GetPoint(1).Y()); - const double fDistance(((SdrMeasureLineDistItem&)rItemSet.Get(SDRATTR_MEASURELINEDIST)).GetValue()); - const double fUpperDistance(((SdrMeasureHelplineOverhangItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEOVERHANG)).GetValue()); - const double fLowerDistance(((SdrMeasureHelplineDistItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINEDIST)).GetValue()); - const double fLeftDelta(((SdrMeasureHelpline1LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE1LEN)).GetValue()); - const double fRightDelta(((SdrMeasureHelpline2LenItem&)rItemSet.Get(SDRATTR_MEASUREHELPLINE2LEN)).GetValue()); - const bool bBelow(((SdrMeasureBelowRefEdgeItem&)rItemSet.Get(SDRATTR_MEASUREBELOWREFEDGE)).GetValue()); - const bool bTextRotation(((SdrMeasureTextRota90Item&)rItemSet.Get(SDRATTR_MEASURETEXTROTA90)).GetValue()); - const bool bTextAutoAngle(((SdrMeasureTextAutoAngleItem&)rItemSet.Get(SDRATTR_MEASURETEXTAUTOANGLE)).GetValue()); - drawinglayer::primitive2d::MeasureTextPosition aMTPHor(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - drawinglayer::primitive2d::MeasureTextPosition aMTPVer(drawinglayer::primitive2d::MEASURETEXTPOSITION_AUTOMATIC); - - switch(((SdrMeasureTextHPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTHPOS)).GetValue()) - { - case SDRMEASURE_TEXTLEFTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURE_TEXTINSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_TEXTRIGHTOUTSIDE : - { - aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTHAUTO - { - break; - } - } - - switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) - { - case SDRMEASURE_ABOVE : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; - break; - } - case SDRMEASURETEXT_BREAKEDLINE : - case SDRMEASURETEXT_VERTICALCENTERED : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; - break; - } - case SDRMEASURE_BELOW : - { - aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; - break; - } - default : // SDRMEASURE_TEXTVAUTO - { - break; - } - } - - // create primitive with the model data - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrMeasurePrimitive2D(*pAttribute, - aStart, aEnd, aMTPHor, aMTPVer, fDistance, fUpperDistance, fLowerDistance, fLeftDelta, fRightDelta, - bBelow, bTextRotation, bTextAutoAngle)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURE_TEXTINSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_TEXTRIGHTOUTSIDE : + { + aMTPHor = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTHAUTO + { + break; + } + } - delete pAttribute; + switch(((SdrMeasureTextVPosItem&)rItemSet.Get(SDRATTR_MEASURETEXTVPOS)).GetValue()) + { + case SDRMEASURE_ABOVE : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_NEGATIVE; + break; + } + case SDRMEASURETEXT_BREAKEDLINE : + case SDRMEASURETEXT_VERTICALCENTERED : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_CENTERED; + break; + } + case SDRMEASURE_BELOW : + { + aMTPVer = drawinglayer::primitive2d::MEASURETEXTPOSITION_POSITIVE; + break; + } + default : // SDRMEASURE_TEXTVAUTO + { + break; } } - return xRetval; + // create primitive with the model data. Always create primitives to allow the + // decomposition of SdrMeasurePrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrMeasurePrimitive2D( + aAttribute, aStart, aEnd, + aMTPHor, aMTPVer, fDistance, + fUpperDistance, fLowerDistance, + fLeftDelta, fRightDelta, bBelow, + bTextRotation, bTextAutoAngle)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index 96a2f65e32ee..03eb97281240 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -157,7 +157,9 @@ namespace sdr // create range using the model data directly. This is in SdrTextObj::aRect which i will access using // GetGeoRect() to not trigger any calculations. It's the unrotated geometry which is okay for MediaObjects ATM. const Rectangle& rRectangle(GetSdrMediaObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); // create object transform basegfx::B2DHomMatrix aTransform; @@ -166,12 +168,15 @@ namespace sdr aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - // create media primitive + // create media primitive. Always create primitives to allow the + // decomposition of MediaPrimitive2D to create needed invisible elements for HitTest + // and/or BoundRect const basegfx::BColor aBackgroundColor(67.0 / 255.0, 67.0 / 255.0, 67.0 / 255.0); const rtl::OUString& rURL(GetSdrMediaObj().getURL()); const sal_uInt32 nPixelBorder(4L); - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::MediaPrimitive2D( - aTransform, rURL, aBackgroundColor, nPixelBorder)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::MediaPrimitive2D( + aTransform, rURL, aBackgroundColor, nPixelBorder)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 352b9198e97b..36475a38eb64 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -34,13 +34,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -121,126 +121,121 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetCustomShapeObj().GetMergedItemSet(); - SdrText* pSdrText = GetCustomShapeObj().getText(0); - if(pSdrText) - { - // #i98072# Get shandow and text; eventually suppress the text if it's - // a TextPath FontworkGallery object - drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute( + // #i98072# Get shandow and text; eventually suppress the text if it's + // a TextPath FontworkGallery object + const drawinglayer::attribute::SdrShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrShadowTextAttribute( rItemSet, - *pSdrText, - GetCustomShapeObj().IsTextPath()); - drawinglayer::primitive2d::Primitive2DSequence xGroup; - bool bHasText(pAttribute && pAttribute->getText()); + GetCustomShapeObj().getText(0), + GetCustomShapeObj().IsTextPath())); + drawinglayer::primitive2d::Primitive2DSequence xGroup; + bool bHasText(!aAttribute.getText().isDefault()); + + // create Primitive2DSequence from sub-geometry + const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); + bool b3DShape(false); - // create Primitive2DSequence from sub-geometry - const SdrObject* pSdrObjRepresentation = GetCustomShapeObj().GetSdrObjectFromCustomShape(); - bool b3DShape(false); + if(pSdrObjRepresentation) + { + SdrObjListIter aIterator(*pSdrObjRepresentation); - if(pSdrObjRepresentation) + while(aIterator.IsMore()) { - SdrObjListIter aIterator(*pSdrObjRepresentation); + SdrObject& rCandidate = *aIterator.Next(); - while(aIterator.IsMore()) + if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) { - SdrObject& rCandidate = *aIterator.Next(); - - if(!b3DShape && dynamic_cast< E3dObject* >(&rCandidate)) - { - b3DShape = true; - } - - const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); + b3DShape = true; } + + const drawinglayer::primitive2d::Primitive2DSequence xNew(rCandidate.GetViewContact().getViewIndependentPrimitive2DSequence()); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xGroup, xNew); } + } + + if(bHasText || xGroup.hasElements()) + { + // prepare text box geometry + basegfx::B2DHomMatrix aTextBoxMatrix; + bool bWordWrap(false); - if(bHasText || xGroup.hasElements()) + if(bHasText) { - // prepare text box geometry - basegfx::B2DHomMatrix aTextBoxMatrix; - bool bWordWrap(false); + // take unrotated snap rect as default, then get the + // unrotated text box. Rotation needs to be done centered + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); - if(bHasText) - { - // take unrotated snap rect as default, then get the - // unrotated text box. Rotation needs to be done centered - const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); - const basegfx::B2DRange aObjectRange(aObjectBound.Left(), aObjectBound.Top(), aObjectBound.Right(), aObjectBound.Bottom()); + // #i101684# get the text range unrotated and absolute to the object range + const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); - // #i101684# get the text range unrotated and absolute to the object range - const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect()); + // give text object a size + aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // give text object a size - aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); + // check if we have a rotation/shear at all to take care of + const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); + const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); - // check if we have a rotation/shear at all to take care of - const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); - const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); + if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + { + if(aObjectRange != aTextRange) + { + // move relative to unrotated object range + aTextBoxMatrix.translate( + aTextRange.getMinX() - aObjectRange.getMinimum().getX(), + aTextRange.getMinY() - aObjectRange.getMinimum().getY()); + } - if(rGeoStat.nShearWink || rGeoStat.nDrehWink || !basegfx::fTools::equalZero(fExtraTextRotation)) + if(rGeoStat.nShearWink) { - if(aObjectRange != aTextRange) - { - // move relative to unrotated object range - aTextBoxMatrix.translate( - aTextRange.getMinX() - aObjectRange.getMinimum().getX(), - aTextRange.getMinY() - aObjectRange.getMinimum().getY()); - } - - if(rGeoStat.nShearWink) - { - aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); - } - - if(rGeoStat.nDrehWink) - { - aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); - } - - if(!basegfx::fTools::equalZero(fExtraTextRotation)) - { - aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); - } - - // give text it's target position - aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + aTextBoxMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000)); } - else + + if(rGeoStat.nDrehWink) { - aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); + aTextBoxMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000); } - // check if SdrTextWordWrapItem is set - bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); - } + if(!basegfx::fTools::equalZero(fExtraTextRotation)) + { + aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180); + } - // make sure a (even empty) SdrShadowTextAttribute exists for - // primitive creation - if(!pAttribute) + // give text it's target position + aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY()); + } + else { - pAttribute = new drawinglayer::attribute::SdrShadowTextAttribute(0L, 0L); + aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY()); } - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( - *pAttribute, - xGroup, - aTextBoxMatrix, - bWordWrap, - b3DShape, - false)); // #SJ# New parameter to force to clipped BlockText for SC - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + // check if SdrTextWordWrapItem is set + bWordWrap = ((SdrTextWordWrapItem&)(GetCustomShapeObj().GetMergedItem(SDRATTR_TEXT_WORDWRAP))).GetValue(); } - if(pAttribute) - { - delete pAttribute; - } + // create primitive + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrCustomShapePrimitive2D( + aAttribute, + xGroup, + aTextBoxMatrix, + bWordWrap, + b3DShape, + false)); // #SJ# New parameter to force to clipped BlockText for SC + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + // always append an invisible outline for the cases where no visible content exists + const Rectangle aObjectBound(GetCustomShapeObj().GetGeoRect()); + const basegfx::B2DRange aObjectRange( + aObjectBound.Left(), aObjectBound.Top(), + aObjectBound.Right(), aObjectBound.Bottom()); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectRange)); + return xRetval; } } // end of namespace contact diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 7672577138d0..bcd7646f326a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -76,59 +75,51 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters( bool bHighContrast) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; - SdrText* pSdrText = GetOle2Obj().getText(0); - - if(pSdrText) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); - const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object matrix - const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); - const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); - const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // Prepare attribute settings, will be used soon anyways - const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(!pAttribute) - { - // force existence, even when not visible - pAttribute = new drawinglayer::attribute::SdrLineFillShadowTextAttribute(0, 0, 0, 0, 0, 0); - } - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( - GetOle2Obj(), - aObjectMatrix, - - // #i104867# add GraphicVersion number to be able to check for - // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), - - bHighContrast)); - - // create primitive. Use Ole2 primitive here. Prepare attribute settings, will be used soon anyways. - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrOle2Primitive2D( + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); + const basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // Prepare attribute settings, will be used soon anyways + const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetOle2Obj().getText(0))); + + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + const drawinglayer::primitive2d::Primitive2DReference xOleContent( + new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + GetOle2Obj(), + aObjectMatrix, + + // #i104867# add GraphicVersion number to be able to check for + // content change in the primitive later + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(), + + bHighContrast)); + + // create primitive. Use Ole2 primitive here. Prepare attribute settings, will + // be used soon anyways. Always create primitives to allow the decomposition of + // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrOle2Primitive2D( xOLEContent, aObjectMatrix, - *pAttribute)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - delete pAttribute; - } + aAttribute)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 26a3934c179e..12b7e1b0acf4 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -45,9 +45,9 @@ #include #include #include -#include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -101,7 +101,8 @@ namespace sdr const svtools::ColorConfig aColorConfig; const Color aInitColor(aColorConfig.GetColorValue(svtools::DOCCOLOR).nColor); const basegfx::BColor aRGBColor(aInitColor.getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::BackgroundColorPrimitive2D(aRGBColor)); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } @@ -216,25 +217,25 @@ namespace sdr { // build primitive from pObject's attributes const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - if(pFill) + if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) { - if(pFill->isVisible()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pFill; + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } } diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx index 3c8449bae7f6..97716a7fdddd 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -57,93 +56,91 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetPathObj().GetMergedItemSet(); - SdrText* pSdrText = GetPathObj().getText(0); + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetPathObj().getText(0))); + basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); + sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); + sal_uInt32 nPointCount(0); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + nPointCount += aUnitPolyPolygon.getB2DPolygon(a).count(); + } + + if(!nPointCount) + { + OSL_ENSURE(false, "PolyPolygon object without geometry detected, this should not be created (!)"); + basegfx::B2DPolygon aFallbackLine; + aFallbackLine.append(basegfx::B2DPoint(0.0, 0.0)); + aFallbackLine.append(basegfx::B2DPoint(1000.0, 1000.0)); + aUnitPolyPolygon = basegfx::B2DPolyPolygon(aFallbackLine); + + nPolyCount = 1; + } + + // prepare object transformation and unit polygon (direct model data) + basegfx::B2DHomMatrix aObjectMatrix; + const bool bIsLine( + !aUnitPolyPolygon.areControlPointsUsed() + && 1 == nPolyCount + && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - if(pSdrText) + if(bIsLine) { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = - drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( - rItemSet, - *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly()); - const sal_uInt32 nPolyCount(aUnitPolyPolygon.count()); - - if(nPolyCount) - { - // prepare object transformation and unit polygon (direct model data) - basegfx::B2DHomMatrix aObjectMatrix; - const bool bIsLine( - !aUnitPolyPolygon.areControlPointsUsed() - && 1 == nPolyCount - && 2 == aUnitPolyPolygon.getB2DPolygon(0).count()); - - if(bIsLine) - { - // special handling for single line mode (2 points) - const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); - const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); - const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); - const basegfx::B2DVector aLine(aEnd - aStart); - - // #i102548# create new unit polygon for line (horizontal) - basegfx::B2DPolygon aNewPolygon; - aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); - aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); - aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); - - // #i102548# fill objectMatrix with rotation and offset (no shear for lines) - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aLine.getLength(), 1.0, - 0.0, - atan2(aLine.getY(), aLine.getX()), - aStart.getX(), aStart.getY()); - } - else - { - // #i102548# create unscaled, unsheared, unrotated and untranslated polygon - // (unit polygon) by creating the object matrix and back-transforming the polygon - const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); - const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); - const double fWidth(aObjectRange.getWidth()); - const double fHeight(aObjectRange.getHeight()); - const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); - const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); - - aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - fScaleX, fScaleY, - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY()); - - // ceate unit polygon from object's absolute path - basegfx::B2DHomMatrix aInverse(aObjectMatrix); - aInverse.invert(); - aUnitPolyPolygon.transform(aInverse); - } - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrPathPrimitive2D( - aObjectMatrix, - *pAttribute, - aUnitPolyPolygon)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - delete pAttribute; - } + // special handling for single line mode (2 points) + const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0)); + const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0)); + const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1)); + const basegfx::B2DVector aLine(aEnd - aStart); + + // #i102548# create new unit polygon for line (horizontal) + basegfx::B2DPolygon aNewPolygon; + aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0)); + aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0)); + aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon); + + // #i102548# fill objectMatrix with rotation and offset (no shear for lines) + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aLine.getLength(), 1.0, + 0.0, + atan2(aLine.getY(), aLine.getX()), + aStart.getX(), aStart.getY()); } + else + { + // #i102548# create unscaled, unsheared, unrotated and untranslated polygon + // (unit polygon) by creating the object matrix and back-transforming the polygon + const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon)); + const GeoStat& rGeoStat(GetPathObj().GetGeoStat()); + const double fWidth(aObjectRange.getWidth()); + const double fHeight(aObjectRange.getHeight()); + const double fScaleX(basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth); + const double fScaleY(basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight); + + aObjectMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + fScaleX, fScaleY, + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY()); + + // ceate unit polygon from object's absolute path + basegfx::B2DHomMatrix aInverse(aObjectMatrix); + aInverse.invert(); + aUnitPolyPolygon.transform(aInverse); + } + + // create primitive. Always create primitives to allow the decomposition of + // SdrPathPrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrPathPrimitive2D( + aObjectMatrix, + aAttribute, + aUnitPolyPolygon)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx index 94b26b5d020e..6a7f6842a76d 100644 --- a/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrrectobj.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -59,70 +58,48 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrRectObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const SfxItemSet& rItemSet = GetRectObj().GetMergedItemSet(); - SdrText* pSdrText = GetRectObj().getText(0); - - if(pSdrText) - { - drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText); - - if(pAttribute) - { - if(pAttribute->isVisible()) - { - // take unrotated snap rect (direct model data) for position and size - const Rectangle& rRectangle = GetRectObj().GetGeoRect(); - const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); - - // fill object matrix - basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), - rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, - rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, - aObjectRange.getMinX(), aObjectRange.getMinY())); - - // calculate corner radius - sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); - double fCornerRadiusX; - double fCornerRadiusY; - drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); - - // #i105856# use knowledge about pickthrough from the model - const bool bPickThroughTransparentTextFrames( - GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); - - // create primitive - const drawinglayer::primitive2d::Primitive2DReference xReference( - new drawinglayer::primitive2d::SdrRectanglePrimitive2D( - aObjectMatrix, - *pAttribute, - fCornerRadiusX, - fCornerRadiusY, - // #i105856# use fill for HitTest when TextFrame and not PickThrough - GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - - delete pAttribute; - } - - if(!xRetval.hasElements()) - { - // #i99123# - // Object is invisible. Create a fallback primitive for HitTest - basegfx::B2DHomMatrix aObjectMatrix; - basegfx::B2DPolyPolygon aObjectPolyPolygon; - GetRectObj().TRGetBaseGeometry(aObjectMatrix, aObjectPolyPolygon); - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createFallbackHitTestPrimitive(aObjectMatrix)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - - return xRetval; + const drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute( + drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( + rItemSet, + GetRectObj().getText(0))); + + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = GetRectObj().GetGeoRect(); + const ::basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + const GeoStat& rGeoStat(GetRectObj().GetGeoStat()); + + // fill object matrix + basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0, + rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // calculate corner radius + sal_uInt32 nCornerRadius(((SdrEckenradiusItem&)(rItemSet.Get(SDRATTR_ECKENRADIUS))).GetValue()); + double fCornerRadiusX; + double fCornerRadiusY; + drawinglayer::primitive2d::calculateRelativeCornerRadius(nCornerRadius, aObjectRange, fCornerRadiusX, fCornerRadiusY); + + // #i105856# use knowledge about pickthrough from the model + const bool bPickThroughTransparentTextFrames( + GetRectObj().GetModel() && GetRectObj().GetModel()->IsPickThroughTransparentTextFrames()); + + // create primitive. Always create primitives to allow the decomposition of + // SdrRectanglePrimitive2D to create needed invisible elements for HitTest and/or BoundRect + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrRectanglePrimitive2D( + aObjectMatrix, + aAttribute, + fCornerRadiusX, + fCornerRadiusY, + // #i105856# use fill for HitTest when TextFrame and not PickThrough + GetRectObj().IsTextFrame() && !bPickThroughTransparentTextFrames)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx index 7bea25feeeed..f830369fc2ec 100644 --- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx @@ -50,6 +50,7 @@ #include #include #include +#include //........................................................................ namespace sdr { namespace contact { @@ -138,35 +139,43 @@ namespace sdr { namespace contact { //-------------------------------------------------------------------- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfUnoControl::createViewIndependentPrimitive2DSequence() const { + // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use + // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) + // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything + const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); + const basegfx::B2DRange aRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object transform + basegfx::B2DHomMatrix aTransform; + + aTransform.set(0, 0, aRange.getWidth()); + aTransform.set(1, 1, aRange.getHeight()); + aTransform.set(0, 2, aRange.getMinX()); + aTransform.set(1, 2, aRange.getMinY()); + Reference< XControlModel > xControlModel = GetSdrUnoObj().GetUnoControlModel(); if(xControlModel.is()) { - // create range. Use model data directly, not getBoundRect()/getSnapRect; these will use - // the primitive data themselves in the long run. Use SdrUnoObj's (which is a SdrRectObj) - // call to GetGeoRect() to access SdrTextObj::aRect directly and without executing anything - const Rectangle& rRectangle(GetSdrUnoObj().GetGeoRect()); - const basegfx::B2DRange aRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aTransform; - aTransform.set(0, 0, aRange.getWidth()); - aTransform.set(1, 1, aRange.getHeight()); - aTransform.set(0, 2, aRange.getMinX()); - aTransform.set(1, 2, aRange.getMinY()); - // create control primitive WITHOUT possibly existing XControl; this would be done in // the VOC in createPrimitive2DSequence() - const drawinglayer::primitive2d::Primitive2DReference xRetval(new drawinglayer::primitive2d::ControlPrimitive2D( - aTransform, xControlModel)); + const drawinglayer::primitive2d::Primitive2DReference xRetval( + new drawinglayer::primitive2d::ControlPrimitive2D( + aTransform, + xControlModel)); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } else { - // #i93161# This UnoControl does not yet have a xControlModel (can happen - // during diverse creations). Without a model, create no visualisation. - return drawinglayer::primitive2d::Primitive2DSequence(); + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xRetval( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aTransform)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } } diff --git a/svx/source/sdr/contact/viewcontactofvirtobj.cxx b/svx/source/sdr/contact/viewcontactofvirtobj.cxx index 0f046bdda97f..5578bf399f84 100644 --- a/svx/source/sdr/contact/viewcontactofvirtobj.cxx +++ b/svx/source/sdr/contact/viewcontactofvirtobj.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -77,29 +78,39 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfVirtObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; + // create displacement transformation if we have content + basegfx::B2DHomMatrix aObjectMatrix; + Point aAnchor(GetVirtObj().GetAnchorPos()); + + if(aAnchor.X() || aAnchor.Y()) + { + aObjectMatrix.set(0, 2, aAnchor.X()); + aObjectMatrix.set(1, 2, aAnchor.Y()); + } // use method from referenced object to get the Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual(GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DSequence xSequenceVirtual( + GetVirtObj().GetReferencedObj().GetViewContact().getViewIndependentPrimitive2DSequence()); if(xSequenceVirtual.hasElements()) { - // create displacement transformation if we have content - ::basegfx::B2DHomMatrix aObjectMatrix; - Point aAnchor(GetVirtObj().GetAnchorPos()); - - if(aAnchor.X() || aAnchor.Y()) - { - aObjectMatrix.set(0, 2, aAnchor.X()); - aObjectMatrix.set(1, 2, aAnchor.Y()); - } - // create transform primitive - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::TransformPrimitive2D(aObjectMatrix, xSequenceVirtual)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::TransformPrimitive2D( + aObjectMatrix, + xSequenceVirtual)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } + else + { + // always append an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, aObjectMatrix)); - return xRetval; + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } } // end of namespace contact } // end of namespace sdr diff --git a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx index 435eb31c47f0..d031ef552486 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3d.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3d.cxx @@ -39,7 +39,6 @@ #include #include #include -#include ////////////////////////////////////////////////////////////////////////////// // predeclarations diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index b093ddbe8b75..68ac3365796e 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -125,17 +125,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } - else - { - // do neither print nor PDF export the fallback visualisation - if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) - { - // empty group, fallback to parent method which will create the default - // grayed frame for empty 3d scenes by using model data and - // createViewIndependentPrimitive2DSequence::ViewContactOfE3dScene - xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo); - } - } if(bIsActiveVC) { diff --git a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx index 0f67ba46acb9..b7406bd1cc58 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgroup.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgroup.cxx @@ -59,20 +59,6 @@ namespace sdr { } - bool ViewObjectContactOfGroup::isPrimitiveVisible(const DisplayInfo& rDisplayInfo) const - { - const bool bHasChildren(0 != GetViewContact().GetObjectCount()); - - if(!bHasChildren && (GetObjectContact().isOutputToPrinter() || GetObjectContact().isOutputToRecordingMetaFile())) - { - // empty group uses fallback gray empty frame display. Do neither print nor PDF export it - return false; - } - - // call parent - return ViewObjectContactOfSdrObj::isPrimitiveVisible(rDisplayInfo); - } - drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfGroup::getPrimitive2DSequenceHierarchy(DisplayInfo& rDisplayInfo) const { const sal_uInt32 nSubHierarchyCount(GetViewContact().GetObjectCount()); diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index bd208b5cf54f..645632c956f8 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -296,28 +296,19 @@ namespace sdr else if(bCreateGrayFrame) { // #i105146# no content, but frame display. To make hitting the page preview objects - // on the handout page more simple, add a HitTest fill primitive - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange)); - aOutline.transform(aPageObjectTransform); - - const drawinglayer::primitive2d::Primitive2DReference xHitFill( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOutline), - basegfx::BColor(0.0, 0.0, 0.0))); - - const drawinglayer::primitive2d::Primitive2DReference xHit( - new drawinglayer::primitive2d::HitTestPrimitive2D( - drawinglayer::primitive2d::Primitive2DSequence(&xHitFill, 1))); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xHit, 1); + // on the handout page more simple, add hidden fill geometry + const drawinglayer::primitive2d::Primitive2DReference xFrameHit( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aPageObjectTransform)); + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xFrameHit, 1); } // add a gray outline frame, except not when printing if(bCreateGrayFrame) { const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor); - basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOwnOutline(basegfx::tools::createUnitPolygon()); aOwnOutline.transform(aPageObjectTransform); const drawinglayer::primitive2d::Primitive2DReference xGrayFrame( diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 635ae9c7fcc8..954102c0a8cb 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -39,11 +39,11 @@ #include #include #include -#include #include #include -#include -#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -207,7 +207,7 @@ namespace sdr if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { // shade the representation if the object is activated outplace - basegfx::B2DPolygon aObjectOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); aObjectOutline.transform(aObjectTransform); // Use a FillHatchPrimitive2D with necessary attributes diff --git a/svx/source/sdr/overlay/overlayobjectcell.cxx b/svx/source/sdr/overlay/overlayobjectcell.cxx index 5df0fc85f8f9..35fe4351981b 100644 --- a/svx/source/sdr/overlay/overlayobjectcell.cxx +++ b/svx/source/sdr/overlay/overlayobjectcell.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include using namespace ::basegfx; @@ -87,12 +87,12 @@ namespace sdr if(mePaintType == CELL_OVERLAY_TRANSPARENT) { // embed in 50% transparent paint - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, 0.5)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } else // CELL_OVERLAY_INVERT { diff --git a/svx/source/sdr/overlay/overlayselection.cxx b/svx/source/sdr/overlay/overlayselection.cxx index b788de195903..6b449699a51d 100644 --- a/svx/source/sdr/overlay/overlayselection.cxx +++ b/svx/source/sdr/overlay/overlayselection.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include @@ -144,8 +144,8 @@ namespace sdr { // embed all rectangles in transparent paint const double fTransparence(mnLastTransparence / 100.0); - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aRetval, fTransparence)); @@ -159,13 +159,13 @@ namespace sdr // add both to result aRetval.realloc(2); - aRetval[0] = aUnifiedAlpha; + aRetval[0] = aUnifiedTransparence; aRetval[1] = aSelectionOutline; } else { // just add transparent part - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlpha, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1); } } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index d657e6b9a8d7..a1ef5d8f0957 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -58,14 +58,11 @@ #include #include #include -#include #include #include -#include #include #include #include -#include #include #include #include @@ -73,13 +70,22 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -221,9 +227,8 @@ namespace drawinglayer { namespace primitive2d { - attribute::SdrLineAttribute* createNewSdrLineAttribute(const SfxItemSet& rSet) + attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet) { - attribute::SdrLineAttribute* pRetval(0L); const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue()); if(XLINE_NONE != eStyle) @@ -253,7 +258,7 @@ namespace drawinglayer } } - pRetval = new attribute::SdrLineAttribute( + return attribute::SdrLineAttribute( XLineJointtoB2DLineJoin(eJoint), (double)nWidth, (double)nTransparence * 0.01, @@ -263,12 +268,13 @@ namespace drawinglayer } } - return pRetval; + return attribute::SdrLineAttribute(); } - attribute::SdrLineStartEndAttribute* createNewSdrLineStartEndAttribute(const SfxItemSet& rSet, double fWidth) + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth) { - attribute::SdrLineStartEndAttribute* pRetval(0L); const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue()); const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue()); basegfx::B2DPolyPolygon aStartPolyPolygon; @@ -328,15 +334,16 @@ namespace drawinglayer if(bStartActive || bEndActive) { - pRetval = new attribute::SdrLineStartEndAttribute(aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, bStartActive, bEndActive, bStartCentered, bEndCentered); + return attribute::SdrLineStartEndAttribute( + aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth, + bStartActive, bEndActive, bStartCentered, bEndCentered); } - return pRetval; + return attribute::SdrLineStartEndAttribute(); } - attribute::SdrShadowAttribute* createNewSdrShadowAttribute(const SfxItemSet& rSet) + attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet) { - attribute::SdrShadowAttribute* pRetval(0L); const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue()); if(bShadow) @@ -374,16 +381,15 @@ namespace drawinglayer (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue()); const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue()); - pRetval = new attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); } } - return pRetval; + return attribute::SdrShadowAttribute(); } - attribute::SdrFillAttribute* createNewSdrFillAttribute(const SfxItemSet& rSet) + attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet) { - attribute::SdrFillAttribute* pRetval(0L); const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue()); if(XFILL_NONE != eStyle) @@ -398,9 +404,9 @@ namespace drawinglayer if(100 != nTransparence) { const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue()); - attribute::FillGradientAttribute* pGradient(0L); - attribute::FillHatchAttribute* pHatch(0L); - attribute::SdrFillBitmapAttribute* pBitmap(0L); + attribute::FillGradientAttribute aGradient; + attribute::FillHatchAttribute aHatch; + attribute::SdrFillBitmapAttribute aBitmap; switch(eStyle) { @@ -412,10 +418,10 @@ namespace drawinglayer } case XFILL_GRADIENT : { - XGradient aGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); + XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue()); - const Color aStartColor(aGradient.GetStartColor()); - const sal_uInt16 nStartIntens(aGradient.GetStartIntens()); + const Color aStartColor(aXGradient.GetStartColor()); + const sal_uInt16 nStartIntens(aXGradient.GetStartIntens()); basegfx::BColor aStart(aStartColor.getBColor()); if(nStartIntens != 100) @@ -424,8 +430,8 @@ namespace drawinglayer aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); } - const Color aEndColor(aGradient.GetEndColor()); - const sal_uInt16 nEndIntens(aGradient.GetEndIntens()); + const Color aEndColor(aXGradient.GetEndColor()); + const sal_uInt16 nEndIntens(aXGradient.GetEndIntens()); basegfx::BColor aEnd(aEndColor.getBColor()); if(nEndIntens != 100) @@ -434,12 +440,12 @@ namespace drawinglayer aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); } - pGradient = new attribute::FillGradientAttribute( - XGradientStyleToGradientStyle(aGradient.GetGradientStyle()), - (double)aGradient.GetBorder() * 0.01, - (double)aGradient.GetXOffset() * 0.01, - (double)aGradient.GetYOffset() * 0.01, - (double)aGradient.GetAngle() * F_PI1800, + aGradient = attribute::FillGradientAttribute( + XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), + (double)aXGradient.GetBorder() * 0.01, + (double)aXGradient.GetXOffset() * 0.01, + (double)aXGradient.GetYOffset() * 0.01, + (double)aXGradient.GetAngle() * F_PI1800, aStart, aEnd, ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue()); @@ -451,7 +457,7 @@ namespace drawinglayer const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue()); const Color aColorB(rHatch.GetColor()); - pHatch = new attribute::FillHatchAttribute( + aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), (double)rHatch.GetDistance(), (double)rHatch.GetAngle() * F_PI1800, @@ -462,23 +468,25 @@ namespace drawinglayer } case XFILL_BITMAP : { - pBitmap = createNewSdrFillBitmapAttribute(rSet); + aBitmap = createNewSdrFillBitmapAttribute(rSet); break; } } - pRetval = new attribute::SdrFillAttribute( + return attribute::SdrFillAttribute( (double)nTransparence * 0.01, aColor.getBColor(), - pGradient, pHatch, pBitmap); + aGradient, + aHatch, + aBitmap); } } - return pRetval; + return attribute::SdrFillAttribute(); } // #i101508# Support handing over given text-to-border distances - attribute::SdrTextAttribute* createNewSdrTextAttribute( + attribute::SdrTextAttribute createNewSdrTextAttribute( const SfxItemSet& rSet, const SdrText& rText, const sal_Int32* pLeft, @@ -486,7 +494,6 @@ namespace drawinglayer const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrTextAttribute* pRetval(0); const SdrTextObj& rTextObj = rText.GetObject(); if(rText.GetOutlinerParaObject() && rText.GetModel()) @@ -530,7 +537,7 @@ namespace drawinglayer const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj); const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING); - pRetval = new attribute::SdrTextAttribute( + return attribute::SdrTextAttribute( rText, aOutlinerParaObject, ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(), @@ -550,15 +557,15 @@ namespace drawinglayer bWrongSpell); } - return pRetval; + return attribute::SdrTextAttribute(); } - attribute::FillGradientAttribute* createNewTransparenceGradientAttribute(const SfxItemSet& rSet) + attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet) { - attribute::FillGradientAttribute* pRetval = 0L; const SfxPoolItem* pGradientItem; - if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) + if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem) + && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()) { // test if float transparence is completely transparent const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); @@ -571,7 +578,7 @@ namespace drawinglayer const double fStartLum(nStartLuminance / 255.0); const double fEndLum(nEndLuminance / 255.0); - pRetval = new attribute::FillGradientAttribute( + return attribute::FillGradientAttribute( XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), (double)rGradient.GetBorder() * 0.01, (double)rGradient.GetXOffset() * 0.01, @@ -583,12 +590,11 @@ namespace drawinglayer } } - return pRetval; + return attribute::FillGradientAttribute(); } - attribute::SdrFillBitmapAttribute* createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute(const SfxItemSet& rSet) { - attribute::SdrFillBitmapAttribute* pRetval(0L); Bitmap aBitmap((((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetBitmapValue()).GetBitmap()); // make sure it's not empty, use default instead @@ -635,7 +641,7 @@ namespace drawinglayer (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); - pRetval = new attribute::SdrFillBitmapAttribute( + return attribute::SdrFillBitmapAttribute( aBitmap, aSize, aOffset, @@ -644,252 +650,174 @@ namespace drawinglayer ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); - - return pRetval; } - attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText) + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bSuppressText) { - attribute::SdrShadowTextAttribute* pRetval(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrTextAttribute aText; // #i98072# added option to suppress text // look for text first - if(!bSuppressText) + if(!bSuppressText && pText) { - pText = createNewSdrTextAttribute(rSet, rText); + aText = createNewSdrTextAttribute(rSet, *pText); } // try shadow - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pText || pShadow) - { - pRetval = new attribute::SdrShadowTextAttribute(pShadow, pText); - } - - return pRetval; + return attribute::SdrShadowTextAttribute(aShadow, aText); } - attribute::SdrLineShadowTextAttribute* createNewSdrLineShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; + aText = createNewSdrTextAttribute(rSet, *pText); + + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.isDefault() + && !aText.getSdrFormTextAttribute().isDefault() + && aText.isHideContour()) + { + bFontworkHideContour = true; + } } // try line style if(!bFontworkHideContour) { - pLine = createNewSdrLineAttribute(rSet); + aLine = createNewSdrLineAttribute(rSet); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } } - // try shadow - if(pLine || pText) + if(!aLine.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); + // try shadow + const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet)); - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } + return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText); } - if(pLine || pText) - { - pRetval = new attribute::SdrLineShadowTextAttribute(pLine, pLineStartEnd, pShadow, pText); - } - - return pRetval; + return attribute::SdrLineShadowTextAttribute(); } - attribute::SdrLineFillShadowTextAttribute* createNewSdrLineFillShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText) + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText) { - attribute::SdrLineFillShadowTextAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrLineAttribute aLine; + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - pText = createNewSdrTextAttribute(rSet, rText); - - // when object has text and text is fontwork and hide contour is set for fontwork, force - // line and fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) + if(pText) { - bFontworkHideContour = true; - } - - // try line style - if(!bFontworkHideContour) - { - pLine = createNewSdrLineAttribute(rSet); + aText = createNewSdrTextAttribute(rSet, *pText); - if(pLine && !pLine->isVisible()) + // when object has text and text is fontwork and hide contour is set for fontwork, force + // line and fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) { - delete pLine; - pLine = 0L; - } - - if(pLine) - { - // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + bFontworkHideContour = true; } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); + // try line style + aLine = createNewSdrLineAttribute(rSet); - if(pFill && !pFill->isVisible()) + if(!aLine.isDefault()) { - delete pFill; - pFill = 0L; + // try LineStartEnd + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } - if(pFill) + // try fill style + aFill = createNewSdrFillAttribute(rSet); + + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - // try shadow - if(pLine || pFill || pText) + if(!aLine.isDefault() || !aFill.isDefault() || !aText.isDefault()) { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) - { - delete pShadow; - pShadow = 0L; - } - } + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); - if(pLine || pFill || pText) - { - pRetval = new attribute::SdrLineFillShadowTextAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient, pText); + return attribute::SdrLineFillShadowTextAttribute( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrLineFillShadowTextAttribute(); } - attribute::SdrLineFillShadowAttribute* createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill) { - attribute::SdrLineFillShadowAttribute* pRetval(0L); - attribute::SdrLineAttribute* pLine(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::SdrLineStartEndAttribute* pLineStartEnd(0L); - attribute::SdrShadowAttribute* pShadow(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); + attribute::SdrFillAttribute aFill; + attribute::SdrLineStartEndAttribute aLineStartEnd; + attribute::SdrShadowAttribute aShadow; + attribute::FillGradientAttribute aFillFloatTransGradient; // try line style - pLine = createNewSdrLineAttribute(rSet); + const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet)); - if(pLine && !pLine->isVisible()) - { - delete pLine; - pLine = 0L; - } - - if(pLine) + if(!aLine.isDefault()) { // try LineStartEnd - pLineStartEnd = createNewSdrLineStartEndAttribute(rSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0L; - } + aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()); } // try fill style - pFill = bSuppressFill ? 0 : createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) + if(!bSuppressFill) { - delete pFill; - pFill = 0L; - } - - if(pFill) - { - // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); - } + aFill = createNewSdrFillAttribute(rSet); - // try shadow - if(pLine || pFill) - { - pShadow = createNewSdrShadowAttribute(rSet); - - if(pShadow && !pShadow->isVisible()) + if(!aFill.isDefault()) { - delete pShadow; - pShadow = 0L; + // try fillfloattransparence + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pLine || pFill) + if(!aLine.isDefault() || !aFill.isDefault()) { - pRetval = new attribute::SdrLineFillShadowAttribute(pLine, pFill, pLineStartEnd, pShadow, pFillFloatTransGradient); + // try shadow + aShadow = createNewSdrShadowAttribute(rSet); + + return attribute::SdrLineFillShadowAttribute3D( + aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient); } - return pRetval; + return attribute::SdrLineFillShadowAttribute3D(); } - attribute::SdrSceneAttribute* createNewSdrSceneAttribute(const SfxItemSet& rSet) + attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet) { // get perspective ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL); @@ -926,10 +854,10 @@ namespace drawinglayer // get two sided lighting const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue()); - return new attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); + return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting); } - attribute::SdrLightingAttribute* createNewSdrLightingAttribute(const SfxItemSet& rSet) + attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet) { // extract lights from given SfxItemSet (from scene) ::std::vector< attribute::Sdr3DLightAttribute > aLightVector; @@ -994,7 +922,7 @@ namespace drawinglayer const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue()); const basegfx::BColor aAmbientLight(aAmbientValue.getBColor()); - return new attribute::SdrLightingAttribute(aAmbientLight, aLightVector); + return attribute::SdrLightingAttribute(aAmbientLight, aLightVector); } void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY) @@ -1051,57 +979,50 @@ namespace drawinglayer } // #i101508# Support handing over given text-to-border distances - attribute::SdrFillTextAttribute* createNewSdrFillTextAttribute( + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( const SfxItemSet& rSet, - const SdrText* pSdrText, + const SdrText* pText, const sal_Int32* pLeft, const sal_Int32* pUpper, const sal_Int32* pRight, const sal_Int32* pLower) { - attribute::SdrFillTextAttribute* pRetval(0L); - attribute::SdrFillAttribute* pFill(0L); - attribute::FillGradientAttribute* pFillFloatTransGradient(0L); - attribute::SdrTextAttribute* pText(0L); + attribute::SdrFillAttribute aFill; + attribute::FillGradientAttribute aFillFloatTransGradient; + attribute::SdrTextAttribute aText; bool bFontworkHideContour(false); // look for text first - if(pSdrText) + if(pText) { - pText = createNewSdrTextAttribute(rSet, *pSdrText, pLeft, pUpper, pRight, pLower); - } + aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower); - // when object has text and text is fontwork and hide contour is set for fontwork, force - // fill style to empty - if(pText && pText->getSdrFormTextAttribute() && pText->isHideContour()) - { - bFontworkHideContour = true; + // when object has text and text is fontwork and hide contour is set for fontwork, force + // fill style to empty + if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()) + { + bFontworkHideContour = true; + } } - // try fill style if(!bFontworkHideContour) { - pFill = createNewSdrFillAttribute(rSet); - - if(pFill && !pFill->isVisible()) - { - delete pFill; - pFill = 0L; - } + // try fill style + aFill = createNewSdrFillAttribute(rSet); - if(pFill) + if(!aFill.isDefault()) { // try fillfloattransparence - pFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); + aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet); } } - if(pFill || pText) + if(!aFill.isDefault() || !aText.isDefault()) { - pRetval = new attribute::SdrFillTextAttribute(pFill, pFillFloatTransGradient, pText); + return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText); } - return pRetval; + return attribute::SdrFillTextAttribute(); } } // end of namespace primitive2d diff --git a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx index e4967f767299..58017f9d01fc 100644 --- a/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,6 @@ namespace drawinglayer Primitive2DSequence SdrCaptionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,68 +58,66 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(getSdrLFSTAttribute().getFill().isDefault()) { + // create invisible fill for HitTest appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - *getSdrLFSTAttribute().getFill(), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } else { - // if no fill, create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { + // create invisible line for HitTest/BoundRect appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - *getSdrLFSTAttribute().getLine())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolygonLinePrimitive( - getTail(), - getTransform(), - *getSdrLFSTAttribute().getLine(), - getSdrLFSTAttribute().getLineStartEnd())); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getTail()), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect. It - // is sufficient to use the tail; the body is already ensured with fill creation - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( - getTail(), + aUnitOutline, getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createPolygonLinePrimitive( + getTail(), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, @@ -128,9 +125,9 @@ namespace drawinglayer } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx index 0c39f7a6480f..a729f8fcfc7a 100644 --- a/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -51,34 +52,45 @@ namespace drawinglayer { Primitive2DSequence aRetval; - // prepare unit transform - ::basegfx::B2DHomMatrix aEmptyMatrix; - // add line - if(getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, *getSdrLSTAttribute().getLine(), getSdrLSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(getUnitPolygon()))); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(getUnitPolygon(), aEmptyMatrix, aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + getUnitPolygon(), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getLine(), + getSdrLSTAttribute().getLineStartEnd())); } // add text - if(getSdrLSTAttribute().getText()) + if(!getSdrLSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(getUnitPolygon()), aEmptyMatrix, *getSdrLSTAttribute().getText(), getSdrLSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(getUnitPolygon()), + basegfx::B2DHomMatrix(), + getSdrLSTAttribute().getText(), + getSdrLSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index 5b686bb5abae..3cf7b6415725 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -36,6 +36,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,21 +53,23 @@ namespace drawinglayer Primitive2DSequence aRetval(getSubPrimitives()); // add text - if(getSdrSTAttribute().getText()) + if(!getSdrSTAttribute().getText().isDefault()) { - const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - basegfx::B2DPolyPolygon(aUnitOutline), - getTextBox(), - *getSdrSTAttribute().getText(), - 0, - false, - getWordWrap(), - isForceTextClipToTextRange())); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTextBox(), + getSdrSTAttribute().getText(), + attribute::SdrLineAttribute(), + false, + getWordWrap(), + isForceTextClipToTextRange())); } // add shadow - if(aRetval.hasElements() && getSdrSTAttribute().getShadow()) + if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault()) { // #i105323# add generic shadow only for 2D shapes. For // 3D shapes shadow will be set at the individual created @@ -80,7 +83,7 @@ namespace drawinglayer // shadow will be correct (using ColorModifierStack), but expensive. if(!get3DShape()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow()); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 8474b72be2e4..db55e4588fea 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -31,12 +31,10 @@ #include "precompiled_svx.hxx" #include -#include #include -#include #include -#include -#include +#include +#include #include #include #include @@ -55,6 +53,10 @@ #include #include #include +#include +#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -70,25 +72,25 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrFillAttribute& rFill, - const attribute::FillGradientAttribute* pFillGradient) + const attribute::FillGradientAttribute& rFillGradient) { // prepare fully scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); BasePrimitive2D* pNewFillPrimitive = 0; - if(rFill.isGradient()) + if(!rFill.getGradient().isDefault()) { - pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, *rFill.getGradient()); + pNewFillPrimitive = new PolyPolygonGradientPrimitive2D(aScaledPolyPolygon, rFill.getGradient()); } - else if(rFill.isHatch()) + else if(!rFill.getHatch().isDefault()) { - pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), *rFill.getHatch()); + pNewFillPrimitive = new PolyPolygonHatchPrimitive2D(aScaledPolyPolygon, rFill.getColor(), rFill.getHatch()); } - else if(rFill.isBitmap()) + else if(!rFill.getBitmap().isDefault()) { const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap()->getFillBitmapAttribute(aRange)); + pNewFillPrimitive = new PolyPolygonBitmapPrimitive2D(aScaledPolyPolygon, rFill.getBitmap().getFillBitmapAttribute(aRange)); } else { @@ -100,9 +102,9 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rFill.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rFill.getTransparence())); } - else if(pFillGradient) + else if(!rFillGradient.isDefault()) { // create sequence with created fill primitive const Primitive2DReference xRefA(pNewFillPrimitive); @@ -111,11 +113,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(aScaledPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, *pFillGradient)); + const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); - // create AlphaPrimitive2D using alpha and content - return Primitive2DReference(new AlphaPrimitive2D(aContent, aAlpha)); + // create TransparencePrimitive2D using alpha and content + return Primitive2DReference(new TransparencePrimitive2D(aContent, aAlpha)); } else { @@ -128,7 +130,7 @@ namespace drawinglayer const basegfx::B2DPolygon& rUnitPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrLineAttribute& rLine, - const attribute::SdrLineStartEndAttribute* pStroke) + const attribute::SdrLineStartEndAttribute& rStroke) { // prepare fully scaled polygon basegfx::B2DPolygon aScaledPolygon(rUnitPolygon); @@ -139,10 +141,10 @@ namespace drawinglayer const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); BasePrimitive2D* pNewLinePrimitive = 0L; - if(!rUnitPolygon.isClosed() && pStroke) + if(!rUnitPolygon.isClosed() && !rStroke.isDefault()) { - attribute::LineStartEndAttribute aStart(pStroke->getStartWidth(), pStroke->getStartPolyPolygon(), pStroke->isStartCentered()); - attribute::LineStartEndAttribute aEnd(pStroke->getEndWidth(), pStroke->getEndPolyPolygon(), pStroke->isEndCentered()); + attribute::LineStartEndAttribute aStart(rStroke.getStartWidth(), rStroke.getStartPolyPolygon(), rStroke.isStartCentered()); + attribute::LineStartEndAttribute aEnd(rStroke.getEndWidth(), rStroke.getEndPolyPolygon(), rStroke.isEndCentered()); // create data pNewLinePrimitive = new PolygonStrokeArrowPrimitive2D(aScaledPolygon, aLineAttribute, aStrokeAttribute, aStart, aEnd); @@ -158,7 +160,7 @@ namespace drawinglayer // create simpleTransparencePrimitive, add created fill primitive const Primitive2DReference xRefA(pNewLinePrimitive); const Primitive2DSequence aContent(&xRefA, 1L); - return Primitive2DReference(new UnifiedAlphaPrimitive2D(aContent, rLine.getTransparence())); + return Primitive2DReference(new UnifiedTransparencePrimitive2D(aContent, rLine.getTransparence())); } else { @@ -171,7 +173,7 @@ namespace drawinglayer const basegfx::B2DPolyPolygon& rUnitPolyPolygon, const basegfx::B2DHomMatrix& rObjectTransform, const attribute::SdrTextAttribute& rText, - const attribute::SdrLineAttribute* pStroke, + const attribute::SdrLineAttribute& rStroke, bool bCellText, bool bWordWrap, bool bClipOnBounds) @@ -182,7 +184,7 @@ namespace drawinglayer if(rText.isContour()) { // contour text - if(pStroke && 0.0 != pStroke->getWidth()) + if(!rStroke.isDefault() && 0.0 != rStroke.getWidth()) { // take line width into account and shrink contour polygon accordingly // decompose to get scale @@ -197,7 +199,7 @@ namespace drawinglayer fabs(aScale.getX()), fabs(aScale.getY()))); // grow the polygon. To shrink, use negative value (half width) - aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(pStroke->getWidth() * 0.5)); + aScaledUnitPolyPolygon = basegfx::tools::growInNormalDirection(aScaledUnitPolyPolygon, -(rStroke.getWidth() * 0.5)); // scale back to unit polygon aScaledUnitPolyPolygon.transform(basegfx::tools::createScaleB2DHomMatrix( @@ -221,7 +223,7 @@ namespace drawinglayer rObjectTransform); } } - else if(rText.getSdrFormTextAttribute()) + else if(!rText.getSdrFormTextAttribute().isDefault()) { // text on path, use scaled polygon basegfx::B2DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); @@ -230,7 +232,7 @@ namespace drawinglayer &rText.getSdrText(), rText.getOutlinerParaObject(), aScaledPolyPolygon, - *rText.getSdrFormTextAttribute()); + rText.getSdrFormTextAttribute()); } else { @@ -327,7 +329,7 @@ namespace drawinglayer if(rText.isScroll()) { // suppress scroll when FontWork - if(!rText.getSdrFormTextAttribute()) + if(rText.getSdrFormTextAttribute().isDefault()) { // get scroll direction const SdrTextAniDirection eDirection(rText.getSdrText().GetObject().GetTextAniDirection()); @@ -468,7 +470,7 @@ namespace drawinglayer const Primitive2DSequence aTempContent(&aRetval[0], 1); aRetval[0] = Primitive2DReference( - new UnifiedAlphaPrimitive2D( + new UnifiedTransparencePrimitive2D( aTempContent, rShadow.getTransparence())); } diff --git a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx index 1327d2a422fa..302eabecbdf9 100644 --- a/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx @@ -36,10 +36,9 @@ #include #include #include -#include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -59,52 +58,73 @@ namespace drawinglayer // Do use createPolygonFromUnitCircle, but let create from first quadrant to mimic old geometry creation. // This is needed to have the same look when stroke is used since the polygon start point defines the // stroke start, too. - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitCircle(1)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitCircle(1)); // scale and move UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - const basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipsePrimitive2D::SdrEllipsePrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), @@ -142,7 +162,7 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - ::basegfx::B2DPolygon aUnitOutline(::basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromUnitEllipseSegment(mfStartAngle, mfEndAngle)); if(mbCloseSegment) { @@ -150,57 +170,77 @@ namespace drawinglayer { // for compatibility, insert the center point at polygon start to get the same // line stroking pattern as the old painting mechanisms. - aUnitOutline.insert(0L, ::basegfx::B2DPoint(0.0, 0.0)); + aUnitOutline.insert(0L, basegfx::B2DPoint(0.0, 0.0)); } aUnitOutline.setClosed(true); } // move and scale UnitEllipse to UnitObject (-1,-1 1,1) -> (0,0 1,1) - basegfx::B2DHomMatrix aUnitCorrectionMatrix(basegfx::tools::createTranslateB2DHomMatrix(1.0, 1.0)); - aUnitCorrectionMatrix.scale(0.5, 0.5); + const basegfx::B2DHomMatrix aUnitCorrectionMatrix( + basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 0.5, 0.5, 0.5)); // apply to the geometry aUnitOutline.transform(aUnitCorrectionMatrix); // add fill - if(getSdrLFSTAttribute().getFill() && aUnitOutline.isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() && aUnitOutline.isClosed()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd())); + // create invisible line for HitTest/BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(::basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; } SdrEllipseSegmentPrimitive2D::SdrEllipseSegmentPrimitive2D( - const ::basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DHomMatrix& rTransform, const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, double fStartAngle, double fEndAngle, diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index befff1b0c539..d83fa53f812e 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -36,7 +36,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -49,21 +50,25 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill, but only when graphic ist transparent - if(getSdrLFSTAttribute().getFill() && isTransparent()) + if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -71,46 +76,61 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } - else - { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); - } // add graphic content if(255L != getGraphicAttr().GetTransparency()) { - Primitive2DReference xGraphicContentPrimitive(new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr())); + const Primitive2DReference xGraphicContentPrimitive( + new GraphicPrimitive2D( + getTransform(), + getGraphicObject(), + getGraphicAttr())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xGraphicContentPrimitive); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index e22e9eb61c5b..ebac828bb9d5 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -60,36 +60,44 @@ namespace drawinglayer bool bLeftActive, bool bRightActive) const { - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); basegfx::B2DPolygon aPolygon; aPolygon.append(rStart); aPolygon.append(rEnd); - if(!pLineStartEnd || (!bLeftActive && !bRightActive)) + if(rLineStartEnd.isDefault() || (!bLeftActive && !bRightActive)) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, 0); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + attribute::SdrLineStartEndAttribute()); } if(bLeftActive && bRightActive) { - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, pLineStartEnd); + return createPolygonLinePrimitive( + aPolygon, + rObjectMatrix, + rLineAttribute, + rLineStartEnd); } const basegfx::B2DPolyPolygon aEmpty; const attribute::SdrLineStartEndAttribute aLineStartEnd( - bLeftActive ? pLineStartEnd->getStartPolyPolygon() : aEmpty, bRightActive ? pLineStartEnd->getEndPolyPolygon() : aEmpty, - bLeftActive ? pLineStartEnd->getStartWidth() : 0.0, bRightActive ? pLineStartEnd->getEndWidth() : 0.0, - bLeftActive ? pLineStartEnd->isStartActive() : false, bRightActive ? pLineStartEnd->isEndActive() : false, - bLeftActive ? pLineStartEnd->isStartCentered() : false, bRightActive? pLineStartEnd->isEndCentered() : false); + bLeftActive ? rLineStartEnd.getStartPolyPolygon() : aEmpty, bRightActive ? rLineStartEnd.getEndPolyPolygon() : aEmpty, + bLeftActive ? rLineStartEnd.getStartWidth() : 0.0, bRightActive ? rLineStartEnd.getEndWidth() : 0.0, + bLeftActive ? rLineStartEnd.isStartActive() : false, bRightActive ? rLineStartEnd.isEndActive() : false, + bLeftActive ? rLineStartEnd.isStartCentered() : false, bRightActive? rLineStartEnd.isEndCentered() : false); - return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, &aLineStartEnd); + return createPolygonLinePrimitive(aPolygon, rObjectMatrix, rLineAttribute, aLineStartEnd); } Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - SdrBlockTextPrimitive2D* pBlockText = 0L; + SdrBlockTextPrimitive2D* pBlockText = 0; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -97,11 +105,13 @@ namespace drawinglayer const double fDistance(aLine.getLength()); const double fAngle(atan2(aLine.getY(), aLine.getX())); bool bAutoUpsideDown(false); - const attribute::SdrTextAttribute* pTextAttribute = getSdrLSTAttribute().getText(); + const attribute::SdrTextAttribute rTextAttribute = getSdrLSTAttribute().getText(); const basegfx::B2DHomMatrix aObjectMatrix( basegfx::tools::createShearXRotateTranslateB2DHomMatrix(0.0, fAngle, getStart())); - if(pTextAttribute) + // preapare text, but do not add yet; it needs to be aligned to + // the line geometry + if(!rTextAttribute.isDefault()) { basegfx::B2DHomMatrix aTextMatrix; double fTestAngle(fAngle); @@ -127,58 +137,52 @@ namespace drawinglayer // create primitive and get text range pBlockText = new SdrBlockTextPrimitive2D( - &pTextAttribute->getSdrText(), - pTextAttribute->getOutlinerParaObject(), + &rTextAttribute.getSdrText(), + rTextAttribute.getOutlinerParaObject(), aTextMatrix, SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER, - pTextAttribute->isScroll(), + rTextAttribute.isScroll(), false, false, false, false); + aTextRange = pBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result - const attribute::SdrLineAttribute* pLineAttribute(getSdrLSTAttribute().getLine()); - - if(!pLineAttribute) - { - // if initially no line is defined, create one for HitTest and BoundRect - pLineAttribute = new attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)); - } - { + const attribute::SdrLineAttribute rLineAttribute(getSdrLSTAttribute().getLine()); bool bArrowsOutside(false); bool bMainLineSplitted(false); - const attribute::SdrLineStartEndAttribute* pLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); + const attribute::SdrLineStartEndAttribute& rLineStartEnd = getSdrLSTAttribute().getLineStartEnd(); double fStartArrowW(0.0); double fStartArrowH(0.0); double fEndArrowW(0.0); double fEndArrowH(0.0); - if(pLineStartEnd) + if(!rLineStartEnd.isDefault()) { - if(pLineStartEnd->isStartActive()) + if(rLineStartEnd.isStartActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getStartPolyPolygon())); - fStartArrowW = pLineStartEnd->getStartWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getStartPolyPolygon())); + fStartArrowW = rLineStartEnd.getStartWidth(); fStartArrowH = aArrowRange.getHeight() * fStartArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isStartCentered()) + if(rLineStartEnd.isStartCentered()) { fStartArrowH *= 0.5; } } - if(pLineStartEnd->isEndActive()) + if(rLineStartEnd.isEndActive()) { - const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(pLineStartEnd->getEndPolyPolygon())); - fEndArrowW = pLineStartEnd->getEndWidth(); + const basegfx::B2DRange aArrowRange(basegfx::tools::getRange(rLineStartEnd.getEndPolyPolygon())); + fEndArrowW = rLineStartEnd.getEndWidth(); fEndArrowH = aArrowRange.getHeight() * fEndArrowW / aArrowRange.getWidth(); - if(pLineStartEnd->isEndCentered()) + if(rLineStartEnd.isEndCentered()) { fEndArrowH *= 0.5; } @@ -187,7 +191,7 @@ namespace drawinglayer const double fSpaceNeededByArrows(fStartArrowH + fEndArrowH + ((fStartArrowW + fEndArrowW) * 0.5)); const double fArrowsOutsideLen((fStartArrowH + fEndArrowH + fStartArrowW + fEndArrowW) * 0.5); - const double fHalfLineWidth(pLineAttribute->getWidth() * 0.5); + const double fHalfLineWidth(rLineAttribute.getWidth() * 0.5); if(fSpaceNeededByArrows > fDistance) { @@ -279,12 +283,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainLeftLeft(aMainLeft.getX() - fLenLeft, aMainLeft.getY()); const basegfx::B2DPoint aMainRightRight(aMainRight.getX() + fLenRight, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeftLeft, aMainLeft, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainRight, aMainRightRight, true, false)); if(!bMainLineSplitted || MEASURETEXTPOSITION_CENTERED != eHorizontal) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(* pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, false, false)); } } else @@ -295,12 +299,12 @@ namespace drawinglayer const basegfx::B2DPoint aMainInnerLeft(aMainLeft.getX() + fHalfLength, aMainLeft.getY()); const basegfx::B2DPoint aMainInnerRight(aMainRight.getX() - fHalfLength, aMainRight.getY()); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainInnerLeft, true, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainInnerRight, aMainRight, false, true)); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aMainLeft, aMainRight, true, true)); } } @@ -313,13 +317,13 @@ namespace drawinglayer const basegfx::B2DPoint aLeftUp(0.0, fTopEdge); const basegfx::B2DPoint aLeftDown(0.0, fBottomLeft); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aLeftDown, aLeftUp, false, false)); // right help line const basegfx::B2DPoint aRightUp(fDistance, fTopEdge); const basegfx::B2DPoint aRightDown(fDistance, fBottomRight); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(*pLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, impCreatePart(rLineAttribute, aObjectMatrix, aRightDown, aRightUp, false, false)); // text horizontal position if(MEASURETEXTPOSITION_NEGATIVE == eHorizontal) @@ -333,9 +337,9 @@ namespace drawinglayer fTextX -= (fArrowsOutsideLen - fStartArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX -= pTextAttribute->getTextRightDistance(); + fTextX -= rTextAttribute.getTextRightDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eHorizontal) @@ -349,9 +353,9 @@ namespace drawinglayer fTextX += (fArrowsOutsideLen - fEndArrowH); } - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += pTextAttribute->getTextLeftDistance(); + fTextX += rTextAttribute.getTextLeftDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -359,9 +363,9 @@ namespace drawinglayer // centered fTextX = aMainLeft.getX() + ((fDistance - aTextRange.getWidth()) * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextX += (pTextAttribute->getTextLeftDistance() - pTextAttribute->getTextRightDistance()) / 2L; + fTextX += (rTextAttribute.getTextLeftDistance() - rTextAttribute.getTextRightDistance()) / 2L; } } @@ -372,9 +376,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() - (aTextRange.getHeight() + fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY -= pTextAttribute->getTextLowerDistance(); + fTextY -= rTextAttribute.getTextLowerDistance(); } } else if(MEASURETEXTPOSITION_POSITIVE == eVertical) @@ -383,9 +387,9 @@ namespace drawinglayer const double fSmall(fArrowsOutsideLen * 0.10); fTextY = aMainLeft.getY() + (fSmall + fHalfLineWidth); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += pTextAttribute->getTextUpperDistance(); + fTextY += rTextAttribute.getTextUpperDistance(); } } else // MEASURETEXTPOSITION_CENTERED @@ -393,21 +397,19 @@ namespace drawinglayer // centered fTextY = aMainLeft.getY() - (aTextRange.getHeight() * 0.5); - if(pTextAttribute) + if(!rTextAttribute.isDefault()) { - fTextY += (pTextAttribute->getTextUpperDistance() - pTextAttribute->getTextLowerDistance()) / 2L; + fTextY += (rTextAttribute.getTextUpperDistance() - rTextAttribute.getTextLowerDistance()) / 2L; } } } - if(!getSdrLSTAttribute().getLine()) + if(getSdrLSTAttribute().getLine().isDefault()) { - // embed line geometry to invisible line group - const Primitive2DReference xHiddenLines(new HitTestPrimitive2D(aRetval)); - aRetval = Primitive2DSequence(&xHiddenLines, 1); + // embed line geometry to invisible (100% transparent) line group for HitTest + const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(aRetval)); - // delete temporary LineAttribute again - delete pLineAttribute; + aRetval = Primitive2DSequence(&xHiddenLines, 1); } if(pBlockText) @@ -437,9 +439,11 @@ namespace drawinglayer } // add shadow - if(getSdrLSTAttribute().getShadow()) + if(!getSdrLSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index bf2df22fb2e6..cb9cb8bf3546 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -84,23 +85,29 @@ namespace drawinglayer Primitive2DSequence aRetval; // create unit outline polygon - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon()); // add fill - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getFill()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line // #i97981# condition was inverse to purpose. When being compatible to paint version, // border needs to be suppressed - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getLine().isDefault()) { // if line width is given, polygon needs to be grown by half of it to make the // outline to be outside of the bitmap - if(0.0 != getSdrLFSTAttribute().getLine()->getWidth()) + if(0.0 != getSdrLFSTAttribute().getLine().getWidth()) { // decompose to get scale basegfx::B2DVector aScale, aTranslate; @@ -108,27 +115,37 @@ namespace drawinglayer getTransform().decompose(aScale, aTranslate, fRotate, fShearX); // create expanded range (add relative half line width to unit rectangle) - double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5); + double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5); double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0); double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0); const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY); basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aExpandedUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolygonLinePrimitive( + aUnitOutline, + getTransform(), + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } } else { // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - const Primitive2DReference xHiddenLineReference(createPolygonLinePrimitive(aUnitOutline, getTransform(), aBlackHairline)); - const Primitive2DSequence xHiddenLineSequence(&xHiddenLineReference, 1); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add graphic content @@ -136,15 +153,26 @@ namespace drawinglayer // add text, no need to supress to stay compatible since text was // always supported by the old paints, too - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getShadow()) + if(!bBehaveCompatibleToPaintVersion + && !getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx index d46ab7b4b14d..ea7ed0c808d1 100644 --- a/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx @@ -138,7 +138,7 @@ namespace drawinglayer if(aColor.bIsVisible) { - basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); const Color aVclColor(aColor.nColor); aOutline.transform(getObjectTransform()); const drawinglayer::primitive2d::Primitive2DReference xOutline( diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index 39f3efc617f5..6b9da51e3b68 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -35,7 +35,7 @@ #include #include #include -#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -52,50 +52,67 @@ namespace drawinglayer Primitive2DSequence aRetval; // add fill - if(getSdrLFSTAttribute().getFill() && getUnitPolyPolygon().isClosed()) + if(!getSdrLFSTAttribute().getFill().isDefault() + && getUnitPolyPolygon().isClosed()) { // take care for orientations - basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon(basegfx::tools::correctOrientations(getUnitPolyPolygon())); - - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive(aOrientedUnitPolyPolygon, getTransform(), *getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); + const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( + basegfx::tools::correctOrientations(getUnitPolyPolygon())); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aOrientedUnitPolyPolygon, + getTransform(), + getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFillFloatTransGradient())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(getSdrLFSTAttribute().getLine().isDefault()) { - Primitive2DSequence aTemp(getUnitPolyPolygon().count()); - - for(sal_uInt32 a(0L); a < getUnitPolyPolygon().count(); a++) - { - aTemp[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), *getSdrLFSTAttribute().getLine(), getSdrLFSTAttribute().getLineStartEnd()); - } - - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); + // if initially no line is defined, create one for HitTest and BoundRect + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + false, + getUnitPolyPolygon(), + getTransform())); } else { - // if initially no line is defined, create one for HitTest and BoundRect - const attribute::SdrLineAttribute aBlackHairline(basegfx::BColor(0.0, 0.0, 0.0)); - Primitive2DSequence xHiddenLineSequence(getUnitPolyPolygon().count()); + Primitive2DSequence aTemp(getUnitPolyPolygon().count()); for(sal_uInt32 a(0); a < getUnitPolyPolygon().count(); a++) { - xHiddenLineSequence[a] = createPolygonLinePrimitive(getUnitPolyPolygon().getB2DPolygon(a), getTransform(), aBlackHairline); + aTemp[a] = createPolygonLinePrimitive( + getUnitPolyPolygon().getB2DPolygon(a), + getTransform(), + getSdrLFSTAttribute().getLine(), + getSdrLFSTAttribute().getLineStartEnd()); } - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(new HitTestPrimitive2D(xHiddenLineSequence))); + appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemp); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(getUnitPolyPolygon(), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + getUnitPolyPolygon(), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index 25b39ebb07d5..dd3c602266f7 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -33,10 +33,6 @@ #include #include #include -#include -#include -#include -#include #include ////////////////////////////////////////////////////////////////////////////// @@ -177,19 +173,6 @@ namespace drawinglayer return aRetVal.get() ? *aRetVal.get() : BitmapEx(); } - // #i99123# - Primitive2DReference createFallbackHitTestPrimitive(const basegfx::B2DHomMatrix& rMatrix) - { - // create PolygonHairlinePrimitive2D - basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); - aUnitOutline.transform(rMatrix); - const basegfx::BColor aBlack(0.0, 0.0, 0.0); - const Primitive2DReference xReference(new PolygonHairlinePrimitive2D(aUnitOutline, aBlack)); - - // create HitTestPrimitive2D with it - const Primitive2DSequence xSequence(&xReference, 1); - return Primitive2DReference(new HitTestPrimitive2D(xSequence)); - } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx index 93ed597cb0a3..94da69bc7323 100644 --- a/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx @@ -35,7 +35,8 @@ #include #include #include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +51,6 @@ namespace drawinglayer Primitive2DSequence SdrRectanglePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DSequence aRetval; - Primitive2DSequence aHitTestContent; // create unit outline polygon const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createPolygonFromRect( @@ -59,64 +59,67 @@ namespace drawinglayer getCornerRadiusY())); // add fill - if(getSdrLFSTAttribute().getFill()) + if(!getSdrLFSTAttribute().getFill().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), - *getSdrLFSTAttribute().getFill(), + getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); } else if(getForceFillForHitTest()) { // if no fill and it's a text frame, create a fill for HitTest and // BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolyPolygonFillPrimitive( + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, basegfx::B2DPolyPolygon(aUnitOutline), - getTransform(), - attribute::SdrFillAttribute(0.0, basegfx::BColor(0.0, 0.0, 0.0)), - getSdrLFSTAttribute().getFillFloatTransGradient())); + getTransform())); } // add line - if(getSdrLFSTAttribute().getLine()) + if(!getSdrLFSTAttribute().getLine().isDefault()) { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive( aUnitOutline, getTransform(), - *getSdrLFSTAttribute().getLine())); + getSdrLFSTAttribute().getLine(), + attribute::SdrLineStartEndAttribute())); } else if(!getForceFillForHitTest()) { // if initially no line is defined and it's not a text frame, create // a line for HitTest and BoundRect - appendPrimitive2DReferenceToPrimitive2DSequence(aHitTestContent, - createPolygonLinePrimitive( - aUnitOutline, - getTransform(), - attribute::SdrLineAttribute(basegfx::BColor(0.0, 0.0, 0.0)))); - } - - // add HitTest and BoundRect helper geometry (if exists) - if(aHitTestContent.hasElements()) - { appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - Primitive2DReference(new HitTestPrimitive2D(aHitTestContent))); + createHiddenGeometryPrimitives2D( + false, + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform())); } // add text - if(getSdrLFSTAttribute().getText()) + if(!getSdrLFSTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(), *getSdrLFSTAttribute().getText(), getSdrLFSTAttribute().getLine(), false, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + basegfx::B2DPolyPolygon(aUnitOutline), + getTransform(), + getSdrLFSTAttribute().getText(), + getSdrLFSTAttribute().getLine(), + false, + false, + false)); } // add shadow - if(getSdrLFSTAttribute().getShadow()) + if(!getSdrLFSTAttribute().getShadow().isDefault()) { - aRetval = createEmbeddedShadowPrimitive(aRetval, *getSdrLFSTAttribute().getShadow()); + aRetval = createEmbeddedShadowPrimitive( + aRetval, + getSdrLFSTAttribute().getShadow()); } return aRetval; diff --git a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx index 6f997a2658ef..038226c2e06d 100644 --- a/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx +++ b/svx/source/sdr/primitive3d/sdrattributecreator3d.cxx @@ -34,8 +34,11 @@ #include #include #include -#include +#include +#include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx new file mode 100644 index 000000000000..b2a103bd8cfc --- /dev/null +++ b/svx/source/sdr/properties/oleproperties.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicproperties.cxx,v $ + * $Revision: 1.12.76.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace properties + { + OleProperties::OleProperties(SdrObject& rObj) + : RectangleProperties(rObj) + { + } + + OleProperties::OleProperties(const OleProperties& rProps, SdrObject& rObj) + : RectangleProperties(rProps, rObj) + { + } + + OleProperties::~OleProperties() + { + } + + BaseProperties& OleProperties::Clone(SdrObject& rObj) const + { + return *(new OleProperties(*this, rObj)); + } + + void OleProperties::ForceDefaultAttributes() + { + // call parent + RectangleProperties::ForceDefaultAttributes(); + + // force ItemSet + GetObjectItemSet(); + + // #i108221# + mpItemSet->Put( XFillStyleItem(XFILL_NONE) ); + mpItemSet->Put( XLineStyleItem(XLINE_NONE) ); + } + } // end of namespace properties +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 826e87520ce3..dd3006ba9a6d 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -69,7 +69,7 @@ #include #include #include -#include +#include #include #include "svditer.hxx" #include @@ -78,13 +78,14 @@ #include #include #include -#include #include #include #include #include #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -726,8 +727,8 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(aResultTransparent.hasElements()) { - drawinglayer::primitive2d::Primitive2DReference aUnifiedAlphaPrimitive2D(new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(aResultTransparent, 0.5)); - aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedAlphaPrimitive2D, 1); + drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5)); + aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1); sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent); rOverlayManager.add(*pNewOverlayObject); @@ -825,35 +826,22 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla if(getSolidDraggingActive()) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); - drawinglayer::attribute::SdrLineAttribute* pLine = drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet); - drawinglayer::attribute::SdrLineStartEndAttribute* pLineStartEnd = 0; + const drawinglayer::attribute::SdrLineAttribute aLine( + drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet)); - if(pLine && !pLine->isVisible()) + if(!aLine.isDefault()) { - delete pLine; - pLine = 0; - } - - if(pLine) - { - pLineStartEnd = drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rItemSet, pLine->getWidth()); - - if(pLineStartEnd && !pLineStartEnd->isVisible()) - { - delete pLineStartEnd; - pLineStartEnd = 0; - } + const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd( + drawinglayer::primitive2d::createNewSdrLineStartEndAttribute( + rItemSet, + aLine.getWidth())); drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive( - aEdgePolygon, basegfx::B2DHomMatrix(), *pLine, pLineStartEnd)); - - if(pLineStartEnd) - { - delete pLineStartEnd; - } - - delete pLine; + aEdgePolygon, + basegfx::B2DHomMatrix(), + aLine, + aLineStartEnd)); } } else diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index b95c13864776..5e0dfbced62c 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -808,16 +808,101 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { - if (GetMarkedObjectCount()) { - BrkAction(); - //HMHHideMarkHdl(); - BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + // moved breaking action and undo start outside loop + BrkAction(); + BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); + + // remove as long as something is selected. This allows to schedule objects for + // removal for a next run as needed + while(GetMarkedObjectCount()) + { + // vector to remember the parents which may be empty after object removal + std::vector< SdrObject* > aParents; + + { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const sal_uInt32 nCount(rMarkList.GetMarkCount()); + sal_uInt32 a(0); + + for(a = 0; a < nCount; a++) + { + // in the first run, add all found parents, but only once + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); + + if(pParent) + { + if(aParents.size()) + { + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pParent); + + if(aFindResult == aParents.end()) + { + aParents.push_back(pParent); + } + } + else + { + aParents.push_back(pParent); + } + } + } + + if(aParents.size()) + { + // in a 2nd run, remove all objects which may already be scheduled for + // removal. I am not sure if this can happen, but theoretically + // a to-be-removed object may already be the group/3DScene itself + for(a = 0; a < nCount; a++) + { + SdrMark* pMark = rMarkList.GetMark(a); + SdrObject* pObject = pMark->GetMarkedSdrObj(); + + std::vector< SdrObject* >::iterator aFindResult = + std::find(aParents.begin(), aParents.end(), pObject); + + if(aFindResult != aParents.end()) + { + aParents.erase(aFindResult); + } + } + } + } + + // original stuff: remove selected objects. Handle clear will + // do something only once DeleteMarkedList(GetMarkedObjectList()); GetMarkedObjectListWriteAccess().Clear(); aHdl.Clear(); - EndUndo(); - MarkListHasChanged(); + + while(aParents.size() && !GetMarkedObjectCount()) + { + // iterate over remembered parents + SdrObject* pParent = aParents.back(); + aParents.pop_back(); + + if(pParent->GetSubList() && 0 == pParent->GetSubList()->GetObjCount()) + { + // we detected an empty parent, a candidate to leave group/3DScene + // if entered + if(GetSdrPageView()->GetAktGroup() + && GetSdrPageView()->GetAktGroup() == pParent) + { + GetSdrPageView()->LeaveOneGroup(); + } + + // schedule empty parent for removal + GetMarkedObjectListWriteAccess().InsertEntry( + SdrMark(pParent, GetSdrPageView())); + } + } } + + // end undo and change messaging moved at the end + EndUndo(); + MarkListHasChanged(); } void SdrEditView::CopyMarkedObj() diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index be3529ea4818..7c3575e786dd 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -846,7 +846,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons } // geometry access -::basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const +basegfx::B2DPolygon SdrCaptionObj::getTailPolygon() const { return aTailPoly.getB2DPolygon(); } diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index ea29c860e8ab..20587f715c81 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -166,6 +166,12 @@ void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const } +void SdrObjGroup::SetBoundRectDirty() +{ + // avoid resetting aOutRect which in case of this object is model data, + // not re-creatable view data +} + UINT16 SdrObjGroup::GetObjIdentifier() const { return UINT16(OBJ_GRUP); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index dfad9824a8fd..02ec537c19b9 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -79,6 +79,7 @@ inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); } #include #include #include +#include using namespace sdr; @@ -2744,13 +2745,10 @@ SdrObject* SdrPathObj::RipPoint(sal_uInt32 nHdlNum, sal_uInt32& rNewPt0Index) SdrObject* SdrPathObj::DoConvertToPolyObj(BOOL bBezier) const { // #i89784# check for FontWork with activated HideContour - bool bHideContour(false); - - { - drawinglayer::attribute::SdrTextAttribute* pText = drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0)); - bHideContour = pText && pText->getSdrFormTextAttribute() && pText->isHideContour(); - delete pText; - } + const drawinglayer::attribute::SdrTextAttribute aText( + drawinglayer::primitive2d::createNewSdrTextAttribute(GetObjectItemSet(), *getText(0))); + const bool bHideContour( + !aText.isDefault() && !aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour()); SdrObject* pRet = bHideContour ? 0 : diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 6522feb7a2b8..e7fc3d771a5b 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -66,7 +66,7 @@ #include #include #include -#include +#include #include #include #include @@ -230,7 +230,7 @@ namespace { class impPolygonParagraphHandler { - const drawinglayer::attribute::SdrFormTextAttribute& mrSdrFormTextAttribute; // FormText parameters + const drawinglayer::attribute::SdrFormTextAttribute maSdrFormTextAttribute; // FormText parameters std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrDecomposition; // destination primitive list std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& mrShadowDecomposition; // destination primitive list for shadow Reference < com::sun::star::i18n::XBreakIterator > mxBreak; // break iterator @@ -273,7 +273,7 @@ namespace const drawinglayer::attribute::SdrFormTextAttribute& rSdrFormTextAttribute, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rDecomposition, std::vector< drawinglayer::primitive2d::BasePrimitive2D* >& rShadowDecomposition) - : mrSdrFormTextAttribute(rSdrFormTextAttribute), + : maSdrFormTextAttribute(rSdrFormTextAttribute), mrDecomposition(rDecomposition), mrShadowDecomposition(rShadowDecomposition) { @@ -297,18 +297,18 @@ namespace double fPolyStart(0.0); double fScaleFactor(1.0); - if(mrSdrFormTextAttribute.getFormTextMirror()) + if(maSdrFormTextAttribute.getFormTextMirror()) { aPolygonCandidate.flip(); } - if(mrSdrFormTextAttribute.getFormTextStart() - && (XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust() - || XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust())) + if(maSdrFormTextAttribute.getFormTextStart() + && (XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust() + || XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust())) { - if(XFT_LEFT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT == maSdrFormTextAttribute.getFormTextAdjust()) { - fPolyStart += mrSdrFormTextAttribute.getFormTextStart(); + fPolyStart += maSdrFormTextAttribute.getFormTextStart(); if(fPolyStart > fPolyEnd) { @@ -317,7 +317,7 @@ namespace } else { - fPolyEnd -= mrSdrFormTextAttribute.getFormTextStart(); + fPolyEnd -= maSdrFormTextAttribute.getFormTextStart(); if(fPolyEnd < fPolyStart) { @@ -326,7 +326,7 @@ namespace } } - if(XFT_LEFT != mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_LEFT != maSdrFormTextAttribute.getFormTextAdjust()) { // calculate total text length of this paragraph, some layout needs to be done const double fParagraphTextLength(getParagraphTextLength(rTextPortions)); @@ -335,7 +335,7 @@ namespace // but still take care of XFT_AUTOSIZE in that case const bool bTextTooLong(fParagraphTextLength > (fPolyEnd - fPolyStart)); - if(XFT_RIGHT == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_RIGHT == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -343,7 +343,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength); } } - else if(XFT_CENTER == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_CENTER == maSdrFormTextAttribute.getFormTextAdjust()) { if(!bTextTooLong) { @@ -351,7 +351,7 @@ namespace fPolyStart += ((fPolyEnd - fPolyStart) - fParagraphTextLength) / 2.0; } } - else if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + else if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) @@ -386,7 +386,7 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand portion length fPortionLength *= fScaleFactor; @@ -401,27 +401,27 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == mrSdrFormTextAttribute.getFormTextAdjust()) + if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) { // when scaling, expand text primitive scaling aNewTransformA.scale(fScaleFactor, fScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition - const bool bShadow(XFTSHADOW_NONE != mrSdrFormTextAttribute.getFormTextShadow()); + const bool bShadow(XFTSHADOW_NONE != maSdrFormTextAttribute.getFormTextShadow()); if(bShadow) { - if(XFTSHADOW_NORMAL == mrSdrFormTextAttribute.getFormTextShadow()) + if(XFTSHADOW_NORMAL == maSdrFormTextAttribute.getFormTextShadow()) { aNewShadowTransform.translate( - mrSdrFormTextAttribute.getFormTextShdwXVal(), - -mrSdrFormTextAttribute.getFormTextShdwYVal()); + maSdrFormTextAttribute.getFormTextShdwXVal(), + -maSdrFormTextAttribute.getFormTextShdwYVal()); } else // XFTSHADOW_SLANT { - double fScaleValue(mrSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); - double fShearValue(-mrSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); + double fScaleValue(maSdrFormTextAttribute.getFormTextShdwYVal() / 100.0); + double fShearValue(-maSdrFormTextAttribute.getFormTextShdwXVal() * F_PI1800); aNewShadowTransform.scale(1.0, fScaleValue); aNewShadowTransform.shearX(sin(fShearValue)); @@ -429,7 +429,7 @@ namespace } } - switch(mrSdrFormTextAttribute.getFormTextStyle()) + switch(maSdrFormTextAttribute.getFormTextStyle()) { case XFT_ROTATE : { @@ -487,7 +487,7 @@ namespace } // distance from path? - if(mrSdrFormTextAttribute.getFormTextDistance()) + if(maSdrFormTextAttribute.getFormTextDistance()) { if(aEndPos.equal(aStartPos)) { @@ -497,7 +497,7 @@ namespace // use back vector (aStartPos - aEndPos) here to get mirrored perpendicular as in old stuff const basegfx::B2DVector aPerpendicular( basegfx::getNormalizedPerpendicular(aStartPos - aEndPos) * - mrSdrFormTextAttribute.getFormTextDistance()); + maSdrFormTextAttribute.getFormTextDistance()); aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } @@ -506,7 +506,7 @@ namespace { if(pCandidate->getText().Len() && nNextGlyphLen) { - const Color aShadowColor(mrSdrFormTextAttribute.getFormTextShdwColor()); + const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); const ::std::vector< double > aNewDXArray( @@ -627,7 +627,7 @@ namespace { if(rOutlineAttribute.getTransparence()) { - // create UnifiedAlphaPrimitive2D + // create UnifiedTransparencePrimitive2D drawinglayer::primitive2d::Primitive2DSequence aStrokePrimitiveSequence(nStrokeCount); for(sal_uInt32 b(0L); b < nStrokeCount; b++) @@ -635,8 +635,8 @@ namespace aStrokePrimitiveSequence[b] = drawinglayer::primitive2d::Primitive2DReference(aStrokePrimitives[b]); } - drawinglayer::primitive2d::UnifiedAlphaPrimitive2D* pNew2 = - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( + drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 = + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aStrokePrimitiveSequence, (double)rOutlineAttribute.getTransparence() / 100.0); aNewPrimitives.push_back(pNew2); @@ -716,7 +716,9 @@ void SdrTextObj::impDecomposePathTextPrimitive( std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aRegularDecomposition; std::vector< drawinglayer::primitive2d::BasePrimitive2D* > aShadowDecomposition; impPolygonParagraphHandler aPolygonParagraphHandler( - rFormTextAttribute, aRegularDecomposition, aShadowDecomposition); + rFormTextAttribute, + aRegularDecomposition, + aShadowDecomposition); sal_uInt32 a; for(a = 0L; a < nLoopCount; a++) @@ -755,10 +757,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add shadow outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getShadowOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getShadowOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aShadowDecomposition, *rFormTextAttribute.getShadowOutline())); + impAddPathTextOutlines( + aShadowDecomposition, + rFormTextAttribute.getShadowOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalA, aOutlines); } } @@ -774,10 +780,14 @@ void SdrTextObj::impDecomposePathTextPrimitive( } // evtl. add outlines - if(rFormTextAttribute.getFormTextOutline() && rFormTextAttribute.getOutline()) + if(rFormTextAttribute.getFormTextOutline() + && !rFormTextAttribute.getOutline().isDefault()) { const drawinglayer::primitive2d::Primitive2DSequence aOutlines( - impAddPathTextOutlines(aRegularDecomposition, *rFormTextAttribute.getOutline())); + impAddPathTextOutlines( + aRegularDecomposition, + rFormTextAttribute.getOutline())); + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetvalB, aOutlines); } } diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 72e10e29c336..2c2e1bb9df83 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,10 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in HitTest primitive to support HitTest of this overlay object + // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest + // of this overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::HitTestPrimitive2D(aSequence)); + new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index e4e515ed1613..b4a941413e70 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -37,19 +37,20 @@ #include #include #include -#include #include #include #include -#include #include -#include #include #include -#include #include #include #include +#include +#include +#include +#include +#include #include "cell.hxx" #include "tablelayouter.hxx" @@ -99,31 +100,44 @@ namespace drawinglayer { Primitive2DSequence aRetval; - if(getSdrFTAttribute().getFill() || getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getFill().isDefault() + || !getSdrFTAttribute().getText().isDefault()) { // prepare unit polygon - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)); + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); // add fill - if(getSdrFTAttribute().getFill()) + if(!getSdrFTAttribute().getFill().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); } // add text - if(getSdrFTAttribute().getText()) + if(!getSdrFTAttribute().getText().isDefault()) { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - *getSdrFTAttribute().getText(), - 0, - true, false, false)); + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } } @@ -539,14 +553,13 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfTableObj::createViewIndependentPrimitive2DSequence() const { - drawinglayer::primitive2d::Primitive2DSequence xRetval; const sdr::table::SdrTableObj& rTableObj = GetTableObj(); const uno::Reference< com::sun::star::table::XTable > xTable = rTableObj.getTable(); - const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); if(xTable.is()) { // create primitive representation for table + drawinglayer::primitive2d::Primitive2DSequence xRetval; const sal_Int32 nRowCount(xTable->getRowCount()); const sal_Int32 nColCount(xTable->getColumnCount()); const sal_Int32 nAllCount(nRowCount * nColCount); @@ -599,7 +612,7 @@ namespace sdr const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); const sal_uInt32 nTextIndex(nColCount * aCellPos.mnRow + aCellPos.mnCol); const SdrText* pSdrText = rTableObj.getText(nTextIndex); - drawinglayer::attribute::SdrFillTextAttribute* pAttribute = 0; + drawinglayer::attribute::SdrFillTextAttribute aAttribute; if(pSdrText) { @@ -609,7 +622,7 @@ namespace sdr const sal_Int32 nUpper(xCurrentCell->GetTextUpperDistance()); const sal_Int32 nLower(xCurrentCell->GetTextLowerDistance()); - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText, &nLeft, @@ -619,21 +632,17 @@ namespace sdr } else { - pAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( + aAttribute = drawinglayer::primitive2d::createNewSdrFillTextAttribute( rCellItemSet, pSdrText); } - if(pAttribute) + // always create cell primitives for BoundRect and HitTest { - if(pAttribute->isVisible()) - { - const drawinglayer::primitive2d::Primitive2DReference xCellReference(new drawinglayer::primitive2d::SdrCellPrimitive2D( - aCellMatrix, *pAttribute)); - xCellSequence[nCellInsert++] = xCellReference; - } - - delete pAttribute; + const drawinglayer::primitive2d::Primitive2DReference xCellReference( + new drawinglayer::primitive2d::SdrCellPrimitive2D( + aCellMatrix, aAttribute)); + xCellSequence[nCellInsert++] = xCellReference; } // handle cell borders @@ -678,21 +687,46 @@ namespace sdr xRetval = xCellSequence; drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, xBorderSequence); } - } - if(xRetval.hasElements()) - { - // check and create evtl. shadow for created content - drawinglayer::attribute::SdrShadowAttribute* pNewShadowAttribute = drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet); - - if(pNewShadowAttribute) + if(xRetval.hasElements()) { - xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, *pNewShadowAttribute); - delete pNewShadowAttribute; + // check and create evtl. shadow for created content + const SfxItemSet& rObjectItemSet = rTableObj.GetMergedItemSet(); + const drawinglayer::attribute::SdrShadowAttribute aNewShadowAttribute( + drawinglayer::primitive2d::createNewSdrShadowAttribute(rObjectItemSet)); + + if(!aNewShadowAttribute.isDefault()) + { + xRetval = drawinglayer::primitive2d::createEmbeddedShadowPrimitive(xRetval, aNewShadowAttribute); + } } - } - return xRetval; + return xRetval; + } + else + { + // take unrotated snap rect (direct model data) for position and size + const Rectangle& rRectangle = rTableObj.GetGeoRect(); + const basegfx::B2DRange aObjectRange( + rRectangle.Left(), rRectangle.Top(), + rRectangle.Right(), rRectangle.Bottom()); + + // create object matrix + const GeoStat& rGeoStat(rTableObj.GetGeoStat()); + const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); + const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); + const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY())); + + // credate an invisible outline for the cases where no visible content exists + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createHiddenGeometryPrimitives2D( + false, + aObjectMatrix)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } } ViewContactOfTableObj::ViewContactOfTableObj(::sdr::table::SdrTableObj& rTableObj) -- cgit v1.2.3 From 49c96f757ec7f1f41bda734dd07794e84c4d31d3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 14:12:41 +0100 Subject: autorecovery: merged DocumentMacroConfirmationRequest2 into DocumentMacroConfirmationRequest - no need to have two types which are effectively the same, and both rarely used --- sfx2/source/doc/objmisc.cxx | 6 +++--- uui/source/iahndl.cxx | 24 +++++------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 63b4b2ee4c28..ab49a1ba1086 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -87,7 +87,7 @@ #include #include -#include +#include #include #include @@ -2441,9 +2441,9 @@ sal_Bool SfxObjectShell_Impl::hasTrustedScriptingSignature( sal_Bool bAllowUIToA if ( xInteraction.is() ) { - task::DocumentMacroConfirmationRequest2 aRequest; + task::DocumentMacroConfirmationRequest aRequest; aRequest.DocumentURL = getDocumentLocation(); - aRequest.DocumentZipStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); + aRequest.DocumentStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); aRequest.DocumentSignatureInformation = aInfo; aRequest.DocumentVersion = aVersion; aRequest.Classification = task::InteractionClassification_QUERY; diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 2db6cc79ac57..40051ce00b51 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -69,7 +69,6 @@ #include "com/sun/star/task/MasterPasswordRequest.hpp" #include "com/sun/star/task/NoMasterException.hpp" #include "com/sun/star/task/DocumentMacroConfirmationRequest.hpp" -#include "com/sun/star/task/DocumentMacroConfirmationRequest2.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionDisapprove.hpp" @@ -1286,26 +1285,13 @@ bool UUIInteractionHelper::handleErrorHandlerRequests( handleMacroConfirmRequest( aMacroConfirmRequest.DocumentURL, aMacroConfirmRequest.DocumentStorage, - ODFVER_012_TEXT, + aMacroConfirmRequest.DocumentVersion.getLength() ? aMacroConfirmRequest.DocumentVersion : ODFVER_012_TEXT, aMacroConfirmRequest.DocumentSignatureInformation, rRequest->getContinuations() ); return true; } - star::task::DocumentMacroConfirmationRequest2 aMacroConfirmRequest2; - if (aAnyRequest >>= aMacroConfirmRequest2) - { - handleMacroConfirmRequest( - aMacroConfirmRequest2.DocumentURL, - aMacroConfirmRequest2.DocumentZipStorage, - aMacroConfirmRequest2.DocumentVersion, - aMacroConfirmRequest2.DocumentSignatureInformation, - rRequest->getContinuations() - ); - return true; - } - FutureDocumentVersionProductUpdateRequest aProductUpdateRequest; if (aAnyRequest >>= aProductUpdateRequest) { @@ -1378,10 +1364,10 @@ UUIInteractionHelper::handle_impl( OSL_ENSURE( xInitialization.is(), "Custom Interactionhandler does not implement mandatory interface XInitialization!" ); if (xInitialization.is()) { - uno::Sequence< uno::Any > propertyValues(1); - beans::PropertyValue aProperty; - - aProperty.Name = rtl::OUString::createFromAscii( "Parent" ); + uno::Sequence< uno::Any > propertyValues(1); + beans::PropertyValue aProperty; + + aProperty.Name = rtl::OUString::createFromAscii( "Parent" ); aProperty.Value <<= getParentXWindow(); propertyValues[ 0 ] <<= aProperty; -- cgit v1.2.3 From 1e62c8af7a8a76ecf89acb40ffc991f96f5c869a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 15:31:27 +0100 Subject: autorecovery: NotifyModifyListeners_Impl is called to generously, ensure that m_bModifiedSinceLastSave is properly set --- sfx2/source/doc/sfxbasemodel.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 19af0866a1fc..9454889760e2 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2549,7 +2549,9 @@ void SfxBaseModel::NotifyModifyListeners_Impl() const pIC->notifyEach( &util::XModifyListener::modified, aEvent ); } - m_pData->m_bModifiedSinceLastSave = sal_True; + // this notification here is done too generously, we cannot simply assume that we're really modified + // now, but we need to check it ... + m_pData->m_bModifiedSinceLastSave = const_cast< SfxBaseModel* >( this )->isModified(); } void SfxBaseModel::changing() -- cgit v1.2.3 From e8b81cd40140a1a5f79f9eb24470ad4891564ef8 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- .../source/processor2d/hittestprocessor2d.cxx | 44 ++++++++++++++ svx/inc/svx/cube3d.hxx | 5 +- svx/inc/svx/extrud3d.hxx | 7 +-- svx/inc/svx/lathe3d.hxx | 7 +-- svx/inc/svx/obj3d.hxx | 10 ++-- svx/inc/svx/polygn3d.hxx | 6 +- svx/inc/svx/scene3d.hxx | 9 +-- svx/inc/svx/sdrmasterpagedescriptor.hxx | 5 +- svx/inc/svx/sphere3d.hxx | 7 +-- svx/inc/svx/svdoashp.hxx | 11 ++-- svx/inc/svx/svdoattr.hxx | 5 +- svx/inc/svx/svdobj.hxx | 2 + svx/inc/svx/svdocapt.hxx | 7 +-- svx/inc/svx/svdocirc.hxx | 9 +-- svx/inc/svx/svdoedge.hxx | 7 +-- svx/inc/svx/svdograf.hxx | 10 +--- svx/inc/svx/svdogrp.hxx | 7 +-- svx/inc/svx/svdomeas.hxx | 7 +-- svx/inc/svx/svdomedia.hxx | 3 +- svx/inc/svx/svdoole2.hxx | 5 +- svx/inc/svx/svdopage.hxx | 11 ++-- svx/inc/svx/svdopath.hxx | 5 +- svx/inc/svx/svdorect.hxx | 11 +--- svx/inc/svx/svdotable.hxx | 8 +-- svx/inc/svx/svdotext.hxx | 8 +-- svx/inc/svx/svdovirt.hxx | 4 +- svx/inc/svx/svdpage.hxx | 1 + svx/source/customshapes/EnhancedCustomShape2d.cxx | 13 ---- svx/source/sdr/properties/makefile.mk | 1 + svx/source/svdraw/sdrmasterpagedescriptor.cxx | 3 +- svx/source/svdraw/svddrgmt.cxx | 15 ++++- svx/source/svdraw/svdhdl.cxx | 4 +- svx/source/svdraw/svdobj.cxx | 6 +- svx/source/svdraw/svdogrp.cxx | 2 +- svx/source/svdraw/svdoole2.cxx | 9 +++ svx/source/svdraw/svdpage.cxx | 3 +- svx/source/table/svdotable.cxx | 2 +- svx/source/table/tablehandles.cxx | 8 +-- svx/source/table/viewcontactoftableobj.cxx | 69 ++++++++++------------ 39 files changed, 181 insertions(+), 175 deletions(-) diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index e699f1ae8ea4..9be5b5633d1f 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -50,6 +50,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -487,6 +488,49 @@ namespace drawinglayer break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : + { + if(!getHitTextOnly()) + { + // The recently added BitmapEx::GetTransparency() makes it easy to extend + // the BitmapPrimitive2D HitTest to take the contained BotmapEx and it's + // transparency into account + const basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D())); + + if(!aRange.isEmpty()) + { + const primitive2d::BitmapPrimitive2D& rBitmapCandidate(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate)); + const BitmapEx& rBitmapEx = rBitmapCandidate.getBitmapEx(); + const Size& rSizePixel(rBitmapEx.GetSizePixel()); + + if(rSizePixel.Width() && rSizePixel.Height()) + { + basegfx::B2DHomMatrix aBackTransform( + getViewInformation2D().getObjectToViewTransformation() * + rBitmapCandidate.getTransform()); + aBackTransform.invert(); + + const basegfx::B2DPoint aRelativePoint(aBackTransform * getDiscreteHitPosition()); + const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + + if(aUnitRange.isInside(aRelativePoint)) + { + const sal_Int32 nX(basegfx::fround(aRelativePoint.getX() * rSizePixel.Width())); + const sal_Int32 nY(basegfx::fround(aRelativePoint.getY() * rSizePixel.Height())); + + mbHit = (0xff != rBitmapEx.GetTransparency(nX, nY)); + } + } + else + { + // fallback to standard HitTest + const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); + mbHit = checkFillHitWithTolerance(basegfx::B2DPolyPolygon(aOutline), getDiscreteHitTolerance()); + } + } + } + + break; + } case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D : case PRIMITIVE2D_ID_CONTROLPRIMITIVE2D : case PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D : diff --git a/svx/inc/svx/cube3d.hxx b/svx/inc/svx/cube3d.hxx index 3985ab6ca594..0661200a9850 100644 --- a/svx/inc/svx/cube3d.hxx +++ b/svx/inc/svx/cube3d.hxx @@ -55,10 +55,6 @@ enum { CUBE_BOTTOM = 0x0001, CUBE_BACK = 0x0002, CUBE_LEFT = 0x0004, class SVX_DLLPUBLIC E3dCubeObj : public E3dCompoundObject { private: - // Zur Geometrieerzeugung eines Cubes notwendige - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPoint aCubePos; basegfx::B3DVector aCubeSize; @@ -69,6 +65,7 @@ private: protected: void SetDefaultAttributes(E3dDefaultAttributes& rDefault); + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: TYPEINFO(); diff --git a/svx/inc/svx/extrud3d.hxx b/svx/inc/svx/extrud3d.hxx index ee0c38af9fdd..b979a44fce60 100644 --- a/svx/inc/svx/extrud3d.hxx +++ b/svx/inc/svx/extrud3d.hxx @@ -43,11 +43,6 @@ class SVX_DLLPUBLIC E3dExtrudeObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::E3dExtrudeProperties access to SetGeometryValid() friend class sdr::properties::E3dExtrudeProperties; @@ -55,6 +50,8 @@ private: basegfx::B2DPolyPolygon maExtrudePolygon; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/lathe3d.hxx b/svx/inc/svx/lathe3d.hxx index a0474fef522d..2d8e92df6496 100644 --- a/svx/inc/svx/lathe3d.hxx +++ b/svx/inc/svx/lathe3d.hxx @@ -47,16 +47,13 @@ class SVX_DLLPUBLIC E3dLatheObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // Partcodes fuer Wireframe-Generierung: Standard oder Deckelflaeche enum { LATHE_PART_STD = 1, LATHE_PART_COVER = 2 }; basegfx::B2DPolyPolygon maPolyPoly2D; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/obj3d.hxx b/svx/inc/svx/obj3d.hxx index 30a22938f888..8297d727919f 100644 --- a/svx/inc/svx/obj3d.hxx +++ b/svx/inc/svx/obj3d.hxx @@ -109,8 +109,7 @@ public: class SVX_DLLPUBLIC E3dObject : public SdrAttrObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dProperties access to StructureChanged() friend class sdr::properties::E3dProperties; @@ -119,6 +118,8 @@ class SVX_DLLPUBLIC E3dObject : public SdrAttrObj friend class E3dDragMethod; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + E3dObjList maSubList; // Subliste (Childobjekte) basegfx::B3DRange maLocalBoundVol; // umschliessendes Volumen des Objekts (aus geometrieerzeugung) @@ -223,8 +224,7 @@ public: class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dCompoundProperties access to SetGeometryValid() friend class sdr::properties::E3dCompoundProperties; friend class sdr::properties::E3dExtrudeProperties; @@ -232,6 +232,8 @@ class SVX_DLLPUBLIC E3dCompoundObject : public E3dObject friend class sdr::properties::E3dSphereProperties; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // Material des Objektes Color aMaterialAmbientColor; diff --git a/svx/inc/svx/polygn3d.hxx b/svx/inc/svx/polygn3d.hxx index 5bc9f9b8fb15..c24fb765cffb 100644 --- a/svx/inc/svx/polygn3d.hxx +++ b/svx/inc/svx/polygn3d.hxx @@ -37,9 +37,6 @@ class SVX_DLLPUBLIC E3dPolygonObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // Parameter basegfx::B3DPolyPolygon aPolyPoly3D; basegfx::B3DPolyPolygon aPolyNormals3D; @@ -49,6 +46,9 @@ private: SVX_DLLPRIVATE void CreateDefaultNormals(); SVX_DLLPRIVATE void CreateDefaultTexture(); +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: void SetPolyPolygon3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); diff --git a/svx/inc/svx/scene3d.hxx b/svx/inc/svx/scene3d.hxx index a4cd8c497cd6..d7bd5e2d809e 100644 --- a/svx/inc/svx/scene3d.hxx +++ b/svx/inc/svx/scene3d.hxx @@ -71,17 +71,14 @@ class Imp3DDepthRemapper; class SVX_DLLPUBLIC E3dScene : public E3dObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: // to allow sdr::properties::E3dSceneProperties access to StructureChanged() friend class sdr::properties::E3dSceneProperties; - // #110094# DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: // Transformationen B3dCamera aCameraSet; Camera3D aCamera; diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index b0593ab48774..52752945255c 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -52,17 +52,20 @@ namespace sdr { class MasterPageDescriptor : public sdr::PageUser { + private: SdrPage& maOwnerPage; SdrPage& maUsedPage; SetOfByte maVisibleLayers; // ViewContact part sdr::contact::ViewContact* mpViewContact; - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); // assignment operator defined, but not implemented void operator=(const MasterPageDescriptor& rCandidate); + protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + public: MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage); virtual ~MasterPageDescriptor(); diff --git a/svx/inc/svx/sphere3d.hxx b/svx/inc/svx/sphere3d.hxx index 9c11b6537354..1f8e21a032ca 100644 --- a/svx/inc/svx/sphere3d.hxx +++ b/svx/inc/svx/sphere3d.hxx @@ -44,15 +44,12 @@ class SVX_DLLPUBLIC E3dSphereObj : public E3dCompoundObject { private: - // #110094# DrawContact section - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - basegfx::B3DPoint aCenter; basegfx::B3DVector aSize; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx index f65afc0b4efe..db7189254b76 100644 --- a/svx/inc/svx/svdoashp.hxx +++ b/svx/inc/svx/svdoashp.hxx @@ -88,15 +88,16 @@ struct SdrCustomShapeInteraction class SVX_DLLPUBLIC SdrObjCustomShape : public SdrTextObj { +private: // fObjectRotation is containing the object rotation in degrees. double fObjectRotation; -private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +public: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + // to allow sdr::properties::CustomShapeProperties access friend class sdr::properties::CustomShapeProperties; @@ -179,7 +180,7 @@ public: virtual UINT16 GetObjIdentifier() const; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; - virtual void SetModel(SdrModel* pNewModel); + virtual void SetModel(SdrModel* pNewModel); virtual void RecalcSnapRect(); diff --git a/svx/inc/svx/svdoattr.hxx b/svx/inc/svx/svdoattr.hxx index 3bcce26ea45e..2edc125d88f6 100644 --- a/svx/inc/svx/svdoattr.hxx +++ b/svx/inc/svx/svdoattr.hxx @@ -55,11 +55,12 @@ class SfxItemPool; class SVX_DLLPUBLIC SdrAttrObj : public SdrObject { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - +private: friend class SdrOutliner; protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + Rectangle maSnapRect; protected: diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index cc21e645e4d2..fce776ef0abf 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -426,6 +426,7 @@ public: // BaseProperties section private: sdr::properties::BaseProperties* mpProperties; +protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); public: virtual sdr::properties::BaseProperties& GetProperties() const; @@ -434,6 +435,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/inc/svx/svdocapt.hxx b/svx/inc/svx/svdocapt.hxx index 37bfd5ed2f9b..fd6e7dc67789 100644 --- a/svx/inc/svx/svdocapt.hxx +++ b/svx/inc/svx/svdocapt.hxx @@ -63,19 +63,16 @@ public: class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj { - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); private: - // to allow sdr::properties::CaptionProperties access to ImpRecalcTail() friend class sdr::properties::CaptionProperties; - friend class SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow protected: - // DrawContact section -private: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: Polygon aTailPoly; // das ganze Polygon des Schwanzes sal_Bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE sal_Bool mbFixedTail; // for calc note box fixed tail, default FALSE diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx index 3f6a589d2cd7..866b63379a3e 100644 --- a/svx/inc/svx/svdocirc.hxx +++ b/svx/inc/svx/svdocirc.hxx @@ -61,20 +61,17 @@ public: class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo() friend class sdr::properties::CircleProperties; // only for SdrCircleAttributes SdrObjKind GetCircleKind() const { return meCircleKind; } - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: - SdrObjKind meCircleKind; + SdrObjKind meCircleKind; long nStartWink; long nEndWink; diff --git a/svx/inc/svx/svdoedge.hxx b/svx/inc/svx/svdoedge.hxx index 227afd9ab027..a4dfcc322f4e 100644 --- a/svx/inc/svx/svdoedge.hxx +++ b/svx/inc/svx/svdoedge.hxx @@ -160,19 +160,16 @@ public: class SVX_DLLPUBLIC SdrEdgeObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::ConnectorProperties access to ImpSetAttrToEdgeInfo() friend class sdr::properties::ConnectorProperties; friend class SdrCreateView; friend class ImpEdgeHdl; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjConnection aCon1; // Verbindungszustand des Linienanfangs SdrObjConnection aCon2; // Verbindungszustand des Linienendes diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 4f00da997361..a8d6a006835e 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -88,22 +88,16 @@ class SdrGraphicLink; class SVX_DLLPUBLIC SdrGrafObj : public SdrRectObj { private: - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // to allow sdr::properties::GraphicProperties access to SetXPolyDirty() friend class sdr::properties::GraphicProperties; // to allow sdr::contact::ViewObjectContactOfGraphic access to ImpUpdateGraphicLink() friend class sdr::contact::ViewObjectContactOfGraphic; - friend class SdrGraphicLink; protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); void ImpSetAttrToGrafInfo(); // Werte vom Pool kopieren void ImpSetGrafInfoToAttr(); // Werte in den Pool kopieren diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index db799da81e1d..8d1cf9b4e0b0 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -49,14 +49,11 @@ class SfxItemSet; class SVX_DLLPUBLIC SdrObjGroup : public SdrObject { - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // #110094# DrawContact section private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: SdrObjList* pSub; // Subliste (Kinder) long nDrehWink; long nShearWink; diff --git a/svx/inc/svx/svdomeas.hxx b/svx/inc/svx/svdomeas.hxx index 406c5badbcb0..eb4c77e80269 100644 --- a/svx/inc/svx/svdomeas.hxx +++ b/svx/inc/svx/svdomeas.hxx @@ -68,18 +68,15 @@ public: class SVX_DLLPUBLIC SdrMeasureObj : public SdrTextObj { private: - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::MeasureProperties access to SetTextDirty() friend class sdr::properties::MeasureProperties; friend class SdrMeasureField; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: Point aPt1; Point aPt2; FASTBOOL bTextDirty; diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index 4b612dcf7e9e..8c2d683397ed 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -83,11 +83,10 @@ public: protected: virtual void mediaPropertiesChanged( const ::avmedia::MediaItem& rNewState ); + virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); private: - virtual ::sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - ::avmedia::MediaItem maMediaProperties; ::std::auto_ptr< Graphic > mapGraphic; }; diff --git a/svx/inc/svx/svdoole2.hxx b/svx/inc/svx/svdoole2.hxx index 2b5a19f7b60b..b26fbe55d2d6 100644 --- a/svx/inc/svx/svdoole2.hxx +++ b/svx/inc/svx/svdoole2.hxx @@ -62,11 +62,10 @@ private: SVX_DLLPRIVATE void GetObjRef_Impl(); SVX_DLLPRIVATE void SetGraphic_Impl(const Graphic* pGrf); - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); -protected: svt::EmbeddedObjectRef xObjRef; Graphic* pGraphic; String aProgName; diff --git a/svx/inc/svx/svdopage.hxx b/svx/inc/svx/svdopage.hxx index b138b7c12be9..f046a20dbed0 100644 --- a/svx/inc/svx/svdopage.hxx +++ b/svx/inc/svx/svdopage.hxx @@ -44,17 +44,14 @@ public: virtual void PageInDestruction(const SdrPage& rPage); private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - // #111111# // To make things more safe, remember the page, not a number SdrPage* mpShownPage; +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + public: TYPEINFO(); SdrPageObj(SdrPage* pNewPage = 0L); diff --git a/svx/inc/svx/svdopath.hxx b/svx/inc/svx/svdopath.hxx index 382f968f19b2..d8157446d0ce 100644 --- a/svx/inc/svx/svdopath.hxx +++ b/svx/inc/svx/svdopath.hxx @@ -65,13 +65,12 @@ public: class SVX_DLLPUBLIC SdrPathObj : public SdrTextObj { +private: friend class ImpPathForDragAndCreate; - // DrawContact section -private: +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: basegfx::B2DPolyPolygon maPathPolygon; SdrObjKind meKind; diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx index d8b0d2767553..eadd5c7490a0 100644 --- a/svx/inc/svx/svdorect.hxx +++ b/svx/inc/svx/svdorect.hxx @@ -54,19 +54,14 @@ namespace sdr { namespace properties { class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj { private: - // BaseProperties section - virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - // to allow sdr::properties::RectangleProperties access to SetXPolyDirty() friend class sdr::properties::RectangleProperties; - - // DrawContact section -private: - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); - friend class SdrTextObj; // wg SetXPolyDirty bei GrowAdjust protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + XPolygon* mpXPoly; protected: diff --git a/svx/inc/svx/svdotable.hxx b/svx/inc/svx/svdotable.hxx index a524ce757898..779087cbe254 100644 --- a/svx/inc/svx/svdotable.hxx +++ b/svx/inc/svx/svdotable.hxx @@ -315,14 +315,10 @@ public: private: void init( sal_Int32 nColumns, sal_Int32 nRows ); - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: virtual SdrObjGeoData* NewGeoData() const; virtual void SaveGeoData(SdrObjGeoData& rGeo) const; virtual void RestGeoData(const SdrObjGeoData& rGeo); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 6ffa4ab5bd22..928b1b4580b2 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -145,13 +145,11 @@ private: // CustomShapeproperties need to access the "bTextFrame" member: friend class sdr::properties::CustomShapeProperties; - // BaseProperties section - SVX_DLLPRIVATE virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); - - // DrawContact section -private: +protected: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); +private: // This method is only allowed for sdr::properties::TextProperties SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const { diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index 190576fc68c6..7451fb582dff 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -49,11 +49,9 @@ class SVX_DLLPUBLIC SdrVirtObj : public SdrObject public: virtual sdr::properties::BaseProperties& GetProperties() const; -private: - // AW, OD 2004-05-03 #i27224# +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); -protected: SdrObject& rRefObj; // Referenziertes Zeichenobjekt Rectangle aSnapRect; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 3523308b6e8f..02181afb1674 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -403,6 +403,7 @@ public: // #110094# DrawContact section private: sdr::contact::ViewContact* mpViewContact; +protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: sdr::contact::ViewContact& GetViewContact() const; diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 940b882f2e7c..d8d66838c3eb 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1709,19 +1709,6 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm if(aNewB2DPolyPolygon.count()) { - if( !bLineGeometryNeededOnly ) - { - // hack aNewB2DPolyPolygon to fill logic rect - this is - // needed to produce gradient fills that look like mso - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(0,0)); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - - aNewB2DPolygon.clear(); - aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(), - aLogicRect.GetHeight())); - aNewB2DPolyPolygon.append(aNewB2DPolygon); - } // #i37011# bool bForceCreateTwoObjects(false); diff --git a/svx/source/sdr/properties/makefile.mk b/svx/source/sdr/properties/makefile.mk index 04e96dd6c24d..8e0fe5955a03 100644 --- a/svx/source/sdr/properties/makefile.mk +++ b/svx/source/sdr/properties/makefile.mk @@ -51,6 +51,7 @@ SLOFILES=\ $(SLO)$/textproperties.obj \ $(SLO)$/customshapeproperties.obj \ $(SLO)$/rectangleproperties.obj \ + $(SLO)$/oleproperties.obj \ $(SLO)$/captionproperties.obj \ $(SLO)$/circleproperties.obj \ $(SLO)$/connectorproperties.obj \ diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 652327f3ff85..9cee1e344c6a 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -76,7 +76,8 @@ namespace sdr { if(!mpViewContact) { - ((MasterPageDescriptor*)this)->mpViewContact = ((MasterPageDescriptor*)this)->CreateObjectSpecificViewContact(); + const_cast< MasterPageDescriptor* >(this)->mpViewContact = + const_cast< MasterPageDescriptor* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index dd3006ba9a6d..0b34c5cc4e81 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -678,7 +678,7 @@ void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay createSdrDragEntries(); } - // if there are entries, derive OverlayObjects fromthe entries, including + // if there are entries, derive OverlayObjects from the entries, including // modification from current interactive state if(maSdrDragEntries.size()) { @@ -823,7 +823,18 @@ drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverla // this polygon is a temporary calculated connector path, so it is not possible to fetch // the needed primitives directly from the pEdge object which does not get changed. If full // drag is on, use the SdrObjects ItemSet to create a adequate representation - if(getSolidDraggingActive()) + bool bUseSolidDragging(getSolidDraggingActive()); + + if(bUseSolidDragging) + { + // switch off solid dragging if connector is not visible + if(!pEdge->HasLineStyle()) + { + bUseSolidDragging = false; + } + } + + if(bUseSolidDragging) { const SfxItemSet& rItemSet = pEdge->GetMergedItemSet(); const drawinglayer::attribute::SdrLineAttribute aLine( diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index d3202e389f83..7bd47ae80616 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -284,13 +284,13 @@ SdrHdlBitmapSet& getSimpleSet() SdrHdlBitmapSet& getModernSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS)); return *aModernSet.get(); } SdrHdlBitmapSet& getHighContrastSet() { - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_MARKERS)); + static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS)); return *aHighContrastSet.get(); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index fb26d7b5fc9c..3ed33e0f20ad 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -329,7 +329,8 @@ sdr::properties::BaseProperties& SdrObject::GetProperties() const { if(!mpProperties) { - ((SdrObject*)this)->mpProperties = ((SdrObject*)this)->CreateObjectSpecificProperties(); + const_cast< SdrObject* >(this)->mpProperties = + const_cast< SdrObject* >(this)->CreateObjectSpecificProperties(); } return *mpProperties; @@ -364,7 +365,8 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const { if(!mpViewContact) { - ((SdrObject*)this)->mpViewContact = ((SdrObject*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrObject* >(this)->mpViewContact = + const_cast< SdrObject* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 20587f715c81..89d9221a8552 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -83,7 +83,7 @@ sdr::properties::BaseProperties* SdrObjGroup::CreateObjectSpecificProperties() { - return new sdr::properties::GroupProperties((SdrObject&)(*this)); + return new sdr::properties::GroupProperties(*this); } ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 67505e12ba73..69599790ab1b 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -89,6 +89,7 @@ #include #include #include +#include // #i100710# #include @@ -735,6 +736,14 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj } } +////////////////////////////////////////////////////////////////////////////// +// BaseProperties section + +sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() +{ + return new sdr::properties::OleProperties(*this); +} + ////////////////////////////////////////////////////////////////////////////// // DrawContact section diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index a8cbfbb24c3d..864cc3d77e8d 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1168,7 +1168,8 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const { if(!mpViewContact) { - ((SdrPage*)this)->mpViewContact = ((SdrPage*)this)->CreateObjectSpecificViewContact(); + const_cast< SdrPage* >(this)->mpViewContact = + const_cast< SdrPage* >(this)->CreateObjectSpecificViewContact(); } return *mpViewContact; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 97e06fd4bb61..2fa47ed0b119 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -2575,7 +2575,7 @@ basegfx::B2DPolyPolygon SdrTableObj::getSpecialDragPoly(const SdrDragStat& rDrag basegfx::B2DPolyPolygon aRetval; const SdrHdl* pHdl = rDrag.GetHdl(); - if(HDL_USER == pHdl->GetKind()) + if(pHdl && HDL_USER == pHdl->GetKind()) { const TableEdgeHdl* pEdgeHdl = dynamic_cast< const TableEdgeHdl* >( pHdl ); diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 2c2e1bb9df83..b034fafe7994 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +#include namespace sdr { namespace table { @@ -245,11 +245,11 @@ drawinglayer::primitive2d::Primitive2DSequence OverlayTableEdge::createOverlayOb } else { - // embed in 100% transparent UnifiedTransparencePrimitive2D to support HitTest - // of this overlay object + // embed in HiddenGeometryPrimitive2D to support HitTest of this invisible + // overlay object const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aReference, 1); const drawinglayer::primitive2d::Primitive2DReference aNewReference( - new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aSequence, 1.0)); + new drawinglayer::primitive2d::HiddenGeometryPrimitive2D(aSequence)); aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aNewReference, 1); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index b4a941413e70..0afa4aa50096 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -98,47 +98,42 @@ namespace drawinglayer Primitive2DSequence SdrCellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const { + // prepare unit polygon Primitive2DSequence aRetval; + const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - if(!getSdrFTAttribute().getFill().isDefault() - || !getSdrFTAttribute().getText().isDefault()) + // add fill + if(!getSdrFTAttribute().getFill().isDefault()) { - // prepare unit polygon - const basegfx::B2DPolyPolygon aUnitPolyPolygon(basegfx::tools::createUnitPolygon()); - - // add fill - if(!getSdrFTAttribute().getFill().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createPolyPolygonFillPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getFill(), - getSdrFTAttribute().getFillFloatTransGradient())); - } - else - { - // if no fill create one for HitTest and BoundRect fallback - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createHiddenGeometryPrimitives2D( - true, - aUnitPolyPolygon, - getTransform())); - } + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createPolyPolygonFillPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getFill(), + getSdrFTAttribute().getFillFloatTransGradient())); + } + else + { + // if no fill create one for HitTest and BoundRect fallback + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createHiddenGeometryPrimitives2D( + true, + aUnitPolyPolygon, + getTransform())); + } - // add text - if(!getSdrFTAttribute().getText().isDefault()) - { - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, - createTextPrimitive( - aUnitPolyPolygon, - getTransform(), - getSdrFTAttribute().getText(), - attribute::SdrLineAttribute(), - true, - false, - false)); - } + // add text + if(!getSdrFTAttribute().getText().isDefault()) + { + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, + createTextPrimitive( + aUnitPolyPolygon, + getTransform(), + getSdrFTAttribute().getText(), + attribute::SdrLineAttribute(), + true, + false, + false)); } return aRetval; -- cgit v1.2.3 From cfdb20d0ccd44014edbe406942914d5eef57de47 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 22:19:50 +0100 Subject: autorecovery: move the responsibility for calling attachResource into recoverFromFile. This saves us from some problems with SFX-based documents, which change there Args during the load process (during macro confirmation), so a later attachResource from outside would overwrite those changed args --- framework/source/services/autorecovery.cxx | 9 ++++++--- sfx2/source/doc/sfxbasemodel.cxx | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index defd5332d079..46b3b1733d5f 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2735,6 +2735,9 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL "unexpected document state" ); Reference< XLoadable > xModelLoad( xModel, UNO_QUERY_THROW ); xModelLoad->initNew(); + + // TODO: remove load-process specific arguments from the descriptor, e.g. the status indicator + xModel->attachResource( sURL, lDescriptor.getAsConstPropertyValueList() ); } else { @@ -2745,10 +2748,10 @@ void AutoRecovery::implts_openOneDoc(const ::rtl::OUString& sURL lDescriptor.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString() ), lDescriptor.getAsConstPropertyValueList() ); - } - xModel->attachResource( sURL, lDescriptor.getAsConstPropertyValueList() ); - // TODO: remove load-process specific arguments from the descriptor, e.g. the status indicator + // No attachResource needed here. By definition (of XDocumentRecovery), the implementation is responsible + // for completely initializing the model, which includes attachResource (or equivalent), if required. + } // re-create all the views ::std::vector< ::rtl::OUString > aViewsToRestore( rInfo.ViewNames.getLength() ); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9454889760e2..47935392012f 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1687,6 +1687,13 @@ void SAL_CALL SfxBaseModel::recoverFromFile( const ::rtl::OUString& i_SourceLoca aMediaDescriptor.put( "URL", i_SourceLocation ); load( aMediaDescriptor.getPropertyValues() ); + + // Note: The XDocumentRecovery interface specification requires us to do an attachResource after loading. + // However, we will not do this here, as we know that our load implementation (respectively some method + // called from there) already did so. + // In particular, the load process might already have modified some elements of the media + // descriptor, for instance the MacroExecMode (in case the user was involved to decide about it), and we do + // not want to overwrite it with the "old" elements passed to this method here. } //________________________________________________________________________________________________________ -- cgit v1.2.3 From ac51fecad39fd226ac219cc4d1247618172fd46d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 14:18:52 +0100 Subject: autorecovery: implts_changeAllDocVisibility: iterate through the sub frames, too, not only desktop-level frames --- framework/source/services/autorecovery.cxx | 45 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 46b3b1733d5f..ebebe01cb53f 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2053,6 +2053,33 @@ AutoRecovery::TDocumentList::iterator AutoRecovery::impl_searchDocument( Au return pIt; } +//----------------------------------------------- +namespace +{ + void lcl_changeVisibility( const css::uno::Reference< css::frame::XFramesSupplier >& i_rFrames, sal_Bool i_bVisible ) + { + css::uno::Reference< css::container::XIndexAccess > xFramesContainer( i_rFrames->getFrames(), css::uno::UNO_QUERY ); + const sal_Int32 count = xFramesContainer->getCount(); + + Any aElement; + for ( sal_Int32 i=0; i < count; ++i ) + { + aElement = xFramesContainer->getByIndex(i); + // check for sub frames + css::uno::Reference< css::frame::XFramesSupplier > xFramesSupp( aElement, css::uno::UNO_QUERY ); + if ( xFramesSupp.is() ) + lcl_changeVisibility( xFramesSupp, i_bVisible ); + + css::uno::Reference< css::frame::XFrame > xFrame( aElement, css::uno::UNO_QUERY ); + if ( !xFrame.is() ) + continue; + + css::uno::Reference< css::awt::XWindow > xWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xWindow->setVisible( i_bVisible ); + } + } +} + //----------------------------------------------- void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) { @@ -2062,22 +2089,8 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XFramesSupplier > xDesktop (xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); - css::uno::Reference< css::container::XIndexAccess > xContainer(xDesktop->getFrames() , css::uno::UNO_QUERY); - sal_Int32 c = xContainer->getCount(); - sal_Int32 i = 0; - - for (i=0; i xTask; - - xContainer->getByIndex(i) >>= xTask; - if (!xTask.is()) - continue; - - css::uno::Reference< css::awt::XWindow > xWindow = xTask->getContainerWindow(); - xWindow->setVisible(bVisible); - } + css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY); + lcl_changeVisibility( xDesktop, bVisible ); aReadLock.unlock(); // <- SAFE ---------------------------------- -- cgit v1.2.3 From 0e79b13cbd761931f6cd134b1e9ad4465882be7a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 15:38:20 +0100 Subject: autorecovery: saveToRecoveryFile => storeToRecoveryFile --- framework/source/services/autorecovery.cxx | 2 +- sfx2/inc/sfx2/sfxbasemodel.hxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index ebebe01cb53f..e256b40035e3 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2449,7 +2449,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& { try { - xDocRecover->saveToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); + xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, lNewArgs.getAsConstPropertyValueList() ); #ifdef TRIGGER_FULL_DISC_CHECK throw css::uno::Exception(); diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx index 6ffcf4df5ca8..ebd61ad6c5af 100644 --- a/sfx2/inc/sfx2/sfxbasemodel.hxx +++ b/sfx2/inc/sfx2/sfxbasemodel.hxx @@ -1301,7 +1301,7 @@ public: // css.document.XDocumentRecovery virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() throw ( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) + virtual void SAL_CALL storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 47935392012f..166becddaf9a 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1657,7 +1657,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& return m_pData->m_bModifiedSinceLastSave; } -void SAL_CALL SfxBaseModel::saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +void SAL_CALL SfxBaseModel::storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) { SfxModelGuard aGuard( *this ); @@ -1665,7 +1665,7 @@ void SAL_CALL SfxBaseModel::saveToRecoveryFile( const ::rtl::OUString& i_TargetL SfxSaveGuard aSaveGuard( this, m_pData, sal_False ); impl_store( i_TargetLocation, i_MediaDescriptor, sal_True ); - // no need for subsequent calls to saveToRecoveryFile, unless we're modified, again + // no need for subsequent calls to storeToRecoveryFile, unless we're modified, again m_pData->m_bModifiedSinceLastSave = sal_False; } -- cgit v1.2.3 From af66a011a47f673a9a0ee2c6a0b27e23b11b6ebf Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- connectivity/source/commontools/dbtools.cxx | 4 +- .../registry/data/org/openoffice/Interaction.xcu | 56 +++ officecfg/registry/data/org/openoffice/makefile.mk | 3 +- .../registry/schema/org/openoffice/Interaction.xcs | 86 ++++ .../registry/schema/org/openoffice/makefile.mk | 3 +- .../org/openoffice/ucb/InteractionHandler.xcs | 59 +-- svx/source/form/fmctrler.cxx | 2 +- svx/source/inc/fmservs.hxx | 1 - uui/source/iahndl.cxx | 231 ++++++--- uui/source/iahndl.hxx | 535 ++++++++++----------- 10 files changed, 595 insertions(+), 385 deletions(-) create mode 100644 officecfg/registry/data/org/openoffice/Interaction.xcu create mode 100644 officecfg/registry/schema/org/openoffice/Interaction.xcs diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 02e6e420142f..4b0d0eafd56f 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -320,8 +320,8 @@ Reference< XConnection > getConnection_allowException( Reference xConnectionCompletion(xProp, UNO_QUERY); if (xConnectionCompletion.is()) { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rxFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.sdb.InteractionHandler")), UNO_QUERY); - OSL_ENSURE(xHandler.is(), "dbtools::getConnection service com.sun.star.sdb.InteractionHandler not available!"); + Reference< XInteractionHandler > xHandler(_rxFactory->createInstance(::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler")), UNO_QUERY); + OSL_ENSURE(xHandler.is(), "dbtools::getConnection service com.sun.star.task.InteractionHandler not available!"); if (xHandler.is()) { xConnection = xConnectionCompletion->connectWithCompletion(xHandler); diff --git a/officecfg/registry/data/org/openoffice/Interaction.xcu b/officecfg/registry/data/org/openoffice/Interaction.xcu new file mode 100644 index 000000000000..afd78005fb71 --- /dev/null +++ b/officecfg/registry/data/org/openoffice/Interaction.xcu @@ -0,0 +1,56 @@ + + + + + + + + + + + named-and-derived + + + + + named-and-derived + + + + + named-and-derived + + + + + com.sun.star.comp.dbaccess.DatabaseInteractionHandler + + + + diff --git a/officecfg/registry/data/org/openoffice/makefile.mk b/officecfg/registry/data/org/openoffice/makefile.mk index b953c9b1cd63..e2b1d268568c 100644 --- a/officecfg/registry/data/org/openoffice/makefile.mk +++ b/officecfg/registry/data/org/openoffice/makefile.mk @@ -44,7 +44,8 @@ XCUFILES= \ Setup.xcu \ VCL.xcu \ FirstStartWizard.xcu \ - UserProfile.xcu + UserProfile.xcu \ + Interaction.xcu MODULEFILES= \ Setup-brand.xcu \ diff --git a/officecfg/registry/schema/org/openoffice/Interaction.xcs b/officecfg/registry/schema/org/openoffice/Interaction.xcs new file mode 100644 index 000000000000..e39d44da7fd1 --- /dev/null +++ b/officecfg/registry/schema/org/openoffice/Interaction.xcs @@ -0,0 +1,86 @@ + + + + + + Frank Schönheit + contains configuration related to the interaction system of OpenOffice.org. + + + + + describes the responsibility for a single interaction request type. + + + + describes how the responsibility for this particular request type propagates through the + type hierarchy. + + + + + specifies that the interaction handler is responsible only for this particular type. + + + + + + specifies that the interaction handler is responsible not only for this particular type, + but also for all derived types. + + + + + + + + + contains information about a concrete interaction handler implementation. + + + + specifies the types which the interaction handler implementation is responsible for. The node names + of this set are interpreted as names in the UNO type system, this way specifying the request types + which should be delegated to the given interaction handler. + + + + + contains the name to be used to create an instance of the interaction handler implementation. + + + + + + + + collects information about registered interaction handlers. + + + + diff --git a/officecfg/registry/schema/org/openoffice/makefile.mk b/officecfg/registry/schema/org/openoffice/makefile.mk index 2269c68b00b7..975450140762 100644 --- a/officecfg/registry/schema/org/openoffice/makefile.mk +++ b/officecfg/registry/schema/org/openoffice/makefile.mk @@ -46,7 +46,8 @@ XCSFILES= \ System.xcs \ UserProfile.xcs \ VCL.xcs \ - FirstStartWizard.xcs + FirstStartWizard.xcs \ + Interaction.xcs .INCLUDE : target.mk diff --git a/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs index 6cf0a994c808..0cbc20eaffa9 100644 --- a/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs +++ b/officecfg/registry/schema/org/openoffice/ucb/InteractionHandler.xcs @@ -29,39 +29,28 @@ * ************************************************************************ --> - - TKR - Contains components and templates used for InteractionHandler configuration related data. - - - - - Contains the Service name of the custom InteractionHandler. The listed InteractionHandlers will be called after the "build-in" InteractionHandler sequently. - - - - Specifies the name of the UNO service to be used to instantiate the InteractionHandler. The type should be com.sun.star.task.XInteractionHandler. - - - - - - - - Contains a root entry for InteractionHandler configurations. - - - + + + TKR + Deprecated. Use org.openoffice.Interaction instead. + + + + + Deprecated. Use org.openoffice.Interaction instead. + + + + Deprecated. Use org.openoffice.Interaction instead. + + + + + + + + Deprecated. Use org.openoffice.Interaction instead. + + + - - - - - - - - - - - - diff --git a/svx/source/form/fmctrler.cxx b/svx/source/form/fmctrler.cxx index af2a103c5d03..ad4844427685 100644 --- a/svx/source/form/fmctrler.cxx +++ b/svx/source/form/fmctrler.cxx @@ -3942,7 +3942,7 @@ bool FmXFormController::ensureInteractionHandler() if ( !m_xORB.is() ) return false; - m_xInteractionHandler.set( m_xORB->createInstance( SRV_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + m_xInteractionHandler.set( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( m_xInteractionHandler.is(), "FmXFormController::ensureInteractionHandler: could not create an interaction handler!" ); return m_xInteractionHandler.is(); } diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx index 201a5a351224..bb63f39b64cc 100644 --- a/svx/source/inc/fmservs.hxx +++ b/svx/source/inc/fmservs.hxx @@ -59,7 +59,6 @@ #define FM_CONTROL_GRIDCONTROL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "stardiv.one.form.control.GridControl" ) ) #define FM_FORM_CONTROLLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) #define SRV_SDB_CONNECTION rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.Connection" ) ) -#define SRV_SDB_INTERACTION_HANDLER rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) #define FM_SUN_COMPONENT_FORM rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.Form" ) ) #define FM_SUN_COMPONENT_TEXTFIELD rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ) ) #define FM_SUN_COMPONENT_LISTBOX rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ) ) diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 40051ce00b51..9d5baac21d1a 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -111,6 +111,7 @@ #include "vos/mutex.hxx" #include "tools/rcid.h" +#include "tools/diagnose_ex.h" #include "vcl/svapp.hxx" #include "svl/svtools.hrc" #include "svl/httpcook.hxx" @@ -118,7 +119,10 @@ #include "toolkit/helper/vclunohelper.hxx" #include "comphelper/sequenceashashmap.hxx" #include "comphelper/documentconstants.hxx" +#include "comphelper/namedvaluecollection.hxx" +#include "typelib/typedescription.hxx" #include "unotools/configmgr.hxx" +#include "unotools/confignode.hxx" #include "ids.hrc" #include "cookiedg.hxx" @@ -144,6 +148,7 @@ using namespace com::sun; namespace csss = ::com::sun::star::security; +/** === begin UNO using === **/ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::Reference; @@ -152,6 +157,15 @@ using ::com::sun::star::task::XInteractionAbort; using ::com::sun::star::task::XInteractionApprove; using ::com::sun::star::task::XInteractionAskLater; using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::lang::XInitialization; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::task::XInteractionHandler2; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Any; +using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::lang::XMultiServiceFactory; +/** === end UNO using === **/ #define CONFIG_INTERACTIONHANDLERS_KEY "/org.openoffice.ucb.InteractionHandler/InteractionHandlers" @@ -1316,6 +1330,114 @@ bool UUIInteractionHelper::handleErrorHandlerRequests( return false; } +namespace +{ + // ................................................................................................................. + static bool lcl_matchesRequest( const Any& i_rRequest, const ::rtl::OUString& i_rTypeName, const ::rtl::OUString& i_rPropagation ) + { + const ::com::sun::star::uno::TypeDescription aTypeDesc( i_rTypeName ); + const typelib_TypeDescription* pTypeDesc = aTypeDesc.get(); + if ( !pTypeDesc || !pTypeDesc->pWeakRef ) + { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer aMessage; + aMessage.append( "no type found for '" ); + aMessage.append( ::rtl::OUStringToOString( i_rTypeName, RTL_TEXTENCODING_UTF8 ) ); + aMessage.append( "'" ); + OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); +#endif + return false; + } + const ::com::sun::star::uno::Type aType( pTypeDesc->pWeakRef ); + + const bool bExactMatch = ( i_rPropagation.compareToAscii( "named-only" ) == 0 ); + if ( bExactMatch ) + return i_rRequest.getValueType().equals( aType ); + + return i_rRequest.isExtractableTo( aType ); + } +} + +// --------------------------------------------------------------------------------------------------------------------- +bool UUIInteractionHelper::handleCustomRequest( const Reference< XInteractionRequest >& i_rRequest, const ::rtl::OUString& i_rServiceName ) const +{ + try + { + Reference< XInteractionHandler2 > xHandler( m_xServiceFactory->createInstance( i_rServiceName ), UNO_QUERY_THROW ); + + Reference< XInitialization > xHandlerInit( xHandler, UNO_QUERY ); + if ( xHandlerInit.is() ) + { + ::comphelper::NamedValueCollection aInitArgs; + aInitArgs.put( "Parent", getParentXWindow() ); + xHandlerInit->initialize( aInitArgs.getWrappedPropertyValues() ); + } + + if ( xHandler->handleInteractionRequest( i_rRequest ) ) + return true; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return false; +} + +// --------------------------------------------------------------------------------------------------------------------- +bool UUIInteractionHelper::handleTypedHandlerImplementations( Reference< XInteractionRequest > const & rRequest ) +{ + // the request + const Any aRequest( rRequest->getRequest() ); + + const StringHashMap::const_iterator aCacheHitTest = m_aTypedCustomHandlers.find( aRequest.getValueTypeName() ); + if ( aCacheHitTest != m_aTypedCustomHandlers.end() ) + return handleCustomRequest( rRequest, aCacheHitTest->second ); + + // the base registration node for "typed" interaction handlers + const ::utl::OConfigurationTreeRoot aConfigRoot( ::utl::OConfigurationTreeRoot::createWithServiceFactory( + m_xServiceFactory, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Interaction/InteractionHandlers" ) ), + -1, + ::utl::OConfigurationTreeRoot::CM_READONLY + ) ); + + // loop through all registered implementations + const Sequence< ::rtl::OUString > aRegisteredHandlers( aConfigRoot.getNodeNames() ); + const ::rtl::OUString* pHandlerName = aRegisteredHandlers.getConstArray(); + const ::rtl::OUString* pHandlersEnd = aRegisteredHandlers.getConstArray() + aRegisteredHandlers.getLength(); + for ( ; pHandlerName != pHandlersEnd; ++pHandlerName ) + { + const ::utl::OConfigurationNode aHandlerNode( aConfigRoot.openNode( *pHandlerName ) ); + const ::utl::OConfigurationNode aTypesNode( aHandlerNode.openNode( "HandledRequestTypes" ) ); + + // loop through all the types which the current handler is registered for + const Sequence< ::rtl::OUString > aHandledTypes( aTypesNode.getNodeNames() ); + const ::rtl::OUString* pType = aHandledTypes.getConstArray(); + const ::rtl::OUString* pTypesEnd = aHandledTypes.getConstArray() + aHandledTypes.getLength(); + for ( ; pType != pTypesEnd; ++pType ) + { + // the UNO type is the node name + ::utl::OConfigurationNode aType( aTypesNode.openNode( *pType ) ); + // and there's a child denoting how the responsibility propagates + ::rtl::OUString sPropagation; + OSL_VERIFY( aType.getNodeValue( "Propagation" ) >>= sPropagation ); + if ( lcl_matchesRequest( aRequest, *pType, sPropagation ) ) + { + // retrieve the service/implementation name of the handler + ::rtl::OUString sServiceName; + OSL_VERIFY( aHandlerNode.getNodeValue( "ServiceName" ) >>= sServiceName ); + // cache the information who feels responsible for requests of this type + m_aTypedCustomHandlers[ aRequest.getValueTypeName() ] = sServiceName; + // actually handle the request + if ( handleCustomRequest( rRequest, sServiceName ) ) + return true; + } + } + } + + return false; +} + bool UUIInteractionHelper::handle_impl( star::uno::Reference< star::task::XInteractionRequest > const & rRequest) @@ -1326,68 +1448,39 @@ UUIInteractionHelper::handle_impl( if (!rRequest.is()) return false; - //////////////////////////////////////////////////////////// // Display Messagebox - //////////////////////////////////////////////////////////// bool bDummy = false; rtl::OUString aDummy; - if (! handleMessageboxRequests(rRequest, false, bDummy, aDummy)) - { - //////////////////////////////////////////////////////////// - // Use ErrorHandler::HandleError - //////////////////////////////////////////////////////////// - if (!handleErrorHandlerRequests(rRequest, false, bDummy, aDummy)) - { - //////////////////////////////////////////////////////////// - // Display Special Dialog - //////////////////////////////////////////////////////////// - if (!handleDialogRequests(rRequest)) - { - //////////////////////////////////////////////////////////// - // Use customized InteractionHandler from configuration - //////////////////////////////////////////////////////////// - InteractionHandlerDataList dataList; - - GetInteractionHandlerList(dataList); - - InteractionHandlerDataList::const_iterator aEnd(dataList.end()); - for (InteractionHandlerDataList::const_iterator aIt(dataList.begin()); - aIt != aEnd; ++aIt) - { - Reference< uno::XInterface > xIfc = - m_xServiceFactory->createInstance(aIt->ServiceName); - - - Reference< com::sun::star::lang::XInitialization > xInitialization = - Reference< com::sun::star::lang::XInitialization >( xIfc, UNO_QUERY ); + if ( handleMessageboxRequests(rRequest, false, bDummy, aDummy) ) + return true; - OSL_ENSURE( xInitialization.is(), "Custom Interactionhandler does not implement mandatory interface XInitialization!" ); - if (xInitialization.is()) - { - uno::Sequence< uno::Any > propertyValues(1); - beans::PropertyValue aProperty; + // Use ErrorHandler::HandleError + if ( handleErrorHandlerRequests(rRequest, false, bDummy, aDummy) ) + return true; - aProperty.Name = rtl::OUString::createFromAscii( "Parent" ); - aProperty.Value <<= getParentXWindow(); - propertyValues[ 0 ] <<= aProperty; + // Display Special Dialog + if ( handleDialogRequests( rRequest ) ) + return true; - xInitialization->initialize(propertyValues); - } + // Use typed InteractionHandlers from configuration + if ( handleTypedHandlerImplementations( rRequest ) ) + return true; - Reference< task::XInteractionHandler2 > - xInteractionHandler( xIfc, UNO_QUERY ); + // Use customized InteractionHandler from configuration + InteractionHandlerDataList dataList; + GetInteractionHandlerList(dataList); - OSL_ENSURE( xInteractionHandler.is(), - "Custom Interactionhandler does not implement " - "mandatory interface XInteractionHandler2!" ); - if (xInteractionHandler.is()) - if (xInteractionHandler->handleInteractionRequest(rRequest)) - return true; - } - return false; - } - } + InteractionHandlerDataList::const_iterator aEnd(dataList.end()); + for ( InteractionHandlerDataList::const_iterator aIt( dataList.begin() ); + aIt != aEnd; + ++aIt + ) + { + if ( handleCustomRequest( rRequest, aIt->ServiceName ) ) + return true; } + + return false; } catch (std::bad_alloc const &) { @@ -1395,6 +1488,14 @@ UUIInteractionHelper::handle_impl( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")), star::uno::Reference< star::uno::XInterface >()); } + catch( const uno::RuntimeException& ) + { + throw; // allowed to leave here + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } return true; } @@ -1514,20 +1615,15 @@ Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) return 0; } -star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::getParentXWindow() SAL_THROW(()) +star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::getParentXWindow() const SAL_THROW(()) { osl::MutexGuard aGuard(m_aPropertyMutex); - for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i) + ::comphelper::NamedValueCollection aProperties( m_aProperties ); + if ( aProperties.has( "Parent" ) ) { - star::beans::PropertyValue aProperty; - if ((m_aProperties[i] >>= aProperty) - && aProperty. - Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Parent"))) - { - star::uno::Reference< star::awt::XWindow > xWindow; - aProperty.Value >>= xWindow; - return xWindow; - } + star::uno::Reference< star::awt::XWindow > xWindow; + OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow ); + return xWindow; } return 0; } @@ -3357,11 +3453,8 @@ UUIInteractionHelper::handleFutureDocumentVersionUpdateRequest( // suitable place), again, and we would only have one place where we remember the s_bDeferredToNextSession // flag. // - // The side effect (well, actually the more important effect) would be that we do not need to burden - // this central implementation with all interactions which are possible. Instead, separate parts of OOo - // can define/implement different requests. (for instance, everything which today is done in the - // css.sdb.InteractionHandler can then be routed through a "normal" interaction handler, where today we - // always need to tell people to instantiate the SDB-version of the handler, not the normal one.) + // Note: The above pattern has been implemented in CWS autorecovery. Now the remaining task is to move the + // handling of this interaction to SFX, again. if ( !s_bDeferredToNextSession ) { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index bea53e436c6d..12e15691fa55 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -54,6 +54,8 @@ #include #endif +#include + class Window; class LoginErrorInfo; struct CntHTTPCookieRequest; @@ -113,14 +115,17 @@ namespace com { namespace sun { namespace star { } } } } +typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > Continuations; + +typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > StringHashMap; + class UUIInteractionHelper { private: - osl::Mutex m_aPropertyMutex; - com::sun::star::uno::Reference< - com::sun::star::lang::XMultiServiceFactory > - m_xServiceFactory; - com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties; + mutable osl::Mutex m_aPropertyMutex; + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties; + StringHashMap m_aTypedCustomHandlers; UUIInteractionHelper(UUIInteractionHelper &); // not implemented void operator =(UUIInteractionHelper); // not implemented @@ -152,298 +157,278 @@ public: throw (com::sun::star::uno::RuntimeException); private: - bool - handle_impl(com::sun::star::uno::Reference< - com::sun::star::task::XInteractionRequest > const & - rRequest) - throw (com::sun::star::uno::RuntimeException); + bool handle_impl( + com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest > const & rRequest + ) + throw (com::sun::star::uno::RuntimeException); - void - GetInteractionHandlerList(InteractionHandlerDataList &rdataList); + void GetInteractionHandlerList(InteractionHandlerDataList &rdataList); sal_Bool - isDomainMatch( rtl::OUString hostName, rtl::OUString certHostName); + isDomainMatch( + rtl::OUString hostName, + rtl::OUString certHostName + ); + static long - handlerequest(void* pHandleData, void* pInteractionHandler); + handlerequest( + void* pHandleData, + void* pInteractionHandler + ); com::sun::star::beans::Optional< rtl::OUString > - getStringFromRequest_impl(com::sun::star::uno::Reference< - com::sun::star::task::XInteractionRequest > const & - rRequest) - throw (com::sun::star::uno::RuntimeException); + getStringFromRequest_impl( + com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest > const & rRequest + ) + throw (com::sun::star::uno::RuntimeException); static long - getstringfromrequest(void* pHandleData, void* pInteractionHandler); + getstringfromrequest(void* pHandleData, void* pInteractionHandler); - Window * getParentProperty() SAL_THROW(()); + Window* getParentProperty() SAL_THROW(()); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> getParentXWindow() SAL_THROW(()); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> + getParentXWindow() const SAL_THROW(()); - rtl::OUString getContextProperty() SAL_THROW(()); + rtl::OUString + getContextProperty() SAL_THROW(()); - bool - initPasswordContainer(com::sun::star::uno::Reference< - com::sun::star::task::XPasswordContainer > * - pContainer, - com::sun::star::uno::Reference< - com::sun::star::task::XUrlContainer > * - pUrlContainer) - const SAL_THROW(()); + bool initPasswordContainer( + com::sun::star::uno::Reference< com::sun::star::task::XPasswordContainer > * pContainer, + com::sun::star::uno::Reference< com::sun::star::task::XUrlContainer > * pUrlContainer + ) const + SAL_THROW(()); com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > - getInteractionHandler() const - SAL_THROW((com::sun::star::uno::RuntimeException)); + getInteractionHandler() const + SAL_THROW((com::sun::star::uno::RuntimeException)); - void executeLoginDialog(LoginErrorInfo & rInfo, + void executeLoginDialog(LoginErrorInfo & rInfo, rtl::OUString const & rRealm) SAL_THROW((com::sun::star::uno::RuntimeException)); - void - executeMasterPasswordDialog(LoginErrorInfo & rInfo, - com::sun::star::task::PasswordRequestMode nMode) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - executePasswordDialog(LoginErrorInfo & rInfo, - com::sun::star::task::PasswordRequestMode nMode, - ::rtl::OUString aDocumentName) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - executeMSPasswordDialog(LoginErrorInfo & rInfo, - com::sun::star::task::PasswordRequestMode nMode, - ::rtl::OUString aDocumentName) - SAL_THROW((com::sun::star::uno::RuntimeException)); + void executeMasterPasswordDialog( + LoginErrorInfo & rInfo, + com::sun::star::task::PasswordRequestMode nMode + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void executePasswordDialog( + LoginErrorInfo & rInfo, + com::sun::star::task::PasswordRequestMode nMode, + ::rtl::OUString aDocumentName + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void executeMSPasswordDialog( + LoginErrorInfo & rInfo, + com::sun::star::task::PasswordRequestMode nMode, + ::rtl::OUString aDocumentName + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void executeCookieDialog( + CntHTTPCookieRequest & rReques + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void executeFilterDialog( + rtl::OUString const & rURL , + uui::FilterNameList const & rFilters, + rtl::OUString & rFilter + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); - void executeCookieDialog(CntHTTPCookieRequest & rRequest) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void executeFilterDialog(rtl::OUString const & rURL , - uui::FilterNameList const & rFilters, - rtl::OUString & rFilter ) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - sal_Bool executeUnknownAuthDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert ) - SAL_THROW((com::sun::star::uno::RuntimeException)); + sal_Bool + executeUnknownAuthDialog( + const cssu::Reference< dcss::security::XCertificate >& rXCert + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); - sal_Bool executeSSLWarnDialog( const cssu::Reference< dcss::security::XCertificate >& rXCert, - sal_Int32 const & failures, - const rtl::OUString & hostName) - SAL_THROW((com::sun::star::uno::RuntimeException)); + sal_Bool + executeSSLWarnDialog( + const cssu::Reference< dcss::security::XCertificate >& rXCert, + sal_Int32 const & failures, + const rtl::OUString & hostName + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); rtl::OUString - getLocalizedDatTimeStr( ::com::sun::star::util::DateTime aDateTime ); - - USHORT - executeErrorDialog(com::sun::star::task::InteractionClassification - eClassification, - rtl::OUString const & rContext, - rtl::OUString const & rMessage, - WinBits nButtonMask ) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - USHORT - executeMessageBox( rtl::OUString const & rTitle, - rtl::OUString const & rMessage, - WinBits nButtonMask ) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleAuthenticationRequest( - com::sun::star::ucb::AuthenticationRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - rtl::OUString const & rURL) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleCertificateValidationRequest( - com::sun::star::ucb::CertificateValidationRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleNameClashResolveRequest( - com::sun::star::ucb::NameClashResolveRequest const & rRequest, - com::sun::star::uno::Sequence< com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleMasterPasswordRequest( - com::sun::star::task::PasswordRequestMode nMode, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - - void - handlePasswordRequest( - com::sun::star::task::PasswordRequestMode nMode, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - ::rtl::OUString aDocumentName = ::rtl::OUString()) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleMSPasswordRequest( - com::sun::star::task::PasswordRequestMode nMode, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - ::rtl::OUString aDocumentName = ::rtl::OUString()) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleCookiesRequest( - com::sun::star::ucb::HandleCookiesRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleNoSuchFilterRequest( - com::sun::star::document::NoSuchFilterRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleAmbigousFilterRequest( - com::sun::star::document::AmbigousFilterRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleFilterOptionsRequest( - com::sun::star::document::FilterOptionsRequest const & rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleErrorRequest( - com::sun::star::task::InteractionClassification eClassification, - ErrCode nErrorCode, - std::vector< rtl::OUString > const & rArguments, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - bool bObtainErrorStringOnly, - bool & bHasErrorString, - rtl::OUString & rErrorString) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleGenericErrorRequest( - sal_Int32 nErrorCode, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - bool bObtainErrorStringOnly, - bool & bHasErrorString, - rtl::OUString & rErrorString) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleMacroConfirmRequest( - const ::rtl::OUString& aDocumentURL, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xZipStorage, - const ::rtl::OUString& aDocumentVersion, - const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > aSignInfo, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations - ) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleFutureDocumentVersionUpdateRequest( - const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest& _rRequest, - com::sun::star::uno::Sequence< - com::sun::star::uno::Reference< - com::sun::star::task::XInteractionContinuation > > const & - rContinuations - ) - SAL_THROW((com::sun::star::uno::RuntimeException)); - - void - handleBrokenPackageRequest( - std::vector< rtl::OUString > const & rArguments, - ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - bool bObtainErrorStringOnly, - bool & bHasErrorString, - rtl::OUString & rErrorString) - SAL_THROW((::com::sun::star::uno::RuntimeException)); - - bool handleMessageboxRequests( - ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionRequest > const & - rRequest, - bool bObtainErrorStringOnly, - bool & bHasErrorString, - rtl::OUString & rErrorString); - - bool handleDialogRequests( - ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionRequest > const & - rRequest); - - bool handleErrorHandlerRequests( - ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionRequest > const & - rRequest, - bool bObtainErrorStringOnly, - bool & bHasErrorString, - rtl::OUString & rErrorString); - - void handleLockedDocumentRequest( - const ::rtl::OUString& aDocumentURL, - const ::rtl::OUString& aInfo, - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionContinuation > > const & - rContinuations, - sal_uInt16 nMode ) - SAL_THROW((::com::sun::star::uno::RuntimeException)); - - void handleChangedByOthersRequest( - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionContinuation > > const & - rContinuations ) - SAL_THROW((::com::sun::star::uno::RuntimeException)); - - void handleLockFileIgnoreRequest( - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< - ::com::sun::star::task::XInteractionContinuation > > const & - rContinuations ) - SAL_THROW((::com::sun::star::uno::RuntimeException)); - + getLocalizedDatTimeStr( + ::com::sun::star::util::DateTime aDateTime + ); + + USHORT executeErrorDialog( + com::sun::star::task::InteractionClassification eClassification, + rtl::OUString const & rContext, + rtl::OUString const & rMessage, + WinBits nButtonMask + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + USHORT executeMessageBox( + rtl::OUString const & rTitle, + rtl::OUString const & rMessage, + WinBits nButtonMask + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + + void handleAuthenticationRequest( + com::sun::star::ucb::AuthenticationRequest const & rRequest, + Continuations const & rContinuations, + rtl::OUString const & rURL + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleCertificateValidationRequest( + com::sun::star::ucb::CertificateValidationRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleNameClashResolveRequest( + com::sun::star::ucb::NameClashResolveRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleMasterPasswordRequest( + com::sun::star::task::PasswordRequestMode nMode, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + + void handlePasswordRequest( + com::sun::star::task::PasswordRequestMode nMode, + Continuations const & rContinuations, + ::rtl::OUString aDocumentName = ::rtl::OUString() + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleMSPasswordRequest( + com::sun::star::task::PasswordRequestMode nMode, + Continuations const & rContinuations, + ::rtl::OUString aDocumentName = ::rtl::OUString() + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleCookiesRequest( + com::sun::star::ucb::HandleCookiesRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleNoSuchFilterRequest( + com::sun::star::document::NoSuchFilterRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleAmbigousFilterRequest( + com::sun::star::document::AmbigousFilterRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleFilterOptionsRequest( + com::sun::star::document::FilterOptionsRequest const & rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + + void handleErrorRequest( + com::sun::star::task::InteractionClassification eClassification, + ErrCode nErrorCode, + std::vector< rtl::OUString > const & rArguments, + Continuations const & rContinuations, + bool bObtainErrorStringOnly, + bool & bHasErrorString, + rtl::OUString & rErrorString + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleGenericErrorRequest( + sal_Int32 nErrorCode, + Continuations const & rContinuations, + bool bObtainErrorStringOnly, + bool & bHasErrorString, + rtl::OUString & rErrorString + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleMacroConfirmRequest( + const ::rtl::OUString& aDocumentURL, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xZipStorage, + const ::rtl::OUString& aDocumentVersion, + const ::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > aSignInfo, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleFutureDocumentVersionUpdateRequest( + const ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest& _rRequest, + Continuations const & rContinuations + ) + SAL_THROW((com::sun::star::uno::RuntimeException)); + + void handleBrokenPackageRequest( + ::std::vector< rtl::OUString > const & rArguments, + Continuations const & + rContinuations, + bool bObtainErrorStringOnly, + bool & bHasErrorString, + ::rtl::OUString & rErrorString + ) + SAL_THROW((::com::sun::star::uno::RuntimeException)); + + bool handleMessageboxRequests( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest, + bool bObtainErrorStringOnly, + bool & bHasErrorString, + ::rtl::OUString & rErrorString + ); + + bool handleDialogRequests( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest + ); + + bool handleErrorHandlerRequests( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest, + bool bObtainErrorStringOnly, + bool & bHasErrorString, + ::rtl::OUString & rErrorString + ); + + bool handleTypedHandlerImplementations( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest + ); + + void handleLockedDocumentRequest( + const ::rtl::OUString& aDocumentURL, + const ::rtl::OUString& aInfo, + Continuations const & + rContinuations, + sal_uInt16 nMode + ) + SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) ); + + void handleChangedByOthersRequest( + Continuations const & rContinuations + ) + SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) ); + + void handleLockFileIgnoreRequest( + Continuations const & rContinuations + ) + SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) ); + + bool handleCustomRequest( + const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_rRequest, + const ::rtl::OUString& i_rServiceName + ) const; }; #endif // UUI_IAHNDL_HXX -- cgit v1.2.3 From db91786a9326d275aeec1fa86c8e9c78a294ca53 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 2 Feb 2010 12:15:37 +0100 Subject: aw079 #i108636# use better operator== for comparing two UNO API sequences of primitives --- svx/source/sdr/primitive2d/sdrole2primitive2d.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index cb9cb8bf3546..7e63c8cb0016 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -64,7 +64,13 @@ namespace drawinglayer { const SdrOle2Primitive2D& rCompare = (SdrOle2Primitive2D&)rPrimitive; - if(getOLEContent() == rCompare.getOLEContent() + // #i108636# The standard operator== on two UNO sequences did not work as i + // would have expected; it just checks the .is() states and the data type + // of the sequence. What i need here is detection of equality of the whole + // sequence content, thus i need to use the arePrimitive2DSequencesEqual helper + // here instead of the operator== which lead to always returning false and thus + // always re-decompositions of the subcontent. + if(arePrimitive2DSequencesEqual(getOLEContent(), rCompare.getOLEContent()) && getTransform() == rCompare.getTransform() && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()) { -- cgit v1.2.3 From 2bb7512e2923c860fa6d6bb55dcb000737f3a7ec Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 2 Feb 2010 12:16:54 +0100 Subject: aw079 #i108440# Support MetaStretchTextAction in MetafilePrimitive2D decomposition --- .../drawinglayer/primitive2d/textlayoutdevice.hxx | 21 ++- .../source/primitive2d/metafileprimitive2d.cxx | 176 +++++++++++++++++---- .../source/primitive2d/textlayoutdevice.cxx | 69 ++++++-- 3 files changed, 214 insertions(+), 52 deletions(-) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index f3de43c22fd7..2d2f77f34fe5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -101,20 +101,20 @@ namespace drawinglayer double getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; bool getTextOutlines( basegfx::B2DPolyPolygonVector&, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray); + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const; basegfx::B2DRange getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const; + sal_uInt32 nIndex, + sal_uInt32 nLength) const; double getFontAscent() const; double getFontDescent() const; @@ -123,7 +123,12 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile); + GDIMetaFile& rGDIMetaFile) const; + + ::std::vector< double > getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const; }; } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 4bb123380ee6..e621bed175e8 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -981,7 +981,42 @@ namespace TargetHolders& rTargetHolders, PropertyHolders& rPropertyHolders) { - // process evtl. created primitives which belong to the current region settings + const bool bNewActive(pRegion && !pRegion->IsEmpty()); + + // #i108636# The handlig of new ClipRegions was not done as good as possible + // in the first version of this interpreter; e.g. when a ClipRegion was set + // initially and then using a lot of push/pop actions, the pop always leads + // to setting a 'new' ClipRegion which indeed is the return to the ClipRegion + // of the properties next on the stack. + // This ClipRegion is identical to the current one, so there is no need to + // create a MaskPrimitive2D containing the up-to-now created primitives, but + // this was done before. While this does not lead to wrong primitive + // representations of the metafile data, it creates unneccesarily expensive + // representations. Just detecting when no really 'new' ClipRegion gets set + // solves the problem. + + if(!rPropertyHolders.Current().getRegionActive() && !bNewActive) + { + // no active region exchanged by no new one, done + return; + } + + if(rPropertyHolders.Current().getRegionActive() && bNewActive) + { + // active region and new active region + if(rPropertyHolders.Current().getRegion() == *pRegion) + { + // new region is the same as the old region, done + return; + } + } + + // Here the old region and the new one are definitively different, maybe + // old one and/or new one is not active. + + // Handle deletion of old region.The process evtl. created primitives which + // belong to this active region. These need to be embedded to a + // MaskPrimitive2D accordingly. if(rPropertyHolders.Current().getRegionActive() && rTargetHolders.size() > 1) { drawinglayer::primitive2d::Primitive2DSequence aSubContent; @@ -1001,8 +1036,8 @@ namespace } } - // apply new settings - const bool bNewActive(pRegion && !pRegion->IsEmpty()); + // apply new settings to current properties by setting + // the new region now rPropertyHolders.Current().setRegionActive(bNewActive); if(bNewActive) @@ -1259,13 +1294,12 @@ namespace const XubString& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLength, - sal_Int32* pDXArray, + const ::std::vector< double >& rDXArray, TargetHolder& rTarget, PropertyHolder& rProperty) { drawinglayer::primitive2d::BasePrimitive2D* pResult = 0; const Font& rFont = rProperty.getFont(); - std::vector< double > aDXArray; basegfx::B2DVector aAlignmentOffset(0.0, 0.0); if(nTextLength) @@ -1283,17 +1317,6 @@ namespace // add TextStartPosition aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); - // preapare DXArray (if used) - if(pDXArray && nTextLength) - { - aDXArray.reserve(nTextLength); - - for(xub_StrLen a(0); a < nTextLength; a++) - { - aDXArray.push_back((double)(*(pDXArray + a))); - } - } - // prepare FontColor and Locale const basegfx::BColor aFontColor(rProperty.getTextColor()); const com::sun::star::lang::Locale aLocale(MsLangId::convertLanguageToLocale(rProperty.getLanguageType())); @@ -1353,7 +1376,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor, @@ -1380,7 +1403,7 @@ namespace rText, nTextStart, nTextLength, - aDXArray, + rDXArray, aFontAttribute, aLocale, aFontColor); @@ -1396,13 +1419,13 @@ namespace // get text width double fTextWidth(0.0); - if(aDXArray.empty()) + if(rDXArray.empty()) { fTextWidth = aTextLayouterDevice.getTextWidth(rText, nTextStart, nTextLength); } else { - fTextWidth = aDXArray.back(); + fTextWidth = rDXArray.back(); } if(basegfx::fTools::more(fTextWidth, 0.0)) @@ -1957,15 +1980,24 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextAction* pA = (const MetaTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) { + const std::vector< double > aDXArray; proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - 0, + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1976,15 +2008,37 @@ namespace { /** CHECKED, WORKS WELL */ const MetaTextArrayAction* pA = (const MetaTextArrayAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); - if(pA->GetLen() && rPropertyHolders.Current().getTextColorActive()) + if(nTextLength + nTextIndex > nStringLength) { + nTextLength = nStringLength - nTextIndex; + } + + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) + { + // preapare DXArray (if used) + std::vector< double > aDXArray; + sal_Int32* pDXArray = pA->GetDXArray(); + + if(pDXArray) + { + aDXArray.reserve(nTextLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aDXArray.push_back((double)(*(pDXArray + a))); + } + } + proccessMetaTextAction( pA->GetPoint(), pA->GetText(), - pA->GetIndex(), - pA->GetLen(), - pA->GetDXArray(), + nTextIndex, + nTextLength, + aDXArray, rTargetHolders.Current(), rPropertyHolders.Current()); } @@ -1993,10 +2047,65 @@ namespace } case META_STRETCHTEXT_ACTION : { - /** NEEDS IMPLEMENTATION */ - OSL_ENSURE(false, "META_STRETCHTEXT_ACTION requested (!)"); - // use OutputDevice::GetTextArray() to map the... - // const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + // #i108440# StarMath uses MetaStretchTextAction, thus support is needed. + // It looks as if it pretty never really uses a width different from + // the default text-layout width, but it's not possible to be sure. + // Implemented getting the DXArray and checking for scale at all. If + // scale is more than 3.5% different, scale the DXArray before usage. + // New status: + + /** CHECKED, WORKS WELL */ + const MetaStretchTextAction* pA = (const MetaStretchTextAction*)pAction; + sal_uInt32 nTextLength(pA->GetLen()); + const sal_uInt32 nTextIndex(pA->GetIndex()); + const sal_uInt32 nStringLength(pA->GetText().Len()); + + if(nTextLength + nTextIndex > nStringLength) + { + nTextLength = nStringLength - nTextIndex; + } + + if(nTextLength && rPropertyHolders.Current().getTextColorActive()) + { + drawinglayer::primitive2d::TextLayouterDevice aTextLayouterDevice; + aTextLayouterDevice.setFont(rPropertyHolders.Current().getFont()); + + ::std::vector< double > aTextArray( + aTextLayouterDevice.getTextArray( + pA->GetText(), + nTextIndex, + nTextLength)); + + if(!aTextArray.empty()) + { + const double fTextLength(aTextArray.back()); + + if(0.0 != fTextLength && pA->GetWidth()) + { + const double fRelative(pA->GetWidth() / fTextLength); + + if(fabs(fRelative - 1.0) >= 0.035) + { + // when derivation is more than 3,5% from default text size, + // scale the DXArray + for(sal_uInt32 a(0); a < aTextArray.size(); a++) + { + aTextArray[a] *= fRelative; + } + } + } + } + + proccessMetaTextAction( + pA->GetPoint(), + pA->GetText(), + nTextIndex, + nTextLength, + aTextArray, + rTargetHolders.Current(), + rPropertyHolders.Current()); + } + break; } case META_TEXTRECT_ACTION : @@ -2005,8 +2114,9 @@ namespace // OSL_ENSURE(false, "META_TEXTRECT_ACTION requested (!)"); const MetaTextRectAction* pA = (const MetaTextRectAction*)pAction; const Rectangle& rRectangle = pA->GetRect(); + const sal_uInt32 nStringLength(pA->GetText().Len()); - if(!rRectangle.IsEmpty() && 0 != pA->GetText().Len()) + if(!rRectangle.IsEmpty() && 0 != nStringLength) { // The problem with this action is that it describes unlayouted text // and the layout capabilities are in EditEngine/Outliner in SVX. The diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 2950427d6b57..c7e2fcebb96f 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -223,8 +223,8 @@ namespace drawinglayer double TextLayouterDevice::getTextWidth( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { return mrDevice.GetTextWidth(rText, nIndex, nLength); } @@ -232,15 +232,22 @@ namespace drawinglayer bool TextLayouterDevice::getTextOutlines( basegfx::B2DPolyPolygonVector& rB2DPolyPolyVector, const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength, - const ::std::vector< double >& rDXArray) + sal_uInt32 nIndex, + sal_uInt32 nLength, + const ::std::vector< double >& rDXArray) const { const sal_uInt32 nDXArrayCount(rDXArray.size()); + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } if(nDXArrayCount) { - OSL_ENSURE(nDXArrayCount == nLength, "DXArray size does not correspond to text portion size (!)"); + OSL_ENSURE(nDXArrayCount == nTextLength, "DXArray size does not correspond to text portion size (!)"); std::vector< sal_Int32 > aIntegerDXArray(nDXArrayCount); for(sal_uInt32 a(0); a < nDXArrayCount; a++) @@ -274,10 +281,18 @@ namespace drawinglayer basegfx::B2DRange TextLayouterDevice::getTextBoundRect( const String& rText, - xub_StrLen nIndex, - xub_StrLen nLength) const + sal_uInt32 nIndex, + sal_uInt32 nLength) const { - if(nLength) + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) { Rectangle aRect; @@ -291,7 +306,9 @@ namespace drawinglayer // #i104432#, #i102556# take empty results into account if(!aRect.IsEmpty()) { - return basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()); + return basegfx::B2DRange( + aRect.Left(), aRect.Top(), + aRect.Right(), aRect.Bottom()); } } @@ -314,11 +331,41 @@ namespace drawinglayer const Rectangle& rRectangle, const String& rText, sal_uInt16 nStyle, - GDIMetaFile& rGDIMetaFile) + GDIMetaFile& rGDIMetaFile) const { mrDevice.AddTextRectActions( rRectangle, rText, nStyle, rGDIMetaFile); } + + ::std::vector< double > TextLayouterDevice::getTextArray( + const String& rText, + sal_uInt32 nIndex, + sal_uInt32 nLength) const + { + ::std::vector< double > aRetval; + sal_uInt32 nTextLength(nLength); + const sal_uInt32 nStringLength(rText.Len()); + + if(nTextLength + nIndex > nStringLength) + { + nTextLength = nStringLength - nIndex; + } + + if(nTextLength) + { + aRetval.reserve(nTextLength); + sal_Int32* pArray = new sal_Int32[nTextLength]; + mrDevice.GetTextArray(rText, pArray, nIndex, nLength); + + for(sal_uInt32 a(0); a < nTextLength; a++) + { + aRetval.push_back(pArray[a]); + } + } + + return aRetval; + } + } // end of namespace primitive2d } // end of namespace drawinglayer -- cgit v1.2.3 From c5ac08c9fdc71eaa55964c97b7dc2fe0b135b686 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Wed, 3 Feb 2010 16:23:21 +0100 Subject: ause113: #i108416# update windows version defines --- fpicker/source/win32/filepicker/makefile.mk | 1 + shell/source/win32/shlxthandler/propsheets/makefile.mk | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fpicker/source/win32/filepicker/makefile.mk b/fpicker/source/win32/filepicker/makefile.mk index de192879b629..044d19b280c5 100644 --- a/fpicker/source/win32/filepicker/makefile.mk +++ b/fpicker/source/win32/filepicker/makefile.mk @@ -47,6 +47,7 @@ CDEFS+=-D_UNICODE CDEFS+=-DUNICODE #CDEFS+=-DWIN32_LEAN_AND_MEAN #CDEFS+=-DWIN32 +CDEFS+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0600 # --- Resources ---------------------------------------------------- diff --git a/shell/source/win32/shlxthandler/propsheets/makefile.mk b/shell/source/win32/shlxthandler/propsheets/makefile.mk index ac12795cf37f..ce1300596687 100644 --- a/shell/source/win32/shlxthandler/propsheets/makefile.mk +++ b/shell/source/win32/shlxthandler/propsheets/makefile.mk @@ -39,13 +39,14 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 +CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE +CDEFS+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0501 -U_WIN32_IE -D_WIN32_IE=0x501 +.IF "$(COM)"!="GCC" CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -CDEFS+=-D_WIN32_IE=0x501 - -CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501 +CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820 -CDEFS_X64+=-D_WIN32_IE=0x501 +CDEFS_X64+=-D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x501 +.ENDIF # --- Files -------------------------------------------------------- -- cgit v1.2.3 From fc0828d5a4e517a1a868a76cbf5b01b29a3c9b17 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 14:13:58 +0100 Subject: autorecovery: post-rebase build problems solved --- sfx2/source/view/viewfrm2.cxx | 2 +- uui/source/iahndl.cxx | 2 ++ uui/source/iahndl.hxx | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx index 62da2c87d5ca..9d1cda9eba61 100644 --- a/sfx2/source/view/viewfrm2.cxx +++ b/sfx2/source/view/viewfrm2.cxx @@ -231,7 +231,7 @@ String SfxViewFrame::UpdateTitle() // Name des SbxObjects String aSbxName = pObjSh->SfxShell::GetName(); - if ( IsVisible_Impl() ) + if ( IsVisible() ) { aSbxName += ':'; aSbxName += String::CreateFromInt32(pImp->nDocViewNo); diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 7d10a879ffe3..898081fd1bf8 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -112,6 +112,8 @@ using ::com::sun::star::task::XInteractionRequest; using ::com::sun::star::lang::XMultiServiceFactory; /** === end UNO using === **/ +using namespace ::com::sun::star; + namespace { class HandleData : public osl::Condition diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index a4db6632b664..e0b58f66ed58 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -174,6 +174,10 @@ private: getInteractionHandler() SAL_THROW((com::sun::star::uno::RuntimeException)); + bool handleTypedHandlerImplementations( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & rRequest + ); + bool tryOtherInteractionHandler( com::sun::star::uno::Reference< -- cgit v1.2.3 From aa8543f821e9e84bd52382f424ec165ebd27f558 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 22:33:56 +0100 Subject: autorecovery: #i10000# make compile on unxlngi6.pro --- framework/source/services/autorecovery.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index e256b40035e3..410706bc96f6 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -97,6 +97,7 @@ #include #include #include +#include #include -- cgit v1.2.3 From 62a22fa9ea85d5e29e701e9649c01f52a5105559 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Feb 2010 13:04:20 +0100 Subject: autorecovery: when a handler is not yet in the cache, nonetheless use the first matching entry from the configuration, instead of continueing with other handlers when the first can't handle the request --- uui/source/iahndl.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 898081fd1bf8..e9f1b9e4c618 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -439,8 +439,7 @@ bool UUIInteractionHelper::handleTypedHandlerImplementations( Reference< XIntera // cache the information who feels responsible for requests of this type m_aTypedCustomHandlers[ aRequest.getValueTypeName() ] = sServiceName; // actually handle the request - if ( handleCustomRequest( rRequest, sServiceName ) ) - return true; + return handleCustomRequest( rRequest, sServiceName ); } } } -- cgit v1.2.3 From c51e93fc737bdb7f806ee9ce534706b318042a48 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 8 Feb 2010 16:03:09 +0100 Subject: mtaccfixes: #i87415 Mnemonics need to be unambiguous --- svx/source/dialog/srchdlg.src | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/svx/source/dialog/srchdlg.src b/svx/source/dialog/srchdlg.src index 2c69a25b92d8..510d7b59ccf7 100644 --- a/svx/source/dialog/srchdlg.src +++ b/svx/source/dialog/srchdlg.src @@ -240,7 +240,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 163 ) ; Size = MAP_APPFONT ( 126 , 10 ) ; - Text [ en-US ] = "Current selection ~only" ; + Text [ en-US ] = "C~urrent selection only" ; TabStop = TRUE ; Hide = TRUE ; }; @@ -349,7 +349,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 285 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search in" ; + Text [ en-US ] = "Search i~n" ; Hide = TRUE ; }; ListBox LB_CALC_SEARCHIN @@ -371,7 +371,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 12 , 300 ) ; Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "~Search direction" ; + Text [ en-US ] = "Search ~direction" ; Hide = TRUE ; }; RadioButton RB_CALC_ROWS @@ -385,7 +385,7 @@ ModelessDialog RID_SVXDLG_SEARCH { Pos = MAP_APPFONT ( 75 , 313 ) ; Size = MAP_APPFONT ( 63 , 10 ) ; - Text [ en-US ] = "Col~umns" ; + Text [ en-US ] = "Colu~mns" ; Hide = TRUE ; }; CheckBox CB_ALL_SHEETS -- cgit v1.2.3 From 5f1e3bff24310560c4a3c314bb0cd909d1f423c2 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 9 Feb 2010 11:33:08 +0100 Subject: aw079 #i99386# finer granular changes for MPBGO removal --- svx/inc/svx/sdrmasterpagedescriptor.hxx | 7 + svx/inc/svx/svdobj.hxx | 4 + svx/inc/svx/svdpage.hxx | 118 ++++++++----- .../contact/viewcontactofmasterpagedescriptor.cxx | 32 ++++ svx/source/sdr/contact/viewcontactofsdrpage.cxx | 30 ++++ .../viewobjectcontactofmasterpagedescriptor.cxx | 13 ++ svx/source/sdr/properties/attributeproperties.cxx | 2 + svx/source/svdraw/sdrmasterpagedescriptor.cxx | 21 +++ svx/source/svdraw/svdobj.cxx | 4 + svx/source/svdraw/svdpage.cxx | 194 ++++++++++++++++++++- svx/source/svdraw/svdpntv.cxx | 2 +- svx/source/unodraw/UnoGraphicExporter.cxx | 54 +++++- 12 files changed, 434 insertions(+), 47 deletions(-) diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 52752945255c..a8780c614285 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -34,9 +34,12 @@ #include #include +#define NEWPBG + ////////////////////////////////////////////////////////////////////////////// // predeclarations class SdrObject; +class SfxItemSet; namespace sdr { @@ -92,8 +95,12 @@ namespace sdr sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; +#ifdef NEWPBG + const SfxItemSet& getCorrectFillAttributes() const; +#else // #i42075# Get the correct BackgroundObject SdrObject* GetBackgroundObject() const; +#endif }; } // end of namespace sdr diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index fce776ef0abf..edab358a2e4a 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -31,6 +31,8 @@ #ifndef _SVDOBJ_HXX #define _SVDOBJ_HXX +#define NEWPBG + #include #include #include @@ -1102,10 +1104,12 @@ public: sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const; +#ifndef NEWPBG // #111111# // Needed again and again i will now add a test for finding out if // this object is the BackgroundObject of the page. sal_Bool IsMasterPageBackgroundObject() const; +#endif // #116168# // Give info if object is in destruction diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 02181afb1674..60193f132db9 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -31,59 +31,29 @@ #ifndef _SVDPAGE_HXX #define _SVDPAGE_HXX -#include +#define NEWPBG -#ifndef _PRINT_HXX //autogen +#include #include -#endif -#ifndef _GDIMTF_HXX //autogen #include -#endif #include #include #include #include - -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface #include - -// #111111# #include #include - -// StandardCheckVisisbilityRedirector #include #include #include "svx/svxdllapi.h" - #include #include #include -// #110094# -namespace sdr -{ - namespace contact - { - class ViewContact; - } // end of namespace contact -} // end of namespace sdr - -// ------------------------------ -// - intern benutzte Paint-Modi - -// ------------------------------ - -//#if 0 // _SOLAR__PRIVATE - -#define IMP_PAGEPAINT_NORMAL 0 -#define IMP_PAGEPAINT_PREPARE_CACHE 1 -#define IMP_PAGEPAINT_PAINT_CACHE 2 -#define IMP_PAGEPAINT_PREPARE_BG_CACHE 3 -#define IMP_PAGEPAINT_PAINT_BG_CACHE 4 - -//#endif // __PRIVATE +////////////////////////////////////////////////////////////////////////////// +// predefines +namespace sdr { namespace contact { class ViewContact; }} class SdrPage; class SdrModel; class SfxItemPool; @@ -113,7 +83,11 @@ public: SdrInsertReasonKind GetReason() const { return eReason; } }; -class SVX_DLLPUBLIC SdrObjList { +////////////////////////////////////////////////////////////////////////////// +// class SdrObjList + +class SVX_DLLPUBLIC SdrObjList +{ private: typedef ::std::vector SdrObjectContainerType; SdrObjectContainerType maList; @@ -350,8 +324,12 @@ Objektes abgefragt sowie direkt gesetzt werden. // Used for all methods which return a page number #define SDRPAGE_NOTFOUND 0xFFFF +////////////////////////////////////////////////////////////////////////////// +// class SdrPageGridFrame + // Fuer das Fangraster/Punkgitter im Writer -class SdrPageGridFrame { +class SdrPageGridFrame +{ Rectangle aPaper; Rectangle aUserArea; public: @@ -383,8 +361,50 @@ public: }; //////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPageProperties + +#ifdef NEWPBG + +class SVX_DLLPUBLIC SdrPageProperties : public SfxListener +{ +private: + // data + SdrPage* mpSdrPage; + SfxStyleSheet* mpStyleSheet; + SfxItemSet* mpProperties; + + // internal helpers + void ImpRemoveStyleSheet(); + void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet); + + // not implemented + SdrPageProperties& operator=(const SdrPageProperties& rCandidate); + +public: + // construct/destruct + SdrPageProperties(SdrPage& rSdrPage); + SdrPageProperties(const SdrPageProperties& rCandidate); + virtual ~SdrPageProperties(); + + // Notify(...) from baseclass SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); + + // data read/write + const SfxItemSet& GetItemSet() const; + void PutItemSet(const SfxItemSet& rSet); + void PutItem(const SfxPoolItem& rItem); + void ClearItem(const sal_uInt16 nWhich = 0); + + // StyleSheet access + void SetStyleSheet(SfxStyleSheet* pStyleSheet); + SfxStyleSheet* GetStyleSheet() const; +}; + +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////// +// class SdrPage -class SVX_DLLPUBLIC SdrPage: public SdrObjList, public tools::WeakBase< SdrPage > +class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage > { /////////////////////////////////////////////////////////////////////////////// // start PageUser section @@ -430,9 +450,19 @@ friend class ChXChartDocument; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage; protected: - SdrLayerAdmin* pLayerAdmin; - SdrObject* pBackgroundObj; + SdrLayerAdmin* pLayerAdmin; +#ifndef NEWPBG + SdrObject* pBackgroundObj; +#else +private: + SdrPageProperties* mpSdrPageProperties; + +public: + SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } + const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } +#endif +protected: // new MasterPageDescriptorVector ::sdr::MasterPageDescriptor* mpMasterPageDescriptor; @@ -537,8 +567,10 @@ public: bool IsSwappingLocked() const { return mbSwappingLocked; } void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } +#ifndef NEWPBG SdrObject* GetBackgroundObj() const { return pBackgroundObj; } void SetBackgroundObj( SdrObject* pObj ); +#endif ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage(); @@ -567,8 +599,8 @@ public: /** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */ bool isHandoutMasterPage() const; -////////////////////////////////////////////////////////////////////////////// -// sdr::Comment interface + ////////////////////////////////////////////////////////////////////////////// + // sdr::Comment interface private: sdr::CommentVector maComments; @@ -577,8 +609,6 @@ public: const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex); void AddComment(const sdr::Comment& rNew); void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew); - -////////////////////////////////////////////////////////////////////////////// }; typedef tools::WeakReference< SdrPage > SdrPageWeakRef; diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 84f6c7c9bfe2..4dad454af869 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -64,6 +64,33 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + +#ifdef NEWPBG + // build primitive from page fill attributes + const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); + const basegfx::B2DRange aInnerRange( + rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), + rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), + rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } +#else const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); if(pBackgroundCandidate) @@ -93,6 +120,7 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } } +#endif return xRetval; } @@ -113,20 +141,24 @@ namespace sdr { sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); +#ifndef NEWPBG if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nRetval--; } +#endif return nRetval; } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 12b7e1b0acf4..3018a9dc17e2 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,6 +206,31 @@ namespace sdr } else { +#ifdef NEWPBG + // build primitive from pObject's attributes + const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); + const drawinglayer::attribute::SdrFillAttribute aFill( + drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + + if(!aFill.isDefault()) + { + // direct model data is the page size, get and use it + const basegfx::B2DRange aInnerRange( + rPage.GetLftBorder(), rPage.GetUppBorder(), + rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); + const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); + const basegfx::B2DHomMatrix aEmptyTransform; + const drawinglayer::primitive2d::Primitive2DReference xReference( + drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon(aInnerPolgon), + aEmptyTransform, + aFill, + drawinglayer::attribute::FillGradientAttribute())); + + xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + +#else OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); if(rPage.GetObjCount()) @@ -239,6 +264,7 @@ namespace sdr } } } +#endif } } @@ -461,20 +487,24 @@ namespace sdr { sal_uInt32 nSubObjectCount(getPage().GetObjCount()); +#ifndef NEWPBG if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nSubObjectCount--; } +#endif return nSubObjectCount; } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { +#ifndef NEWPBG if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) { nIndex++; } +#endif SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index fa785125118c..f0c3eb2c8bed 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,6 +98,18 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); +#ifdef NEWPBG + // check layer visibility (traditionally was member of layer 1) + if(aPreprocessedLayers.IsSet(1)) + { + // hide PageBackground for special DrawModes; historical reasons + if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) + { + // if visible, create the default background primitive sequence + xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); + } + } +#else // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); @@ -110,6 +122,7 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } +#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index 4fcdb12ffe5c..df8944342619 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -587,6 +587,7 @@ namespace sdr bHintUsed = sal_True; } +#ifndef NEWPBG // #111111# // When it's the BackgroundObject, set the MasterPage to changed to // get a refresh for the evtl. changed BackgroundStyle @@ -602,6 +603,7 @@ namespace sdr { GetSdrObject().GetPage()->ActionChanged(); } +#endif if(!bHintUsed) { diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 9cee1e344c6a..dcc519148e27 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -37,6 +37,11 @@ // #i42075# #include +#ifdef NEWPBG +#include +#include +#endif + ////////////////////////////////////////////////////////////////////////////// namespace sdr @@ -98,6 +103,7 @@ namespace sdr maVisibleLayers = rNew; GetViewContact().ActionChanged(); +#ifndef NEWPBG // #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too SdrObject* pObject = GetBackgroundObject(); @@ -105,6 +111,7 @@ namespace sdr { pObject->BroadcastObjectChange(); } +#endif } } @@ -123,6 +130,19 @@ namespace sdr || maVisibleLayers != rCandidate.maVisibleLayers); } +#ifdef NEWPBG + const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const + { + const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); + + if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) + { + return rOwnerPageAtributes; + } + + return GetUsedPage().getSdrPageProperties().GetItemSet(); + } +#else // #i42075# Get the correct BackgroundObject SdrObject* MasterPageDescriptor::GetBackgroundObject() const { @@ -158,6 +178,7 @@ namespace sdr return pRetval; } +#endif } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 3ed33e0f20ad..58f3d4ce2873 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -375,6 +375,7 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { +#ifndef NEWPBG // Forward change call to MasterPageDescriptor if BackgroundObject was changed const SdrPage* pObjectsPage = GetPage(); @@ -419,6 +420,7 @@ void SdrObject::ActionChanged() const } } } +#endif // Do necessary ViewContact actions GetViewContact().ActionChanged(); @@ -3117,6 +3119,7 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba SetSnapRect(aBaseRect); } +#ifndef NEWPBG // #111111# // Needed again and again i will now add a test for finding out if // this object is the BackgroundObject of the page. @@ -3136,6 +3139,7 @@ sal_Bool SdrObject::IsMasterPageBackgroundObject() const return sal_False; } +#endif // #116168# // Give info if object is in destruction diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 864cc3d77e8d..b53606d53aeb 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -69,6 +69,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -1175,6 +1176,140 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const return *mpViewContact; } +//////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef NEWPBG + +void SdrPageProperties::ImpRemoveStyleSheet() +{ + if(mpStyleSheet) + { + EndListening(*mpStyleSheet); + mpProperties->SetParent(0); + mpStyleSheet = 0; + } +} + +void SdrPageProperties::ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet) +{ + if(mpStyleSheet != &rNewStyleSheet) + { + ImpRemoveStyleSheet(); + mpStyleSheet = &rNewStyleSheet; + StartListening(rNewStyleSheet); + mpProperties->SetParent(&rNewStyleSheet.GetItemSet()); + } +} + +void ImpPageChange(SdrPage& rSdrPage) +{ + rSdrPage.ActionChanged(); + + if(rSdrPage.GetModel()) + { + rSdrPage.GetModel()->SetChanged(true); + SdrHint aHint(HINT_PAGEORDERCHG); + aHint.SetPage(&rSdrPage); + rSdrPage.GetModel()->Broadcast(aHint); + } +} + +SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) +: mpSdrPage(&rSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) +{ + if(!rSdrPage.IsMasterPage()) + { + mpProperties->Put(XFillStyleItem(XFILL_NONE)); + } +} + +SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) +: mpSdrPage(rCandidate.mpSdrPage), + mpStyleSheet(0), + mpProperties(new SfxItemSet(*rCandidate.mpProperties)) +{ + if(rCandidate.GetStyleSheet()) + { + ImpAddStyleSheet(*rCandidate.GetStyleSheet()); + } +} + +SdrPageProperties::~SdrPageProperties() +{ + ImpRemoveStyleSheet(); + delete mpProperties; +} + +void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); + + if(pSimpleHint) + { + switch(pSimpleHint->GetId()) + { + case SFX_HINT_DATACHANGED : + { + // notify change, broadcast + ImpPageChange(*mpSdrPage); + break; + } + case SFX_HINT_DYING : + { + // Style needs to be forgotten + ImpRemoveStyleSheet(); + break; + } + } + } +} + +const SfxItemSet& SdrPageProperties::GetItemSet() const +{ + return *mpProperties; +} + +void SdrPageProperties::PutItemSet(const SfxItemSet& rSet) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rSet); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::PutItem(const SfxPoolItem& rItem) +{ + OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)"); + mpProperties->Put(rItem); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::ClearItem(const sal_uInt16 nWhich) +{ + mpProperties->ClearItem(nWhich); + ImpPageChange(*mpSdrPage); +} + +void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet) +{ + if(pStyleSheet) + { + ImpAddStyleSheet(*pStyleSheet); + } + else + { + ImpRemoveStyleSheet(); + } + + ImpPageChange(*mpSdrPage); +} + +SfxStyleSheet* SdrPageProperties::GetStyleSheet() const +{ + return mpStyleSheet; +} + +#endif //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrPage,SdrObjList); @@ -1189,7 +1324,11 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) nBordRgt(0L), nBordLwr(0L), pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())), +#ifndef NEWPBG pBackgroundObj(0L), +#else + mpSdrPageProperties(0), +#endif mpMasterPageDescriptor(0L), nPageNum(0L), mbMaster(bMasterPage), @@ -1201,6 +1340,10 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) DBG_CTOR(SdrPage,NULL); aPrefVisiLayers.SetAll(); eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; + +#ifdef NEWPBG + mpSdrPageProperties = new SdrPageProperties(*this); +#endif } SdrPage::SdrPage(const SdrPage& rSrcPage) @@ -1214,7 +1357,11 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) nBordRgt(rSrcPage.nBordRgt), nBordLwr(rSrcPage.nBordLwr), pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())), +#ifndef NEWPBG pBackgroundObj(0L), +#else + mpSdrPageProperties(0), +#endif mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), mbMaster(rSrcPage.mbMaster), @@ -1248,6 +1395,10 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } + +#ifdef NEWPBG + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); +#endif } SdrPage::~SdrPage() @@ -1281,7 +1432,9 @@ SdrPage::~SdrPage() // when they get called from PageInDestruction(). maPageUsers.clear(); +#ifndef NEWPBG SdrObject::Free( pBackgroundObj ); +#endif delete pLayerAdmin; TRG_ClearMasterPage(); @@ -1293,6 +1446,13 @@ SdrPage::~SdrPage() mpViewContact = 0L; } +#ifdef NEWPBG + { + delete mpSdrPageProperties; + mpSdrPageProperties = 0; + } +#endif + DBG_DTOR(SdrPage,NULL); } @@ -1304,7 +1464,9 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mpViewContact = 0L; } +#ifndef NEWPBG SdrObject::Free( pBackgroundObj ); +#endif // Joe also sets some parameters for the class this one // is derived from. SdrObjList does the same bad handling of @@ -1339,6 +1501,7 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; +#ifndef NEWPBG if(rSrcPage.pBackgroundObj) { pBackgroundObj = rSrcPage.pBackgroundObj->Clone(); @@ -1348,6 +1511,12 @@ void SdrPage::operator=(const SdrPage& rSrcPage) // #i62000# for single-page MPBGO, force no line pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); } +#else + { + delete mpSdrPageProperties; + mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + } +#endif // Now copy the contained obejcts (by cloning them) SdrObjList::operator=(rSrcPage); @@ -1526,8 +1695,16 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); +#ifndef NEWPBG if( pBackgroundObj ) pBackgroundObj->SetModel( pNewModel ); +#else + { + SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + delete mpSdrPageProperties; + mpSdrPageProperties = pNew; + } +#endif } // update listeners at possible api wrapper object @@ -1661,6 +1838,7 @@ XubString SdrPage::GetLayoutName() const return String(); } +#ifndef NEWPBG void SdrPage::SetBackgroundObj( SdrObject* pObj ) { if ( pObj ) @@ -1676,6 +1854,7 @@ void SdrPage::SetBackgroundObj( SdrObject* pObj ) SdrObject::Free( pBackgroundObj ); pBackgroundObj = pObj; } +#endif void SdrPage::SetInserted( bool bIns ) { @@ -1750,10 +1929,22 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) aColor = pView->GetApplicationDocumentColor(); } +#ifdef NEWPBG + const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet(); + + if(!IsMasterPage() && TRG_HasMasterPage()) + { + if(XFILL_NONE == ((const XFillStyleItem&)pBackgroundFill->Get(XATTR_FILLSTYLE)).GetValue()) + { + pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + } + } + + GetDraftFillColor(*pBackgroundFill, aColor); +#else // first, see if we have a background object SdrObject* pBackgroundObj2 = NULL; - if( IsMasterPage() ) { if( GetObjCount() ) @@ -1782,6 +1973,7 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet(); GetDraftFillColor( rSet, aColor ); } +#endif return aColor; } diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 8c46e1d06bb6..2d04301433e9 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -335,7 +335,7 @@ void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (eKind==HINT_PAGEORDERCHG) { const SdrPage* pPg=pSdrHint->GetPage(); - if(!pPg->IsInserted()) + if(pPg && !pPg->IsInserted()) { if(mpPageView && mpPageView->GetPage() == pPg) { diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index ebd8f83e00f0..1e191f3125c1 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -618,6 +618,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); +#ifndef NEWPBG // create a view SdrView* pView; @@ -633,17 +634,25 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, pView->SetBordVisible( FALSE ); pView->SetPageVisible( FALSE ); pView->ShowSdrPage( pPage ); +#endif SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); +#ifdef NEWPBG + rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); +#else rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); +#endif // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); +#ifdef NEWPBG + SdrObject* pTempBackgroundShape = 0; +#endif std::vector< SdrObject* > aShapes; bool bRet = true; @@ -652,6 +661,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { +#ifdef NEWPBG + pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); + pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); + pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); + aShapes.push_back(pTempBackgroundShape); +#else SdrObject* pShape = 0; if( pPage->IsMasterPage() ) { @@ -665,6 +680,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, if( pShape ) aShapes.push_back( pShape ); +#endif } else { @@ -741,8 +757,26 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT ); aVDev.EnableOutput( FALSE ); aMtf.Record( &aVDev ); - Size aNewSize; + +#ifdef NEWPBG + // create a view + SdrView* pView; + + if( PTR_CAST( FmFormModel, mpDoc ) ) + { + pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); + } + else + { + pView = new SdrView( mpDoc, &aVDev ); + } + + pView->SetBordVisible( FALSE ); + pView->SetPageVisible( FALSE ); + pView->ShowSdrPage( pPage ); +#endif + if ( pView && pPage ) { pView->SetBordVisible( FALSE ); @@ -783,6 +817,13 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } +#ifdef NEWPBG + if ( pView ) + { + pView->HideSdrPage(); + delete pView; + } +#endif if( rSettings.mbTranslucent ) { Size aOutSize; @@ -907,6 +948,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; +#ifndef NEWPBG if(rSettings.mbExportOnlyBackground) { // shape is MPBGO and if it's not yet set, it's size will @@ -916,6 +958,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aBound = Rectangle(Point(0,0), pPage->GetSize()); } else +#endif { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -989,11 +1032,20 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } +#ifndef NEWPBG if ( pView ) { pView->HideSdrPage(); delete pView; } +#endif + +#ifdef NEWPBG + if(pTempBackgroundShape) + { + SdrObject::Free(pTempBackgroundShape); + } +#endif rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); -- cgit v1.2.3 From bec6c2b0014b2b5f0d291914db4957c57eac4642 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 9 Feb 2010 23:10:16 +0100 Subject: autorecovery: even when loading a new document from a recovery storage, ensure that attachResource is called, for those (correct) implentations which do *not* implicitly do this in their loadFromStorage method --- embeddedobj/source/commonembedding/persistence.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 55170093c43e..2ef491cf73d4 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -372,8 +372,8 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl() { // init document as a new xLoadable->initNew(); - xModel->attachResource( xModel->getURL(), m_aDocMediaDescriptor ); } + xModel->attachResource( xModel->getURL(), m_aDocMediaDescriptor ); } catch( uno::Exception& ) { -- cgit v1.2.3 From ba195fedb854976ac4e7f04e09a96cb005060d8f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 10 Feb 2010 12:01:12 +0100 Subject: dba33e: #i109097 --- basic/source/uno/namecont.cxx | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index cd9fb2ad1219..883d1d7c643d 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1793,11 +1793,11 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { // create a temporary target storage const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) ); + sal_Int32 index = 0; do { ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase ); - sal_Int32 index = 0; - aTempTargetName.append( index ); + aTempTargetName.append( index++ ); sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear(); if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) ) @@ -1826,6 +1826,8 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { if ( mxStorage->hasByName( maLibrariesDir ) ) xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); + else if ( bInplaceStorage ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ); } catch( const uno::Exception& ) { @@ -1939,6 +1941,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto // then we need to clean up the temporary storage we used for this if ( bInplaceStorage && sTempTargetStorName.getLength() ) { + OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" ); try { // for this, we first remove everything from the source storage, then copy the complete content @@ -1948,24 +1951,27 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto // (We cannot simply remove the storage, denoted by maLibrariesDir, from i_rStorage - there might be // open references to it.) - // remove - const Sequence< ::rtl::OUString > aRemoveNames( xTargetLibrariesStor->getElementNames() ); - for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); - pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); - ++pRemoveName - ) + if ( xSourceLibrariesStor.is() ) { - xSourceLibrariesStor->removeElement( *pRemoveName ); - } + // remove + const Sequence< ::rtl::OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); + pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); + ++pRemoveName + ) + { + xSourceLibrariesStor->removeElement( *pRemoveName ); + } - // copy - const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); - for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); - pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); - ++pCopyName - ) - { - xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + // copy + const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); + pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); + ++pCopyName + ) + { + xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + } } // close and remove temp target -- cgit v1.2.3 From 3497a025cea0fc5fc0a7ca3ad835b17c6ae38573 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 10 Feb 2010 12:16:22 +0100 Subject: aw079: changes after resync (linux) --- drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 2 +- drawinglayer/source/primitive2d/shadowprimitive2d.cxx | 2 +- .../source/primitive2d/unifiedtransparenceprimitive2d.cxx | 2 +- drawinglayer/source/processor2d/canvasprocessor.cxx | 2 +- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 2 +- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 2 +- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 +- drawinglayer/source/processor3d/shadow3dextractor.cxx | 2 +- svx/source/svdraw/svdpage.cxx | 8 +++++--- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index e621bed175e8..9d497ffe65e8 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index 7d8abd5490fb..c5ca479504a2 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx index b0905b2adf39..6d930e40f5d7 100644 --- a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -36,7 +36,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_drawinglayer.hxx" -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx index d089e6a440de..6bb825a7b476 100644 --- a/drawinglayer/source/processor2d/canvasprocessor.cxx +++ b/drawinglayer/source/processor2d/canvasprocessor.cxx @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 687bb751ca20..f96dccab39b4 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 9161f8d4c59d..e0ba7ae53000 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 1c1865c13f75..8f9fca8286d0 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 6e7b6a587b1e..a3f75073731b 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index b53606d53aeb..7516148d7a47 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1214,7 +1214,8 @@ void ImpPageChange(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) -: mpSdrPage(&rSdrPage), +: SfxListener(), + mpSdrPage(&rSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST)) { @@ -1225,7 +1226,8 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: mpSdrPage(rCandidate.mpSdrPage), +: SfxListener(), + mpSdrPage(rCandidate.mpSdrPage), mpStyleSheet(0), mpProperties(new SfxItemSet(*rCandidate.mpProperties)) { @@ -1241,7 +1243,7 @@ SdrPageProperties::~SdrPageProperties() delete mpProperties; } -void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) +void SdrPageProperties::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) { const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint); -- cgit v1.2.3 From e5824f31b3295a5d21f31f1eb160b027ac26dc6c Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 10 Feb 2010 13:05:28 +0100 Subject: dba33e: #i107717# some renaming and wording changed --- connectivity/source/commontools/TTableHelper.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx index 38b5d7fc52f3..0107c6dab2bb 100644 --- a/connectivity/source/commontools/TTableHelper.cxx +++ b/connectivity/source/commontools/TTableHelper.cxx @@ -98,6 +98,16 @@ public: } namespace connectivity { + ::rtl::OUString lcl_getServiceNameForSetting(const Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& i_sSetting) + { + ::rtl::OUString sSupportService; + Any aValue; + if ( ::dbtools::getDataSourceSetting(_xConnection,i_sSetting,aValue) ) + { + aValue >>= sSupportService; + } + return sSupportService; + } struct OTableHelperImpl { TKeyMap m_aKeys; @@ -122,13 +132,13 @@ namespace connectivity if ( xFac.is() ) { static const ::rtl::OUString s_sTableRename(RTL_CONSTASCII_USTRINGPARAM("TableRenameServiceName")); - m_xRename.set(xFac->createInstance(s_sTableRename),UNO_QUERY); + m_xRename.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sTableRename)),UNO_QUERY); static const ::rtl::OUString s_sTableAlteration(RTL_CONSTASCII_USTRINGPARAM("TableAlterationServiceName")); - m_xAlter.set(xFac->createInstance(s_sTableAlteration),UNO_QUERY); + m_xAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sTableAlteration)),UNO_QUERY); static const ::rtl::OUString s_sKeyAlteration(RTL_CONSTASCII_USTRINGPARAM("KeyAlterationServiceName")); - m_xKeyAlter.set(xFac->createInstance(s_sKeyAlteration),UNO_QUERY); + m_xKeyAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sKeyAlteration)),UNO_QUERY); static const ::rtl::OUString s_sIndexAlteration(RTL_CONSTASCII_USTRINGPARAM("IndexAlterationServiceName")); - m_xIndexAlter.set(xFac->createInstance(s_sIndexAlteration),UNO_QUERY); + m_xIndexAlter.set(xFac->createInstance(lcl_getServiceNameForSetting(m_xConnection,s_sIndexAlteration)),UNO_QUERY); } } catch(const Exception&) -- cgit v1.2.3 From c4eadd3cb2aa9e6e12123683728b9dd2c587eb25 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 11 Feb 2010 17:35:16 +0100 Subject: aw079 #i99386# cleanup of define and last change from CL --- svx/inc/svx/sdrmasterpagedescriptor.hxx | 7 -- svx/inc/svx/svdobj.hxx | 9 -- svx/inc/svx/svdpage.hxx | 14 --- .../contact/viewcontactofmasterpagedescriptor.cxx | 50 +---------- svx/source/sdr/contact/viewcontactofsdrpage.cxx | 55 +----------- .../viewobjectcontactofmasterpagedescriptor.cxx | 15 ---- svx/source/sdr/properties/attributeproperties.cxx | 18 ---- svx/source/svdraw/sdrmasterpagedescriptor.cxx | 51 ----------- svx/source/svdraw/svdobj.cxx | 69 -------------- svx/source/svdraw/svdpage.cxx | 100 +-------------------- svx/source/unodraw/UnoGraphicExporter.cxx | 66 +------------- 11 files changed, 6 insertions(+), 448 deletions(-) diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index a8780c614285..cee577767a06 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -34,8 +34,6 @@ #include #include -#define NEWPBG - ////////////////////////////////////////////////////////////////////////////// // predeclarations class SdrObject; @@ -95,12 +93,7 @@ namespace sdr sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; -#ifdef NEWPBG const SfxItemSet& getCorrectFillAttributes() const; -#else - // #i42075# Get the correct BackgroundObject - SdrObject* GetBackgroundObject() const; -#endif }; } // end of namespace sdr diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index edab358a2e4a..f953d6b4ed78 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -31,8 +31,6 @@ #ifndef _SVDOBJ_HXX #define _SVDOBJ_HXX -#define NEWPBG - #include #include #include @@ -1104,13 +1102,6 @@ public: sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const; -#ifndef NEWPBG - // #111111# - // Needed again and again i will now add a test for finding out if - // this object is the BackgroundObject of the page. - sal_Bool IsMasterPageBackgroundObject() const; -#endif - // #116168# // Give info if object is in destruction sal_Bool IsInDestruction() const; diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 60193f132db9..bb0ed9e8cee3 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -31,8 +31,6 @@ #ifndef _SVDPAGE_HXX #define _SVDPAGE_HXX -#define NEWPBG - #include #include #include @@ -363,8 +361,6 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrPageProperties -#ifdef NEWPBG - class SVX_DLLPUBLIC SdrPageProperties : public SfxListener { private: @@ -400,7 +396,6 @@ public: SfxStyleSheet* GetStyleSheet() const; }; -#endif //////////////////////////////////////////////////////////////////////////////////////////////////// // class SdrPage @@ -451,16 +446,12 @@ friend class ChXChartDocument; protected: SdrLayerAdmin* pLayerAdmin; -#ifndef NEWPBG - SdrObject* pBackgroundObj; -#else private: SdrPageProperties* mpSdrPageProperties; public: SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } -#endif protected: // new MasterPageDescriptorVector @@ -567,11 +558,6 @@ public: bool IsSwappingLocked() const { return mbSwappingLocked; } void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; } -#ifndef NEWPBG - SdrObject* GetBackgroundObj() const { return pBackgroundObj; } - void SetBackgroundObj( SdrObject* pObj ); -#endif - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage(); virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const; diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index 4dad454af869..d99c6f7baa5f 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -65,7 +65,6 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; -#ifdef NEWPBG // build primitive from page fill attributes const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -90,37 +89,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } -#else - const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject(); - - if(pBackgroundCandidate) - { - // build primitive from pBackgroundCandidate's attributes - const SfxItemSet& rFillProperties = pBackgroundCandidate->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault()) - { - // direct model data is the page size, get and use it - const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage(); - const basegfx::B2DRange aInnerRange( - rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(), - rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(), - rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } -#endif return xRetval; } @@ -139,27 +107,11 @@ namespace sdr sal_uInt32 ViewContactOfMasterPageDescriptor::GetObjectCount() const { - sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount()); - -#ifndef NEWPBG - if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nRetval--; - } -#endif - - return nRetval; + return GetMasterPageDescriptor().GetUsedPage().GetObjCount(); } ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact(); } diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index 3018a9dc17e2..d469b15a761a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -206,7 +206,6 @@ namespace sdr } else { -#ifdef NEWPBG // build primitive from pObject's attributes const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); const drawinglayer::attribute::SdrFillAttribute aFill( @@ -229,42 +228,6 @@ namespace sdr xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } - -#else - OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)"); - - if(rPage.GetObjCount()) - { - SdrObject* pObject = rPage.GetObj(0); - OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)"); - - if(pObject && pObject->IsMasterPageBackgroundObject()) - { - // build primitive from pObject's attributes - const SfxItemSet& rFillProperties = pObject->GetMergedItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties)); - - if(!aFill.isDefault() && 1.0 != aFill.getTransparence()) - { - // direct model data is the page size, get and use it - const basegfx::B2DRange aInnerRange( - rPage.GetLftBorder(), rPage.GetUppBorder(), - rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder()); - const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange)); - const basegfx::B2DHomMatrix aEmptyTransform; - const drawinglayer::primitive2d::Primitive2DReference xReference( - drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon(aInnerPolgon), - aEmptyTransform, - aFill, - drawinglayer::attribute::FillGradientAttribute())); - - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - } - } - } -#endif } } @@ -485,27 +448,11 @@ namespace sdr sal_uInt32 ViewContactOfPageHierarchy::GetObjectCount() const { - sal_uInt32 nSubObjectCount(getPage().GetObjCount()); - -#ifndef NEWPBG - if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nSubObjectCount--; - } -#endif - - return nSubObjectCount; + return getPage().GetObjCount(); } ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const { -#ifndef NEWPBG - if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject()) - { - nIndex++; - } -#endif - SdrObject* pObj = getPage().GetObj(nIndex); DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)"); return pObj->GetViewContact(); diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx index f0c3eb2c8bed..f5ca659f501c 100644 --- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx @@ -98,7 +98,6 @@ namespace sdr rDisplayInfo.SetProcessLayers(aPreprocessedLayers); rDisplayInfo.SetSubContentActive(true); -#ifdef NEWPBG // check layer visibility (traditionally was member of layer 1) if(aPreprocessedLayers.IsSet(1)) { @@ -109,20 +108,6 @@ namespace sdr xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); } } -#else - // check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet - const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject(); - - if(pBackgroundCandidate && aPreprocessedLayers.IsSet(pBackgroundCandidate->GetLayer())) - { - // hide PageBackground for special DrawModes; historical reasons - if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast()) - { - // if yes, create the default background primitive sequence - xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence(); - } - } -#endif // hide MasterPage content? Test self here for hierarchy if(isPrimitiveVisible(rDisplayInfo)) diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx index df8944342619..b6dbf9aab670 100644 --- a/svx/source/sdr/properties/attributeproperties.cxx +++ b/svx/source/sdr/properties/attributeproperties.cxx @@ -587,24 +587,6 @@ namespace sdr bHintUsed = sal_True; } -#ifndef NEWPBG - // #111111# - // When it's the BackgroundObject, set the MasterPage to changed to - // get a refresh for the evtl. changed BackgroundStyle - - // #114265# - // To only invalidate the page when the StyleSheet change happens, - // some more rigid testing is necessary. - const SfxSimpleHint *pSimpleHint = PTR_CAST(SfxSimpleHint, &rHint); - - if(pSimpleHint - && pSimpleHint->GetId() == SFX_HINT_DATACHANGED - && GetSdrObject().IsMasterPageBackgroundObject()) - { - GetSdrObject().GetPage()->ActionChanged(); - } -#endif - if(!bHintUsed) { // forward to SdrObject ATM. Not sure if this will be necessary diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index dcc519148e27..8ad41c90ded5 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -36,11 +36,8 @@ // #i42075# #include - -#ifdef NEWPBG #include #include -#endif ////////////////////////////////////////////////////////////////////////////// @@ -102,16 +99,6 @@ namespace sdr { maVisibleLayers = rNew; GetViewContact().ActionChanged(); - -#ifndef NEWPBG - // #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too - SdrObject* pObject = GetBackgroundObject(); - - if(pObject) - { - pObject->BroadcastObjectChange(); - } -#endif } } @@ -130,7 +117,6 @@ namespace sdr || maVisibleLayers != rCandidate.maVisibleLayers); } -#ifdef NEWPBG const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const { const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); @@ -142,43 +128,6 @@ namespace sdr return GetUsedPage().getSdrPageProperties().GetItemSet(); } -#else - // #i42075# Get the correct BackgroundObject - SdrObject* MasterPageDescriptor::GetBackgroundObject() const - { - SdrObject* pRetval = 0L; - const SdrPage& rMasterPage = GetUsedPage(); - - // Here i will rely on old knowledge about the 0'st element of a masterpage - // being the PageBackgroundObject. This will be removed again when that definition - // will be changed. -#ifdef DBG_UTIL - const sal_uInt32 nMasterPageObjectCount(rMasterPage.GetObjCount()); - DBG_ASSERT(1 <= nMasterPageObjectCount, - "MasterPageDescriptor::GetBackgroundObject(): MasterPageBackgroundObject missing (!)"); -#endif - pRetval = rMasterPage.GetObj(0L); - - // Test if it's really what we need. There are known problems where - // the 0th object is not the MasterPageBackgroundObject at all. - if(pRetval && !pRetval->IsMasterPageBackgroundObject()) - { - pRetval = 0L; - } - - // Get the evtl. existing page background object from the using page and use it - // preferred to the MasterPageBackgroundObject - const SdrPage& rOwnerPage = GetOwnerPage(); - SdrObject* pCandidate = rOwnerPage.GetBackgroundObj(); - - if(pCandidate) - { - pRetval = pCandidate; - } - - return pRetval; - } -#endif } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 58f3d4ce2873..1ddbcb2a8b4c 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -375,53 +375,6 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const // DrawContact support: Methods for handling Object changes void SdrObject::ActionChanged() const { -#ifndef NEWPBG - // Forward change call to MasterPageDescriptor if BackgroundObject was changed - const SdrPage* pObjectsPage = GetPage(); - - if(pObjectsPage) - { - // do the necessary ActionChange() forwards when a MasterPageBackgroundObject - // gets changed. This can be removed as soon as the MasterPageBackgroundObject - // handling is replaced with the proper ItemSet handling at the SdrPages. The - // needed ActionChanged calls will then be triggered by changing those ItemSets. - if(pObjectsPage->IsMasterPage()) - { - if(IsMasterPageBackgroundObject()) - { - SdrModel* pObjectsModel = GetModel(); - - if(pObjectsModel) - { - const sal_uInt16 nCount(pObjectsModel->GetPageCount()); - - for(sal_uInt16 a(0); a < nCount; a++) - { - const SdrPage* pUserPage = pObjectsModel->GetPage(a); - - if(pUserPage && pUserPage->TRG_HasMasterPage()) - { - SdrPage& rUsedMasterPage = pUserPage->TRG_GetMasterPage(); - - if(&rUsedMasterPage == pObjectsPage) - { - pUserPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } - } - } - } - else - { - if(pObjectsPage->TRG_HasMasterPage() && pObjectsPage->GetBackgroundObj() == this) - { - pObjectsPage->TRG_GetMasterPageDescriptorViewContact().ActionChanged(); - } - } - } -#endif - // Do necessary ViewContact actions GetViewContact().ActionChanged(); } @@ -3119,28 +3072,6 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba SetSnapRect(aBaseRect); } -#ifndef NEWPBG -// #111111# -// Needed again and again i will now add a test for finding out if -// this object is the BackgroundObject of the page. -sal_Bool SdrObject::IsMasterPageBackgroundObject() const -{ - if(pObjList - && pObjList == pPage - && pPage->IsMasterPage() - && pObjList->GetObj(0) == this - && 1L == (pPage->GetPageNum() % 2)) - { - // 0'th object, directly on page, page is MasterPage, - // MasterPagePageNum is 1,3,5,... - // --> It's the background object (!) - return sal_True; - } - - return sal_False; -} -#endif - // #116168# // Give info if object is in destruction sal_Bool SdrObject::IsInDestruction() const diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 7516148d7a47..15a9e1886472 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1177,7 +1177,6 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const } //////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef NEWPBG void SdrPageProperties::ImpRemoveStyleSheet() { @@ -1311,7 +1310,6 @@ SfxStyleSheet* SdrPageProperties::GetStyleSheet() const return mpStyleSheet; } -#endif //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrPage,SdrObjList); @@ -1326,11 +1324,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) nBordRgt(0L), nBordLwr(0L), pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())), -#ifndef NEWPBG - pBackgroundObj(0L), -#else mpSdrPageProperties(0), -#endif mpMasterPageDescriptor(0L), nPageNum(0L), mbMaster(bMasterPage), @@ -1343,9 +1337,7 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage) aPrefVisiLayers.SetAll(); eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE; -#ifdef NEWPBG mpSdrPageProperties = new SdrPageProperties(*this); -#endif } SdrPage::SdrPage(const SdrPage& rSrcPage) @@ -1359,11 +1351,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) nBordRgt(rSrcPage.nBordRgt), nBordLwr(rSrcPage.nBordLwr), pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())), -#ifndef NEWPBG - pBackgroundObj(0L), -#else mpSdrPageProperties(0), -#endif mpMasterPageDescriptor(0L), nPageNum(rSrcPage.nPageNum), mbMaster(rSrcPage.mbMaster), @@ -1398,9 +1386,7 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) xComponent->dispose(); } -#ifdef NEWPBG mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); -#endif } SdrPage::~SdrPage() @@ -1434,9 +1420,6 @@ SdrPage::~SdrPage() // when they get called from PageInDestruction(). maPageUsers.clear(); -#ifndef NEWPBG - SdrObject::Free( pBackgroundObj ); -#endif delete pLayerAdmin; TRG_ClearMasterPage(); @@ -1448,12 +1431,10 @@ SdrPage::~SdrPage() mpViewContact = 0L; } -#ifdef NEWPBG { delete mpSdrPageProperties; mpSdrPageProperties = 0; } -#endif DBG_DTOR(SdrPage,NULL); } @@ -1466,10 +1447,6 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mpViewContact = 0L; } -#ifndef NEWPBG - SdrObject::Free( pBackgroundObj ); -#endif - // Joe also sets some parameters for the class this one // is derived from. SdrObjList does the same bad handling of // copy constructor and operator=, so i better let it stand here. @@ -1503,22 +1480,10 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; -#ifndef NEWPBG - if(rSrcPage.pBackgroundObj) - { - pBackgroundObj = rSrcPage.pBackgroundObj->Clone(); - pBackgroundObj->SetPage( this ); - pBackgroundObj->SetModel( pModel ); - - // #i62000# for single-page MPBGO, force no line - pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); - } -#else { delete mpSdrPageProperties; mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } -#endif // Now copy the contained obejcts (by cloning them) SdrObjList::operator=(rSrcPage); @@ -1697,16 +1662,9 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); -#ifndef NEWPBG - if( pBackgroundObj ) - pBackgroundObj->SetModel( pNewModel ); -#else - { - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); - delete mpSdrPageProperties; - mpSdrPageProperties = pNew; - } -#endif + SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + delete mpSdrPageProperties; + mpSdrPageProperties = pNew; } // update listeners at possible api wrapper object @@ -1840,24 +1798,6 @@ XubString SdrPage::GetLayoutName() const return String(); } -#ifndef NEWPBG -void SdrPage::SetBackgroundObj( SdrObject* pObj ) -{ - if ( pObj ) - { - pObj->SetPage( this ); - pObj->SetModel( pModel ); - pObj->SetLayer( 1 ); // Nothing known about the backgroundlayer... - - // #i62000# for single-page MPBGO, force no line - pObj->SetMergedItem(XLineStyleItem(XLINE_NONE)); - } - - SdrObject::Free( pBackgroundObj ); - pBackgroundObj = pObj; -} -#endif - void SdrPage::SetInserted( bool bIns ) { if( mbInserted != bIns ) @@ -1931,7 +1871,6 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) aColor = pView->GetApplicationDocumentColor(); } -#ifdef NEWPBG const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet(); if(!IsMasterPage() && TRG_HasMasterPage()) @@ -1943,39 +1882,6 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay ) } GetDraftFillColor(*pBackgroundFill, aColor); -#else - // first, see if we have a background object - SdrObject* pBackgroundObj2 = NULL; - - if( IsMasterPage() ) - { - if( GetObjCount() ) - pBackgroundObj2 = GetObj( 0 ); - } - else - { - pBackgroundObj2 = GetBackgroundObj(); - if( NULL == pBackgroundObj2 ) - { - // if not, see if we have a masterpage and get that background object - if(TRG_HasMasterPage()) - { - SdrPage& rMasterPage = TRG_GetMasterPage(); - - if(rMasterPage.GetObjCount()) - { - pBackgroundObj2 = rMasterPage.GetObj( 0 ); - } - } - } - } - - if( pBackgroundObj2 ) - { - const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet(); - GetDraftFillColor( rSet, aColor ); - } -#endif return aColor; } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 1e191f3125c1..9218d13a667a 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -618,41 +618,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, VirtualDevice aVDev; const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY ); -#ifndef NEWPBG - // create a view - SdrView* pView; - - if( PTR_CAST( FmFormModel, mpDoc ) ) - { - pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ); - } - else - { - pView = new SdrView( mpDoc, &aVDev ); - } - - pView->SetBordVisible( FALSE ); - pView->SetPageVisible( FALSE ); - pView->ShowSdrPage( pPage ); -#endif - SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL); maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl(); rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) ); -#ifdef NEWPBG rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() ); -#else - rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) ); -#endif // #i102251# const sal_uInt32 nOldCntrl(rOutl.GetControlWord()); sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING; rOutl.SetControlWord(nCntrl); -#ifdef NEWPBG SdrObject* pTempBackgroundShape = 0; -#endif std::vector< SdrObject* > aShapes; bool bRet = true; @@ -661,26 +637,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { -#ifdef NEWPBG pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); aShapes.push_back(pTempBackgroundShape); -#else - SdrObject* pShape = 0; - if( pPage->IsMasterPage() ) - { - if( pPage->GetObjCount() > 0 ) - pShape = pPage->GetObj(0); - } - else - { - pShape = pPage->GetBackgroundObj(); - } - - if( pShape ) - aShapes.push_back( pShape ); -#endif } else { @@ -759,7 +719,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aMtf.Record( &aVDev ); Size aNewSize; -#ifdef NEWPBG // create a view SdrView* pView; @@ -775,7 +734,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, pView->SetBordVisible( FALSE ); pView->SetPageVisible( FALSE ); pView->ShowSdrPage( pPage ); -#endif if ( pView && pPage ) { @@ -817,13 +775,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, aGraphic = Graphic(aMtf); } -#ifdef NEWPBG if ( pView ) { pView->HideSdrPage(); delete pView; } -#endif + if( rSettings.mbTranslucent ) { Size aOutSize; @@ -948,17 +905,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, // calculate bound rect for all shapes Rectangle aBound; -#ifndef NEWPBG - if(rSettings.mbExportOnlyBackground) - { - // shape is MPBGO and if it's not yet set, it's size will - // be empty when using GetCurrentBoundRect(). Since anyways - // the page size is used by MPBGO and MPBGO is EOLd, get - // the wanted size from the page model directly - aBound = Rectangle(Point(0,0), pPage->GetSize()); - } - else -#endif { std::vector< SdrObject* >::iterator aIter = aShapes.begin(); const std::vector< SdrObject* >::iterator aEnd = aShapes.end(); @@ -1032,20 +978,10 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, } } -#ifndef NEWPBG - if ( pView ) - { - pView->HideSdrPage(); - delete pView; - } -#endif - -#ifdef NEWPBG if(pTempBackgroundShape) { SdrObject::Free(pTempBackgroundShape); } -#endif rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl ); -- cgit v1.2.3 From 6bf1a65c9c3a802c9f71e26338c2ac5a794f6cb1 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 12 Feb 2010 11:35:33 +0100 Subject: vcl109: #i109129# avoid recursive behavior of NSFileWrapper --- fpicker/source/aqua/FilterHelper.cxx | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index 3e7b04021f3a..da3d621f2f40 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -394,30 +394,25 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) { DBG_PRINT_ENTRY(CLASS_NAME, __func__); -// OSL_TRACE("filter event handler called"); - if (m_aCurrentFilter == NULL) { OSL_TRACE("filter name is null"); return sal_True; } NSFileManager *manager = [NSFileManager defaultManager]; - MacOSBOOL bDir = NO; - if ([manager fileExistsAtPath:sFilename isDirectory:&bDir] && bDir == YES) { -// OSL_TRACE(" folder"); - return sal_True; - } - - NSFileWrapper *wrapper = [[NSFileWrapper alloc] initWithPath:sFilename]; - MacOSBOOL bIsLink = [wrapper isSymbolicLink]; - [wrapper release]; - if (bIsLink) { -// OSL_TRACE(" symboliclink"); - return sal_True; + NSDictionary* pAttribs = [manager fileAttributesAtPath: sFilename traverseLink: NO]; + if( pAttribs ) + { + NSObject* pType = [pAttribs objectForKey: NSFileType]; + if( pType && [pType isMemberOfClass: [NSString class]] ) + { + NSString* pT = (NSString*)pType; + if( [pT isEqualToString: NSFileTypeDirectory] || + [pT isEqualToString: NSFileTypeSymbolicLink] ) + return sal_True; + } } -// OSL_TRACE(" file"); - FilterList::iterator filter = ::std::find_if(m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch(m_aCurrentFilter)); if (filter == m_pFilterList->end()) { OSL_TRACE("filter not found in list"); @@ -427,7 +422,6 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) OUStringList suffixList = filter->getFilterSuffixList(); { -// OSL_TRACE(" starting to work"); rtl::OUString aName = [sFilename OUString]; rtl::OUString allMatcher = rtl::OUString::createFromAscii(".*"); for(OUStringList::iterator iter = suffixList.begin(); iter != suffixList.end(); iter++) { -- cgit v1.2.3 From 00cde21c20fdb754368700af92db1c49346813ad Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Feb 2010 12:08:41 +0100 Subject: autorecovery: let the XMLSettingsExportHelper work on an abstract interface for actual writing, instead of an SvXMLExport. This way, it can also be used in contexts where we do not have a full blown SvXMLExport instance. --- xmloff/inc/xmloff/SettingsExportHelper.hxx | 12 ++- xmloff/inc/xmloff/XMLSettingsExportContext.hxx | 66 +++++++++++++ xmloff/prj/d.lst | 1 + xmloff/source/core/SettingsExportHelper.cxx | 129 +++++++++++++------------ xmloff/source/core/xmlexp.cxx | 74 +++++++++++++- 5 files changed, 216 insertions(+), 66 deletions(-) create mode 100644 xmloff/inc/xmloff/XMLSettingsExportContext.hxx diff --git a/xmloff/inc/xmloff/SettingsExportHelper.hxx b/xmloff/inc/xmloff/SettingsExportHelper.hxx index 4c6329e58fdb..e0a8960c5336 100644 --- a/xmloff/inc/xmloff/SettingsExportHelper.hxx +++ b/xmloff/inc/xmloff/SettingsExportHelper.hxx @@ -43,9 +43,15 @@ namespace com namespace util { struct DateTime; } } } } + +namespace xmloff +{ + class XMLSettingsExportContext; +} + class XMLSettingsExportHelper { - SvXMLExport& rExport; + ::xmloff::XMLSettingsExportContext& m_rContext; ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubsitution; @@ -94,10 +100,10 @@ class XMLSettingsExportHelper const rtl::OUString rName) const; public: - XMLSettingsExportHelper(SvXMLExport& rExport); + XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ); ~XMLSettingsExportHelper(); - void exportSettings( + void exportAllSettings( const com::sun::star::uno::Sequence& aProps, const rtl::OUString& rName) const; }; diff --git a/xmloff/inc/xmloff/XMLSettingsExportContext.hxx b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx new file mode 100644 index 000000000000..d3e0b6a8c5ee --- /dev/null +++ b/xmloff/inc/xmloff/XMLSettingsExportContext.hxx @@ -0,0 +1,66 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef XML_SETTINGS_EXPORT_CONTEXT_HXX +#define XML_SETTINGS_EXPORT_CONTEXT_HXX + +/** === begin UNO includes === **/ +#include +/** === end UNO includes === **/ + +#include "xmloff/xmltoken.hxx" + +//........................................................................ +namespace xmloff +{ +//........................................................................ + + //==================================================================== + //= XMLExporter + //==================================================================== + class SAL_NO_VTABLE XMLSettingsExportContext + { + public: + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + const ::rtl::OUString& i_rValue ) = 0; + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0; + + virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, + const sal_Bool i_bIgnoreWhitespace ) = 0; + virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ) = 0; + + virtual void Characters( const ::rtl::OUString& i_rCharacters ) = 0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + GetServiceFactory() const = 0; + + }; + +//........................................................................ +} // namespace xmloff +//........................................................................ + +#endif // XML_SETTINGS_EXPORT_CONTEXT_HXX diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst index 686b4b70a0ae..98ab3c3e5cd1 100644 --- a/xmloff/prj/d.lst +++ b/xmloff/prj/d.lst @@ -87,6 +87,7 @@ mkdir: %_DEST%\inc%_EXT%\xmloff ..\inc\HatchStyle.hxx %_DEST%\inc%_EXT%\xmloff\HatchStyle.hxx ..\inc\ImageStyle.hxx %_DEST%\inc%_EXT%\xmloff\ImageStyle.hxx ..\inc\xmloff\SettingsExportHelper.hxx %_DEST%\inc%_EXT%\xmloff\SettingsExportHelper.hxx +..\inc\xmloff\XMLSettingsExportContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLSettingsExportContext.hxx ..\inc\xmloff\DocumentSettingsContext.hxx %_DEST%\inc%_EXT%\xmloff\DocumentSettingsContext.hxx ..\inc\xmloff\XMLGraphicsDefaultStyle.hxx %_DEST%\inc%_EXT%\xmloff\XMLGraphicsDefaultStyle.hxx ..\inc\XMLEmbeddedObjectExportFilter.hxx %_DEST%\inc%_EXT%\xmloff\XMLEmbeddedObjectExportFilter.hxx diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index e8bb000942d1..79d8cede571c 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -35,32 +35,27 @@ #include #include #include +#include #include -// #110680# -//#ifndef _COMPHELPER_PROCESSFACTORYHXX_ -//#include -//#endif #include #include #include #include -#ifndef _COM_SUN_STAR_CONTAINER_XIndexCONTAINER_HPP_ #include -#endif #include #include #include #include #include -#include +#include #include using namespace ::com::sun::star; using namespace ::xmloff::token; -XMLSettingsExportHelper::XMLSettingsExportHelper(SvXMLExport& rTempExport) -: rExport(rTempExport) +XMLSettingsExportHelper::XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ) +: m_rContext( i_rContext ) , msPrinterIndependentLayout( RTL_CONSTASCII_USTRINGPARAM( "PrinterIndependentLayout" ) ) , msColorTableURL( RTL_CONSTASCII_USTRINGPARAM( "ColorTableURL" ) ) , msLineEndTableURL( RTL_CONSTASCII_USTRINGPARAM( "LineEndTableURL" ) ) @@ -197,89 +192,97 @@ void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny, void XMLSettingsExportHelper::exportBool(const sal_Bool bValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BOOLEAN); - SvXMLElementExport aBoolElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BOOLEAN ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUString sValue; if (bValue) sValue = GetXMLToken(XML_TRUE); else sValue = GetXMLToken(XML_FALSE); - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportByte(const sal_Int8 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BYTE); - SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BYTE ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue)); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportShort(const sal_Int16 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_SHORT); - SvXMLElementExport aShortElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_SHORT ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, sal_Int32(nValue)); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportInt(const sal_Int32 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_INT); - SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_INT ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertNumber(sBuffer, nValue); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportLong(const sal_Int64 nValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_LONG); - SvXMLElementExport aIntElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_LONG ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUString sValue(rtl::OUString::valueOf(nValue)); - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportDouble(const double fValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DOUBLE); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_DOUBLE ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertDouble(sBuffer, fValue); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportString(const rtl::OUString& sValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_STRING); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_STRING ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); if (sValue.getLength()) - rExport.GetDocHandler()->characters(sValue); + m_rContext.Characters( sValue ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportDateTime(const util::DateTime& aValue, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_DATETIME); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_DATETIME ); rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::convertDateTime(sBuffer, aValue); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); + m_rContext.Characters( sBuffer.makeStringAndClear() ); + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportSequencePropertyValue( @@ -290,10 +293,11 @@ void XMLSettingsExportHelper::exportSequencePropertyValue( sal_Int32 nLength(aProps.getLength()); if(nLength) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aSequenceElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_SET, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_SET, sal_True ); for (sal_Int32 i = 0; i < nLength; i++) CallTypeFunction(aProps[i].Value, aProps[i].Name); + m_rContext.EndElement( sal_True ); } } void XMLSettingsExportHelper::exportSymbolDescriptors( @@ -302,7 +306,7 @@ void XMLSettingsExportHelper::exportSymbolDescriptors( { // #110680# // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() ); DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportSymbolDescriptors: got no service manager" ); if( xServiceFactory.is() ) @@ -365,15 +369,16 @@ void XMLSettingsExportHelper::exportbase64Binary( { DBG_ASSERT(rName.getLength(), "no name"); sal_Int32 nLength(aProps.getLength()); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_TYPE, XML_BASE64BINARY); - SvXMLElementExport aDoubleElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM, sal_True, sal_False); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.AddAttribute( XML_TYPE, XML_BASE64BINARY ); + m_rContext.StartElement( XML_CONFIG_ITEM, sal_True ); if(nLength) { rtl::OUStringBuffer sBuffer; SvXMLUnitConverter::encodeBase64(sBuffer, aProps); - rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear()); + m_rContext.Characters( sBuffer.makeStringAndClear() ); } + m_rContext.EndElement( sal_False ); } void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny, @@ -387,10 +392,11 @@ void XMLSettingsExportHelper::exportMapEntry(const uno::Any& rAny, if (nLength) { if (bNameAccess) - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aEntryElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_ENTRY, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_ENTRY, sal_True ); for (sal_Int32 i = 0; i < nLength; i++) CallTypeFunction(aProps[i].Value, aProps[i].Name); + m_rContext.EndElement( sal_True ); } } @@ -403,11 +409,12 @@ void XMLSettingsExportHelper::exportNameAccess( "wrong NameAccess" ); if(aNamed->hasElements()) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aNamedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_NAMED, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_NAMED, sal_True ); uno::Sequence< rtl::OUString > aNames(aNamed->getElementNames()); for (sal_Int32 i = 0; i < aNames.getLength(); i++) exportMapEntry(aNamed->getByName(aNames[i]), aNames[i], sal_True); + m_rContext.EndElement( sal_True ); } } @@ -421,13 +428,14 @@ void XMLSettingsExportHelper::exportIndexAccess( rtl::OUString sEmpty;// ( RTLCONSTASCII_USTRINGPARAM( "View" ) ); if(aIndexed->hasElements()) { - rExport.AddAttribute(XML_NAMESPACE_CONFIG, XML_NAME, rName); - SvXMLElementExport aIndexedElem(rExport, XML_NAMESPACE_CONFIG, XML_CONFIG_ITEM_MAP_INDEXED, sal_True, sal_True); + m_rContext.AddAttribute( XML_NAME, rName ); + m_rContext.StartElement( XML_CONFIG_ITEM_MAP_INDEXED, sal_True ); sal_Int32 nCount = aIndexed->getCount(); for (sal_Int32 i = 0; i < nCount; i++) { exportMapEntry(aIndexed->getByIndex(i), sEmpty, sal_False); } + m_rContext.EndElement( sal_True ); } } @@ -448,7 +456,7 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( // #110680# // uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( rExport.getServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xServiceFactory( m_rContext.GetServiceFactory() ); DBG_ASSERT( xServiceFactory.is(), "XMLSettingsExportHelper::exportForbiddenCharacters: got no service manager" ); if( xServiceFactory.is() ) @@ -499,14 +507,12 @@ void XMLSettingsExportHelper::exportForbiddenCharacters( } } -void XMLSettingsExportHelper::exportSettings( +void XMLSettingsExportHelper::exportAllSettings( const uno::Sequence& aProps, const rtl::OUString& rName) const { DBG_ASSERT(rName.getLength(), "no name"); - ::rtl::OUString aQName = - rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, rName ); - exportSequencePropertyValue(aProps, aQName); + exportSequencePropertyValue(aProps, rName); } @@ -534,15 +540,16 @@ void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUSt { if( !mxStringSubsitution.is() ) { - if( rExport.getServiceFactory().is() ) try + if( m_rContext.GetServiceFactory().is() ) try { const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution = uno::Reference< util::XStringSubstitution >::query( - rExport.getServiceFactory()-> + m_rContext.GetServiceFactory()-> createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) ); } catch( uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index e96759c3e470..84294a905105 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include "XMLStarBasicExportHandler.hxx" @@ -160,6 +161,72 @@ const XMLServiceMapEntry_Impl aServiceMap[] = //============================================================================== +class SAL_DLLPRIVATE SettingsExportFacade : public ::xmloff::XMLSettingsExportContext +{ +public: + SettingsExportFacade( SvXMLExport& i_rExport ) + :m_rExport( i_rExport ) + { + } + + virtual ~SettingsExportFacade() + { + } + + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + const ::rtl::OUString& i_rValue ); + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + enum ::xmloff::token::XMLTokenEnum i_eValue ); + + virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, + const sal_Bool i_bIgnoreWhitespace ); + virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ); + + virtual void Characters( const ::rtl::OUString& i_rCharacters ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + GetServiceFactory() const; +private: + SvXMLExport& m_rExport; + ::std::stack< ::rtl::OUString > m_aElements; +}; + +void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue ) +{ + m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue ); +} + +void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue ) +{ + m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_eValue ); +} + +void SettingsExportFacade::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace ) +{ + const ::rtl::OUString sElementName( m_rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_CONFIG, GetXMLToken( i_eName ) ) ); + m_rExport.StartElement( sElementName, i_bIgnoreWhitespace ); + m_aElements.push( sElementName ); +} + +void SettingsExportFacade::EndElement( const sal_Bool i_bIgnoreWhitespace ) +{ + const ::rtl::OUString sElementName( m_aElements.top() ); + m_rExport.EndElement( sElementName, i_bIgnoreWhitespace ); + m_aElements.pop(); +} + +void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters ) +{ + m_rExport.GetDocHandler()->characters( i_rCharacters ); +} + +Reference< XMultiServiceFactory > SettingsExportFacade::GetServiceFactory() const +{ + return m_rExport.getServiceFactory(); +} + +//============================================================================== + class SvXMLExportEventListener : public cppu::WeakImplHelper1< com::sun::star::lang::XEventListener > { @@ -1103,7 +1170,9 @@ void SvXMLExport::ImplExportSettings() nSettingsCount != 0, XML_NAMESPACE_OFFICE, XML_SETTINGS, sal_True, sal_True ); - XMLSettingsExportHelper aSettingsExportHelper(*this); + + SettingsExportFacade aSettingsExportContext( *this ); + XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext ); for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin(); settings != aSettings.end(); @@ -1114,7 +1183,8 @@ void SvXMLExport::ImplExportSettings() continue; OUString sSettingsName( GetXMLToken( settings->eGroupName ) ); - aSettingsExportHelper.exportSettings( settings->aSettings, sSettingsName ); + OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName ); + aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName ); } } } -- cgit v1.2.3 From a47f324ffa781bb0ac7cfacb9ca640b1c408adde Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 15 Feb 2010 10:48:01 +0100 Subject: vcl109: #i109129# use isKindOfClass instead of isMemeberOfClass --- fpicker/source/aqua/FilterHelper.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpicker/source/aqua/FilterHelper.cxx b/fpicker/source/aqua/FilterHelper.cxx index da3d621f2f40..d0d36544998f 100644 --- a/fpicker/source/aqua/FilterHelper.cxx +++ b/fpicker/source/aqua/FilterHelper.cxx @@ -404,7 +404,7 @@ sal_Bool FilterHelper::filenameMatchesFilter(NSString* sFilename) if( pAttribs ) { NSObject* pType = [pAttribs objectForKey: NSFileType]; - if( pType && [pType isMemberOfClass: [NSString class]] ) + if( pType && [pType isKindOfClass: [NSString class]] ) { NSString* pT = (NSString*)pType; if( [pT isEqualToString: NSFileTypeDirectory] || -- cgit v1.2.3 From 138bd21d14eb84b5b25e524a8c2696ff9012d8b5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Feb 2010 14:23:37 +0100 Subject: autorecovery: export XMLSettingsExportHelper --- xmloff/inc/xmloff/SettingsExportHelper.hxx | 4 +++- xmloff/source/core/SettingsExportHelper.cxx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xmloff/inc/xmloff/SettingsExportHelper.hxx b/xmloff/inc/xmloff/SettingsExportHelper.hxx index e0a8960c5336..53284ee023e2 100644 --- a/xmloff/inc/xmloff/SettingsExportHelper.hxx +++ b/xmloff/inc/xmloff/SettingsExportHelper.hxx @@ -31,6 +31,8 @@ #ifndef _XMLOFF_SETTINGSEXPORTHELPER_HXX #define _XMLOFF_SETTINGSEXPORTHELPER_HXX +#include "xmloff/dllapi.h" + #include #include #include @@ -49,7 +51,7 @@ namespace xmloff class XMLSettingsExportContext; } -class XMLSettingsExportHelper +class XMLOFF_DLLPUBLIC XMLSettingsExportHelper { ::xmloff::XMLSettingsExportContext& m_rContext; diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx index 79d8cede571c..8b057d7b67fb 100644 --- a/xmloff/source/core/SettingsExportHelper.cxx +++ b/xmloff/source/core/SettingsExportHelper.cxx @@ -424,7 +424,7 @@ void XMLSettingsExportHelper::exportIndexAccess( { DBG_ASSERT(rName.getLength(), "no name"); DBG_ASSERT(aIndexed->getElementType().equals(getCppuType( (uno::Sequence *)0 ) ), - "wrong NameAccess" ); + "wrong IndexAccess" ); rtl::OUString sEmpty;// ( RTLCONSTASCII_USTRINGPARAM( "View" ) ); if(aIndexed->hasElements()) { -- cgit v1.2.3 From 350a0791efb2d2b3ed5e32e15a079916b35beaca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Feb 2010 16:05:58 +0100 Subject: autorecovery: clarified the role of a doc's URL/Location as per agreement with MAV, XModel::getURL and XStorable::getLocation both need to return the logical document URL, even when the document has been recoved from another location. So, the DocFileLocation of the ModelImpl now is for internal purpose only. Consequently, ModelImpl's API has been reworked to better differ between the logical and the "loaded-from" URL of the document. --- framework/source/services/autorecovery.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 410706bc96f6..2e11fa1e97e7 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2679,7 +2679,10 @@ AutoRecovery::ETimerType AutoRecovery::implts_openDocs(const DispatchParams& aPa { ::comphelper::MediaDescriptor lPatchDescriptor(rInfo.Document->getArgs()); lPatchDescriptor[::comphelper::MediaDescriptor::PROP_FILTERNAME()] <<= rInfo.RealFilter; - rInfo.Document->attachResource(sURL, lPatchDescriptor.getAsConstPropertyValueList()); + rInfo.Document->attachResource(rInfo.Document->getURL(), lPatchDescriptor.getAsConstPropertyValueList()); + // do *not* use sURL here. In case this points to the recovery file, it has already been passed + // to recoverFromFile. Also, passing it here is logically wrong, as attachResource is intended + // to take the logical file URL. } css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); -- cgit v1.2.3 From b5e6c6c56493c84d9823a0d0b7c85b61a23c2be3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 18 Feb 2010 11:33:54 +0100 Subject: dba33e: #i108128# check if the found driver also accepts the URL --- connectivity/source/manager/mdrivermanager.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index d62f6294e5f8..75ad3b611e9a 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -720,7 +720,7 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUStri } // found something? - if ( m_aDriversBS.end() != aFind ) + if ( m_aDriversBS.end() != aFind && aFind->xDriver.is() && aFind->xDriver->acceptsURL(_rURL) ) xReturn = aFind->xDriver; } -- cgit v1.2.3 From 7084956e2f62bbe9d1ae9356958ac40f2c3c9784 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 18 Feb 2010 12:19:04 +0100 Subject: aw079: corrected include path --- svx/source/sdr/primitive2d/sdrattributecreator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index a1ef5d8f0957..a1090d92a889 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -75,7 +75,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 0512e2eed23fcbf29ce4576d76fe76f18d679d05 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 19 Feb 2010 11:22:17 +0100 Subject: autorecovery: SwitchToViewShell_Impl: do not use the doc's suspend, but only the view's PrepareClose (preventing the 'do you want to save' question this way). Strange enough, I'm pretty sure I already did this patch in the past - but I can find a respective change set in the log ... --- sfx2/source/view/viewfrm.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index d469366a48ad..7afeb623a780 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2205,8 +2205,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl if ( pOldSh ) { // ask wether it can be closed - Reference< XController > xController( pOldSh->GetController(), UNO_SET_THROW ); - if ( !xController->suspend( sal_True ) ) + if ( !pOldSh->PrepareClose( TRUE ) ) return sal_False; // remove sub shells from Dispatcher before switching to new ViewShell -- cgit v1.2.3 From 1e6e8e55b8dd27117d45813f32ab1b9b5721ad29 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 11:25:52 +0100 Subject: autorecovery: silently survice a close call when we're already disposed - there might be legacy code not expecting the DisposedException --- sfx2/source/doc/sfxbasemodel.cxx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 166becddaf9a..e48f2c182afe 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1355,9 +1355,8 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo { static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving."); - SfxModelGuard aGuard( *this ); - - if ( m_pData->m_bClosed || m_pData->m_bClosing ) + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( impl_isDisposed() || m_pData->m_bClosed || m_pData->m_bClosing ) return; uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); @@ -1706,10 +1705,7 @@ void SAL_CALL SfxBaseModel::initNew() ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // do not use the SfxModelGuard, it would throw, since we're not yet initialized - if ( IsDisposed() ) - throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( IsInitialized() ) throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); @@ -3419,10 +3415,7 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - // do not use the SfxModelGuard, it would throw, since we're not yet initialized - if ( IsDisposed() ) - throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( IsInitialized() ) throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); -- cgit v1.2.3 From 6184419197b90f2012cb22300f958ca128513669 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 13:04:13 +0100 Subject: autorecovery: oops, GetFormState broke with one of the recent changes - fixed --- svx/source/form/fmshell.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index 2919ce8640dc..c83df5fa8487 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -1128,9 +1128,6 @@ void FmFormShell::GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich) || m_bDesignMode || !GetImpl()->getActiveForm().is() || GetImpl()->isInFilterMode() - || ( /*GetImpl()->HasPendingCursorAction(GetImpl()->getNavController()) - && */(SID_FM_RECORD_TOTAL != nWhich) - ) ) rSet.DisableItem(nWhich); else -- cgit v1.2.3 From a717a487c98334fc52b884c55faac6a12c37f0ff Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 13:31:57 +0100 Subject: autorecovery: removeEventListener can also be called in the initialization phase --- sfx2/source/doc/sfxbasemodel.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e48f2c182afe..ffa2c14905b2 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -824,7 +824,6 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN throw(::com::sun::star::uno::RuntimeException) { SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); - m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -835,7 +834,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - SfxModelGuard aGuard( *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } -- cgit v1.2.3 From b7dc581d7ce45f9c692d942686ad0dd9ab701d90 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Feb 2010 10:16:39 +0100 Subject: autorecovery: it's allowed to dispose a document which has not yet been (fully) initialized - happens in some clipboard scenarios with 'artificial' documents --- sfx2/source/doc/sfxbasemodel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index ffa2c14905b2..8ef68871d0b7 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -764,7 +764,7 @@ void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& P void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException) { - SfxModelGuard aGuard( *this ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_bClosed ) { -- cgit v1.2.3 From fdde6b9aa1922baa6b0248ea35a4d8bb969b1fb8 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Thu, 25 Feb 2010 16:58:44 +0100 Subject: mtaccfixes: #i14114# XAccessibleHypertext for EditEngine --- svx/inc/svx/unoedsrc.hxx | 1 + svx/inc/svx/unofored.hxx | 1 + svx/inc/svx/unoforou.hxx | 2 + svx/inc/svx/unotext.hxx | 2 + .../accessibility/AccessibleEditableTextPara.cxx | 87 ++++++++++++ .../accessibility/AccessibleEditableTextPara.hxx | 11 +- .../accessibility/AccessibleEmptyEditSource.cxx | 2 + svx/source/accessibility/AccessibleHyperlink.cxx | 146 +++++++++++++++++++++ svx/source/accessibility/AccessibleHyperlink.hxx | 82 ++++++++++++ svx/source/accessibility/AccessibleTextHelper.cxx | 4 - svx/source/accessibility/makefile.mk | 1 + svx/source/inc/unoedprx.hxx | 7 +- svx/source/unoedit/unoedprx.cxx | 27 ++++ svx/source/unoedit/unofored.cxx | 5 + svx/source/unoedit/unoforou.cxx | 5 + svx/source/unoedit/unotext.cxx | 4 + svx/xml/AccessibleEditableTextPara.xml | 1 + 17 files changed, 381 insertions(+), 7 deletions(-) create mode 100644 svx/source/accessibility/AccessibleHyperlink.cxx create mode 100644 svx/source/accessibility/AccessibleHyperlink.hxx diff --git a/svx/inc/svx/unoedsrc.hxx b/svx/inc/svx/unoedsrc.hxx index 6c3025072e3c..f2018b49a8b0 100644 --- a/svx/inc/svx/unoedsrc.hxx +++ b/svx/inc/svx/unoedsrc.hxx @@ -174,6 +174,7 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/svx/inc/svx/unofored.hxx b/svx/inc/svx/unofored.hxx index a9c72f766a35..0c2f329a7bbc 100644 --- a/svx/inc/svx/unofored.hxx +++ b/svx/inc/svx/unofored.hxx @@ -66,6 +66,7 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/svx/inc/svx/unoforou.hxx b/svx/inc/svx/unoforou.hxx index 75adcc620a47..21b447b5277f 100644 --- a/svx/inc/svx/unoforou.hxx +++ b/svx/inc/svx/unoforou.hxx @@ -85,6 +85,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; Outliner& GetOutliner() const { return rOutliner; } diff --git a/svx/inc/svx/unotext.hxx b/svx/inc/svx/unotext.hxx index 46e26dbbc0a8..36a685f2f484 100644 --- a/svx/inc/svx/unotext.hxx +++ b/svx/inc/svx/unotext.hxx @@ -215,6 +215,8 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ); virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; virtual void SetNotifyHdl( const Link& ); diff --git a/svx/source/accessibility/AccessibleEditableTextPara.cxx b/svx/source/accessibility/AccessibleEditableTextPara.cxx index 1c0ce04bb1d6..a5be07fc33b2 100644 --- a/svx/source/accessibility/AccessibleEditableTextPara.cxx +++ b/svx/source/accessibility/AccessibleEditableTextPara.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,7 @@ #include "unolingu.hxx" #include "unopracc.hxx" #include "AccessibleEditableTextPara.hxx" +#include "AccessibleHyperlink.hxx" #include #include "accessibility.hrc" @@ -528,7 +530,9 @@ namespace accessibility { uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex ); if( xPara.is() ) + { return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY ); + } } } @@ -814,6 +818,11 @@ namespace accessibility uno::Reference< XAccessibleEditableText > aAccEditText = this; aRet <<= aAccEditText; } + else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) ) + { + uno::Reference< XAccessibleHypertext > aAccHyperText = this; + aRet <<= aAccHyperText; + } else { aRet = AccessibleTextParaInterfaceBase::queryInterface(rType); @@ -2066,6 +2075,84 @@ namespace accessibility return aOutSequence; } + // XAccessibleHypertext + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException) + { + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLinks = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + nHyperLinks++; + } + return nHyperLinks; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef; + + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( nHyperLink == nLinkIndex ) + { + USHORT nEEStart = aField.aPosition.nIndex; + + // Translate EE Index to accessible index + USHORT nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); + USHORT nEnd = nStart + aField.aCurrentText.Len(); + xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); + break; + } + nHyperLink++; + } + } + + return xRef; + } + + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + const sal_Int32 nPara = GetParagraphIndex(); + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + +// SvxAccessibleTextIndex aIndex; +// aIndex.SetIndex(nPara, nCharIndex, rT); +// const USHORT nEEIndex = aIndex.GetEEIndex(); + + const USHORT nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); + sal_Int32 nHLIndex = 0; + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( aField.aPosition.nIndex == nEEIndex ) + { + nHLIndex = nHyperLink; + break; + } + nHyperLink++; + } + } + + return nHLIndex; + } + // XAccessibleMultiLineText sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { diff --git a/svx/source/accessibility/AccessibleEditableTextPara.hxx b/svx/source/accessibility/AccessibleEditableTextPara.hxx index 4e297f44c3b5..daf4e6e7867c 100644 --- a/svx/source/accessibility/AccessibleEditableTextPara.hxx +++ b/svx/source/accessibility/AccessibleEditableTextPara.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -55,12 +56,13 @@ namespace accessibility { - typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::accessibility::XAccessible, + typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleEditableText, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleTextAttributes, + ::com::sun::star::accessibility::XAccessibleHypertext, ::com::sun::star::accessibility::XAccessibleMultiLineText, ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; @@ -164,6 +166,11 @@ namespace accessibility virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XAccessibleMultiLineText virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index 8bfc618dfbd9..3ddae99f33a3 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -145,6 +145,8 @@ namespace accessibility { return XubString(); } + void FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) {;} + BOOL IsValid() const { return sal_True; } void SetNotifyHdl( const Link& ) {} diff --git a/svx/source/accessibility/AccessibleHyperlink.cxx b/svx/source/accessibility/AccessibleHyperlink.cxx new file mode 100644 index 000000000000..5d0e98f0b0d2 --- /dev/null +++ b/svx/source/accessibility/AccessibleHyperlink.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleEditableTextPara.cxx,v $ + * $Revision: 1.53 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include +#include +#include + +#include "AccessibleHyperlink.hxx" +#include "unoedprx.hxx" +#include +#include + +using namespace ::com::sun::star; + + +//------------------------------------------------------------------------ +// +// AccessibleHyperlink implementation +// +//------------------------------------------------------------------------ + +namespace accessibility +{ + + AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) + : rTA( r ) + { + pFld = p; + nPara = nP; + nRealIdx = nR; + nStartIdx = nStt; + nEndIdx = nEnd; + aDescription = rD; + } + + AccessibleHyperlink::~AccessibleHyperlink() + { + delete pFld; + } + + // XAccessibleAction + sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) + { + return isValid() ? 1 : 0; + } + + sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + sal_Bool bRet = sal_False; + if ( isValid() && ( nIndex == 0 ) ) + { + rTA.FieldClicked( *pFld, nPara, nRealIdx ); + bRet = sal_True; + } + return bRet; + } + + ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + ::rtl::OUString aDesc; + + if ( isValid() && ( nIndex == 0 ) ) + aDesc = aDescription; + + return aDesc; + } + + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; + + if( isValid() && ( nIndex == 0 ) ) + { + ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); + xKeyBinding = pKeyBindingHelper; + + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + aKeyStroke.KeyCode = KEY_RETURN; + aKeyStroke.KeyChar = 0; + aKeyStroke.KeyFunc = 0; + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + + return xKeyBinding; + } + + // XAccessibleHyperlink + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) + { + return nStartIdx; + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) + { + return nEndIdx; + } + + sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) + { + return rTA.IsValid(); + } + +} // end of namespace accessibility + +//------------------------------------------------------------------------ diff --git a/svx/source/accessibility/AccessibleHyperlink.hxx b/svx/source/accessibility/AccessibleHyperlink.hxx new file mode 100644 index 000000000000..5192f4b5be0b --- /dev/null +++ b/svx/source/accessibility/AccessibleHyperlink.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleEditableTextPara.hxx,v $ + * $Revision: 1.22 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_ACCESSIBLE_HYPERLINK_HXX +#define _SVX_ACCESSIBLE_HYPERLINK_HXX + +#include +#include +#include +#include + +#include +#include +#include + +#include + +class SvxFieldItem; +class SvxAccessibleTextAdapter; + +namespace accessibility +{ + + class AccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink > + { + private: + + SvxAccessibleTextAdapter& rTA; + SvxFieldItem* pFld; + USHORT nPara, nRealIdx; // EE values + sal_Int32 nStartIdx, nEndIdx; // translated values + ::rtl::OUString aDescription; + + public: + AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); + ~AccessibleHyperlink(); + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHyperlink + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (::com::sun::star::uno::RuntimeException); + }; + +} // end of namespace accessibility + +#endif + diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 5b632115c93c..d186de9d060d 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -52,10 +52,6 @@ #include #include #include -#include -#include -#include -#include #include #include #include diff --git a/svx/source/accessibility/makefile.mk b/svx/source/accessibility/makefile.mk index 8b1802bf1a25..dfc25b00a3bb 100755 --- a/svx/source/accessibility/makefile.mk +++ b/svx/source/accessibility/makefile.mk @@ -68,6 +68,7 @@ LIB2OBJFILES= \ $(SLO)$/AccessibleTextEventQueue.obj \ $(SLO)$/AccessibleStaticTextBase.obj \ $(SLO)$/AccessibleParaManager.obj \ + $(SLO)$/AccessibleHyperlink.obj \ $(SLO)$/AccessibleEditableTextPara.obj \ $(SLO)$/AccessibleImageBullet.obj \ $(SLO)$/ShapeTypeHandler.obj \ diff --git a/svx/source/inc/unoedprx.hxx b/svx/source/inc/unoedprx.hxx index a260063d7525..47c75777acf8 100644 --- a/svx/source/inc/unoedprx.hxx +++ b/svx/source/inc/unoedprx.hxx @@ -53,7 +53,10 @@ public: virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; + virtual sal_Int32 CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ); + virtual USHORT CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ); + + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); @@ -64,6 +67,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/svx/source/unoedit/unoedprx.cxx b/svx/source/unoedit/unoedprx.cxx index e7bbcea519b8..72ce7da212da 100644 --- a/svx/source/unoedit/unoedprx.cxx +++ b/svx/source/unoedit/unoedprx.cxx @@ -692,6 +692,33 @@ XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + mrTextForwarder->FieldClicked( rField, nPara, nPos ); +} + +sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder); + return aIndex.GetIndex(); +} + +USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder); + return aIndex.GetEEIndex(); +} + + + BOOL SvxAccessibleTextAdapter::IsValid() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); diff --git a/svx/source/unoedit/unofored.cxx b/svx/source/unoedit/unofored.cxx index 14c8fb20a768..3c853580644e 100644 --- a/svx/source/unoedit/unofored.cxx +++ b/svx/source/unoedit/unofored.cxx @@ -174,6 +174,11 @@ XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, US return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rEditEngine.FieldClicked( rField, nPara, nPos ); +} + USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ) { EECharAttribArray aAttribs; diff --git a/svx/source/unoedit/unoforou.cxx b/svx/source/unoedit/unoforou.cxx index a98b6830b698..3a3a93e92a06 100644 --- a/svx/source/unoedit/unoforou.cxx +++ b/svx/source/unoedit/unoforou.cxx @@ -245,6 +245,11 @@ XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHO return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rOutliner.FieldClicked( rField, nPara, nPos ); +} + BOOL SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index a4d8c36462e6..92218031fdc2 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2573,6 +2573,10 @@ XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, s return XubString(); } +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) +{ +} + sal_Bool SvxDummyTextSource::IsValid() const { return sal_False; diff --git a/svx/xml/AccessibleEditableTextPara.xml b/svx/xml/AccessibleEditableTextPara.xml index 1859980760df..affb15f4dd55 100644 --- a/svx/xml/AccessibleEditableTextPara.xml +++ b/svx/xml/AccessibleEditableTextPara.xml @@ -28,6 +28,7 @@ title="Link to a general description of UNO accessibility"/> com.sun.star.accessibility.XAccessibleEventBroadcaster com.sun.star.accessibility.XAccessibleComponent com.sun.star.accessibility.XAccessibleEditableText +com.sun.star.accessibility.XAccessibleHyperext com.sun.star.accessibility.XAccessibleTextAttributes com.sun.star.lang.XTypeProvider com.sun.star.lang.XServiceInfo -- cgit v1.2.3 From ed1812044a1cbf47cdb67476a81faa4cac03aba2 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 1 Mar 2010 14:29:36 +0100 Subject: ause115: #i109704# fix build breakage --- xmlhelp/source/com/sun/star/help/makefile.mk | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk index eab2a6a08a4d..73e3f38c88b4 100644 --- a/xmlhelp/source/com/sun/star/help/makefile.mk +++ b/xmlhelp/source/com/sun/star/help/makefile.mk @@ -32,42 +32,18 @@ PRJ = ..$/..$/..$/..$/.. PRJNAME = xmlhelp TARGET = HelpLinker -LIBBASENAME = helplinker PACKAGE = com$/sun$/star$/help -TARGETTYPE=CUI .IF "$(SOLAR_JAVA)"!="" # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : helplinker.pmk -.IF "$(SYSTEM_LIBXSLT)" == "YES" -CFLAGS+= $(LIBXSLT_CFLAGS) -.ELSE -LIBXSLTINCDIR=external$/libxslt -CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) -.ENDIF - -.IF "$(SYSTEM_DB)" == "YES" -CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES) -.ENDIF - -.IF "$(SYSTEM_EXPAT)" == "YES" -CFLAGS+=-DSYSTEM_EXPAT -.ENDIF - - JAVACLASSFILES = \ $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class -JAVAFILES = \ - HelpSearch.java \ - HelpComponent.java \ - HelpIndexer.java - TRANSEX3FILES = \ $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpIndexerTool.class \ $(SOLARBINDIR)$/help$/$(PACKAGE)$/HelpFileDocument.class @@ -91,14 +67,12 @@ CUSTOMMANIFESTFILE = MANIFEST.MF .INCLUDE : target.mk -ALLTAR : $(ADDFILES) - .IF "$(JARTARGETN)"!="" $(JAVATARGET) : $(ADDFILES) $(JARTARGETN) : $(ADDFILES) .ENDIF -$(CLASSDIR)$/$(PACKAGE)$/%.class : $(SOLARBINDIR)$/help$/$(PACKAGE)$/%.class +$(ADDFILES) : $(SOLARBINDIR)$/help$/$(PACKAGE)$/$$(@:f) $(MKDIRHIER) $(@:d) $(COPY) $< $@ -- cgit v1.2.3 From ddfd910e86c34a6b405125218a93bc08c4401c60 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 1 Mar 2010 14:40:40 +0100 Subject: mtaccfixes: #i50760 Handle CSS for high contrast --- xmlhelp/source/cxxhelp/provider/databases.cxx | 45 +++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 467dd1539fed..9515b770f0e9 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -60,6 +60,12 @@ #include #include +#include +#include +#include +#include +#include + #include #include @@ -1294,19 +1300,47 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, bool error = true; rtl::OUString fileURL; + sal_Bool bHighContrastMode = sal_False; + rtl::OUString aCSS( m_aCSS ); + if ( aCSS.compareToAscii( "default" ) == 0 ) + { + // #i50760: "default" needs to adapt HC mode + uno::Reference< awt::XToolkit > xToolkit = uno::Reference< awt::XToolkit >( + ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY ); + if ( xToolkit.is() ) + { + uno::Reference< awt::XExtendedToolkit > xExtToolkit( xToolkit, uno::UNO_QUERY ); + if ( xExtToolkit.is() ) + { + uno::Reference< awt::XTopWindow > xTopWindow = xExtToolkit->getActiveTopWindow(); + if ( xTopWindow.is() ) + { + uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY ); + if ( xVclWindowPeer.is() ) + { + uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString::createFromAscii( "HighContrastMode" ) ); + if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) + aCSS = rtl::OUString::createFromAscii( "highcontrastblack" ); + } + } + } + } + } + while( error && retry ) { + if( retry == 2 ) fileURL = getInstallPathAsURL() + processLang( Language ) + rtl::OUString::createFromAscii( "/" ) + - m_aCSS + + aCSS + rtl::OUString::createFromAscii( ".css" ); else if( retry == 1 ) fileURL = getInstallPathAsURL() + - m_aCSS + + aCSS + rtl::OUString::createFromAscii( ".css" ); osl::DirectoryItem aDirItem; @@ -1327,6 +1361,13 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language, } --retry; + if ( !retry && error && bHighContrastMode ) + { + // fall back to default css + aCSS = rtl::OUString::createFromAscii( "default" ); + retry = 2; + bHighContrastMode = sal_False; + } } if( error ) -- cgit v1.2.3 From 359b43e0ba37cde83d5e346bc2cc9cc4b03ba07b Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Wed, 3 Mar 2010 21:15:58 +0100 Subject: fixed some rebase issues --- editeng/source/accessibility/AccessibleEditableTextPara.cxx | 2 +- editeng/source/accessibility/AccessibleHyperlink.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 67fb3df6ecc1..2febde11085e 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -76,7 +76,7 @@ #include #include #include "editeng/AccessibleEditableTextPara.hxx" -#include "editeng/AccessibleHyperlink.hxx" +#include "AccessibleHyperlink.hxx" #include diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx index 5d0e98f0b0d2..52cc796a25cf 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.cxx +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svx.hxx" +#include "precompiled_editeng.hxx" #include #include #include #include "AccessibleHyperlink.hxx" -#include "unoedprx.hxx" +#include "editeng/unoedprx.hxx" #include #include -- cgit v1.2.3 From 16d0fecae46a77e77552b9da01826596279d4d27 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 11 Mar 2010 13:09:35 +0100 Subject: mtaccfixes: adjustments due to merge with DEV300_m73 --- editeng/source/accessibility/AccessibleEditableTextPara.cxx | 2 +- editeng/source/accessibility/AccessibleHyperlink.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 2febde11085e..94981dc32e73 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx index 52cc796a25cf..52c12b08a27b 100644 --- a/editeng/source/accessibility/AccessibleHyperlink.cxx +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -37,7 +37,7 @@ #include "AccessibleHyperlink.hxx" #include "editeng/unoedprx.hxx" -#include +#include #include using namespace ::com::sun::star; -- cgit v1.2.3 From 002bb9adfb4b6a4222767dc823d8ba52a1b8786d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 11 Mar 2010 15:53:40 +0100 Subject: autorecovery: include with \\\, not with < > , to fetch the files from the module, not from solver --- svx/source/items/svxitems.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/svx/source/items/svxitems.src b/svx/source/items/svxitems.src index 5faaf1cb31f0..e21ea8fc6e4b 100644 --- a/svx/source/items/svxitems.src +++ b/svx/source/items/svxitems.src @@ -26,8 +26,8 @@ ************************************************************************/ // include ------------------------------------------------------------------ -#include -#include +#include "svx/svxitems.hrc" +#include "svx/svxids.hrc" #include StringArray RID_ATTR_NAMES -- cgit v1.2.3 From bdcf38cfcbb9cb9fdce7604927d82a0e25c2bd03 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Mar 2010 09:47:00 +0100 Subject: autorecovery: post-rebase: SetTransferPriority removed (had been removed from SvxLinkManager in CWS, and moved to sfx2's LinkManager in MWS) --- sfx2/inc/sfx2/linkmgr.hxx | 2 -- sfx2/source/appl/linkmgr2.cxx | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/sfx2/inc/sfx2/linkmgr.hxx b/sfx2/inc/sfx2/linkmgr.hxx index ee734dd69773..7dc779e2ba6e 100644 --- a/sfx2/inc/sfx2/linkmgr.hxx +++ b/sfx2/inc/sfx2/linkmgr.hxx @@ -131,8 +131,6 @@ public: // (ist zur Zeit nur fuer die FileLinks interressant!) void CancelTransfers(); - static void SetTransferPriority( sfx2::SvBaseLink& rLink, USHORT nPrio ); - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 3f5dcb78a677..ce69ba225157 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -430,16 +430,6 @@ void LinkManager::CancelTransfers() pFileObj->CancelTransfers(); } -void LinkManager::SetTransferPriority( sfx2::SvBaseLink& /*rLink*/, USHORT /*nPrio*/ ) -{ -// SvFileObject* pFileObj = -// (SvFileObject*)SvFileObject::ClassFactory()-> -// CastAndAddRef( rLink.GetObj() ); -// OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & rLink.GetObjType()) ? -// (SvFileObject*)rLink.GetObj() : 0; -} - - // um Status Informationen aus dem FileObject an den BaseLink zu // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat // dann die entsprechenden Informationen als String. -- cgit v1.2.3 From 3d9007d051323d2e31b36fe031f8cc69b4f51324 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 17 Mar 2010 12:34:44 +0100 Subject: dba33e: #i102366# parse [ as names as well --- connectivity/source/parse/sqlflex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l index e365fdec1eca..46d1c7e81417 100644 --- a/connectivity/source/parse/sqlflex.l +++ b/connectivity/source/parse/sqlflex.l @@ -400,7 +400,7 @@ VAR_SAMP {SQL_NEW_KEYWORD(SQL_TOKEN_VAR_S \" { return gatherString('\"',0); } ` { return gatherString('`' ,0); } -"[" { return gatherString(']' ,0);} +"[" { return gatherString(']' ,0);} \' { return gatherString('\'',1); } -- cgit v1.2.3 From ec71512fb94b53ca3ae40c42afbece8f87ce4032 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Fri, 5 Mar 2010 10:05:32 +0100 Subject: native287 #i109807# no more soffice.exe into msi database --- sysui/prj/d.lst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sysui/prj/d.lst b/sysui/prj/d.lst index 126376930c0d..89ce91029523 100644 --- a/sysui/prj/d.lst +++ b/sysui/prj/d.lst @@ -20,6 +20,9 @@ mkdir: %_DEST%\bin%_EXT%\desktop-integration\pkg ..\%__SRC%\bin\soquickstart.exe %_DEST%\bin%_EXT%\so\quickstart.exe ..\%__SRC%\bin\soquickstart.exe %_DEST%\bin%_EXT%\so\install_quickstart.exe +..\%__SRC%\misc\ooo3_main_app.ico %_DEST%\bin%_EXT%\soffice.ico +..\%__SRC%\misc\so9_main_app.ico %_DEST%\bin%_EXT%\so\soffice.ico + ..\%__SRC%\misc\desktopshare\*.desktop %_DEST%\pck%_EXT%\*.desktop ..\%__SRC%\misc\PkgInfo %_DEST%\pck%_EXT%\PkgInfo ..\%__SRC%\misc\Info.plist %_DEST%\pck%_EXT%\Info.plist -- cgit v1.2.3 From 0c9ca4ae6d3448adbf3901345eede4830824459c Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Fri, 5 Mar 2010 10:20:54 +0100 Subject: native287 #i109807# no more soffice.exe into msi database --- sysui/prj/d.lst | 1 - 1 file changed, 1 deletion(-) diff --git a/sysui/prj/d.lst b/sysui/prj/d.lst index 89ce91029523..c6019cea9a43 100644 --- a/sysui/prj/d.lst +++ b/sysui/prj/d.lst @@ -21,7 +21,6 @@ mkdir: %_DEST%\bin%_EXT%\desktop-integration\pkg ..\%__SRC%\bin\soquickstart.exe %_DEST%\bin%_EXT%\so\install_quickstart.exe ..\%__SRC%\misc\ooo3_main_app.ico %_DEST%\bin%_EXT%\soffice.ico -..\%__SRC%\misc\so9_main_app.ico %_DEST%\bin%_EXT%\so\soffice.ico ..\%__SRC%\misc\desktopshare\*.desktop %_DEST%\pck%_EXT%\*.desktop ..\%__SRC%\misc\PkgInfo %_DEST%\pck%_EXT%\PkgInfo -- cgit v1.2.3 From 584eac4b8be31ea46c297b63fb1dc330560bfc5f Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Mon, 15 Feb 2010 16:14:08 +0100 Subject: #i108916# added STRG-ALT-N shortcut to new comments in impress/draw --- .../registry/data/org/openoffice/Office/Accelerators.xcu | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) mode change 100644 => 100755 officecfg/registry/data/org/openoffice/Office/Accelerators.xcu diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu old mode 100644 new mode 100755 index 8c20db415c12..bf08c7b5da6a --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -1869,6 +1869,12 @@ + + + I10N SHORTCUTS - NO TRANSLATE + .uno:InsertAnnotation + + I10N SHORTCUTS - NO TRANSLATE @@ -5499,7 +5505,13 @@ - + + + I10N SHORTCUTS - NO TRANSLATE + .uno:InsertAnnotation + + + I10N SHORTCUTS - NO TRANSLATE .uno:Undo -- cgit v1.2.3 From e327e7e9a2647675a9d09d2df69a086631c5ca68 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Wed, 24 Mar 2010 15:39:09 +0100 Subject: #i108976# applied patch fix a crash when default style is deleted - transplanted from 263352@impresscomments1 --- svx/source/svdraw/svdpntv.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 0d526ff8a279..998c687608fc 100755 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -294,6 +294,9 @@ SdrPaintView::SdrPaintView(SdrModel* pModel1, OutputDevice* pOut) SdrPaintView::~SdrPaintView() { DBG_DTOR(SdrPaintView,NULL); + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); + maColorConfig.RemoveListener(this); ClearPageView(); @@ -317,8 +320,16 @@ SdrPaintView::~SdrPaintView() //////////////////////////////////////////////////////////////////////////////////////////////////// -void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +void __EXPORT SdrPaintView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { + //If the stylesheet has been destroyed + if (&rBC == pDefaultStyleSheet) + { + if (rHint.ISA(SfxSimpleHint) && ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING) + pDefaultStyleSheet = NULL; + return; + } + BOOL bObjChg=!bSomeObjChgdFlag; // TRUE= auswerten fuer ComeBack-Timer if (bObjChg) { SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint); @@ -1238,7 +1249,12 @@ void SdrPaintView::SetDefaultAttr(const SfxItemSet& rAttr, BOOL bReplaceAll) void SdrPaintView::SetDefaultStyleSheet(SfxStyleSheet* pStyleSheet, BOOL bDontRemoveHardAttr) { + if (pDefaultStyleSheet) + EndListening(*pDefaultStyleSheet); pDefaultStyleSheet=pStyleSheet; + if (pDefaultStyleSheet) + StartListening(*pDefaultStyleSheet); + if (pStyleSheet!=NULL && !bDontRemoveHardAttr) { SfxWhichIter aIter(pStyleSheet->GetItemSet()); USHORT nWhich=aIter.FirstWhich(); -- cgit v1.2.3 From 5a523e334d222926afb4302b7351c9f22c2063e7 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 25 Mar 2010 14:14:26 +0100 Subject: CWS-TOOLING: integrate CWS ooo321gsl04_DEV300 --- scripting/source/pyprov/pythonscript.py | 51 ++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 6a57fa792873..88e0a9efbc9d 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -5,6 +5,7 @@ import sys import os import imp import time +import compiler class LogLevel: NONE = 0 @@ -340,6 +341,32 @@ class ProviderContext: ret = url[0:pos]+ package.transientPathElement + "/" + url[pos:len(url)] log.isDebugLevel() and log.debug( "getStorageUrlFromPersistentUrl " + url + " -> "+ ret) return ret + + def getFuncsByUrl( self, url ): + src = readTextFromStream( self.sfa.openFileRead( url ) ) + checkForPythonPathBesideScript( url[0:url.rfind('/')] ) + src = ensureSourceState( src ) + + code = compiler.parse( src ) + + allFuncs = [] + + if code == None: + return allFuncs + + g_exportedScripts = [] + for node in code.node.nodes: + if node.__class__.__name__ == 'Function': + allFuncs.append(node.name) + elif node.__class__.__name__ == 'Assign': + for assignee in node.nodes: + if assignee.name == 'g_exportedScripts': + for item in node.expr: + if item.__class__.__name__ == 'Name': + g_exportedScripts.append(item.name) + return g_exportedScripts + + return allFuncs def getModuleByUrl( self, url ): entry = self.modules.get(url) @@ -382,11 +409,10 @@ def isScript( candidate ): #------------------------------------------------------- class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, XActionListener ): - def __init__( self, provCtx, uri, fileName, funcName, func ): + def __init__( self, provCtx, uri, fileName, funcName ): self.fileName = fileName self.funcName = funcName self.provCtx = provCtx - self.func = func self.uri = uri def getName( self ): @@ -407,8 +433,6 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, if name == "URI": ret = self.provCtx.uriHelper.getScriptURI( self.provCtx.getPersistentUrlFromStorageUrl( self.uri + "$" + self.funcName ) ) - elif name == "Description": - ret = getattr( self.func, "__doc__", None ) elif name == "Editable" and ENABLE_EDIT_DIALOG: ret = not self.provCtx.sfa.isReadOnly( self.uri ) @@ -506,7 +530,7 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): self.provCtx = provCtx self.uri = uri self.name = name - self.module = None + self.funcnames = None def getName( self ): return self.name @@ -514,21 +538,14 @@ class FileBrowseNode( unohelper.Base, XBrowseNode ): def getChildNodes(self): ret = () try: - self.module = self.provCtx.getModuleByUrl( self.uri ) - values = self.module.__dict__.get( CALLABLE_CONTAINER_NAME , None ) + self.funcnames = self.provCtx.getFuncsByUrl( self.uri ) - # no g_exportedScripts, export every function - if not isinstance(values, type(())): - values = self.module.__dict__.values() - scriptNodeList = [] - for i in values: - if isScript( i ): - scriptNodeList.append( - ScriptBrowseNode( - self.provCtx, self.uri, self.name, i.__name__, i )) + for i in self.funcnames: + scriptNodeList.append( + ScriptBrowseNode( + self.provCtx, self.uri, self.name, i )) ret = tuple( scriptNodeList ) - # must compile ! log.isDebugLevel() and log.debug( "returning " +str(len(ret)) + " ScriptChildNodes on " + self.uri ) except Exception, e: text = lastException2String() -- cgit v1.2.3 From d59253a558a108d6d3bc194ab1899fff3c374a04 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 8 Jan 2010 15:15:59 +0000 Subject: #i108159# new ODF- and nonODF-Icons --- sysui/desktop/icons/database.icns | Bin 0 -> 48416 bytes sysui/desktop/icons/database.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/drawing-template.icns | Bin 10935 -> 48006 bytes sysui/desktop/icons/drawing-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/drawing.icns | Bin 11290 -> 46878 bytes sysui/desktop/icons/drawing.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/formula.icns | Bin 10380 -> 41940 bytes sysui/desktop/icons/formula.ico | Bin 0 -> 295606 bytes .../icons/hicolor/128x128/mimetypes/database.png | Bin 0 -> 5874 bytes .../hicolor/128x128/mimetypes/drawing-template.png | Bin 0 -> 6217 bytes .../icons/hicolor/128x128/mimetypes/drawing.png | Bin 0 -> 6387 bytes .../icons/hicolor/128x128/mimetypes/formula.png | Bin 0 -> 4353 bytes .../hicolor/128x128/mimetypes/master-document.png | Bin 0 -> 2662 bytes .../hicolor/128x128/mimetypes/oasis-database.png | Bin 15854 -> 6845 bytes .../128x128/mimetypes/oasis-drawing-template.png | Bin 16120 -> 7206 bytes .../hicolor/128x128/mimetypes/oasis-drawing.png | Bin 16063 -> 7373 bytes .../hicolor/128x128/mimetypes/oasis-formula.png | Bin 12936 -> 5370 bytes .../128x128/mimetypes/oasis-master-document.png | Bin 11992 -> 3703 bytes .../mimetypes/oasis-presentation-template.png | Bin 13955 -> 6193 bytes .../128x128/mimetypes/oasis-presentation.png | Bin 13654 -> 5434 bytes .../mimetypes/oasis-spreadsheet-template.png | Bin 12792 -> 5753 bytes .../hicolor/128x128/mimetypes/oasis-spreadsheet.png | Bin 12338 -> 4617 bytes .../128x128/mimetypes/oasis-text-template.png | Bin 12100 -> 6763 bytes .../icons/hicolor/128x128/mimetypes/oasis-text.png | Bin 11770 -> 6847 bytes .../128x128/mimetypes/oasis-web-template.png | Bin 17754 -> 3493 bytes .../128x128/mimetypes/presentation-template.png | Bin 0 -> 5212 bytes .../hicolor/128x128/mimetypes/presentation.png | Bin 0 -> 4459 bytes .../128x128/mimetypes/spreadsheet-template.png | Bin 0 -> 4764 bytes .../icons/hicolor/128x128/mimetypes/spreadsheet.png | Bin 0 -> 3598 bytes .../hicolor/128x128/mimetypes/text-template.png | Bin 0 -> 5772 bytes .../icons/hicolor/128x128/mimetypes/text.png | Bin 0 -> 5817 bytes .../icons/hicolor/16x16/mimetypes/database.png | Bin 291 -> 555 bytes .../hicolor/16x16/mimetypes/drawing-template.png | Bin 348 -> 522 bytes .../icons/hicolor/16x16/mimetypes/drawing.png | Bin 354 -> 555 bytes .../icons/hicolor/16x16/mimetypes/formula.png | Bin 252 -> 562 bytes .../hicolor/16x16/mimetypes/master-document.png | Bin 310 -> 450 bytes .../hicolor/16x16/mimetypes/oasis-database.png | Bin 1009 -> 574 bytes .../16x16/mimetypes/oasis-drawing-template.png | Bin 1094 -> 554 bytes .../icons/hicolor/16x16/mimetypes/oasis-drawing.png | Bin 1082 -> 572 bytes .../icons/hicolor/16x16/mimetypes/oasis-formula.png | Bin 1014 -> 580 bytes .../16x16/mimetypes/oasis-master-document.png | Bin 929 -> 472 bytes .../16x16/mimetypes/oasis-presentation-template.png | Bin 1025 -> 532 bytes .../hicolor/16x16/mimetypes/oasis-presentation.png | Bin 960 -> 441 bytes .../16x16/mimetypes/oasis-spreadsheet-template.png | Bin 1018 -> 538 bytes .../hicolor/16x16/mimetypes/oasis-spreadsheet.png | Bin 961 -> 436 bytes .../hicolor/16x16/mimetypes/oasis-text-template.png | Bin 986 -> 444 bytes .../icons/hicolor/16x16/mimetypes/oasis-text.png | Bin 923 -> 420 bytes .../hicolor/16x16/mimetypes/oasis-web-template.png | Bin 1023 -> 436 bytes .../16x16/mimetypes/presentation-template.png | Bin 303 -> 515 bytes .../icons/hicolor/16x16/mimetypes/presentation.png | Bin 302 -> 425 bytes .../16x16/mimetypes/spreadsheet-template.png | Bin 287 -> 513 bytes .../icons/hicolor/16x16/mimetypes/spreadsheet.png | Bin 271 -> 412 bytes .../icons/hicolor/16x16/mimetypes/text-template.png | Bin 240 -> 413 bytes .../desktop/icons/hicolor/16x16/mimetypes/text.png | Bin 245 -> 392 bytes .../icons/hicolor/32x32/mimetypes/database.png | Bin 529 -> 1319 bytes .../hicolor/32x32/mimetypes/drawing-template.png | Bin 1344 -> 1307 bytes .../icons/hicolor/32x32/mimetypes/drawing.png | Bin 1483 -> 1363 bytes .../icons/hicolor/32x32/mimetypes/formula.png | Bin 1349 -> 1172 bytes .../hicolor/32x32/mimetypes/master-document.png | Bin 1559 -> 909 bytes .../hicolor/32x32/mimetypes/oasis-database.png | Bin 2922 -> 1497 bytes .../32x32/mimetypes/oasis-drawing-template.png | Bin 2957 -> 1506 bytes .../icons/hicolor/32x32/mimetypes/oasis-drawing.png | Bin 2828 -> 1548 bytes .../icons/hicolor/32x32/mimetypes/oasis-formula.png | Bin 2622 -> 1346 bytes .../32x32/mimetypes/oasis-master-document.png | Bin 2338 -> 1110 bytes .../32x32/mimetypes/oasis-presentation-template.png | Bin 2812 -> 1370 bytes .../hicolor/32x32/mimetypes/oasis-presentation.png | Bin 2623 -> 1180 bytes .../32x32/mimetypes/oasis-spreadsheet-template.png | Bin 2856 -> 1130 bytes .../hicolor/32x32/mimetypes/oasis-spreadsheet.png | Bin 2618 -> 917 bytes .../hicolor/32x32/mimetypes/oasis-text-template.png | Bin 2575 -> 1153 bytes .../icons/hicolor/32x32/mimetypes/oasis-text.png | Bin 2311 -> 1106 bytes .../hicolor/32x32/mimetypes/oasis-web-template.png | Bin 2908 -> 966 bytes .../32x32/mimetypes/presentation-template.png | Bin 1403 -> 1166 bytes .../icons/hicolor/32x32/mimetypes/presentation.png | Bin 1515 -> 982 bytes .../32x32/mimetypes/spreadsheet-template.png | Bin 1211 -> 919 bytes .../icons/hicolor/32x32/mimetypes/spreadsheet.png | Bin 1301 -> 692 bytes .../icons/hicolor/32x32/mimetypes/text-template.png | Bin 1211 -> 941 bytes .../desktop/icons/hicolor/32x32/mimetypes/text.png | Bin 1406 -> 903 bytes .../icons/hicolor/48x48/mimetypes/database.png | Bin 652 -> 1862 bytes .../hicolor/48x48/mimetypes/drawing-template.png | Bin 1819 -> 1923 bytes .../icons/hicolor/48x48/mimetypes/drawing.png | Bin 1913 -> 1962 bytes .../icons/hicolor/48x48/mimetypes/formula.png | Bin 1803 -> 1589 bytes .../hicolor/48x48/mimetypes/master-document.png | Bin 2003 -> 1160 bytes .../hicolor/48x48/mimetypes/oasis-database.png | Bin 5032 -> 2430 bytes .../48x48/mimetypes/oasis-drawing-template.png | Bin 4919 -> 2482 bytes .../icons/hicolor/48x48/mimetypes/oasis-drawing.png | Bin 4935 -> 2518 bytes .../icons/hicolor/48x48/mimetypes/oasis-formula.png | Bin 4422 -> 2171 bytes .../48x48/mimetypes/oasis-master-document.png | Bin 3808 -> 1741 bytes .../48x48/mimetypes/oasis-presentation-template.png | Bin 4650 -> 2376 bytes .../hicolor/48x48/mimetypes/oasis-presentation.png | Bin 4611 -> 2125 bytes .../48x48/mimetypes/oasis-spreadsheet-template.png | Bin 4409 -> 2400 bytes .../hicolor/48x48/mimetypes/oasis-spreadsheet.png | Bin 4211 -> 2079 bytes .../hicolor/48x48/mimetypes/oasis-text-template.png | Bin 4023 -> 2125 bytes .../icons/hicolor/48x48/mimetypes/oasis-text.png | Bin 3785 -> 2094 bytes .../hicolor/48x48/mimetypes/oasis-web-template.png | Bin 4854 -> 1537 bytes .../48x48/mimetypes/presentation-template.png | Bin 2044 -> 1792 bytes .../icons/hicolor/48x48/mimetypes/presentation.png | Bin 2043 -> 1551 bytes .../48x48/mimetypes/spreadsheet-template.png | Bin 1599 -> 1829 bytes .../icons/hicolor/48x48/mimetypes/spreadsheet.png | Bin 1684 -> 1476 bytes .../icons/hicolor/48x48/mimetypes/text-template.png | Bin 1687 -> 1552 bytes .../desktop/icons/hicolor/48x48/mimetypes/text.png | Bin 1764 -> 1525 bytes sysui/desktop/icons/master-document.icns | Bin 11003 -> 41443 bytes sysui/desktop/icons/master-document.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-database.icns | Bin 53983 -> 51503 bytes sysui/desktop/icons/oasis-database.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-drawing-template.icns | Bin 53400 -> 51093 bytes sysui/desktop/icons/oasis-drawing-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-drawing.icns | Bin 52603 -> 49965 bytes sysui/desktop/icons/oasis-drawing.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-formula.icns | Bin 50335 -> 45027 bytes sysui/desktop/icons/oasis-formula.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-master-document.icns | Bin 48904 -> 44531 bytes sysui/desktop/icons/oasis-master-document.ico | Bin 0 -> 295606 bytes .../desktop/icons/oasis-presentation-template.icns | Bin 51890 -> 47163 bytes sysui/desktop/icons/oasis-presentation-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-presentation.icns | Bin 51073 -> 43638 bytes sysui/desktop/icons/oasis-presentation.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-spreadsheet-template.icns | Bin 51919 -> 52924 bytes sysui/desktop/icons/oasis-spreadsheet-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-spreadsheet.icns | Bin 50953 -> 51578 bytes sysui/desktop/icons/oasis-spreadsheet.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-text-template.icns | Bin 49196 -> 49722 bytes sysui/desktop/icons/oasis-text-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-text.icns | Bin 47545 -> 48791 bytes sysui/desktop/icons/oasis-text.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/oasis-web-template.icns | Bin 55853 -> 42146 bytes sysui/desktop/icons/oasis-web-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/presentation-template.icns | Bin 10690 -> 44076 bytes sysui/desktop/icons/presentation-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/presentation.icns | Bin 10947 -> 40551 bytes sysui/desktop/icons/presentation.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/spreadsheet-template.icns | Bin 10085 -> 49837 bytes sysui/desktop/icons/spreadsheet-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/spreadsheet.icns | Bin 10457 -> 48491 bytes sysui/desktop/icons/spreadsheet.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/text-template.icns | Bin 10095 -> 46635 bytes sysui/desktop/icons/text-template.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/text.icns | Bin 10401 -> 45704 bytes sysui/desktop/icons/text.ico | Bin 0 -> 295606 bytes 138 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 sysui/desktop/icons/database.icns create mode 100644 sysui/desktop/icons/database.ico create mode 100644 sysui/desktop/icons/drawing-template.ico create mode 100644 sysui/desktop/icons/drawing.ico create mode 100644 sysui/desktop/icons/formula.ico create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/database.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png create mode 100644 sysui/desktop/icons/hicolor/128x128/mimetypes/text.png create mode 100644 sysui/desktop/icons/master-document.ico create mode 100644 sysui/desktop/icons/oasis-database.ico create mode 100644 sysui/desktop/icons/oasis-drawing-template.ico create mode 100644 sysui/desktop/icons/oasis-drawing.ico create mode 100644 sysui/desktop/icons/oasis-formula.ico create mode 100644 sysui/desktop/icons/oasis-master-document.ico create mode 100644 sysui/desktop/icons/oasis-presentation-template.ico create mode 100644 sysui/desktop/icons/oasis-presentation.ico create mode 100644 sysui/desktop/icons/oasis-spreadsheet-template.ico create mode 100644 sysui/desktop/icons/oasis-spreadsheet.ico create mode 100644 sysui/desktop/icons/oasis-text-template.ico create mode 100644 sysui/desktop/icons/oasis-text.ico create mode 100644 sysui/desktop/icons/oasis-web-template.ico create mode 100644 sysui/desktop/icons/presentation-template.ico create mode 100644 sysui/desktop/icons/presentation.ico create mode 100644 sysui/desktop/icons/spreadsheet-template.ico create mode 100644 sysui/desktop/icons/spreadsheet.ico create mode 100644 sysui/desktop/icons/text-template.ico create mode 100644 sysui/desktop/icons/text.ico diff --git a/sysui/desktop/icons/database.icns b/sysui/desktop/icons/database.icns new file mode 100644 index 000000000000..115dc859cdcd Binary files /dev/null and b/sysui/desktop/icons/database.icns differ diff --git a/sysui/desktop/icons/database.ico b/sysui/desktop/icons/database.ico new file mode 100644 index 000000000000..171d39bb9643 Binary files /dev/null and b/sysui/desktop/icons/database.ico differ diff --git a/sysui/desktop/icons/drawing-template.icns b/sysui/desktop/icons/drawing-template.icns index 359164f314ac..407484582f93 100644 Binary files a/sysui/desktop/icons/drawing-template.icns and b/sysui/desktop/icons/drawing-template.icns differ diff --git a/sysui/desktop/icons/drawing-template.ico b/sysui/desktop/icons/drawing-template.ico new file mode 100644 index 000000000000..5b5a74e99f41 Binary files /dev/null and b/sysui/desktop/icons/drawing-template.ico differ diff --git a/sysui/desktop/icons/drawing.icns b/sysui/desktop/icons/drawing.icns index 81777c7f92b6..5322625b0507 100644 Binary files a/sysui/desktop/icons/drawing.icns and b/sysui/desktop/icons/drawing.icns differ diff --git a/sysui/desktop/icons/drawing.ico b/sysui/desktop/icons/drawing.ico new file mode 100644 index 000000000000..1065490a2807 Binary files /dev/null and b/sysui/desktop/icons/drawing.ico differ diff --git a/sysui/desktop/icons/formula.icns b/sysui/desktop/icons/formula.icns index 61cd00a0e001..4620688c79c6 100644 Binary files a/sysui/desktop/icons/formula.icns and b/sysui/desktop/icons/formula.icns differ diff --git a/sysui/desktop/icons/formula.ico b/sysui/desktop/icons/formula.ico new file mode 100644 index 000000000000..e06aef187734 Binary files /dev/null and b/sysui/desktop/icons/formula.ico differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png new file mode 100644 index 000000000000..93b8e60cb276 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/database.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png new file mode 100644 index 000000000000..15b80e039313 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png new file mode 100644 index 000000000000..9d47f747dffa Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/drawing.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png new file mode 100644 index 000000000000..184dd0ca6ca8 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/formula.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png new file mode 100644 index 000000000000..acf19ff835f2 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/master-document.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png index 1429d82ce829..f95bbf137a5b 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-database.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png index 4fdde3c34c3f..630a51ebb430 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png index 7272482a04b3..82ac8d15bfc3 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-drawing.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png index 9e4c72eab7af..c838eaa12851 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-formula.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png index 6f191e2cf0d4..640e2d98614c 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-master-document.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png index bf8229c1f55c..c4954802e82c 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png index 2b3a5bb90065..1d5acededb94 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-presentation.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png index 18c00ad4bb82..01781db415fa 100644 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png index ca480522d847..bc46714afa92 100644 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png index ef5b5dd7a5f4..569bd514fcb7 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png index 178d4e26d967..b45244ac1a4b 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-text.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png index 7edd66d369d0..8e6c4580e9fd 100755 Binary files a/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png and b/sysui/desktop/icons/hicolor/128x128/mimetypes/oasis-web-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png new file mode 100644 index 000000000000..c8a3813188de Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png new file mode 100644 index 000000000000..2a0552eb62b4 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/presentation.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png new file mode 100644 index 000000000000..cc7aa51bcb3c Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png new file mode 100644 index 000000000000..c701fd7b5d46 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png new file mode 100644 index 000000000000..652c1ce480c9 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/text-template.png differ diff --git a/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png b/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png new file mode 100644 index 000000000000..f881aca21839 Binary files /dev/null and b/sysui/desktop/icons/hicolor/128x128/mimetypes/text.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png index bbf485561e19..fb32e00a1ba6 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/database.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png index 74770d5d482f..f045190f395a 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png index 30303797baf7..3bd7b7d29cb1 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/drawing.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png index 3eb7f884f91d..e7e95875efed 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/formula.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png index c424e4fbf430..e442a0c0985d 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/master-document.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png index 2f2d56dd0daa..e4ae28570f08 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-database.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png index 94f4ac9ec58e..eaad54fcdf7e 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png index d65439afbc6c..3d66cc97eb5e 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-drawing.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png index 9c628ce789f9..4cefbb690d10 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-formula.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png index 137778d11fa2..12aab4a27c32 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-master-document.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png index 3153d8e3c705..9f281836d793 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png index c642127abc1e..46942cba2852 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-presentation.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png index 689bb5aef425..4781bfc3a6fc 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png index f51a29a85492..abc38d4310c9 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png index 1c20ed072ba8..9836814c6c2c 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png index 8b095bfcbafb..06c1f30c8fa2 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-text.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png index 795d92615e4f..01c04a0ea697 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/oasis-web-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png index bb20d139e1a5..df1d5293a83d 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png index b82ddf720912..6803ae4c7492 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/presentation.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png index 3546349b59a3..5be785e40f64 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png index df164ff2caae..46c72242a02a 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png index 4d895288251e..2827f29f3a4e 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/text-template.png differ diff --git a/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png b/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png index 6ff2517af44d..c0d1cd3dcc7a 100644 Binary files a/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png and b/sysui/desktop/icons/hicolor/16x16/mimetypes/text.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png index 709903d46c21..6e0a4b8f60ba 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/database.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png index 76e5abdab9f0..a341632dabb7 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png index 380c60a7df2c..4abe5c0f80af 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/drawing.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png index 37306ac617ec..d989593924c2 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/formula.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png index 1f3e79927608..d4b033f4aab8 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/master-document.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png index ddfcd7d19588..461bdf37b774 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-database.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png index e742adc40258..cdc2f2df0fc8 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png index 8d78d91c1866..55dda2143e57 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-drawing.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png index 302c7ab633f4..6b8f2f732201 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-formula.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png index fc032402b756..234bac461e74 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-master-document.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png index 03c96f8dd867..012516065215 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png index 465583b9b06b..fedeb0620a75 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-presentation.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png index 383906a70a2e..9d63063e67d0 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png index 67da85c10bf1..020d95bef310 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png index feb935cc1df4..983b39e611ae 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png index 571e6a0e4a48..ac350cb409d1 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-text.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png index e3bd788ea1dc..8e906f8be1df 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/oasis-web-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png index 0edabbc86f16..5163f441039a 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png index 0eee1162ce15..730f86f0ba63 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/presentation.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png index 158a63a58c92..d81cd27dd93f 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png index f7352ab51783..dc9bd083c218 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png index cfba26102380..7c738c21eb59 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/text-template.png differ diff --git a/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png b/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png index 77f87e777b7a..1454b20fd5db 100644 Binary files a/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png and b/sysui/desktop/icons/hicolor/32x32/mimetypes/text.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png index 224943b0e9ea..b385ed9db537 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/database.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png index 043dd5dfae71..b7da9bfa2c81 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png index 8857034ce262..85499fd2199f 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/drawing.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png index 45f6d919387c..bcc61b432b94 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/formula.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png index 191a619f7cf3..7a7b86956537 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/master-document.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png index 2c2ffb86e6c5..77e684960ec2 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-database.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png index 655a938f826c..8cb4dd3fa7d0 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png index c1bbdc4de6bb..258b3b2fc1e2 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-drawing.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png index fbdede243a6f..f6508de45379 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-formula.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png index d06b5ca8b11f..1923fc9b9ff4 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-master-document.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png index f77c9c6e9ad9..00d311317566 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png index 7336f3530367..635953e1c714 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-presentation.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png index 850250c71a45..7c4beda53d60 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png index 6f6328cece2c..4c407a0f5fc1 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png index ac0d373a0362..64b86940885a 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png index 8c2b714b292b..0c04210a0c9a 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-text.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png index a7cf8d0f7d14..0ff92ec7a267 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/oasis-web-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png index 2193c98931ae..d9651bf654af 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png index bd59fbbbaf82..e058d25f822e 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/presentation.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png index 34c60c2819d6..5d5e46e21bc0 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png index 6868f577ce1a..c352966320a1 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/spreadsheet.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png index 52a28fb3af80..ad5129774837 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/text-template.png differ diff --git a/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png b/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png index 7ead079cade2..2a1707006d82 100644 Binary files a/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png and b/sysui/desktop/icons/hicolor/48x48/mimetypes/text.png differ diff --git a/sysui/desktop/icons/master-document.icns b/sysui/desktop/icons/master-document.icns index 2089b9a660ef..33fdae3d47b7 100644 Binary files a/sysui/desktop/icons/master-document.icns and b/sysui/desktop/icons/master-document.icns differ diff --git a/sysui/desktop/icons/master-document.ico b/sysui/desktop/icons/master-document.ico new file mode 100644 index 000000000000..2c581f59a2b2 Binary files /dev/null and b/sysui/desktop/icons/master-document.ico differ diff --git a/sysui/desktop/icons/oasis-database.icns b/sysui/desktop/icons/oasis-database.icns index f64c6d2570ae..4d70286b0d9f 100644 Binary files a/sysui/desktop/icons/oasis-database.icns and b/sysui/desktop/icons/oasis-database.icns differ diff --git a/sysui/desktop/icons/oasis-database.ico b/sysui/desktop/icons/oasis-database.ico new file mode 100644 index 000000000000..3157568c3252 Binary files /dev/null and b/sysui/desktop/icons/oasis-database.ico differ diff --git a/sysui/desktop/icons/oasis-drawing-template.icns b/sysui/desktop/icons/oasis-drawing-template.icns index bb357bae58a1..dcb55db8e98f 100644 Binary files a/sysui/desktop/icons/oasis-drawing-template.icns and b/sysui/desktop/icons/oasis-drawing-template.icns differ diff --git a/sysui/desktop/icons/oasis-drawing-template.ico b/sysui/desktop/icons/oasis-drawing-template.ico new file mode 100644 index 000000000000..f98a2d6f44cb Binary files /dev/null and b/sysui/desktop/icons/oasis-drawing-template.ico differ diff --git a/sysui/desktop/icons/oasis-drawing.icns b/sysui/desktop/icons/oasis-drawing.icns index 80adc9feaaf5..3802af5ef3b5 100644 Binary files a/sysui/desktop/icons/oasis-drawing.icns and b/sysui/desktop/icons/oasis-drawing.icns differ diff --git a/sysui/desktop/icons/oasis-drawing.ico b/sysui/desktop/icons/oasis-drawing.ico new file mode 100644 index 000000000000..b24f2dadbe86 Binary files /dev/null and b/sysui/desktop/icons/oasis-drawing.ico differ diff --git a/sysui/desktop/icons/oasis-formula.icns b/sysui/desktop/icons/oasis-formula.icns index a7bded196c99..657ea29eb95c 100644 Binary files a/sysui/desktop/icons/oasis-formula.icns and b/sysui/desktop/icons/oasis-formula.icns differ diff --git a/sysui/desktop/icons/oasis-formula.ico b/sysui/desktop/icons/oasis-formula.ico new file mode 100644 index 000000000000..8ba738304e85 Binary files /dev/null and b/sysui/desktop/icons/oasis-formula.ico differ diff --git a/sysui/desktop/icons/oasis-master-document.icns b/sysui/desktop/icons/oasis-master-document.icns index 1891c129ad47..c39cb8963c82 100644 Binary files a/sysui/desktop/icons/oasis-master-document.icns and b/sysui/desktop/icons/oasis-master-document.icns differ diff --git a/sysui/desktop/icons/oasis-master-document.ico b/sysui/desktop/icons/oasis-master-document.ico new file mode 100644 index 000000000000..2104eafef55c Binary files /dev/null and b/sysui/desktop/icons/oasis-master-document.ico differ diff --git a/sysui/desktop/icons/oasis-presentation-template.icns b/sysui/desktop/icons/oasis-presentation-template.icns index 337df2fa7b25..57455ada701a 100644 Binary files a/sysui/desktop/icons/oasis-presentation-template.icns and b/sysui/desktop/icons/oasis-presentation-template.icns differ diff --git a/sysui/desktop/icons/oasis-presentation-template.ico b/sysui/desktop/icons/oasis-presentation-template.ico new file mode 100644 index 000000000000..ef561b821598 Binary files /dev/null and b/sysui/desktop/icons/oasis-presentation-template.ico differ diff --git a/sysui/desktop/icons/oasis-presentation.icns b/sysui/desktop/icons/oasis-presentation.icns index 4b9ba4231f24..cf768ac47ba9 100644 Binary files a/sysui/desktop/icons/oasis-presentation.icns and b/sysui/desktop/icons/oasis-presentation.icns differ diff --git a/sysui/desktop/icons/oasis-presentation.ico b/sysui/desktop/icons/oasis-presentation.ico new file mode 100644 index 000000000000..6f2c1602efdf Binary files /dev/null and b/sysui/desktop/icons/oasis-presentation.ico differ diff --git a/sysui/desktop/icons/oasis-spreadsheet-template.icns b/sysui/desktop/icons/oasis-spreadsheet-template.icns index 2bae7e38a860..8235e5287806 100644 Binary files a/sysui/desktop/icons/oasis-spreadsheet-template.icns and b/sysui/desktop/icons/oasis-spreadsheet-template.icns differ diff --git a/sysui/desktop/icons/oasis-spreadsheet-template.ico b/sysui/desktop/icons/oasis-spreadsheet-template.ico new file mode 100644 index 000000000000..1124d9f433e9 Binary files /dev/null and b/sysui/desktop/icons/oasis-spreadsheet-template.ico differ diff --git a/sysui/desktop/icons/oasis-spreadsheet.icns b/sysui/desktop/icons/oasis-spreadsheet.icns index 69b46c2a1d86..5facf50dbcf2 100644 Binary files a/sysui/desktop/icons/oasis-spreadsheet.icns and b/sysui/desktop/icons/oasis-spreadsheet.icns differ diff --git a/sysui/desktop/icons/oasis-spreadsheet.ico b/sysui/desktop/icons/oasis-spreadsheet.ico new file mode 100644 index 000000000000..160ab0cbf36c Binary files /dev/null and b/sysui/desktop/icons/oasis-spreadsheet.ico differ diff --git a/sysui/desktop/icons/oasis-text-template.icns b/sysui/desktop/icons/oasis-text-template.icns index 1986a329cbf8..0f0fe3f89788 100644 Binary files a/sysui/desktop/icons/oasis-text-template.icns and b/sysui/desktop/icons/oasis-text-template.icns differ diff --git a/sysui/desktop/icons/oasis-text-template.ico b/sysui/desktop/icons/oasis-text-template.ico new file mode 100644 index 000000000000..602124fabee7 Binary files /dev/null and b/sysui/desktop/icons/oasis-text-template.ico differ diff --git a/sysui/desktop/icons/oasis-text.icns b/sysui/desktop/icons/oasis-text.icns index 21a44a91d6b7..2d031fe49953 100644 Binary files a/sysui/desktop/icons/oasis-text.icns and b/sysui/desktop/icons/oasis-text.icns differ diff --git a/sysui/desktop/icons/oasis-text.ico b/sysui/desktop/icons/oasis-text.ico new file mode 100644 index 000000000000..d2bd5943164c Binary files /dev/null and b/sysui/desktop/icons/oasis-text.ico differ diff --git a/sysui/desktop/icons/oasis-web-template.icns b/sysui/desktop/icons/oasis-web-template.icns index 66b0db74ad0a..ee6d299991d7 100644 Binary files a/sysui/desktop/icons/oasis-web-template.icns and b/sysui/desktop/icons/oasis-web-template.icns differ diff --git a/sysui/desktop/icons/oasis-web-template.ico b/sysui/desktop/icons/oasis-web-template.ico new file mode 100644 index 000000000000..63ac9f348fda Binary files /dev/null and b/sysui/desktop/icons/oasis-web-template.ico differ diff --git a/sysui/desktop/icons/presentation-template.icns b/sysui/desktop/icons/presentation-template.icns index 5cdf700d9744..f4d01878b9fb 100644 Binary files a/sysui/desktop/icons/presentation-template.icns and b/sysui/desktop/icons/presentation-template.icns differ diff --git a/sysui/desktop/icons/presentation-template.ico b/sysui/desktop/icons/presentation-template.ico new file mode 100644 index 000000000000..471940369aaf Binary files /dev/null and b/sysui/desktop/icons/presentation-template.ico differ diff --git a/sysui/desktop/icons/presentation.icns b/sysui/desktop/icons/presentation.icns index 3f6e268c681b..091be5b13677 100644 Binary files a/sysui/desktop/icons/presentation.icns and b/sysui/desktop/icons/presentation.icns differ diff --git a/sysui/desktop/icons/presentation.ico b/sysui/desktop/icons/presentation.ico new file mode 100644 index 000000000000..360ef79e18b9 Binary files /dev/null and b/sysui/desktop/icons/presentation.ico differ diff --git a/sysui/desktop/icons/spreadsheet-template.icns b/sysui/desktop/icons/spreadsheet-template.icns index 058a147b5011..d2dfa849296b 100644 Binary files a/sysui/desktop/icons/spreadsheet-template.icns and b/sysui/desktop/icons/spreadsheet-template.icns differ diff --git a/sysui/desktop/icons/spreadsheet-template.ico b/sysui/desktop/icons/spreadsheet-template.ico new file mode 100644 index 000000000000..be267eb21bb1 Binary files /dev/null and b/sysui/desktop/icons/spreadsheet-template.ico differ diff --git a/sysui/desktop/icons/spreadsheet.icns b/sysui/desktop/icons/spreadsheet.icns index 8594b9ba862e..5c893541954b 100644 Binary files a/sysui/desktop/icons/spreadsheet.icns and b/sysui/desktop/icons/spreadsheet.icns differ diff --git a/sysui/desktop/icons/spreadsheet.ico b/sysui/desktop/icons/spreadsheet.ico new file mode 100644 index 000000000000..a88045e9c1c3 Binary files /dev/null and b/sysui/desktop/icons/spreadsheet.ico differ diff --git a/sysui/desktop/icons/text-template.icns b/sysui/desktop/icons/text-template.icns index 0f7c006b42f4..8b9694ac755a 100644 Binary files a/sysui/desktop/icons/text-template.icns and b/sysui/desktop/icons/text-template.icns differ diff --git a/sysui/desktop/icons/text-template.ico b/sysui/desktop/icons/text-template.ico new file mode 100644 index 000000000000..07986929a6f1 Binary files /dev/null and b/sysui/desktop/icons/text-template.ico differ diff --git a/sysui/desktop/icons/text.icns b/sysui/desktop/icons/text.icns index 169ef0961d98..401d2b9dbf6c 100644 Binary files a/sysui/desktop/icons/text.icns and b/sysui/desktop/icons/text.icns differ diff --git a/sysui/desktop/icons/text.ico b/sysui/desktop/icons/text.ico new file mode 100644 index 000000000000..f19a7812b15a Binary files /dev/null and b/sysui/desktop/icons/text.ico differ -- cgit v1.2.3 From 3deac2386c9340062ef650f8ad60bb3a1093c5cb Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 12:36:19 +0000 Subject: #i108159# ODF-Icons for OOo build --- sysui/desktop/icons/makefile.mk | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sysui/desktop/icons/makefile.mk b/sysui/desktop/icons/makefile.mk index f98b235d1252..1af3f4367fee 100644 --- a/sysui/desktop/icons/makefile.mk +++ b/sysui/desktop/icons/makefile.mk @@ -37,6 +37,33 @@ TARGET=icons # --- Targets ------------------------------------------------------------- all: \ + $(MISC)$/oasis-database.ico \ + $(MISC)$/oasis-drawing-template.ico \ + $(MISC)$/oasis-drawing.ico \ + $(MISC)$/oasis-empty-template.ico \ + $(MISC)$/oasis-empty-document.ico \ + $(MISC)$/oasis-formula.ico \ + $(MISC)$/oasis-master-document.ico \ + $(MISC)$/oasis-presentation-template.ico \ + $(MISC)$/oasis-presentation.ico \ + $(MISC)$/oasis-spreadsheet-template.ico \ + $(MISC)$/oasis-spreadsheet.ico \ + $(MISC)$/oasis-text-template.ico \ + $(MISC)$/oasis-text.ico \ + $(MISC)$/oasis-web-template.ico \ + $(MISC)$/database.ico \ + $(MISC)$/drawing-template.ico \ + $(MISC)$/drawing.ico \ + $(MISC)$/empty-template.ico \ + $(MISC)$/empty-document.ico \ + $(MISC)$/formula.ico \ + $(MISC)$/master-document.ico \ + $(MISC)$/presentation-template.ico \ + $(MISC)$/presentation.ico \ + $(MISC)$/spreadsheet-template.ico \ + $(MISC)$/spreadsheet.ico \ + $(MISC)$/text-template.ico \ + $(MISC)$/text.ico \ $(MISC)$/ooo-base-app.ico \ $(MISC)$/ooo-base-doc.ico \ $(MISC)$/ooo-calc-app.ico \ -- cgit v1.2.3 From cc0745cea08faec35a56f70a8208da6748ee3789 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 15:31:35 +0000 Subject: #i108159# ODF-Icons for OOo build --- desktop/util/ooverinfo.rc | 61 +++++++++++++++++++++++----------------------- desktop/util/ooverinfo2.rc | 61 +++++++++++++++++++++++----------------------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/desktop/util/ooverinfo.rc b/desktop/util/ooverinfo.rc index 7a80adcad62c..b2fab36e41d5 100644 --- a/desktop/util/ooverinfo.rc +++ b/desktop/util/ooverinfo.rc @@ -96,44 +96,43 @@ VS_VERSION_INFO versioninfo } } - -2 ICON "icons\\ooo3_writer_doc.ico" -3 ICON "icons\\ooo3_writer_tem.ico" -4 ICON "icons\\ooo3_calc_doc.ico" -5 ICON "icons\\ooo3_calc_tem.ico" -6 ICON "icons\\ooo3_draw_doc.ico" -7 ICON "icons\\ooo3_draw_tem.ico" -8 ICON "icons\\ooo3_impress_doc.ico" -9 ICON "icons\\ooo3_impress_tem.ico" -10 ICON "icons\\ooo3_impress_doc.ico" -11 ICON "icons\\ooo3_global_doc.ico" -12 ICON "icons\\ooo3_html_doc.ico" -13 ICON "icons\\ooo3_chart_doc.ico" -14 ICON "icons\\ooo3_base_doc.ico" -15 ICON "icons\\ooo3_math_doc.ico" -16 ICON "icons\\ooo3_empty_tem.ico" -17 ICON "icons\\ooo3_macro_doc.ico" +2 ICON "icons\\oasis-text.ico" +3 ICON "icons\\oasis-text-template.ico" +4 ICON "icons\\oasis-spreadsheet.ico" +5 ICON "icons\\oasis-spreadsheet-template.ico" +6 ICON "icons\\oasis-drawing.ico" +7 ICON "icons\\oasis-drawing-template.ico" +8 ICON "icons\\oasis-presentation.ico" +9 ICON "icons\\oasis-presentation-template.ico" +10 ICON "icons\\oasis-presentation-template.ico" +11 ICON "icons\\oasis-master-document.ico" +12 ICON "icons\\oasis-web-template.ico" +13 ICON "icons\\oasis-empty-document.ico" +14 ICON "icons\\oasis-database.ico" +15 ICON "icons\\oasis-formula.ico" +16 ICON "icons\\empty-template.ico" +17 ICON "icons\\empty-document.ico" 18 ICON "icons\\ooo-configuration.ico" 19 ICON "icons\\ooo-open.ico" -20 ICON "icons\\ooo-image-doc.ico" +20 ICON "icons\\empty-document.ico" 21 ICON "icons\\ooo3_writer_app.ico" 22 ICON "icons\\ooo3_calc_app.ico" 23 ICON "icons\\ooo3_draw_app.ico" 24 ICON "icons\\ooo3_impress_app.ico" 25 ICON "icons\\ooo3_math_app.ico" 26 ICON "icons\\ooo3_base_app.ico" -27 ICON "icons\\ooo3_empty_doc.ico" -28 ICON "icons\\ooo11-writer-doc.ico" -29 ICON "icons\\ooo11-writer-tem.ico" -30 ICON "icons\\ooo11-calc-doc.ico" -31 ICON "icons\\ooo11-calc-tem.ico" -32 ICON "icons\\ooo11-draw-doc.ico" -33 ICON "icons\\ooo11-draw-tem.ico" -34 ICON "icons\\ooo11-impress-doc.ico" -35 ICON "icons\\ooo11-impress-tem.ico" -36 ICON "icons\\ooo11-master-doc.ico" -37 ICON "icons\\ooo11-chart-doc.ico" -38 ICON "icons\\ooo11-base-doc.ico" -39 ICON "icons\\ooo11-math-doc.ico" +27 ICON "icons\\oasis-empty-document.ico" +28 ICON "icons\\text.ico" +29 ICON "icons\\text-template.ico" +30 ICON "icons\\spreadsheet.ico" +31 ICON "icons\\spreadsheet-template.ico" +32 ICON "icons\\drawing.ico" +33 ICON "icons\\drawing-template.ico" +34 ICON "icons\\presentation.ico" +35 ICON "icons\\presentation-template.ico" +36 ICON "icons\\master-document.ico" +37 ICON "icons\\empty-document.ico" +38 ICON "icons\\database.ico" +39 ICON "icons\\formula.ico" 40 ICON "icons\\oxt-extension.ico" diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index adf7aac708eb..d19603d54855 100644 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -48,42 +48,43 @@ // ----------------------------------------------------------------------- -ICON 2 "icons/ooo-writer-doc.ico" -ICON 3 "icons/ooo-writer-tem.ico" -ICON 4 "icons/ooo-calc-doc.ico" -ICON 5 "icons/ooo-calc-tem.ico" -ICON 6 "icons/ooo-draw-doc.ico" -ICON 7 "icons/ooo-draw-tem.ico" -ICON 8 "icons/ooo-impress-doc.ico" -ICON 9 "icons/ooo-impress-tem.ico" -ICON 10 "icons/ooo-impress-doc.ico" -//ICON 11 "icons/ooo-global-doc.ico" -//ICON 12 "icons/ooo-html-doc.ico" -ICON 13 "icons/ooo-chart-doc.ico" -ICON 14 "icons/ooo-base-doc.ico" -ICON 15 "icons/ooo-math-doc.ico" -ICON 16 "icons/ooo-empty-tem.ico" -ICON 17 "icons/ooo-macro-doc.ico" +ICON 2 "icons/oasis-text.ico" +ICON 3 "icons/oasis-text-template.ico" +ICON 4 "icons/oasis-spreadsheet.ico" +ICON 5 "icons/oasis-spreadsheet-template.ico" +ICON 6 "icons/oasis-drawing.ico" +ICON 7 "icons/oasis-drawing-template.ico" +ICON 8 "icons/oasis-presentation.ico" +ICON 9 "icons/oasis-presentation-template.ico" +ICON 10 "icons/oasis-presentation-template.ico" +// ICON 11 "icons/oasis-master-document.ico" +// ICON 12 "icons/oasis-web-template.ico" +ICON 13 "icons/oasis-empty-document.ico" +ICON 14 "icons/oasis-database.ico" +ICON 15 "icons/oasis-formula.ico" +ICON 16 "icons/empty-template.ico" +ICON 17 "icons/empty-document.ico" ICON 18 "icons/ooo-configuration.ico" ICON 19 "icons/ooo-open.ico" -ICON 20 "icons/ooo-image-doc.ico" +ICON 20 "icons/empty-document.ico" ICON 21 "icons/ooo-writer-app.ico" ICON 22 "icons/ooo-calc-app.ico" ICON 23 "icons/ooo-draw-app.ico" ICON 24 "icons/ooo-impress-app.ico" ICON 25 "icons/ooo-math-app.ico" ICON 26 "icons/ooo-base-app.ico" -ICON 27 "icons/ooo-empty-doc.ico" -ICON 28 "icons/ooo11-writer-doc.ico" -ICON 29 "icons/ooo11-writer-tem.ico" -ICON 30 "icons/ooo11-calc-doc.ico" -ICON 31 "icons/ooo11-calc-tem.ico" -ICON 32 "icons/ooo11-draw-doc.ico" -ICON 33 "icons/ooo11-draw-tem.ico" -ICON 34 "icons/ooo11-impress-doc.ico" -ICON 35 "icons/ooo11-impress-tem.ico" -ICON 36 "icons/ooo11-master-doc.ico" -ICON 37 "icons/ooo11-chart-doc.ico" -ICON 38 "icons/ooo11-base-doc.ico" -ICON 39 "icons/ooo11-math-doc.ico" +ICON 27 "icons/oasis-empty-document.ico" +ICON 28 "icons/text.ico" +ICON 29 "icons/text-template.ico" +ICON 30 "icons/spreadsheet.ico" +ICON 31 "icons/spreadsheet-template.ico" +ICON 32 "icons/drawing.ico" +ICON 33 "icons/drawing-template.ico" +ICON 34 "icons/presentation.ico" +ICON 35 "icons/presentation-template.ico" +ICON 36 "icons/master-document.ico" +ICON 37 "icons/empty-document.ico" +ICON 38 "icons/database.ico" +ICON 39 "icons/formula.ico" +ICON 40 "icons/oxt-extension.ico" -- cgit v1.2.3 From 10aa44cc9795d72e9ffc86029dcc6fab499aa4ed Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 16:33:00 +0000 Subject: #i108159# ODF-Icons for OOo build --- sysui/desktop/icons/oasis-empty-template.icns | Bin 0 -> 42146 bytes sysui/desktop/icons/oasis-empty-template.ico | Bin 0 -> 295606 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 sysui/desktop/icons/oasis-empty-template.icns create mode 100644 sysui/desktop/icons/oasis-empty-template.ico diff --git a/sysui/desktop/icons/oasis-empty-template.icns b/sysui/desktop/icons/oasis-empty-template.icns new file mode 100644 index 000000000000..ee6d299991d7 Binary files /dev/null and b/sysui/desktop/icons/oasis-empty-template.icns differ diff --git a/sysui/desktop/icons/oasis-empty-template.ico b/sysui/desktop/icons/oasis-empty-template.ico new file mode 100644 index 000000000000..63ac9f348fda Binary files /dev/null and b/sysui/desktop/icons/oasis-empty-template.ico differ -- cgit v1.2.3 From f2574e23ad0fad99ec7435aefa112a96ee1b8e8f Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 16:33:42 +0000 Subject: #i108159# ODF-Icons for OOo build --- sysui/desktop/icons/oasis-empty-document.icns | Bin 0 -> 40589 bytes sysui/desktop/icons/oasis-empty-document.ico | Bin 0 -> 295606 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 sysui/desktop/icons/oasis-empty-document.icns create mode 100644 sysui/desktop/icons/oasis-empty-document.ico diff --git a/sysui/desktop/icons/oasis-empty-document.icns b/sysui/desktop/icons/oasis-empty-document.icns new file mode 100644 index 000000000000..c52970324b27 Binary files /dev/null and b/sysui/desktop/icons/oasis-empty-document.icns differ diff --git a/sysui/desktop/icons/oasis-empty-document.ico b/sysui/desktop/icons/oasis-empty-document.ico new file mode 100644 index 000000000000..a12b54c2a2bf Binary files /dev/null and b/sysui/desktop/icons/oasis-empty-document.ico differ -- cgit v1.2.3 From 4f2b43e261d4632321770b75c3c89b484b123a8f Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 16:35:06 +0000 Subject: #i108159# ODF-Icons for OOo build --- sysui/desktop/icons/empty-document.icns | Bin 50465 -> 37502 bytes sysui/desktop/icons/empty-document.ico | Bin 0 -> 295606 bytes sysui/desktop/icons/empty-template.icns | Bin 47059 -> 39059 bytes sysui/desktop/icons/empty-template.ico | Bin 0 -> 295606 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 sysui/desktop/icons/empty-document.ico create mode 100644 sysui/desktop/icons/empty-template.ico diff --git a/sysui/desktop/icons/empty-document.icns b/sysui/desktop/icons/empty-document.icns index 18d1133eb66b..ab676f6ef8f1 100644 Binary files a/sysui/desktop/icons/empty-document.icns and b/sysui/desktop/icons/empty-document.icns differ diff --git a/sysui/desktop/icons/empty-document.ico b/sysui/desktop/icons/empty-document.ico new file mode 100644 index 000000000000..4115c3089682 Binary files /dev/null and b/sysui/desktop/icons/empty-document.ico differ diff --git a/sysui/desktop/icons/empty-template.icns b/sysui/desktop/icons/empty-template.icns index 034d30bccb32..50e63b94256d 100644 Binary files a/sysui/desktop/icons/empty-template.icns and b/sysui/desktop/icons/empty-template.icns differ diff --git a/sysui/desktop/icons/empty-template.ico b/sysui/desktop/icons/empty-template.ico new file mode 100644 index 000000000000..dec147610af4 Binary files /dev/null and b/sysui/desktop/icons/empty-template.ico differ -- cgit v1.2.3 From 8d867c72e6c982c65b267daceb43dc7f3e5ad351 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 14 Dec 2009 13:46:00 +0100 Subject: Support png instead of bmp file format for splash/about images --- desktop/source/splash/splash.cxx | 26 +++++++++++++++++++------- desktop/source/splash/splash.hxx | 4 ++-- sfx2/source/dialog/about.cxx | 17 +++++++++++++---- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 6e949c1bf00c..4dbecbd9dcc7 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include +#include #define NOT_LOADED ((long)-1) @@ -373,6 +376,9 @@ void SplashScreen::loadConfig() void SplashScreen::initBitmap() { + MessBox aMsgBox(0, WB_OK, String::CreateFromAscii("Oracle OpenOffice.org"), String::CreateFromAscii("Stop!")); + aMsgBox.Execute(); + if ( _bShowLogo ) { OUString sExecutePath; @@ -418,9 +424,15 @@ bool SplashScreen::loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + // Default case, we load the intro bitmap from a seperate file // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) - aStrm >> _aIntroBmp; + _aIntroBmp = aGraphic.GetBitmapEx(); return true; } @@ -439,7 +451,7 @@ bool SplashScreen::findBitmap(rtl::OUString const & path) { } if ( !haveBitmap ) haveBitmap = loadBitmap( - path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.png"))); return haveBitmap; } @@ -469,7 +481,7 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); + aStrBuf.appendAscii( ".png" ); OUString aBmpFileName = aStrBuf.makeStringAndClear(); bool haveBitmap = loadBitmap( path, aBmpFileName ); @@ -480,7 +492,7 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); + aStrBuf.appendAscii( ".png" ); aBmpFileName = aStrBuf.makeStringAndClear(); haveBitmap = loadBitmap( path, aBmpFileName ); @@ -498,7 +510,7 @@ bool SplashScreen::findAppBitmap(rtl::OUString const & path) aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( _sAppName ); - aStrBuf.appendAscii( ".bmp" ); + aStrBuf.appendAscii( ".png" ); OUString aBmpFileName = aStrBuf.makeStringAndClear(); haveBitmap = loadBitmap( path, aBmpFileName ); } @@ -586,7 +598,7 @@ void SplashScreen::Paint( const Rectangle&) // in case of native controls we need to draw directly to the window if( IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) { - DrawBitmap( Point(), _aIntroBmp ); + DrawBitmapEx( Point(), _aIntroBmp ); ImplControlValue aValue( _iProgress * _barwidth / _iMax); Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); @@ -612,7 +624,7 @@ void SplashScreen::Paint( const Rectangle&) //non native drawing // draw bitmap if (_bPaintBitmap) - _vdev.DrawBitmap( Point(), _aIntroBmp ); + _vdev.DrawBitmapEx( Point(), _aIntroBmp ); if (_bPaintProgress) { // draw progress... diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx index f56fff54b931..a01967d36c44 100644 --- a/desktop/source/splash/splash.hxx +++ b/desktop/source/splash/splash.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -86,7 +86,7 @@ private: Reference< XMultiServiceFactory > _rFactory; VirtualDevice _vdev; - Bitmap _aIntroBmp; + BitmapEx _aIntroBmp; Color _cProgressFrameColor; Color _cProgressBarColor; OUString _sAppName; diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index e76b38922166..ba3d04b42927 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -47,6 +47,8 @@ #include #include #include +#include +#include #include #include "about.hxx" @@ -92,8 +94,15 @@ static bool impl_loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { - Bitmap aBmp; - aStrm >> aBmp; + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + + // Default case, we load the intro bitmap from a seperate file + // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) + BitmapEx aBmp = aGraphic.GetBitmapEx(); rLogo = Image( aBmp ); return true; } @@ -151,14 +160,14 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); } if ( !bLoaded ) { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); } // Transparenter Font -- cgit v1.2.3 From 8fda468433d62653864fc7fe4f6a7e306cdcb28c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Mon, 4 Jan 2010 13:30:37 +0100 Subject: sw33bf02: #i105243# Output of graphic in Writer with corresponding PDF handling --- goodies/inc/grfmgr.hxx | 5 +++ goodies/source/graphic/grfmgr.cxx | 66 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/goodies/inc/grfmgr.hxx b/goodies/inc/grfmgr.hxx index b44c27ea65e3..aaecee454002 100644 --- a/goodies/inc/grfmgr.hxx +++ b/goodies/inc/grfmgr.hxx @@ -428,6 +428,11 @@ public: BOOL Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr = NULL, ULONG nFlags = GRFMGR_DRAW_STANDARD ); + BOOL DrawWithPDFHandling( OutputDevice& rOutDev, + const Point& rPt, const Size& rSz, + const GraphicAttr* pGrfAttr = NULL, + const ULONG nFlags = GRFMGR_DRAW_STANDARD ); + /** Draw the graphic repeatedly into the given output rectangle @param pOut diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx index 39c1e53e7184..5e8b80a6ce31 100644 --- a/goodies/source/graphic/grfmgr.cxx +++ b/goodies/source/graphic/grfmgr.cxx @@ -47,6 +47,10 @@ #include #include "grfmgr.hxx" +// --> OD 2010-01-04 #i105243# +#include +// <-- + // ----------- // - Defines - // ----------- @@ -741,6 +745,68 @@ BOOL GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, return bRet; } +// --> OD 2010-01-04 #i105243# +BOOL GraphicObject::DrawWithPDFHandling( OutputDevice& rOutDev, + const Point& rPt, const Size& rSz, + const GraphicAttr* pGrfAttr, + const ULONG nFlags ) +{ + const GraphicAttr aGrfAttr( pGrfAttr ? *pGrfAttr : GetAttr() ); + + // Notify PDF writer about linked graphic (if any) + bool bWritingPdfLinkedGraphic( false ); + Point aPt( rPt ); + Size aSz( rSz ); + Rectangle aCropRect; + vcl::PDFExtOutDevData* pPDFExtOutDevData = + dynamic_cast(rOutDev.GetExtOutDevData()); + if( pPDFExtOutDevData ) + { + // only delegate image handling to PDF, if no special treatment is necessary + if( GetGraphic().IsLink() && + rSz.Width() > 0L && + rSz.Height() > 0L && + !aGrfAttr.IsSpecialDrawMode() && + !aGrfAttr.IsMirrored() && + !aGrfAttr.IsRotated() && + !aGrfAttr.IsAdjusted() ) + { + bWritingPdfLinkedGraphic = true; + + if( aGrfAttr.IsCropped() ) + { + PolyPolygon aClipPolyPoly; + BOOL bRectClip; + const BOOL bCrop = ImplGetCropParams( &rOutDev, + aPt, aSz, + &aGrfAttr, + aClipPolyPoly, + bRectClip ); + if ( bCrop && bRectClip ) + { + aCropRect = aClipPolyPoly.GetBoundRect(); + } + } + + pPDFExtOutDevData->BeginGroup(); + } + } + + BOOL bRet = Draw( &rOutDev, rPt, rSz, &aGrfAttr, nFlags ); + + // Notify PDF writer about linked graphic (if any) + if( bWritingPdfLinkedGraphic ) + { + pPDFExtOutDevData->EndGroup( const_cast< Graphic& >(GetGraphic()), + aGrfAttr.GetTransparency(), + Rectangle( aPt, aSz ), + aCropRect ); + } + + return bRet; +} +// <-- + // ----------------------------------------------------------------------------- BOOL GraphicObject::DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, -- cgit v1.2.3 From 18ae13f478c25da4852799fd8d2595ed0a695494 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 6 Jan 2010 11:25:16 +0100 Subject: aw079: #i107360# Added functionality for edges, polygons and polypolygons --- basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx | 44 ++- basegfx/source/polygon/b2dtrapezoid.cxx | 502 ++++++++++++++++++++++----- 2 files changed, 458 insertions(+), 88 deletions(-) diff --git a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx index 20bc1c79d390..f484f3807759 100644 --- a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx +++ b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx @@ -43,7 +43,13 @@ namespace basegfx class B2DTrapezoid { private: - // geometry data + // Geometry data. YValues are down-oriented, this means bottom should + // be bigger than top to be below it. The constructor implementation + // guarantees: + // + // - mfBottomY >= mfTopY + // - mfTopXRight >= mfTopXLeft + // - mfBottomXRight >= mfBottomXLeft double mfTopXLeft; double mfTopXRight; double mfTopY; @@ -83,8 +89,40 @@ namespace basegfx { namespace tools { - // convert SourcePolyPolygon to trapezoids - B2DTrapezoidVector trapezoidSubdivide(const B2DPolyPolygon& rSourcePolyPolygon); + // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to + // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves, + // it's default AdaptiveSubdivision will be used. + // CAUTION: Trapezoids are oreintation-dependent in the sense that the upper and lower + // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable + // for primitive decompositions. To use it, the shear and rotate parts of the + // involved transformations HAVE to be taken into account. + void trapezoidSubdivide( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rSourcePolyPolygon); + + // directly create trapezoids from given edge. Depending on the given geometry, + // none up to three trapezoids will be created + void createLineTrapezoidFromEdge( + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, + double fLineWidth = 1.0); + + // create trapezoids for all edges of the given polygon. The closed state of + // the polygon is taken into account. If curves are contaned, the default + // AdaptiveSubdivision will be used. + void createLineTrapezoidFromB2DPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolygon& rPolygon, + double fLineWidth = 1.0); + + // create trapezoids for all edges of the given polyPolygon. The closed state of + // the PolyPolygon is taken into account. If curves are contaned, the default + // AdaptiveSubdivision will be used. + void createLineTrapezoidFromB2DPolyPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rPolyPolygon, + double fLineWidth = 1.0); } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index e935545e0b05..4cd63f938114 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -42,14 +42,20 @@ namespace basegfx namespace trapezoidhelper { ////////////////////////////////////////////////////////////////////////////// + // helper class to hold a simple ege. This is only used for horizontal edges + // currently, thus the YPositions will be equal. I did not create a special + // class for this since holdingthe pointers is more effective and also can be + // used as baseclass for the traversing edges class TrDeSimpleEdge { protected: + // pointers to start and end point const B2DPoint* mpStart; const B2DPoint* mpEnd; public: + // constructor TrDeSimpleEdge( const B2DPoint* pStart, const B2DPoint* pEnd) @@ -65,13 +71,19 @@ namespace basegfx ////////////////////////////////////////////////////////////////////////////// // define vector of simple edges + typedef ::std::vector< TrDeSimpleEdge > TrDeSimpleEdges; ////////////////////////////////////////////////////////////////////////////// + // helper class for holding a traversing edge. It will always have some + // distance in YPos. The slope (in a numerically useful form, see comments) is + // hold and used in SortValue to allow sorting traversing edges by Y, X and slope + // (in that order) class TrDeEdgeEntry : public TrDeSimpleEdge { private: + // the slope in a numerical useful form for sorting sal_uInt32 mnSortValue; public: @@ -79,7 +91,8 @@ namespace basegfx double getDeltaX() const { return mpEnd->getX() - mpStart->getX(); } double getDeltaY() const { return mpEnd->getY() - mpStart->getY(); } - // convenience data read access + // convenience data read access. SortValue is created on demand since + // it is not always used sal_uInt32 getSortValue() const { if(0 != mnSortValue) @@ -95,21 +108,29 @@ namespace basegfx return mnSortValue; } - // constructor + // constructor. SortValue can be given when known, use zero otherwise TrDeEdgeEntry( const B2DPoint* pStart, const B2DPoint* pEnd, - sal_uInt32 nSortValue) + sal_uInt32 nSortValue = 0) : TrDeSimpleEdge(pStart, pEnd), mnSortValue(nSortValue) { - // no horizontal edges allowed, all neeed to traverse vertivally + // force traversal of deltaY downward + if(mpEnd->getY() < mpStart->getY()) + { + std::swap(mpStart, mpEnd); + } + + // no horizontal edges allowed, all neeed to traverse vertically OSL_ENSURE(mpEnd->getY() > mpStart->getY(), "Illegal TrDeEdgeEntry constructed (!)"); } - // data write access + // data write access to StartPoint void setStart( const B2DPoint* pNewStart) { + OSL_ENSURE(0 != pNewStart, "No null pointer allowed here (!)"); + if(mpStart != pNewStart) { mpStart = pNewStart; @@ -119,8 +140,11 @@ namespace basegfx } } + // data write access to EndPoint void setEnd( const B2DPoint* pNewEnd) { + OSL_ENSURE(0 != pNewEnd, "No null pointer allowed here (!)"); + if(mpEnd != pNewEnd) { mpEnd = pNewEnd; @@ -130,7 +154,7 @@ namespace basegfx } } - // operator for sort support + // operator for sort support. Sort by Y, X and slope (in that order) bool operator<(const TrDeEdgeEntry& rComp) const { if(fTools::equal(getStart().getY(), rComp.getStart().getY(), fTools::getSmallValue())) @@ -138,9 +162,11 @@ namespace basegfx if(fTools::equal(getStart().getX(), rComp.getStart().getX(), fTools::getSmallValue())) { // when start points are equal, use the direction the edge is pointing - // to. That value is derived from atan2 in the range ]0.0 .. pi[ and scaled - // to sal_uint32 range for best precision. 0 means no angle, while SAL_MAX_UINT32 - // means pi. Thus, the higher the value, the more left the edge resides. + // to. That value is created on demand and derived from atan2 in the + // range ]0.0 .. pi[ (without extremas, we always have a deltaY in this + // class) and scaled to sal_uInt32 range for best precision. 0 means no angle, + // while SAL_MAX_UINT32 means pi. Thus, the higher the value, the more left + // the edge traverses. return (getSortValue() > rComp.getSortValue()); } else @@ -154,10 +180,21 @@ namespace basegfx } } + // method for cut support + B2DPoint getCutPointForGivenY(double fGivenY) + { + // Calculate cut point locally (do not use interpolate) since it is numerically + // necessary to guarantee the new, equal Y-coordinate + const double fFactor((fGivenY - getStart().getY()) / getDeltaY()); + const double fDeltaXNew(fFactor * getDeltaX()); + + return B2DPoint(getStart().getX() + fDeltaXNew, fGivenY); + } }; ////////////////////////////////////////////////////////////////////////////// // define double linked list of edges (for fast random insert) + typedef ::std::list< TrDeEdgeEntry > TrDeEdgeEntries; } // end of anonymous namespace @@ -169,10 +206,12 @@ namespace basegfx { namespace trapezoidhelper { + // helper class to handle the complete trapezoid subdivision of a PolyPolygon class TrapezoidSubdivider { private: - sal_uInt32 mnEdgeEntryCount; + // local data + sal_uInt32 mnInitialEdgeEntryCount; TrDeEdgeEntries maTrDeEdgeEntries; ::std::vector< B2DPoint > maPoints; ::std::vector< B2DPoint* > maNewPoints; @@ -189,7 +228,6 @@ namespace basegfx // Insert before first which is smaller or equal or at end maTrDeEdgeEntries.insert(aCurrent, rNewEdge); - mnEdgeEntryCount++; } bool splitEdgeAtGivenPoint( @@ -197,11 +235,13 @@ namespace basegfx const B2DPoint& rCutPoint, TrDeEdgeEntries::iterator aCurrent) { + // do not create edges without deltaY: do not split when start is identical if(aEdge.getStart().equal(rCutPoint, fTools::getSmallValue())) { return false; } + // do not create edges without deltaY: do not split when end is identical if(aEdge.getEnd().equal(rCutPoint, fTools::getSmallValue())) { return false; @@ -222,6 +262,7 @@ namespace basegfx if(fTools::lessOrEqual(fNewDeltaYStart, 0.0)) { // do not split: the resulting edge would be horizontal + // correct it to new end point aEdge.setEnd(&rCutPoint); return false; } @@ -278,7 +319,7 @@ namespace basegfx return false; } - // now check if one point is on the other edge + // check if one point is on the other edge (a touch, not a cut) const B2DVector aDeltaB(aEdgeB.getDeltaX(), aEdgeB.getDeltaY()); if(tools::isPointOnEdge(aEdgeA.getStart(), aEdgeB.getStart(), aDeltaB)) @@ -303,7 +344,8 @@ namespace basegfx return splitEdgeAtGivenPoint(aEdgeA, aEdgeB.getEnd(), aCurrent); } - // check for cut inside edges + // check for cut inside edges. Use both t-values to choose the more precise + // one later double fCutA(0.0); double fCutB(0.0); @@ -314,6 +356,8 @@ namespace basegfx &fCutA, &fCutB)) { + // use a simple metric (length criteria) for choosing the numerically + // better cut const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY()); const double fSimpleLengthB(aDeltaB.getX() + aDeltaB.getY()); const bool bAIsLonger(fSimpleLengthA > fSimpleLengthB); @@ -322,6 +366,7 @@ namespace basegfx : new B2DPoint(aEdgeB.getStart() + (fCutB * aDeltaB)); bool bRetval(false); + // try to split both edges bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent); bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent); @@ -340,24 +385,13 @@ namespace basegfx return false; } - B2DPoint getCutPointForGivenY( - const TrDeEdgeEntry& rEdge, - double fGivenY) - { - // Calculate cut point locally (do not use interpolate) since it is numerically - // necessary to guarantee the new, equal Y-coordinate - const double fFactor((fGivenY - rEdge.getStart().getY()) / rEdge.getDeltaY()); - const double fDeltaXNew(fFactor * rEdge.getDeltaX()); - - return B2DPoint(rEdge.getStart().getX() + fDeltaXNew, fGivenY); - } - void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges) { if(rTrDeSimpleEdges.size() && maTrDeEdgeEntries.size()) { // there were horizontal edges. These can be excluded, but - // cuts with other edges need to be solved and added + // cuts with other edges need to be solved and added before + // ignoring them sal_uInt32 a(0); for(a = 0; a < rTrDeSimpleEdges.size(); a++) @@ -367,7 +401,7 @@ namespace basegfx const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX()); const double fFixedY(rHorEdge.getStart().getY()); - // loop over edges + // loop over traversing edges TrDeEdgeEntries::iterator aCurrent(maTrDeEdgeEntries.begin()); do @@ -375,15 +409,15 @@ namespace basegfx // get compare edge TrDeEdgeEntries::reference aCompare(*aCurrent++); - if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY)) + if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY)) { - // edge starts below horizontal edge, continue + // edge ends above horizontal edge, continue continue; } - if(fTools::lessOrEqual(aCompare.getEnd().getY(), fFixedY)) + if(fTools::moreOrEqual(aCompare.getStart().getY(), fFixedY)) { - // edge ends above horizontal edge, continue + // edge starts below horizontal edge, continue continue; } @@ -393,7 +427,7 @@ namespace basegfx if(aRange.overlaps(aCompareRange)) { // possible cut, get cut point - const B2DPoint aSplit(getCutPointForGivenY(aCompare, fFixedY)); + const B2DPoint aSplit(aCompare.getCutPointForGivenY(fFixedY)); if(fTools::more(aSplit.getX(), aRange.getMinimum()) && fTools::less(aSplit.getX(), aRange.getMaximum())) @@ -421,19 +455,27 @@ namespace basegfx public: TrapezoidSubdivider( const B2DPolyPolygon& rSourcePolyPolygon) - : mnEdgeEntryCount(0), + : mnInitialEdgeEntryCount(0), maTrDeEdgeEntries(), maPoints(), maNewPoints() { + B2DPolyPolygon aSource(rSourcePolyPolygon); const sal_uInt32 nPolygonCount(rSourcePolyPolygon.count()); TrDeSimpleEdges aTrDeSimpleEdges; sal_uInt32 a(0), b(0); sal_uInt32 nAllPointCount(0); + // ensure there are no curves used + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + for(a = 0; a < nPolygonCount; a++) { - const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + // 1st run: count points + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) @@ -444,12 +486,14 @@ namespace basegfx if(nAllPointCount) { + // reserve needed points. CAUTION: maPoints size is NOT to be changed anymore + // after 2nd loop since pointers to it are used in the edges maPoints.reserve(nAllPointCount); - sal_uInt32 nStartIndex(0); for(a = 0; a < nPolygonCount; a++) { - const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + // 2nd run: add points + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) @@ -461,20 +505,25 @@ namespace basegfx } } - // moved the edge construction to a 3rd loop; doing it in the 2nd loop is - // possible, but requires q working vector::reserve() implementation, else - // the vector will be reallocated and the pointers will be wrong + // Moved the edge construction to a 3rd run: doing it in the 2nd run is + // possible(and i used it), but requires a working vector::reserve() + // implementation, else the vector will be reallocated and the pointers + // in the edges may be wrong. Security first here. + sal_uInt32 nStartIndex(0); + for(a = 0; a < nPolygonCount; a++) { - const B2DPolygon aPolygonCandidate(rSourcePolyPolygon.getB2DPolygon(a)); + const B2DPolygon aPolygonCandidate(aSource.getB2DPolygon(a)); const sal_uInt32 nCount(aPolygonCandidate.count()); if(nCount > 2) { - B2DPoint* pPrev(&maPoints[maPoints.size() - 1]); + // get the last point of the current polygon + B2DPoint* pPrev(&maPoints[nCount + nStartIndex - 1]); for(b = 0; b < nCount; b++) { + // get next point B2DPoint* pCurr(&maPoints[nStartIndex++]); if(fTools::equal(pPrev->getY(), pCurr->getY(), fTools::getSmallValue())) @@ -492,19 +541,13 @@ namespace basegfx } else { - // vertical edge, add with positive Y-direction - if(pPrev->getY() < pCurr->getY()) - { - maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0)); - } - else - { - maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pCurr, pPrev, 0)); - } - - mnEdgeEntryCount++; + // vertical edge. Positive Y-direction is guaranteed by the + // TrDeEdgeEntry constructor + maTrDeEdgeEntries.push_back(TrDeEdgeEntry(pPrev, pCurr, 0)); + mnInitialEdgeEntryCount++; } + // prepare next step pPrev = pCurr; } } @@ -513,14 +556,17 @@ namespace basegfx if(maTrDeEdgeEntries.size()) { + // single and initial sort of traversing edges maTrDeEdgeEntries.sort(); + // solve horizontal edges if there are any detected solveHorizontalEdges(aTrDeSimpleEdges); } } ~TrapezoidSubdivider() { + // delete the extra points created for cuts const sal_uInt32 nCount(maNewPoints.size()); for(sal_uInt32 a(0); a < nCount; a++) @@ -529,20 +575,41 @@ namespace basegfx } } - B2DTrapezoidVector Subdivide() + void Subdivide(B2DTrapezoidVector& ro_Result) { - B2DTrapezoidVector aRetval; + // This is the central subdivider. The strategy is to use the first two entries + // from the traversing edges as a potential trapezoid and do the needed corrections + // and adaptions on the way. + // + // There always must be two edges with the same YStart value: When adding the polygons + // in the constructor, there is always a topmost point from which two edges start; when + // the topmost is an edge, there is a start and end of this edge from which two edges + // start. All cases have two edges with same StartY (QED). + // + // Based on this these edges get corrected when: + // - one is longer than the other + // - they intersect + // - they intersect with other edges + // - another edge starts inside the thought trapezoid + // + // All this cases again produce a valid state so that the first two edges have a common + // Ystart again. Some cases lead to a restart of the process, some allow consuming the + // edges and create the intended trapezoid. + // + // Be careful when doing chages here: It is essential to keep all possible paths + // in valid states and to be numerically correct. This is especially needed e.g. + // by using fTools::equal(..) in the more robust small-value incarnation. B1DRange aLeftRange; B1DRange aRightRange; if(!maTrDeEdgeEntries.empty()) { // measuring shows that the relation between edges and created trapezoids is - // mostly in the 1.0 range, thus reserve as much trapezoids as edges exist. Do + // mostly in the 1:1 range, thus reserve as much trapezoids as edges exist. Do // not use maTrDeEdgeEntries.size() since that may be a non-constant time - // operation for Lists. Instead, use mnEdgeEntryCount which will contain the - // roughly counted adds to the List - aRetval.reserve(mnEdgeEntryCount); + // operation for Lists. Instead, use mnInitialEdgeEntryCount which will contain + // the roughly counted adds to the List + ro_Result.reserve(ro_Result.size() + mnInitialEdgeEntryCount); } while(!maTrDeEdgeEntries.empty()) @@ -554,7 +621,10 @@ namespace basegfx if(aCurrent == maTrDeEdgeEntries.end()) { // Should not happen: No 2nd edge; consume the single edge - // and start next loop + // to not have an endless loop and start next. During development + // i constantly had breakpoints here, so i am sure enough to add an + // assertion here + OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)"); maTrDeEdgeEntries.pop_front(); continue; } @@ -565,7 +635,10 @@ namespace basegfx if(!fTools::equal(aLeft.getStart().getY(), aRight.getStart().getY(), fTools::getSmallValue())) { // Should not happen: We have a 2nd edge, but YStart is on another - // line; consume the single edge and start next loop + // line; consume the single edge to not have an endless loop and start + // next. During development i constantly had breakpoints here, so i am + // sure enough to add an assertion here + OSL_ENSURE(false, "Trapeziod decomposer in illegal state (!)"); maTrDeEdgeEntries.pop_front(); continue; } @@ -573,13 +646,14 @@ namespace basegfx // aLeft and aRight build a thought trapezoid now. They have a common // start line (same Y for start points). Potentially, one of the edges // is longer than the other. It is only needed to look at the shorter - // length which build the potential traezoid. To do so, get the end points - // locally and adapt the evtl. longer one + // length which build the potential trapezoid. To do so, get the end points + // locally and adapt the evtl. longer one. Use only aLeftEnd and aRightEnd + // from here on, not the aLeft.getEnd() or aRight.getEnd() accesses. B2DPoint aLeftEnd(aLeft.getEnd()); B2DPoint aRightEnd(aRight.getEnd()); // check if end points are on the same line. If yes, no adaption - // needs to be prepared + // needs to be prepared. Also remember which one actually is longer. const bool bEndOnSameLine(fTools::equal(aLeftEnd.getY(), aRightEnd.getY(), fTools::getSmallValue())); bool bLeftIsLonger(false); @@ -590,11 +664,11 @@ namespace basegfx if(bLeftIsLonger) { - aLeftEnd = getCutPointForGivenY(aLeft, aRightEnd.getY()); + aLeftEnd = aLeft.getCutPointForGivenY(aRightEnd.getY()); } else { - aRightEnd = getCutPointForGivenY(aRight, aLeftEnd.getY()); + aRightEnd = aRight.getCutPointForGivenY(aLeftEnd.getY()); } } @@ -602,7 +676,7 @@ namespace basegfx const bool bSameStartPoint(aLeft.getStart().equal(aRight.getStart(), fTools::getSmallValue())); const bool bSameEndPoint(aLeftEnd.equal(aRightEnd, fTools::getSmallValue())); - // check the simple case that the edges form a 'blind' edge + // check the simple case that the edges form a 'blind' edge (deadend) if(bSameStartPoint && bSameEndPoint) { // correct the longer edge if prepared @@ -657,7 +731,7 @@ namespace basegfx // use fast range test first if(aLeftRange.overlaps(aRightRange)) { - // real cut test and correction. If corrected, + // real cut test and correction. If correction was needed, // start new run if(testAndCorrectEdgeIntersection(aLeft, aRight, aCurrent)) { @@ -676,7 +750,6 @@ namespace basegfx { aLeftRange = B1DRange(aLeft.getStart().getX(), aLeftEnd.getX()); aRightRange = B1DRange(aRight.getStart().getX(), aRightEnd.getX()); - bRangesSet = true; } // build full XRange for fast check @@ -684,7 +757,7 @@ namespace basegfx aAllRange.expand(aRightRange); // prepare loop iterator; aCurrent needs to stay unchanged for - // eventual insertions of new EdgeNodes. Also prepare stop flag + // eventual sorted insertions of new EdgeNodes. Also prepare stop flag TrDeEdgeEntries::iterator aLoop(aCurrent); bool bDone(false); @@ -695,7 +768,7 @@ namespace basegfx // avoid edges using the same start point as one of // the edges. These can neither have their start point - // in the thought edge nor cut with one of the edges + // in the thought trapezoid nor cut with one of the edges if(aCompare.getStart().equal(aRight.getStart(), fTools::getSmallValue())) { continue; @@ -704,15 +777,15 @@ namespace basegfx // get compare XRange const B1DRange aCompareRange(aCompare.getStart().getX(), aCompare.getEnd().getX()); - // use fast range test + // use fast range test first if(aAllRange.overlaps(aCompareRange)) { // check for start point inside thought trapezoid if(fTools::more(aCompare.getStart().getY(), aLeft.getStart().getY())) { // calculate the two possible split points at compare's Y - const B2DPoint aSplitLeft(getCutPointForGivenY(aLeft, aCompare.getStart().getY())); - const B2DPoint aSplitRight(getCutPointForGivenY(aRight, aCompare.getStart().getY())); + const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aCompare.getStart().getY())); + const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aCompare.getStart().getY())); // check for start point of aCompare being inside thought // trapezoid @@ -806,7 +879,7 @@ namespace basegfx // the two edges start at the same Y, they use the same DeltaY, they // do not cut themselves and not any other edge in range. Create a // B2DTrapezoid and consume both edges - aRetval.push_back( + ro_Result.push_back( B2DTrapezoid( aLeft.getStart().getX(), aRight.getStart().getX(), @@ -818,8 +891,6 @@ namespace basegfx maTrDeEdgeEntries.pop_front(); maTrDeEdgeEntries.pop_front(); } - - return aRetval; } }; } // end of anonymous namespace @@ -836,23 +907,32 @@ namespace basegfx const double& rfBottomXLeft, const double& rfBottomXRight, const double& rfBottomY) - : - mfTopXLeft(rfTopXLeft), + : mfTopXLeft(rfTopXLeft), mfTopXRight(rfTopXRight), mfTopY(rfTopY), mfBottomXLeft(rfBottomXLeft), mfBottomXRight(rfBottomXRight), mfBottomY(rfBottomY) { - if(rfTopXLeft > rfTopXRight) + // guarantee mfTopXRight >= mfTopXLeft + if(mfTopXLeft > mfTopXRight) { std::swap(mfTopXLeft, mfTopXRight); } - if(rfBottomXLeft > rfBottomXRight) + // guarantee mfBottomXRight >= mfBottomXLeft + if(mfBottomXLeft > mfBottomXRight) { std::swap(mfBottomXLeft, mfBottomXRight); } + + // guarantee mfBottomY >= mfTopY + if(mfTopY > mfBottomY) + { + std::swap(mfTopY, mfBottomY); + std::swap(mfTopXLeft, mfBottomXLeft); + std::swap(mfTopXRight, mfBottomXRight); + } } B2DPolygon B2DTrapezoid::getB2DPolygon() const @@ -875,19 +955,271 @@ namespace basegfx { namespace tools { - // convert SourcePolyPolygon to trapezoids - B2DTrapezoidVector trapezoidSubdivide(const B2DPolyPolygon& rSourcePolyPolygon) + // convert Source PolyPolygon to trapezoids + void trapezoidSubdivide(B2DTrapezoidVector& ro_Result, const B2DPolyPolygon& rSourcePolyPolygon) + { + trapezoidhelper::TrapezoidSubdivider aTrapezoidSubdivider(rSourcePolyPolygon); + + aTrapezoidSubdivider.Subdivide(ro_Result); + } + + void createLineTrapezoidFromEdge( + B2DTrapezoidVector& ro_Result, + const B2DPoint& rPointA, + const B2DPoint& rPointB, + double fLineWidth) + { + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + // no line witdh + return; + } + + if(rPointA.equal(rPointB, fTools::getSmallValue())) + { + // points are equal, no edge + return; + } + + const double fHalfLineWidth(0.5 * fLineWidth); + + if(fTools::equal(rPointA.getX(), rPointB.getX(), fTools::getSmallValue())) + { + // vertical line + const double fLeftX(rPointA.getX() - fHalfLineWidth); + const double fRightX(rPointA.getX() + fHalfLineWidth); + + ro_Result.push_back( + B2DTrapezoid( + fLeftX, + fRightX, + std::min(rPointA.getY(), rPointB.getY()), + fLeftX, + fRightX, + std::max(rPointA.getY(), rPointB.getY()))); + } + else if(fTools::equal(rPointA.getY(), rPointB.getY(), fTools::getSmallValue())) + { + // horizontal line + const double fLeftX(std::min(rPointA.getX(), rPointB.getX())); + const double fRightX(std::max(rPointA.getX(), rPointB.getX())); + + ro_Result.push_back( + B2DTrapezoid( + fLeftX, + fRightX, + rPointA.getY() - fHalfLineWidth, + fLeftX, + fRightX, + rPointA.getY() + fHalfLineWidth)); + } + else + { + // diagonal line + // create perpendicular vector + const B2DVector aDelta(rPointB - rPointA); + B2DVector aPerpendicular(-aDelta.getY(), aDelta.getX()); + aPerpendicular.setLength(fHalfLineWidth); + + // create StartLow, StartHigh, EndLow and EndHigh + const B2DPoint aStartLow(rPointA + aPerpendicular); + const B2DPoint aStartHigh(rPointA - aPerpendicular); + const B2DPoint aEndHigh(rPointB - aPerpendicular); + const B2DPoint aEndLow(rPointB + aPerpendicular); + + // create EdgeEntries + basegfx::trapezoidhelper::TrDeEdgeEntries aTrDeEdgeEntries; + + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartLow, &aStartHigh, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aStartHigh, &aEndHigh, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndHigh, &aEndLow, 0)); + aTrDeEdgeEntries.push_back(basegfx::trapezoidhelper::TrDeEdgeEntry(&aEndLow, &aStartLow, 0)); + aTrDeEdgeEntries.sort(); + + // here we know we have exactly four edges, and they do not cut, touch or + // intersect. This makes processing much easier. Get the first two as start + // edges for the thought trapezoid + basegfx::trapezoidhelper::TrDeEdgeEntries::iterator aCurrent(aTrDeEdgeEntries.begin()); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight(*aCurrent++); + const bool bEndOnSameLine(fTools::equal(aLeft.getEnd().getY(), aRight.getEnd().getY(), fTools::getSmallValue())); + + if(bEndOnSameLine) + { + // create two triangle trapezoids + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeft.getEnd().getX(), + aRight.getEnd().getX(), + aLeft.getEnd().getY())); + + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + + ro_Result.push_back( + B2DTrapezoid( + aLeft2.getStart().getX(), + aRight2.getStart().getX(), + aLeft2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + else + { + // create three trapezoids. Check which edge is longer and + // correct accordingly + const bool bLeftIsLonger(fTools::more(aLeft.getEnd().getY(), aRight.getEnd().getY())); + + if(bLeftIsLonger) + { + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + const B2DPoint aSplitLeft(aLeft.getCutPointForGivenY(aRight.getEnd().getY())); + const B2DPoint aSplitRight(aRight2.getCutPointForGivenY(aLeft.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight.getEnd().getY(), + aLeft2.getStart().getX(), + aSplitRight.getX(), + aLeft2.getStart().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft2.getStart().getX(), + aSplitRight.getX(), + aLeft2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + else + { + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aLeft2(*aCurrent++); + basegfx::trapezoidhelper::TrDeEdgeEntries::reference aRight2(*aCurrent++); + const B2DPoint aSplitRight(aRight.getCutPointForGivenY(aLeft.getEnd().getY())); + const B2DPoint aSplitLeft(aLeft2.getCutPointForGivenY(aRight.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getStart().getX(), + aRight.getStart().getX(), + aLeft.getStart().getY(), + aLeft.getEnd().getX(), + aSplitRight.getX(), + aLeft.getEnd().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aLeft.getEnd().getX(), + aSplitRight.getX(), + aLeft.getEnd().getY(), + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight2.getStart().getY())); + + ro_Result.push_back( + B2DTrapezoid( + aSplitLeft.getX(), + aRight.getEnd().getX(), + aRight2.getStart().getY(), + aLeft2.getEnd().getX(), + aRight2.getEnd().getX(), + aLeft2.getEnd().getY())); + } + } + } + } + + void createLineTrapezoidFromB2DPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolygon& rPolygon, + double fLineWidth) { - B2DPolyPolygon aSource(rSourcePolyPolygon); + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + return; + } + + // ensure there are no curves used + B2DPolygon aSource(rPolygon); if(aSource.areControlPointsUsed()) { aSource = aSource.getDefaultAdaptiveSubdivision(); } - trapezoidhelper::TrapezoidSubdivider aTrapezoidSubdivider(aSource); - return aTrapezoidSubdivider.Subdivide(); + const sal_uInt32 nPointCount(aSource.count()); + + if(!nPointCount) + { + return; + } + + const sal_uInt32 nEdgeCount(aSource.isClosed() ? nPointCount : nPointCount - 1); + B2DPoint aCurrent(aSource.getB2DPoint(0)); + + ro_Result.reserve(ro_Result.size() + (3 * nEdgeCount)); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + const B2DPoint aNext(aSource.getB2DPoint(nNextIndex)); + + createLineTrapezoidFromEdge(ro_Result, aCurrent, aNext, fLineWidth); + aCurrent = aNext; + } + } + + void createLineTrapezoidFromB2DPolyPolygon( + B2DTrapezoidVector& ro_Result, + const B2DPolyPolygon& rPolyPolygon, + double fLineWidth) + { + if(fTools::lessOrEqual(fLineWidth, 0.0)) + { + return; + } + + // ensure there are no curves used + B2DPolyPolygon aSource(rPolyPolygon); + + if(aSource.areControlPointsUsed()) + { + aSource = aSource.getDefaultAdaptiveSubdivision(); + } + + const sal_uInt32 nCount(aSource.count()); + + if(!nCount) + { + return; + } + + for(sal_uInt32 a(0); a < nCount; a++) + { + createLineTrapezoidFromB2DPolygon( + ro_Result, + aSource.getB2DPolygon(a), + fLineWidth); + } } + } // end of namespace tools } // end of namespace basegfx -- cgit v1.2.3 From b9370facc5215892acffb0ad581e196f70c8e2e8 Mon Sep 17 00:00:00 2001 From: hdu Date: Wed, 6 Jan 2010 15:15:15 +0100 Subject: vcl109: remove unused debug code --- vcl/source/fontsubset/cff.cxx | 128 ------------------------------------------ 1 file changed, 128 deletions(-) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index dd198ff521db..ccc141fd7e60 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -391,11 +391,9 @@ public: // used by charstring converter void setCharStringType( int); void fakeLocalSubrCount( int nLocalSubrs ) { maCffLocal[0].mnLocalSubrCount=nLocalSubrs;} - void readCharString( const U8* pTypeOps, int nTypeLen); protected: int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, U8* pType1Ops); private: - void readTypeOp( CffSubsetterContext&); void convertOneTypeOp( void); void convertOneTypeEsc( void); void callType2Subr( bool bGlobal, int nSubrNumber); @@ -431,7 +429,6 @@ private: int getGlyphSID( int nGlyphIndex) const; const char* getGlyphName( int nGlyphIndex); - void readTypeOp( void); void read2push( void); void pop2write( void); void writeType1Val( ValType); @@ -611,25 +608,6 @@ void CffSubsetterContext::setCharStringType( int nVal) // -------------------------------------------------------------------- -void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen) -{ - mnStackIdx = 0; - mnHintSize = 0; - mnHorzHintSize = 0; - maCharWidth = -1; - - assert( nTypeLen >= 0); -// assert( nEnd <= getLength()); - mpReadPtr = pTypeOps; - mpReadEnd = mpReadPtr + nTypeLen; - // reset the execution context - while( mpReadPtr < mpReadEnd) - readTypeOp(); -//### assert( tellRel() == nEnd); -} - -// -------------------------------------------------------------------- - void CffSubsetterContext::readDictOp( void) { ValType nVal = 0; @@ -765,112 +743,6 @@ void CffSubsetterContext::readDictOp( void) // -------------------------------------------------------------------- -void CffSubsetterContext::readTypeOp( void) -{ - int nVal = 0; - const U8 c = *mpReadPtr; - if( (c <= 31) && (c != 28) ) { - const int nOpId = *(mpReadPtr++); - const char* pCmdName; - if( nOpId != 12) - pCmdName = mpCharStringOps[ nOpId]; - else { - const int nExtId = *(mpReadPtr++); - pCmdName = mpCharStringEscs[ nExtId]; - } - - if( !pCmdName ) - pCmdName = ".NULL"; - // handle typeop parameters - int nMinStack = -1, nMaxStack = -1; - switch( *pCmdName) { - default: fprintf( stderr, "unsupported TypeOp.type=\'%c\'\n", *pCmdName); break; - case '.': nMinStack = 0; nMaxStack = 999; break; - case '0': nMinStack = nMaxStack = 0; break; - case '1': nMinStack = nMaxStack = 1; break; - case '2': nMinStack = nMaxStack = 2; break; - case '4': nMinStack = nMaxStack = 4; break; - case '5': nMinStack = nMaxStack = 5; break; // not used for Type2 ops - case '6': nMinStack = nMaxStack = 6; break; - case '7': nMinStack = nMaxStack = 7; break; - case '9': nMinStack = nMaxStack = 9; break; - case 'f': nMinStack = nMaxStack = 11; break; - case 'F': nMinStack = nMaxStack = 13; break; - case 'A': nMinStack = 2; nMaxStack = 999; break; - case 'C': nMinStack = 6; nMaxStack = 999; break; - case 'E': nMinStack = 1; nMaxStack = 999; break; - case 'G': nMinStack = 1; nMaxStack = 999; // global subr - nVal = peekInt(); - // TODO global subr - break; - case 'L': // local subr - nMinStack = 1; nMaxStack = 999; - nVal = peekInt(); - // TODO local subr - break; - case 'I': // operands for "index" -#if 0 - nMinStack = nValStack[ nStackIdx-1]; - if( nMinStack < 0) nMinStack = 0; - nMinStack += 1; -#else - fprintf( stderr, "TODO: Iindex op\n"); -#endif - break; - case 'R': // operands for "rol" -#if 0 - nMinStack = nValStack[ nStackIdx-2]; -#else - fprintf( stderr, "TODO: Rrol op\n"); -#endif - case 'X': // operands for "return" - nMinStack = 0; - nMaxStack = /*### (!bInSubrs)? 0 :###*/999; - break; - case 'H': // "hstemhm" - case 'h': // "hstem" - addHints( false); - nMinStack = nMaxStack = 0; - break; - case 'V': // "vstemhm" - case 'v': // "vstem" - addHints( true); - nMinStack = nMaxStack = 0; - break; - case 'K': // "hintmask" or "cntrmask" - addHints( true); // implicit vstemhm - nMinStack = nMaxStack = 0; - break; - case 'e': // endchar - updateWidth( (size() >= 1) && (size() != 4)); - nMinStack = nMaxStack = 0; - if( size() == 4) - fprintf( stderr,"Deprecated SEAC-like endchar is not supported for CFF subsetting!\n"); // TODO: handle deprecated op - break; - case 'm': // hmoveto or vmoveto - updateWidth( size() > 1); - nMinStack = 1; - nMaxStack = nMinStack; - break; - case 'M': // rmoveto - updateWidth( size() > 2); - nMinStack = 2; - nMaxStack = nMinStack; - break; - } - - clear(); - return; - } - - if( (c >= 32) || (c == 28)) { -// --mpReadPtr; - read2push(); - } -} - -// -------------------------------------------------------------------- - void CffSubsetterContext::read2push() { ValType aVal = 0; -- cgit v1.2.3 From 51d977e00c8481d89cb682a05536e88cdf2fffa4 Mon Sep 17 00:00:00 2001 From: hdu Date: Fri, 8 Jan 2010 13:33:22 +0100 Subject: #i107915# fix vertical writing for non-BMP CJK chars --- vcl/source/gdi/sallayout.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 1f44b823ce44..d937d15ce7df 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sallayout.cxx,v $ - * $Revision: 1.94.90.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -135,13 +132,13 @@ int GetVerticalFlags( sal_UCS4 nChar ) /* #i52932# remember: nChar == 0x2010 || nChar == 0x2015 nChar == 0x2016 || nChar == 0x2026 - are GF_NONE also, but already handled in the first if */ if((nChar >= 0x3008 && nChar <= 0x301C && nChar != 0x3012) - || nChar == 0xFF3B || nChar == 0xFF3D + || (nChar == 0xFF3B || nChar == 0xFF3D) || (nChar >= 0xFF5B && nChar <= 0xFF9F) // halfwidth forms - || nChar == 0xFFE3 ) + || (nChar == 0xFFE3) + || (nChar >= 0x02F800 && nChar <= 0x02FFFF) ) return GF_NONE; // not rotated else if( nChar == 0x30fc ) return GF_ROTR; // right -- cgit v1.2.3 From 381b25700787c4530dc28f548a38d224c074bd12 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 8 Jan 2010 17:29:30 +0100 Subject: vcl109: #i33688# NWF slider implementation (mac) --- vcl/aqua/source/gdi/salnativewidgets.cxx | 91 +++++++++++++++++++++++++------- vcl/inc/vcl/salnativewidgets.hxx | 16 ++++++ vcl/source/control/slider.cxx | 71 +++++++++++++++++++++---- vcl/source/gdi/salgdilayout.cxx | 6 +++ vcl/source/window/window3.cxx | 6 +++ 5 files changed, 163 insertions(+), 27 deletions(-) diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 754358823a93..82eaa93fdca6 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -270,6 +270,11 @@ BOOL AquaSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart n return true; break; + case CTRL_SLIDER: + if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) + return true; + break; + case CTRL_EDITBOX: if( nPart == PART_ENTIRE_CONTROL || nPart == HAS_BACKGROUND_TEXTURE ) @@ -776,6 +781,36 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, } break; + case CTRL_SLIDER: + { + SliderValue* pSLVal = (SliderValue*)aValue.getOptionalVal(); + + HIThemeTrackDrawInfo aTrackDraw; + aTrackDraw.kind = kThemeSliderMedium; + if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) + { + aTrackDraw.bounds = rc; + aTrackDraw.min = pSLVal->mnMin; + aTrackDraw.max = pSLVal->mnMax;; + aTrackDraw.value = pSLVal->mnCur; + aTrackDraw.reserved = 0; + aTrackDraw.attributes = kThemeTrackShowThumb; + if( nPart == PART_TRACK_HORZ_AREA ) + aTrackDraw.attributes |= kThemeTrackHorizontal; + aTrackDraw.enableState = (nState & CTRL_STATE_ENABLED) + ? kThemeTrackActive : kThemeTrackInactive; + + SliderTrackInfo aSlideInfo; + aSlideInfo.thumbDir = kThemeThumbUpward; + aSlideInfo.pressState = 0; + aTrackDraw.trackInfo.slider = aSlideInfo; + + HIThemeDrawTrack( &aTrackDraw, NULL, mrContext, kHIThemeOrientationNormal ); + bOK = true; + } + } + break; + case CTRL_SCROLLBAR: { ScrollbarValue* pScrollbarVal = (ScrollbarValue *)(aValue.getOptionalVal()); @@ -1214,18 +1249,38 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa { BOOL toReturn = FALSE; - short x = rControlRegion.GetBoundRect().Left(); - short y = rControlRegion.GetBoundRect().Top(); + Rectangle aCtrlBoundRect( rControlRegion.GetBoundRect() ); + short x = aCtrlBoundRect.Left(); + short y = aCtrlBoundRect.Top(); short w, h; sal_uInt8 nBorderCleanup = 0; switch (nType) { + case CTRL_SLIDER: + { + if( nPart == PART_THUMB_HORZ ) + { + w = 19; // taken from HIG + h = aCtrlBoundRect.GetHeight(); + rNativeBoundingRegion = rNativeContentRegion = Region( Rectangle( Point( x, y ), Size( w, h ) ) ); + toReturn = true; + } + else if( nPart == PART_THUMB_VERT ) + { + w = aCtrlBoundRect.GetWidth(); + h = 18; // taken from HIG + rNativeBoundingRegion = rNativeContentRegion = Region( Rectangle( Point( x, y ), Size( w, h ) ) ); + toReturn = true; + } + } + break; + case CTRL_SCROLLBAR: { Rectangle aRect; - if( AquaGetScrollRect( /* m_nScreen */ nPart, rControlRegion.GetBoundRect(), aRect ) ) + if( AquaGetScrollRect( /* m_nScreen */ nPart, aCtrlBoundRect, aRect ) ) { toReturn = TRUE; rNativeBoundingRegion = aRect; @@ -1240,8 +1295,8 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa { if ( nType == CTRL_PUSHBUTTON ) { - w = rControlRegion.GetBoundRect().GetWidth(); - h = rControlRegion.GetBoundRect().GetHeight(); + w = aCtrlBoundRect.GetWidth(); + h = aCtrlBoundRect.GetHeight(); } else { @@ -1262,7 +1317,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa break; case CTRL_PROGRESS: { - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( aCtrlBoundRect ); if( aRect.GetHeight() < 16 ) aRect.Bottom() = aRect.Top() + 9; // values taken from HIG for medium progress else @@ -1275,7 +1330,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa case CTRL_INTROPROGRESS: { - Rectangle aRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( aCtrlBoundRect ); aRect.Bottom() = aRect.Top() + INTRO_PROGRESS_HEIGHT; // values taken from HIG for medium progress rNativeBoundingRegion = aRect; rNativeContentRegion = aRect; @@ -1285,7 +1340,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa case CTRL_TAB_ITEM: - w = rControlRegion.GetBoundRect().GetWidth() + 2*TAB_TEXT_OFFSET - 2*VCL_TAB_TEXT_OFFSET; + w = aCtrlBoundRect.GetWidth() + 2*TAB_TEXT_OFFSET - 2*VCL_TAB_TEXT_OFFSET; #ifdef OLD_TAB_STYLE h = TAB_HEIGHT_NORMAL; @@ -1301,7 +1356,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa case CTRL_EDITBOX: { - w = rControlRegion.GetBoundRect().GetWidth(); + w = aCtrlBoundRect.GetWidth(); if( w < 3+2*FOCUS_RING_WIDTH ) w = 3+2*FOCUS_RING_WIDTH; h = TEXT_EDIT_HEIGHT_NORMAL; @@ -1317,7 +1372,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa { if( nPart == PART_ENTIRE_CONTROL ) { - w = rControlRegion.GetBoundRect().GetWidth(); + w = aCtrlBoundRect.GetWidth(); h = COMBOBOX_HEIGHT_NORMAL;//listboxes and comboxes have the same height rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*FOCUS_RING_WIDTH, h ) ); @@ -1327,7 +1382,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa } else if( nPart == PART_BUTTON_DOWN ) { - w = rControlRegion.GetBoundRect().GetWidth(); + w = aCtrlBoundRect.GetWidth(); if( w < 3+2*FOCUS_RING_WIDTH ) w = 3+2*FOCUS_RING_WIDTH; h = COMBOBOX_HEIGHT_NORMAL;//listboxes and comboxes have the same height @@ -1343,7 +1398,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa } else if( nPart == PART_SUB_EDIT ) { - w = rControlRegion.GetBoundRect().GetWidth(); + w = aCtrlBoundRect.GetWidth(); h = COMBOBOX_HEIGHT_NORMAL;//listboxes and comboxes have the same height x += FOCUS_RING_WIDTH; @@ -1364,7 +1419,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa break; case CTRL_SPINBOX: if( nPart == PART_ENTIRE_CONTROL ) { - w = rControlRegion.GetBoundRect().GetWidth(); + w = aCtrlBoundRect.GetWidth(); if( w < 3+2*FOCUS_RING_WIDTH+SPIN_BUTTON_SPACE+SPIN_BUTTON_WIDTH ) w = 3+2*FOCUS_RING_WIDTH+SPIN_BUTTON_SPACE+SPIN_BUTTON_WIDTH; h = TEXT_EDIT_HEIGHT_NORMAL; @@ -1375,7 +1430,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa toReturn = TRUE; } else if( nPart == PART_SUB_EDIT ) { - w = rControlRegion.GetBoundRect().GetWidth() - SPIN_BUTTON_SPACE - SPIN_BUTTON_WIDTH; + w = aCtrlBoundRect.GetWidth() - SPIN_BUTTON_SPACE - SPIN_BUTTON_WIDTH; h = TEXT_EDIT_HEIGHT_NORMAL; x += 4; // add an offset for rounded borders y += 2; // don't draw into upper border @@ -1388,10 +1443,10 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa toReturn = TRUE; } else if( nPart == PART_BUTTON_UP ) { - //rControlRegion.GetBoundRect().GetWidth() contains the width of the full control + //aCtrlBoundRect.GetWidth() contains the width of the full control //ie the width of the textfield + button //x is the position of the left corner of the full control - x += rControlRegion.GetBoundRect().GetWidth() - SPIN_BUTTON_WIDTH - SPIN_BUTTON_SPACE - CLIP_FUZZ; + x += aCtrlBoundRect.GetWidth() - SPIN_BUTTON_WIDTH - SPIN_BUTTON_SPACE - CLIP_FUZZ; y += FOCUS_RING_WIDTH - CLIP_FUZZ; w = SPIN_BUTTON_WIDTH + 2*CLIP_FUZZ; h = SPIN_UPPER_BUTTON_HEIGHT + 2*CLIP_FUZZ; @@ -1402,7 +1457,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa toReturn = TRUE; } else if( nPart == PART_BUTTON_DOWN ) { - x += rControlRegion.GetBoundRect().GetWidth() - SPIN_BUTTON_WIDTH - SPIN_BUTTON_SPACE - CLIP_FUZZ; + x += aCtrlBoundRect.GetWidth() - SPIN_BUTTON_WIDTH - SPIN_BUTTON_SPACE - CLIP_FUZZ; y += SPIN_UPPER_BUTTON_HEIGHT + FOCUS_RING_WIDTH - CLIP_FUZZ; w = SPIN_BUTTON_WIDTH + 2*CLIP_FUZZ; h = SPIN_LOWER_BUTTON_HEIGHT + 2*CLIP_FUZZ; @@ -1419,7 +1474,7 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa if( ( nPart == PART_BORDER ) && !( nStyle & (FRAME_DRAW_MENU | FRAME_DRAW_WINDOWBORDER | FRAME_DRAW_BORDERWINDOWBORDER) ) ) { - Rectangle aRect = rControlRegion.GetBoundRect(); + Rectangle aRect(aCtrlBoundRect); if( nStyle & FRAME_DRAW_DOUBLEIN ) { aRect.Left() += 1; diff --git a/vcl/inc/vcl/salnativewidgets.hxx b/vcl/inc/vcl/salnativewidgets.hxx index c8fb0cb40d21..aedd706d12d9 100644 --- a/vcl/inc/vcl/salnativewidgets.hxx +++ b/vcl/inc/vcl/salnativewidgets.hxx @@ -98,6 +98,8 @@ typedef sal_uInt32 ControlType; // all parts like slider, buttons #define CTRL_SCROLLBAR 60 +#define CTRL_SLIDER 65 + // Border around a group of related // items, perhaps also displaying // a label of identification @@ -292,6 +294,20 @@ class VCL_DLLPUBLIC ScrollbarValue inline ~ScrollbarValue() {}; }; +class VCL_DLLPUBLIC SliderValue +{ + public: + long mnMin; + long mnMax; + long mnCur; + Rectangle maThumbRect; + ControlState mnThumbState; + + SliderValue() : mnMin( 0 ), mnMax( 0 ), mnCur( 0 ), mnThumbState( 0 ) + {} + ~SliderValue() {} +}; + /* TabitemValue: * * Value container for tabitems. diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 2923c382bbdd..52a927d27d95 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -171,6 +171,7 @@ void Slider::ImplInitSettings() void Slider::ImplUpdateRects( BOOL bUpdate ) { Rectangle aOldThumbRect = maThumbRect; + bool bInvalidateAll = false; if ( mnThumbPixRange ) { @@ -196,6 +197,18 @@ void Slider::ImplUpdateRects( BOOL bUpdate ) } else maChannel2Rect.SetEmpty(); + + const Region aControlRegion( Rectangle( Point(0,0), Size( SLIDER_THUMB_SIZE, 10 ) ) ); + Region aThumbBounds, aThumbContent; + if ( GetNativeControlRegion( CTRL_SLIDER, PART_THUMB_HORZ, + aControlRegion, 0, ImplControlValue(), rtl::OUString(), + aThumbBounds, aThumbContent ) ) + { + Rectangle aRect( aThumbBounds.GetBoundRect() ); + maThumbRect.Left() = mnThumbPixPos - aRect.GetWidth()/2; + maThumbRect.Right() = maThumbRect.Left() + aRect.GetWidth() - 1; + bInvalidateAll = true; + } } else { @@ -219,6 +232,18 @@ void Slider::ImplUpdateRects( BOOL bUpdate ) } else maChannel2Rect.SetEmpty(); + + const Region aControlRegion( Rectangle( Point(0,0), Size( 10, SLIDER_THUMB_SIZE ) ) ); + Region aThumbBounds, aThumbContent; + if ( GetNativeControlRegion( CTRL_SLIDER, PART_THUMB_VERT, + aControlRegion, 0, ImplControlValue(), rtl::OUString(), + aThumbBounds, aThumbContent ) ) + { + Rectangle aRect( aThumbBounds.GetBoundRect() ); + maThumbRect.Top() = mnThumbPixPos - aRect.GetHeight()/2; + maThumbRect.Bottom() = maThumbRect.Top() + aRect.GetHeight() - 1; + bInvalidateAll = true; + } } } else @@ -232,17 +257,22 @@ void Slider::ImplUpdateRects( BOOL bUpdate ) { if ( aOldThumbRect != maThumbRect ) { - Region aInvalidRegion( aOldThumbRect ); - aInvalidRegion.Union( maThumbRect ); - - if( !IsBackground() && GetParent() ) + if( bInvalidateAll ) + Invalidate(); + else { - const Point aPos( GetPosPixel() ); - aInvalidRegion.Move( aPos.X(), aPos.Y() ); - GetParent()->Invalidate( aInvalidRegion, INVALIDATE_TRANSPARENT | INVALIDATE_UPDATE ); + Region aInvalidRegion( aOldThumbRect ); + aInvalidRegion.Union( maThumbRect ); + + if( !IsBackground() && GetParent() ) + { + const Point aPos( GetPosPixel() ); + aInvalidRegion.Move( aPos.X(), aPos.Y() ); + GetParent()->Invalidate( aInvalidRegion, INVALIDATE_TRANSPARENT | INVALIDATE_UPDATE ); + } + else + Invalidate( aInvalidRegion ); } - else - Invalidate( aInvalidRegion ); } } } @@ -360,6 +390,29 @@ void Slider::ImplDraw( USHORT nDrawFlags ) if ( mbCalcSize ) ImplCalc( FALSE ); + ControlPart nPart = (GetStyle() & WB_HORZ) ? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA; + ImplControlValue aControlValue( BUTTONVALUE_DONTKNOW, rtl::OUString(), 0 ); + ControlState nState = ( IsEnabled() ? CTRL_STATE_ENABLED : 0 ) | ( HasFocus() ? CTRL_STATE_FOCUSED : 0 ); + SliderValue sldValue; + + sldValue.mnMin = mnMinRange; + sldValue.mnMax = mnMaxRange; + sldValue.mnCur = mnThumbPos; + sldValue.maThumbRect = maThumbRect; + + if( IsMouseOver() ) + { + if( maThumbRect.IsInside( GetPointerPosPixel() ) ) + sldValue.mnThumbState |= CTRL_STATE_ROLLOVER; + } + aControlValue.setOptionalVal( (void *)(&sldValue) ); + + const Region aCtrlRegion( Rectangle( Point(0,0), GetOutputSizePixel() ) ); + bool bNativeOK = DrawNativeControl( CTRL_SLIDER, nPart, + aCtrlRegion, nState, aControlValue, rtl::OUString() ); + if( bNativeOK ) + return; + if ( (nDrawFlags & SLIDER_DRAW_CHANNEL1) && !maChannel1Rect.IsEmpty() ) { long nRectSize; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 1e9572887e0b..e71c47d61c54 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -693,6 +693,12 @@ void SalGraphics::mirror( ControlType nType, const ImplControlValue& rVal, const { switch( nType ) { + case CTRL_SLIDER: + { + SliderValue* pSlVal = reinterpret_cast(rVal.getOptionalVal()); + mirror(pSlVal->maThumbRect,pOutDev,bBack); + } + break; case CTRL_SCROLLBAR: { ScrollbarValue* pScVal = reinterpret_cast(rVal.getOptionalVal()); diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index 4c875c24fc25..e1adbb729130 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -107,6 +107,12 @@ void Window::ImplMoveControlValue( ControlType nType, const ImplControlValue& aV { switch( nType ) { + case CTRL_SLIDER: + { + SliderValue* pSlVal = reinterpret_cast(aValue.getOptionalVal()); + pSlVal->maThumbRect.Move( rDelta.X(), rDelta.Y() ); + } + break; case CTRL_SCROLLBAR: { ScrollbarValue* pScVal = reinterpret_cast(aValue.getOptionalVal()); -- cgit v1.2.3 From 7880302e44f13c6a52f56e5667b91c863a125bb6 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 11 Jan 2010 16:28:33 +0100 Subject: vcl109: #i33688# NWF slider (windows) --- vcl/win/source/gdi/salnativewidgets-luna.cxx | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 5a5703e10944..07bfe3c20695 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -294,6 +294,10 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Progress"); break; + case CTRL_SLIDER: + if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) + hTheme = getThemeHandle( mhWnd, L"Trackbar" ); + break; default: hTheme = NULL; break; @@ -893,6 +897,38 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, return ImplDrawTheme( hTheme, hDC, PP_CHUNK, iState, aProgressRect, aCaption ); } + if( nType == CTRL_SLIDER ) + { + iPart = (nPart == PART_TRACK_HORZ_AREA) ? TKP_TRACK : TKP_TRACKVERT; + iState = (nPart == PART_TRACK_HORZ_AREA) ? TRS_NORMAL : TRVS_NORMAL; + + Rectangle aTrackRect = ImplGetThemeRect( hTheme, hDC, iPart, iState, Rectangle() ); + RECT aTRect = rc; + if( nPart == PART_TRACK_HORZ_AREA ) + { + long nH = aTrackRect.GetHeight(); + aTRect.top += (rc.bottom - rc.top - nH)/2; + aTRect.bottom = aTRect.top + nH; + } + else + { + long nW = aTrackRect.GetWidth(); + aTRect.left += (rc.right - rc.left - nW)/2; + aTRect.right = aTRect.left + nW; + } + ImplDrawTheme( hTheme, hDC, iPart, iState, aTRect, aCaption ); + + RECT aThumbRect; + SliderValue* pVal = (SliderValue*)aValue.getOptionalVal(); + aThumbRect.left = pVal->maThumbRect.Left(); + aThumbRect.top = pVal->maThumbRect.Top(); + aThumbRect.right = pVal->maThumbRect.Right(); + aThumbRect.bottom = pVal->maThumbRect.Bottom(); + iPart = (nPart == PART_TRACK_HORZ_AREA) ? TKP_THUMB : TKP_THUMBVERT; + iState = (nState & CTRL_STATE_ENABLED) ? TUS_NORMAL : TUS_DISABLED; + return ImplDrawTheme( hTheme, hDC, iPart, iState, aThumbRect, aCaption ); + } + return false; } @@ -973,6 +1009,10 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType, if( nPart == PART_ENTIRE_CONTROL ) hTheme = getThemeHandle( mhWnd, L"Progress"); break; + case CTRL_SLIDER: + if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA ) + hTheme = getThemeHandle( mhWnd, L"Trackbar" ); + break; default: hTheme = NULL; break; @@ -1109,6 +1149,32 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, bRet = TRUE; } } + if( nType == CTRL_SLIDER && ( (nPart == PART_THUMB_HORZ) || (nPart == PART_THUMB_VERT) ) ) + { + HTHEME hTheme = getThemeHandle( mhWnd, L"Trackbar"); + if( hTheme ) + { + int iPart = (nPart == PART_THUMB_HORZ) ? TKP_THUMB : TKP_THUMBVERT; + int iState = (nPart == PART_THUMB_HORZ) ? TUS_NORMAL : TUVS_NORMAL; + Rectangle aThumbRect = ImplGetThemeRect( hTheme, hDC, iPart, iState, Rectangle() ); + if( nPart == PART_THUMB_HORZ ) + { + long nW = aThumbRect.GetWidth(); + Rectangle aRect( rControlRegion.GetBoundRect() ); + aRect.Right() = aRect.Left() + nW - 1; + rNativeContentRegion = aRect; + rNativeBoundingRegion = rNativeContentRegion; + } + else + { + long nH = aThumbRect.GetHeight(); + Rectangle aRect( rControlRegion.GetBoundRect() ); + aRect.Bottom() = aRect.Top() + nH - 1; + rNativeContentRegion = aRect; + rNativeBoundingRegion = rNativeContentRegion; + } + } + } ReleaseDC( mhWnd, hDC ); return( bRet ); } -- cgit v1.2.3 From 1943c5e03e956bba70edef6c2dfe1f2a20322bef Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Jan 2010 11:24:30 +0100 Subject: vcl109: #i33688# NWF slider (KDE4) --- vcl/unx/kde4/KDESalGraphics.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 1c9882923b43..343b05248417 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -133,6 +133,9 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par if (type == CTRL_RADIOBUTTON) return true; + if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) ) + return true; + return false; if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true; @@ -536,6 +539,20 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter); } + else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA)) + { + SliderValue* slVal = static_cast ( value.getOptionalVal() ); + QStyleOptionSlider styleOption; + + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + styleOption.state = vclStateValue2StateFlag( nControlState, value ); + styleOption.maximum = slVal->mnMax; + styleOption.minimum = slVal->mnMin; + styleOption.sliderPosition = styleOption.sliderValue = slVal->mnCur; + styleOption.orientation = (part == PART_TRACK_HORZ_AREA) ? Qt::Horizontal : Qt::Vertical; + + kapp->style()->drawComplexControl(QStyle::CC_Slider, &styleOption, &painter); + } else { returnVal = false; @@ -759,6 +776,24 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, boundingRect = contentRect; retVal = true; + break; + } + case CTRL_SLIDER: + { + const int w = kapp->style()->pixelMetric(QStyle::PM_SliderLength); + if( part == PART_THUMB_HORZ ) + { + contentRect = QRect(boundingRect.left(), boundingRect.top(), w, boundingRect.height()); + boundingRect = contentRect; + retVal = true; + } + else if( part == PART_THUMB_VERT ) + { + contentRect = QRect(boundingRect.left(), boundingRect.top(), boundingRect.width(), w); + boundingRect = contentRect; + retVal = true; + } + break; } default: break; -- cgit v1.2.3 From f79ee5e3bca3d71833b1cac2379b589d79c35db8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Jan 2010 14:36:35 +0100 Subject: vcl109: #i108256# fix typo (thanks cmc) --- rsc/source/prj/start.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx index df4ce12200c5..d3a5b385acc6 100644 --- a/rsc/source/prj/start.cxx +++ b/rsc/source/prj/start.cxx @@ -179,7 +179,7 @@ static BOOL CallPrePro( const ByteString& rPrePro, #if ((defined OS2 || defined WNT) && (defined TCPP || defined tcpp)) || defined UNX || defined OS2 nExit = spawnvp( P_WAIT, rPrePro.GetBuffer(), (char* const*)pCmdL->GetBlock() ); #elif defined CSET - nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), char **) (const char**)pCmdL->GetBlock() ); + nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char**)pCmdL->GetBlock() ); #elif defined WTC nExit = spawnvp( P_WAIT, (char*)rPrePro.GetBuffer(), (const char* const*)pCmdL->GetBlock() ); #elif defined MTW -- cgit v1.2.3 From 25b8a89ce0f26db13daa5863d29949470f6fcc1e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Jan 2010 16:57:05 +0100 Subject: vcl109: #i33688# NWF slider (gtk) --- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 171 ++++++++++++++++++++++++++++++- vcl/unx/inc/plugins/gtk/gtkgdi.hxx | 5 + 2 files changed, 175 insertions(+), 1 deletion(-) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index f922552ce923..2e5ef93bf293 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -100,6 +100,8 @@ struct NWFWidgetData GtkWidget * gTooltipPopup; GtkWidget * gProgressBar; GtkWidget * gTreeView; + GtkWidget * gHScale; + GtkWidget * gVScale; NWPixmapCacheList* gNWPixmapCacheList; NWPixmapCache* gCacheTabItems; @@ -132,10 +134,12 @@ struct NWFWidgetData gMenuItemMenuWidget( NULL ), gMenuItemCheckMenuWidget( NULL ), gMenuItemRadioMenuWidget( NULL ), - gImageMenuItem( NULL ), + gImageMenuItem( NULL ), gTooltipPopup( NULL ), gProgressBar( NULL ), gTreeView( NULL ), + gHScale( NULL ), + gVScale( NULL ), gNWPixmapCacheList( NULL ), gCacheTabItems( NULL ), gCacheTabPages( NULL ) @@ -173,6 +177,7 @@ static void NWEnsureGTKMenu ( int nScreen ); static void NWEnsureGTKTooltip ( int nScreen ); static void NWEnsureGTKProgressBar ( int nScreen ); static void NWEnsureGTKTreeView ( int nScreen ); +static void NWEnsureGTKSlider ( int nScreen ); static void NWConvertVCLStateToGTKState( ControlState nVCLState, GtkStateType* nGTKState, GtkShadowType* nGTKShadow ); static void NWAddWidgetToCacheWindow( GtkWidget* widget, int nScreen ); @@ -590,8 +595,13 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP ) || ((nType == CTRL_LISTNODE || nType == CTRL_LISTNET) && ( (nPart == PART_ENTIRE_CONTROL) ) + ) || + ((nType == CTRL_SLIDER) && + ( (nPart == PART_TRACK_HORZ_AREA) + || (nPart == PART_TRACK_VERT_AREA) ) ) + ) return( TRUE ); return( FALSE ); @@ -876,6 +886,10 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType, // don't actually draw anything; gtk treeviews do not draw lines returnVal = true; } + else if( (nType == CTRL_SLIDER) ) + { + returnVal = NWPaintGTKSlider( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rControlHandle, rCaption ); + } if( pixmap ) { @@ -1091,6 +1105,30 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = Region( aIndicatorRect ); returnVal = TRUE; } + if( (nType == CTRL_SLIDER) && (nPart == PART_THUMB_HORZ || nPart == PART_THUMB_VERT) ) + { + NWEnsureGTKSlider( m_nScreen ); + GtkWidget* widget = (nPart == PART_THUMB_HORZ) ? gWidgetData[m_nScreen].gHScale : gWidgetData[m_nScreen].gVScale; + gint slider_length = 10; + gint slider_width = 10; + gtk_widget_style_get( widget, + "slider-width", &slider_width, + "slider-length", &slider_length, + (char *)NULL); + Rectangle aRect( rControlRegion.GetBoundRect() ); + if( nPart == PART_THUMB_HORZ ) + { + aRect.Right() = aRect.Left() + slider_length - 1; + aRect.Bottom() = aRect.Top() + slider_width - 1; + } + else + { + aRect.Bottom() = aRect.Top() + slider_length - 1; + aRect.Right() = aRect.Left() + slider_width - 1; + } + rNativeBoundingRegion = rNativeContentRegion = Region( aRect ); + returnVal = TRUE; + } return( returnVal ); } @@ -3000,6 +3038,123 @@ BOOL GtkSalGraphics::NWPaintGTKProgress( return bRet; } +BOOL GtkSalGraphics::NWPaintGTKSlider( + GdkDrawable*, + ControlType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList&, + ControlState nState, const ImplControlValue& rValue, + SalControlHandle&, const OUString& ) +{ + NWEnsureGTKSlider( m_nScreen ); + + gint w, h; + w = rControlRectangle.GetWidth(); + h = rControlRectangle.GetHeight(); + + SliderValue* pVal = (SliderValue*)rValue.getOptionalVal(); + + GdkPixmap* pixmap = NWGetPixmapFromScreen( rControlRectangle ); + if( ! pixmap ) + return FALSE; + + (void)pVal; + + GdkDrawable* const &pixDrawable = GDK_DRAWABLE( pixmap ); + GtkWidget* pWidget = (nPart == PART_TRACK_HORZ_AREA) + ? GTK_WIDGET(gWidgetData[m_nScreen].gHScale) + : GTK_WIDGET(gWidgetData[m_nScreen].gVScale); + const gchar* pDetail = (nPart == PART_TRACK_HORZ_AREA) ? "hscale" : "vscale"; + GtkOrientation eOri = (nPart == PART_TRACK_HORZ_AREA) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; + GtkStateType eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE; + gtk_paint_box( pWidget->style, + pixDrawable, + eState, + GTK_SHADOW_IN, + NULL, + pWidget, + "trough", + 0, 0, w, h); + + eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; + gint slider_width = 10; + gint slider_length = 10; + gtk_widget_style_get( pWidget, + "slider-width", &slider_width, + "slider-length", &slider_length, + NULL); + if( nPart == PART_TRACK_HORZ_AREA ) + { + gint x = (w - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin); + gtk_paint_slider( pWidget->style, + pixDrawable, + eState, + GTK_SHADOW_OUT, + NULL, + pWidget, + pDetail, + x, (h-slider_width)/2, + slider_length, slider_width, + eOri ); + } + else + { + gint y = (h - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin); + gtk_paint_slider( pWidget->style, + pixDrawable, + eState, + GTK_SHADOW_OUT, + NULL, + pWidget, + pDetail, + (w-slider_width)/2, y, + slider_width, slider_length, + eOri ); + } + #if 0 + // paint background + gtk_paint_flat_box( gWidgetData[m_nScreen].gProgressBar->style, + pixDrawable, + GTK_STATE_NORMAL, + GTK_SHADOW_NONE, + NULL, + gWidgetData[m_nScreen].gProgressBar, + "trough", + 0, 0, w, h ); + if( nProgressWidth > 0 ) + { + // paint progress + if( Application::GetSettings().GetLayoutRTL() ) + { + gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style, + pixDrawable, + GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, + NULL, + gWidgetData[m_nScreen].gProgressBar, + "bar", + w-nProgressWidth, 0, nProgressWidth, h + ); + } + else + { + gtk_paint_box( gWidgetData[m_nScreen].gProgressBar->style, + pixDrawable, + GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, + NULL, + gWidgetData[m_nScreen].gProgressBar, + "bar", + 0, 0, nProgressWidth, h + ); + } + } + #endif + + BOOL bRet = NWRenderPixmapToScreen( pixmap, rControlRectangle ); + g_object_unref( pixmap ); + + return bRet; +} + //---- static Rectangle NWGetListBoxButtonRect( int nScreen, @@ -3937,3 +4092,17 @@ static void NWEnsureGTKTreeView( int nScreen ) NWAddWidgetToCacheWindow( gWidgetData[nScreen].gTreeView, nScreen ); } } + +static void NWEnsureGTKSlider( int nScreen ) +{ + if( !gWidgetData[nScreen].gHScale ) + { + gWidgetData[nScreen].gHScale = gtk_hscale_new_with_range(0, 10, 1); + NWAddWidgetToCacheWindow( gWidgetData[nScreen].gHScale, nScreen ); + } + if( !gWidgetData[nScreen].gVScale ) + { + gWidgetData[nScreen].gVScale = gtk_vscale_new_with_range(0, 10, 1); + NWAddWidgetToCacheWindow( gWidgetData[nScreen].gVScale, nScreen ); + } +} diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx index 5bc7ab40b98e..0e8841f74497 100644 --- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx @@ -171,6 +171,11 @@ protected: const clipList& rClipList, ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& rCaption ); + BOOL NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, + const Rectangle& rControlRectangle, + const clipList& rClipList, + ControlState nState, const ImplControlValue& aValue, + SalControlHandle& rControlHandle, const OUString& rCaption ); BOOL NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart, const Rectangle& rControlRectangle, const clipList& rClipList, -- cgit v1.2.3 From ba49d14e4f4a6f6617993ef9b20dbed1ab739491 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 12 Jan 2010 17:12:04 +0100 Subject: vcl109: #i33688# NWF slider (gtk) --- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 2e5ef93bf293..278ac0e61d92 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3067,24 +3067,26 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( const gchar* pDetail = (nPart == PART_TRACK_HORZ_AREA) ? "hscale" : "vscale"; GtkOrientation eOri = (nPart == PART_TRACK_HORZ_AREA) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL; GtkStateType eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE; - gtk_paint_box( pWidget->style, - pixDrawable, - eState, - GTK_SHADOW_IN, - NULL, - pWidget, - "trough", - 0, 0, w, h); - - eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; gint slider_width = 10; gint slider_length = 10; + gint trough_border = 0; gtk_widget_style_get( pWidget, "slider-width", &slider_width, "slider-length", &slider_length, + "trough-border", &trough_border, NULL); + + eState = (nState & CTRL_STATE_ENABLED) ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; if( nPart == PART_TRACK_HORZ_AREA ) { + gtk_paint_box( pWidget->style, + pixDrawable, + eState, + GTK_SHADOW_IN, + NULL, + pWidget, + "trough", + 0, (h-slider_width-2*trough_border)/2, w, slider_width + 2*trough_border); gint x = (w - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin); gtk_paint_slider( pWidget->style, pixDrawable, @@ -3099,6 +3101,14 @@ BOOL GtkSalGraphics::NWPaintGTKSlider( } else { + gtk_paint_box( pWidget->style, + pixDrawable, + eState, + GTK_SHADOW_IN, + NULL, + pWidget, + "trough", + (w-slider_width-2*trough_border)/2, 0, slider_width + 2*trough_border, h); gint y = (h - slider_length + 1) * (pVal->mnCur - pVal->mnMin) / (pVal->mnMax - pVal->mnMin); gtk_paint_slider( pWidget->style, pixDrawable, -- cgit v1.2.3 From d86bda7d23b41cd22856f5e9f7a2264828df1c6e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Jan 2010 15:53:07 +0100 Subject: vcl109: #i108290# KDE4 integration updates from shtylman --- vcl/unx/kde4/KDESalGraphics.cxx | 428 ++++++++++++++++++---------------------- vcl/unx/kde4/KDESalGraphics.hxx | 10 +- 2 files changed, 202 insertions(+), 236 deletions(-) diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 343b05248417..52eff3a72c1a 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -88,8 +88,18 @@ QRect region2QRect( const Region& rControlRegion ) { Rectangle aRect = rControlRegion.GetBoundRect(); - return QRect( QPoint( aRect.Left(), aRect.Top() ), - QPoint( aRect.Right(), aRect.Bottom() ) ); + return QRect(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight()); +} + +KDESalGraphics::KDESalGraphics() : + m_image(0) +{ +} + +KDESalGraphics::~KDESalGraphics() +{ + if (m_image) + delete m_image; } BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part ) @@ -146,7 +156,6 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par return false; } - BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, const Region&, const Point&, SalControlHandle&, BOOL& ) @@ -154,28 +163,59 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, return FALSE; } -void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveElement i_nElement, - ControlState i_nState, const ImplControlValue& i_rValue ) +/// helper drawing methods +namespace { + void draw( QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state ) + { + option->state |= state; + option->rect = image->rect(); + + QPainter painter(image); + kapp->style()->drawControl(element, option, &painter); + } + + void draw( QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state, int nAdjust = 0 ) + { + option->state |= state; + option->rect = image->rect(); + if( nAdjust ) + option->rect.adjust( nAdjust, nAdjust, -nAdjust, -nAdjust ); + + QPainter painter(image); + kapp->style()->drawPrimitive(element, option, &painter); + } + + void draw( QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, QStyle::State state ) + { + option->state |= state; + option->rect = image->rect(); + + QPainter painter(image); + kapp->style()->drawComplexControl(element, option, &painter); + } + + void lcl_drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State state) + { #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - styleOption.frameShape = QFrame::StyledPanel; + QStyleOptionFrameV3 option; + option.frameShape = QFrame::StyledPanel; + option.state = QStyle::State_Sunken; #else - QStyleOptionFrame styleOption; - QFrame aFrame( NULL ); - aFrame.setFrameRect( QRect(0, 0, i_rRect.width(), i_rRect.height()) ); - aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); - aFrame.ensurePolished(); - styleOption.initFrom( &aFrame ); - styleOption.lineWidth = aFrame.lineWidth(); - styleOption.midLineWidth = aFrame.midLineWidth(); - #endif - styleOption.rect = QRect(0, 0, i_rRect.width(), i_rRect.height()); - styleOption.state = vclStateValue2StateFlag( i_nState, i_rValue ); - #if ( QT_VERSION < QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.state |= QStyle::State_Sunken; + QStyleOptionFrame option; + + QFrame aFrame( NULL ); + aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) ); + aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + aFrame.ensurePolished(); + + option.initFrom( &aFrame ); + option.lineWidth = aFrame.lineWidth(); + option.midLineWidth = aFrame.midLineWidth(); #endif - kapp->style()->drawPrimitive(i_nElement, &styleOption, &i_rPainter); + + draw(element, &option, image, state); + } } BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, @@ -191,10 +231,6 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, BOOL returnVal = true; - Display* dpy = GetXDisplay(); - XLIB_Window drawable = GetDrawable(); - GC gc = SelectPen(); - QRect widgetRect = region2QRect(rControlRegion); if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS ) type = CTRL_SPINBUTTONS; @@ -207,351 +243,271 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, aButtonRect.Right(), aButtonRect.Bottom() ); } - //draw right onto the window - QPixmap pixmap(widgetRect.width(), widgetRect.height()); - - if (pixmap.isNull()) + //if no image, or resized, make a new image + if (!m_image || m_image->size() != widgetRect.size()) { - return false; - } - - QPainter painter(&pixmap); - // painter.setBackgroundMode(Qt::OpaqueMode); + if (m_image) + delete m_image; - //copy previous screen contents for proper blending - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QPixmap screen = QPixmap::fromX11Pixmap(drawable); - painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height()); - #else - const QX11Info& rX11Info( pixmap.x11Info() ); - X11SalGraphics::CopyScreenArea( dpy, - drawable, GetScreenNumber(), GetBitCount(), - pixmap.handle(), rX11Info.screen(), rX11Info.depth(), - GetDisplay()->GetCopyGC( GetScreenNumber() ), - widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height(), - 0, 0 ); - #endif + m_image = new QImage( widgetRect.width(), + widgetRect.height(), + QImage::Format_ARGB32 ); + } + m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); if (type == CTRL_PUSHBUTTON) { - QStyleOptionButton styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state =vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter); + QStyleOptionButton option; + draw( QStyle::CE_PushButton, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if ( (type == CTRL_MENUBAR)) { if (part == PART_MENU_ITEM) { - QStyleOptionMenuItem styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter); + QStyleOptionMenuItem option; + draw( QStyle::CE_MenuBarItem, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); + } + else if (part == PART_ENTIRE_CONTROL) + { } else { - pixmap.fill(KApplication::palette().color(QPalette::Window)); + returnVal = false; } } else if (type == CTRL_MENU_POPUP) { if (part == PART_MENU_ITEM) { - QStyleOptionMenuItem styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter); + QStyleOptionMenuItem option; + draw( QStyle::CE_MenuItem, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } - else if (part == PART_MENU_ITEM_CHECK_MARK) + else if (part == PART_MENU_ITEM_CHECK_MARK && (nControlState & CTRL_STATE_PRESSED) ) { - QStyleOptionButton styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - if (nControlState & CTRL_STATE_PRESSED) - { - kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter); - } + QStyleOptionButton option; + draw( QStyle::PE_IndicatorMenuCheckMark, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } - else if (part == PART_MENU_ITEM_RADIO_MARK) + else if (part == PART_MENU_ITEM_RADIO_MARK && (nControlState & CTRL_STATE_PRESSED) ) { - QStyleOptionButton styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - if (nControlState & CTRL_STATE_PRESSED) - { - kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter); - } + QStyleOptionButton option; + draw( QStyle::PE_IndicatorRadioButton, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else { - pixmap.fill(KApplication::palette().color(QPalette::Window)); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; + QStyleOptionFrameV3 option; + option.frameShape = QFrame::StyledPanel; #else - QStyleOptionFrameV2 styleOption; + QStyleOptionFrameV2 option; #endif - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.frameShape = QFrame::StyledPanel; - #endif - - kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter); + draw( QStyle::PE_FrameMenu, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } } else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) ) { - QStyleOptionToolButton styleOption; + QStyleOptionToolButton option; - styleOption.arrowType = Qt::NoArrow; - styleOption.subControls = QStyle::SC_ToolButton; + option.arrowType = Qt::NoArrow; + option.subControls = QStyle::SC_ToolButton; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise; + option.state = vclStateValue2StateFlag( nControlState, value ); + option.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise; - kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter); + draw( QStyle::CC_ToolButton, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) ) { - QStyleOptionToolBar styleOption; + QStyleOptionToolBar option; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); + option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + option.state = vclStateValue2StateFlag( nControlState, value ); - kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter); + draw( QStyle::CE_ToolBar, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) ) { - QStyleOption styleOption; + const int tw = widgetRect.width(); + widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent)); - int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent); + QStyleOption option; + option.state = QStyle::State_Horizontal; - styleOption.rect = QRect(0, 0, width, widgetRect.height()); - styleOption.state = QStyle::State_Horizontal; + draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); - kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter); + widgetRect.setWidth(tw); } else if (type == CTRL_EDITBOX) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); + QStyleOptionFrameV2 option; + draw( QStyle::PE_PanelLineEdit, &option, m_image, + vclStateValue2StateFlag(nControlState, value), 2 ); - //TODO hover?? OO does not seem to do this for line edits - - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - #else - QStyleOptionFrameV2 styleOption; - #endif - - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - //TODO...how does the line edit draw itself internally?? - styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4); - kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter); - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter); + draw( QStyle::PE_FrameLineEdit, &option, m_image, + vclStateValue2StateFlag(nControlState, value), 0 ); } else if (type == CTRL_COMBOBOX) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); - - QStyleOptionComboBox styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); + QStyleOptionComboBox option; + option.editable = true; - styleOption.editable = true; - - kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + draw( QStyle::CC_ComboBox, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_LISTBOX) { if( part == PART_WINDOW ) { - lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); + lcl_drawFrame( QStyle::PE_Frame, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else { - QStyleOptionComboBox styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - + QStyleOptionComboBox option; if (part == PART_SUB_EDIT) { - kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter); + draw( QStyle::CE_ComboBoxLabel, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else { - kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + draw( QStyle::CC_ComboBox, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } } } else if (type == CTRL_LISTNODE) { - QStyleOption styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - styleOption.state |= QStyle::State_Item; - styleOption.state |= QStyle::State_Children; + QStyleOption option; + option.state = QStyle::State_Item | QStyle::State_Children; if (nControlState & CTRL_STATE_PRESSED) - { - styleOption.state |= QStyle::State_Open; - } + option.state |= QStyle::State_Open; - kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter); + draw( QStyle::PE_IndicatorBranch, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_CHECKBOX) { - QStyleOptionButton styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter); + QStyleOptionButton option; + draw( QStyle::CE_CheckBox, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_SCROLLBAR) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); - if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ)) { + QStyleOptionSlider option; ScrollbarValue* sbVal = static_cast ( value.getOptionalVal() ); - QStyleOptionSlider styleOption; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - //if the scroll bar is active (aka not degenrate...allow for hover events if (sbVal->mnVisibleSize < sbVal->mnMax) - { - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - styleOption.state |= QStyle::State_MouseOver; - } + option.state = QStyle::State_MouseOver; //horizontal or vertical if (part == PART_DRAW_BACKGROUND_VERT) - { - styleOption.orientation = Qt::Vertical; - } + option.orientation = Qt::Vertical; else - { - styleOption.state |= QStyle::State_Horizontal; - } + option.state |= QStyle::State_Horizontal; //setup parameters from the OO values - styleOption.minimum = sbVal->mnMin; - styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize; - styleOption.sliderValue = sbVal->mnCur; - styleOption.sliderPosition = sbVal->mnCur; - styleOption.pageStep = sbVal->mnVisibleSize; + option.minimum = sbVal->mnMin; + option.maximum = sbVal->mnMax - sbVal->mnVisibleSize; + option.sliderValue = sbVal->mnCur; + option.sliderPosition = sbVal->mnCur; + option.pageStep = sbVal->mnVisibleSize; //setup the active control...always the slider if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER) - { - styleOption.activeSubControls = QStyle::SC_ScrollBarSlider; - } + option.activeSubControls = QStyle::SC_ScrollBarSlider; - kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter); + draw( QStyle::CC_ScrollBar, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); + } + else + { + returnVal = false; } } else if (type == CTRL_SPINBOX) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); + QStyleOptionSpinBox option; - QStyleOptionSpinBox styleOption; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); // determine active control SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal()); if( pSpinVal ) { if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) ) - styleOption.activeSubControls |= QStyle::SC_SpinBoxUp; + option.activeSubControls |= QStyle::SC_SpinBoxUp; if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) ) - styleOption.activeSubControls |= QStyle::SC_SpinBoxDown; + option.activeSubControls |= QStyle::SC_SpinBoxDown; } - kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter); + draw( QStyle::CC_SpinBox, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_GROUPBOX) { - QStyleOptionGroupBox styleOption; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter); + QStyleOptionGroupBox option; + draw( QStyle::CC_GroupBox, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_RADIOBUTTON) { - QStyleOptionButton styleOption; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter); + QStyleOptionButton option; + draw( QStyle::CE_RadioButton, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_TOOLTIP) { - QStyleOption styleOption; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter); + QStyleOption option; + draw( QStyle::PE_PanelTipLabel, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_FRAME) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); - lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); + lcl_drawFrame( QStyle::PE_Frame, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_FIXEDBORDER) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); - lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); + lcl_drawFrame( QStyle::PE_FrameWindow, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_WINDOW_BACKGROUND) { - pixmap.fill(KApplication::palette().color(QPalette::Window)); + m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); } else if (type == CTRL_FIXEDLINE) { - QStyleOptionMenuItem styleOption; + QStyleOptionMenuItem option; + option.menuItemType = QStyleOptionMenuItem::Separator; + option.state |= QStyle::State_Item; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - styleOption.menuItemType = QStyleOptionMenuItem::Separator; - styleOption.state |= QStyle::State_Item; - - kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter); + draw( QStyle::CE_MenuItem, &option, m_image, + vclStateValue2StateFlag(nControlState, value) ); } else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA)) { SliderValue* slVal = static_cast ( value.getOptionalVal() ); - QStyleOptionSlider styleOption; + QStyleOptionSlider option; - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - styleOption.maximum = slVal->mnMax; - styleOption.minimum = slVal->mnMin; - styleOption.sliderPosition = styleOption.sliderValue = slVal->mnCur; - styleOption.orientation = (part == PART_TRACK_HORZ_AREA) ? Qt::Horizontal : Qt::Vertical; + option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + option.state = vclStateValue2StateFlag( nControlState, value ); + option.maximum = slVal->mnMax; + option.minimum = slVal->mnMin; + option.sliderPosition = option.sliderValue = slVal->mnCur; + option.orientation = (part == PART_TRACK_HORZ_AREA) ? Qt::Horizontal : Qt::Vertical; - kapp->style()->drawComplexControl(QStyle::CC_Slider, &styleOption, &painter); + draw( QStyle::CC_Slider, &option, m_image, vclStateValue2StateFlag(nControlState, value) ); } else { @@ -560,10 +516,14 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if (returnVal) { - X11SalGraphics::CopyScreenArea( dpy, + if( SelectFont() == 0 ) + return false; + + QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither); + X11SalGraphics::CopyScreenArea( GetXDisplay(), pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(), - drawable, GetScreenNumber(), GetVisual().GetDepth(), gc, - 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() ); + GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(), + SelectFont(), 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top()); } return returnVal; diff --git a/vcl/unx/kde4/KDESalGraphics.hxx b/vcl/unx/kde4/KDESalGraphics.hxx index e598f75be75f..fa890a35ff91 100644 --- a/vcl/unx/kde4/KDESalGraphics.hxx +++ b/vcl/unx/kde4/KDESalGraphics.hxx @@ -31,12 +31,18 @@ #include #include +#define Region QtXRegion +#include +#undef Region + /** handles graphics drawings requests and performs the needed drawing operations */ class KDESalGraphics : public X11SalGraphics { + QImage* m_image; + public: - KDESalGraphics() {} - virtual ~KDESalGraphics() {} + KDESalGraphics(); + virtual ~KDESalGraphics(); /** What widgets can be drawn the native way. -- cgit v1.2.3 From 0b04c75c7a2784b2ed3f747c7db462426d07b23a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 13 Jan 2010 18:31:34 +0100 Subject: vcl109: #i107945# status bar including native borders --- vcl/source/window/status.cxx | 35 +++++++++++++++++++++++------ vcl/unx/kde4/KDESalGraphics.cxx | 50 +++++++++++++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index ede3bcc107aa..274092db3d77 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -64,6 +64,7 @@ public: ~ImplData(); VirtualDevice* mpVirDev; + long mnItemBorderWidth; BOOL mbTopBorder:1; }; @@ -71,6 +72,7 @@ StatusBar::ImplData::ImplData() { mpVirDev = NULL; mbTopBorder = FALSE; + mnItemBorderWidth = 0; } StatusBar::ImplData::~ImplData() @@ -420,8 +422,9 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL // Ausgabebereich berechnen ImplStatusItem* pItem = mpItemList->GetObject( nPos ); - Rectangle aTextRect( aRect.Left()+1, aRect.Top()+1, - aRect.Right()-1, aRect.Bottom()-1 ); + long nW = mpImplData->mnItemBorderWidth + 1; + Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW, + aRect.Right()-nW, aRect.Bottom()-nW ); Size aTextRectSize( aTextRect.GetSize() ); if ( bOffScreen ) @@ -1229,8 +1232,11 @@ Rectangle StatusBar::GetItemRect( USHORT nItemId ) const { // Rechteck holen und Rahmen abziehen aRect = ImplGetItemRectPos( nPos ); - aRect.Left()++; - aRect.Right()--; + long nW = mpImplData->mnItemBorderWidth+1; + aRect.Top() += nW-1; + aRect.Bottom() -= nW-1; + aRect.Left() += nW; + aRect.Right() -= nW; return aRect; } } @@ -1250,8 +1256,9 @@ Point StatusBar::GetItemTextPos( USHORT nItemId ) const // Rechteck holen ImplStatusItem* pItem = mpItemList->GetObject( nPos ); Rectangle aRect = ImplGetItemRectPos( nPos ); - Rectangle aTextRect( aRect.Left()+1, aRect.Top()+1, - aRect.Right()-1, aRect.Bottom()-1 ); + long nW = mpImplData->mnItemBorderWidth + 1; + Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW, + aRect.Right()-nW, aRect.Bottom()-nW ); Point aPos = ImplGetItemTextPos( aTextRect.GetSize(), Size( GetTextWidth( pItem->maText ), GetTextHeight() ), pItem->mnBits ); @@ -1692,7 +1699,21 @@ Size StatusBar::CalcWindowSizePixel() const } } - nCalcHeight = nMinHeight+nBarTextOffset; + if( pThis->IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) ) + { + ImplControlValue aControlValue( FRAME_DRAW_NODRAW ); + Region aBound, aContent; + Region aNatRgn( Rectangle( Point( 0, 0 ), Size( 150, 50 ) ) ); + if( pThis->GetNativeControlRegion(CTRL_FRAME, PART_BORDER, + aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + { + mpImplData->mnItemBorderWidth = + ( aBound.GetBoundRect().GetHeight() - + aContent.GetBoundRect().GetHeight() ) / 2; + } + } + + nCalcHeight = nMinHeight+nBarTextOffset + 2*mpImplData->mnItemBorderWidth; if( nCalcHeight < nProgressHeight+2 ) nCalcHeight = nProgressHeight+2; diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 52eff3a72c1a..b5421d812396 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -255,6 +255,9 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } m_image->fill(KApplication::palette().color(QPalette::Window).rgb()); + + XLIB_Region pTempClipRegion = 0; + if (type == CTRL_PUSHBUTTON) { QStyleOptionButton option; @@ -476,6 +479,19 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, { lcl_drawFrame( QStyle::PE_Frame, m_image, vclStateValue2StateFlag(nControlState, value) ); + + int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + pTempClipRegion = XCreateRegion(); + XRectangle xRect = { widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height() }; + XUnionRectWithRegion( &xRect, pTempClipRegion, pTempClipRegion ); + XLIB_Region pSubtract = XCreateRegion(); + xRect.x += size; + xRect.y += size; + xRect.width -= 2* size; + xRect.height -= 2*size; + XUnionRectWithRegion( &xRect, pSubtract, pSubtract ); + XSubtractRegion( pTempClipRegion, pSubtract, pTempClipRegion ); + XDestroyRegion( pSubtract ); } else if (type == CTRL_FIXEDBORDER) { @@ -516,15 +532,35 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, if (returnVal) { - if( SelectFont() == 0 ) - return false; + GC gc = SelectFont(); + + if( gc ) + { + if( pTempClipRegion ) + { + if( pClipRegion_ ) + XIntersectRegion( pTempClipRegion, pClipRegion_, pTempClipRegion ); + XSetRegion( GetXDisplay(), gc, pTempClipRegion ); + } + QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither); + X11SalGraphics::CopyScreenArea( GetXDisplay(), + pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(), + GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(), + gc, 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top()); - QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither); - X11SalGraphics::CopyScreenArea( GetXDisplay(), - pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(), - GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(), - SelectFont(), 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top()); + if( pTempClipRegion ) + { + if( pClipRegion_ ) + XSetRegion( GetXDisplay(), gc, pClipRegion_ ); + else + XSetClipMask( GetXDisplay(), gc, None ); + } + } + else + returnVal = false; } + if( pTempClipRegion ) + XDestroyRegion( pTempClipRegion ); return returnVal; } -- cgit v1.2.3 From 2bb0c7009438bdd457d8aeb655884c3e03404aec Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 15 Jan 2010 21:48:39 -0500 Subject: kohei04: #i108373# Initialize StatusBar::mnItemsWidth before it gets used. valgrind reports that in class StatusBar, mnItemsWidth is used uninitialized for branching in SetItemText(). --- vcl/source/window/status.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index ede3bcc107aa..8d986f691963 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -156,6 +156,7 @@ void StatusBar::ImplInit( Window* pParent, WinBits nStyle ) mbProgressMode = FALSE; mbInUserDraw = FALSE; mbBottomBorder = FALSE; + mnItemsWidth = STATUSBAR_OFFSET_X; mnDX = 0; mnDY = 0; mnCalcHeight = 0; -- cgit v1.2.3 From 1ae2dbc46311121f3c5710388665694903d00532 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 15 Jan 2010 21:58:25 -0500 Subject: kohei04: #i108374# fixed a memory corruption during ods export. --- sax/source/expatwrap/saxwriter.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 717767d86e11..40f9a28d6e55 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -703,6 +703,7 @@ inline void SaxWriterHelper::clearBuffer() throw( SAXException ) m_Sequence.realloc(nCurrentPos); nCurrentPos = writeSequence(); m_Sequence.realloc(SEQUENCESIZE); + mp_Sequence = m_Sequence.getArray(); } } -- cgit v1.2.3 From 71cdbc4bc63e5e62d788d651fe5411c21e3cc424 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Sat, 16 Jan 2010 12:01:15 -0500 Subject: kohei04: #i108374# added in-line comment for the line I added. --- sax/source/expatwrap/saxwriter.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 40f9a28d6e55..5d15da614482 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -703,6 +703,7 @@ inline void SaxWriterHelper::clearBuffer() throw( SAXException ) m_Sequence.realloc(nCurrentPos); nCurrentPos = writeSequence(); m_Sequence.realloc(SEQUENCESIZE); + // Be sure to update the array pointer after the reallocation. mp_Sequence = m_Sequence.getArray(); } } -- cgit v1.2.3 From b333a8e8f186d884d24d1955a7fd6c8a493d3c86 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 18 Jan 2010 15:34:08 +0100 Subject: #vcl109: #i108368# catch broken AFM files (thanks thb !) --- vcl/unx/source/fontmanager/parseAFM.cxx | 254 +++++++++++++++++--------------- 1 file changed, 136 insertions(+), 118 deletions(-) diff --git a/vcl/unx/source/fontmanager/parseAFM.cxx b/vcl/unx/source/fontmanager/parseAFM.cxx index 0ac4754d4bd5..8f77edcf3faa 100644 --- a/vcl/unx/source/fontmanager/parseAFM.cxx +++ b/vcl/unx/source/fontmanager/parseAFM.cxx @@ -413,89 +413,91 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi ) switch(recognize(keyword, tokenlen)) { case STARTFONTMETRICS: - keyword = token(fp,tokenlen); - gfi->afmVersion = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->afmVersion = strdup( keyword ); break; case COMMENT: keyword = linetoken(fp); break; case FONTNAME: - keyword = token(fp, tokenlen); - gfi->fontName = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->fontName = strdup( keyword ); break; case ENCODINGSCHEME: - keyword = token(fp, tokenlen); - gfi->encodingScheme = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->encodingScheme = strdup( keyword ); break; case FULLNAME: - keyword = linetoken(fp); - gfi->fullName = strdup( keyword ); + if ((keyword = linetoken(fp)) != NULL) + gfi->fullName = strdup( keyword ); break; case FAMILYNAME: - keyword = linetoken(fp); - gfi->familyName = strdup( keyword ); + if ((keyword = linetoken(fp)) != NULL) + gfi->familyName = strdup( keyword ); break; case WEIGHT: - keyword = token(fp, tokenlen); - gfi->weight = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->weight = strdup( keyword ); break; case ITALICANGLE: - keyword = token(fp,tokenlen); - gfi->italicAngle = StringToDouble( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->italicAngle = StringToDouble( keyword ); break; case ISFIXEDPITCH: - keyword = token(fp,tokenlen); - if (MATCH(keyword, False)) - gfi->isFixedPitch = 0; - else - gfi->isFixedPitch = 1; + if ((keyword = token(fp,tokenlen)) != NULL) + { + if (MATCH(keyword, False)) + gfi->isFixedPitch = 0; + else + gfi->isFixedPitch = 1; + } break; case UNDERLINEPOSITION: - keyword = token(fp,tokenlen); - gfi->underlinePosition = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->underlinePosition = atoi(keyword); break; case UNDERLINETHICKNESS: - keyword = token(fp,tokenlen); - gfi->underlineThickness = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->underlineThickness = atoi(keyword); break; case VERSION: - keyword = token(fp,tokenlen); - gfi->version = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->version = strdup( keyword ); break; case NOTICE: - keyword = linetoken(fp); - gfi->notice = strdup( keyword ); + if ((keyword = linetoken(fp)) != NULL) + gfi->notice = strdup( keyword ); break; case FONTBBOX: - keyword = token(fp,tokenlen); - gfi->fontBBox.llx = atoi(keyword); - keyword = token(fp,tokenlen); - gfi->fontBBox.lly = atoi(keyword); - keyword = token(fp,tokenlen); - gfi->fontBBox.urx = atoi(keyword); - keyword = token(fp,tokenlen); - gfi->fontBBox.ury = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->fontBBox.llx = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->fontBBox.lly = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->fontBBox.urx = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->fontBBox.ury = atoi(keyword); break; case CAPHEIGHT: - keyword = token(fp,tokenlen); - gfi->capHeight = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->capHeight = atoi(keyword); break; case XHEIGHT: - keyword = token(fp,tokenlen); - gfi->xHeight = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->xHeight = atoi(keyword); break; case DESCENT: - keyword = token(fp,tokenlen); - gfi->descender = -atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->descender = -atoi(keyword); break; case DESCENDER: - keyword = token(fp,tokenlen); - gfi->descender = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->descender = atoi(keyword); break; case ASCENT: case ASCENDER: - keyword = token(fp,tokenlen); - gfi->ascender = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + gfi->ascender = atoi(keyword); break; case STARTCHARMETRICS: cont = false; @@ -509,8 +511,8 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi ) keyword = token(fp,tokenlen); break; case STARTDIRECTION: - keyword = token(fp,tokenlen); - direction = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + direction = atoi(keyword); break; /* ignore this for now */ case ENDDIRECTION: break; /* ignore this for now */ @@ -533,9 +535,11 @@ static int parseGlobals( FileInputStream* fp, register GlobalFontInfo* gfi ) keyword=token(fp,tokenlen); //ignore break; case CHARWIDTH: - keyword = token(fp,tokenlen); - if (direction == 0) - gfi->charwidth = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + { + if (direction == 0) + gfi->charwidth = atoi(keyword); + } keyword = token(fp,tokenlen); /* ignore y-width for now */ break; @@ -594,24 +598,27 @@ static int initializeArray( FileInputStream* fp, register int* cwi) keyword = linetoken(fp); break; case CODE: - code = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + code = atoi(keyword); break; case CODEHEX: - sscanf(token(fp,tokenlen),"<%x>", &code); + if ((keyword = token(fp,tokenlen)) != NULL) + sscanf(keyword,"<%x>", &code); break; case XWIDTH: - width = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + width = atoi(keyword); break; case X0WIDTH: (void) token(fp,tokenlen); break; case CHARNAME: - keyword = token(fp,tokenlen); - if (MATCH(keyword, Space)) - { - cont = false; - found = true; - } + if ((keyword = token(fp,tokenlen)) != NULL) + if (MATCH(keyword, Space)) + { + cont = false; + found = true; + } break; case ENDCHARMETRICS: cont = false; @@ -700,8 +707,8 @@ static int parseCharWidths( FileInputStream* fp, register int* cwi) keyword = linetoken(fp); break; case CODE: - keyword = token(fp,tokenlen); - pos = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + pos = atoi(keyword); break; case XYWIDTH: /* PROBLEM: Should be no Y-WIDTH when doing "quick & dirty" */ @@ -709,16 +716,16 @@ static int parseCharWidths( FileInputStream* fp, register int* cwi) error = parseError; break; case CODEHEX: - keyword = token(fp,tokenlen); - sscanf(keyword, "<%x>", &pos); + if ((keyword = token(fp,tokenlen)) != NULL) + sscanf(keyword, "<%x>", &pos); break; case X0WIDTH: (void) token(fp,tokenlen); break; case XWIDTH: - keyword = token(fp,tokenlen); - if (pos >= 0) /* ignore unmapped chars */ - cwi[pos] = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + if (pos >= 0) /* ignore unmapped chars */ + cwi[pos] = atoi(keyword); break; case ENDCHARMETRICS: cont = false; @@ -845,7 +852,8 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi) { if (firstTime) firstTime = false; else temp++; - temp->code = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->code = atoi(keyword); if (fi->gfi && fi->gfi->charwidth) temp->wx = fi->gfi->charwidth; count++; @@ -869,7 +877,8 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi) firstTime = false; else temp++; - sscanf(token(fp,tokenlen),"<%x>", &temp->code); + if ((keyword = token(fp,tokenlen)) != NULL) + sscanf(keyword,"<%x>", &temp->code); if (fi->gfi && fi->gfi->charwidth) temp->wx = fi->gfi->charwidth; count++; @@ -880,24 +889,32 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi) } break; case XYWIDTH: - temp->wx = atoi(token(fp,tokenlen)); - temp->wy = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->wx = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->wy = atoi(keyword); break; case X0WIDTH: - temp->wx = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->wx = atoi(keyword); break; case XWIDTH: - temp->wx = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->wx = atoi(keyword); break; case CHARNAME: - keyword = token(fp,tokenlen); - temp->name = (char *)strdup(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->name = (char *)strdup(keyword); break; case CHARBBOX: - temp->charBBox.llx = atoi(token(fp,tokenlen)); - temp->charBBox.lly = atoi(token(fp,tokenlen)); - temp->charBBox.urx = atoi(token(fp,tokenlen)); - temp->charBBox.ury = atoi(token(fp,tokenlen)); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->charBBox.llx = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->charBBox.lly = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->charBBox.urx = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + temp->charBBox.ury = atoi(keyword); break; case LIGATURE: { Ligature **tail = &(temp->ligs); @@ -911,10 +928,10 @@ static int parseCharMetrics( FileInputStream* fp, register FontInfo* fi) } *tail = (Ligature *) calloc(1, sizeof(Ligature)); - keyword = token(fp,tokenlen); - (*tail)->succ = (char *)strdup(keyword); - keyword = token(fp,tokenlen); - (*tail)->lig = (char *)strdup(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + (*tail)->succ = (char *)strdup(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + (*tail)->lig = (char *)strdup(keyword); break; } case ENDCHARMETRICS: cont = false;; @@ -1010,16 +1027,16 @@ static int parseTrackKernData( FileInputStream* fp, register FontInfo* fi) if (tcount < fi->numOfTracks) { - keyword = token(fp,tokenlen); - fi->tkd[pos].degree = atoi(keyword); - keyword = token(fp,tokenlen); - fi->tkd[pos].minPtSize = StringToDouble(keyword); - keyword = token(fp,tokenlen); - fi->tkd[pos].minKernAmt = StringToDouble(keyword); - keyword = token(fp,tokenlen); - fi->tkd[pos].maxPtSize = StringToDouble(keyword); - keyword = token(fp,tokenlen); - fi->tkd[pos++].maxKernAmt = StringToDouble(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->tkd[pos].degree = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->tkd[pos].minPtSize = StringToDouble(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->tkd[pos].minKernAmt = StringToDouble(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->tkd[pos].maxPtSize = StringToDouble(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->tkd[pos++].maxKernAmt = StringToDouble(keyword); tcount++; } else @@ -1117,14 +1134,14 @@ static int parsePairKernData( FileInputStream* fp, register FontInfo* fi) } if (pcount < fi->numOfPairs) { - keyword = token(fp,tokenlen); - fi->pkd[pos].name1 = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->pkd[pos].name2 = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->pkd[pos].xamt = atoi(keyword); - keyword = token(fp,tokenlen); - fi->pkd[pos++].yamt = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos].name1 = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos].name2 = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos].xamt = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos++].yamt = atoi(keyword); pcount++; } else @@ -1141,12 +1158,12 @@ static int parsePairKernData( FileInputStream* fp, register FontInfo* fi) } if (pcount < fi->numOfPairs) { - keyword = token(fp,tokenlen); - fi->pkd[pos].name1 = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->pkd[pos].name2 = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->pkd[pos++].xamt = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos].name1 = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos].name2 = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->pkd[pos++].xamt = atoi(keyword); pcount++; } else @@ -1268,8 +1285,8 @@ static int parseCompCharData( FileInputStream* fp, register FontInfo* fi) if (firstTime) firstTime = false; else pos++; fi->ccd[pos].ccName = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->ccd[pos].numOfPieces = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->ccd[pos].numOfPieces = atoi(keyword); fi->ccd[pos].pieces = (Pcc *) calloc(fi->ccd[pos].numOfPieces, sizeof(Pcc)); j = 0; @@ -1284,12 +1301,12 @@ static int parseCompCharData( FileInputStream* fp, register FontInfo* fi) case COMPCHARPIECE: if (pcount < fi->ccd[pos].numOfPieces) { - keyword = token(fp,tokenlen); - fi->ccd[pos].pieces[j].pccName = strdup( keyword ); - keyword = token(fp,tokenlen); - fi->ccd[pos].pieces[j].deltax = atoi(keyword); - keyword = token(fp,tokenlen); - fi->ccd[pos].pieces[j++].deltay = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->ccd[pos].pieces[j].pccName = strdup( keyword ); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->ccd[pos].pieces[j].deltax = atoi(keyword); + if ((keyword = token(fp,tokenlen)) != NULL) + fi->ccd[pos].pieces[j++].deltay = atoi(keyword); pcount++; } else @@ -1383,7 +1400,8 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) if ((code != normalEOF) && (code != earlyEOF)) { - (*fi)->numOfChars = atoi(token(&aFile,tokenlen)); + if ((keyword = token(&aFile,tokenlen)) != NULL) + (*fi)->numOfChars = atoi(keyword); if (flags & (P_M ^ P_W)) { (*fi)->cmi = (CharMetricInfo *) @@ -1433,7 +1451,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) break; case STARTTRACKKERN: keyword = token(&aFile,tokenlen); - if (flags & P_T) + if ((flags & P_T) && keyword) { (*fi)->numOfTracks = atoi(keyword); (*fi)->tkd = (TrackKernData *) @@ -1448,7 +1466,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) break; case STARTKERNPAIRS: keyword = token(&aFile,tokenlen); - if (flags & P_P) + if ((flags & P_P) && keyword) { (*fi)->numOfPairs = atoi(keyword); (*fi)->pkd = (PairKernData *) @@ -1463,7 +1481,7 @@ int parseFile( const char* pFilename, FontInfo** fi, FLAGS flags) break; case STARTCOMPOSITES: keyword = token(&aFile,tokenlen); - if (flags & P_C) + if ((flags & P_C) && keyword) { (*fi)->numOfComps = atoi(keyword); (*fi)->ccd = (CompCharData *) -- cgit v1.2.3 From 4debc1f9a1306f3c644fc047e1de8456939d6cc5 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 18 Jan 2010 15:54:29 +0100 Subject: vcl109: #i108321# change status bar to optionally use separators instead of item boxes --- vcl/inc/vcl/decoview.hxx | 2 ++ vcl/inc/vcl/status.hxx | 1 + vcl/source/control/fixed.cxx | 28 ++++-------------- vcl/source/window/decoview.cxx | 33 +++++++++++++++++++++ vcl/source/window/status.cxx | 67 ++++++++++++++++++++++++++++++++---------- 5 files changed, 93 insertions(+), 38 deletions(-) diff --git a/vcl/inc/vcl/decoview.hxx b/vcl/inc/vcl/decoview.hxx index 9a65931ed11d..52dd2721a2af 100644 --- a/vcl/inc/vcl/decoview.hxx +++ b/vcl/inc/vcl/decoview.hxx @@ -36,6 +36,7 @@ #include class Rectangle; +class Point; class Color; class OutputDevice; @@ -106,6 +107,7 @@ public: USHORT nStyle = FRAME_HIGHLIGHT_OUT ); Rectangle DrawFrame( const Rectangle& rRect, USHORT nStyle = FRAME_DRAW_OUT ); Rectangle DrawButton( const Rectangle& rRect, USHORT nStyle ); + void DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true ); }; #endif // _SV_DECOVIEW_HXX diff --git a/vcl/inc/vcl/status.hxx b/vcl/inc/vcl/status.hxx index e5ff3c5ee2da..52aef7c82890 100644 --- a/vcl/inc/vcl/status.hxx +++ b/vcl/inc/vcl/status.hxx @@ -119,6 +119,7 @@ private: USHORT nOldPerc, USHORT nNewPerc ); SAL_DLLPRIVATE void ImplCalcProgressRect(); SAL_DLLPRIVATE Rectangle ImplGetItemRectPos( USHORT nPos ) const; + SAL_DLLPRIVATE USHORT ImplGetFirstVisiblePos() const; SAL_DLLPRIVATE void ImplCalcBorder(); public: diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 3d19e288a1ce..6698f51b7ab1 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -499,16 +499,11 @@ void FixedLine::ImplDraw( bool bLayout ) { Size aOutSize = GetOutputSizePixel(); String aText = GetText(); - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; - if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) - SetLineColor( Color( COL_BLACK ) ); - else - SetLineColor( rStyleSettings.GetShadowColor() ); - + DecorationView aDecoView( this ); if ( !aText.Len() || (nWinStyle & WB_VERT) ) { if( !pVector ) @@ -519,21 +514,12 @@ void FixedLine::ImplDraw( bool bLayout ) if ( nWinStyle & WB_VERT ) { nX = (aOutSize.Width()-1)/2; - DrawLine( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) ); + aDecoView.DrawSeparator( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) ); } else { nY = (aOutSize.Height()-1)/2; - DrawLine( Point( 0, nY ), Point( aOutSize.Width()-1, nY ) ); - } - - if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) - { - SetLineColor( rStyleSettings.GetLightColor() ); - if ( nWinStyle & WB_VERT ) - DrawLine( Point( nX+1, 0 ), Point( nX+1, aOutSize.Height()-1 ) ); - else - DrawLine( Point( 0, nY+1 ), Point( aOutSize.Width()-1, nY+1 ) ); + aDecoView.DrawSeparator( Point( 0, nY ), Point( aOutSize.Width()-1, nY ), false ); } } } @@ -541,6 +527,7 @@ void FixedLine::ImplDraw( bool bLayout ) { USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS; Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() ); + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if ( !IsEnabled() ) nStyle |= TEXT_DRAW_DISABLE; @@ -554,12 +541,7 @@ void FixedLine::ImplDraw( bool bLayout ) if( !pVector ) { long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2); - DrawLine( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ) ); - if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) - { - SetLineColor( rStyleSettings.GetLightColor() ); - DrawLine( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop+1 ), Point( aOutSize.Width()-1, nTop+1 ) ); - } + aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false ); } } } diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index 8c6bb2b76463..75467fc7cae8 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -1356,3 +1356,36 @@ Rectangle DecorationView::DrawButton( const Rectangle& rRect, USHORT nStyle ) return aRect; } + +// ----------------------------------------------------------------------- + +void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical ) +{ + Point aStart( rStart ), aStop( rStop ); + const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings(); + + mpOutDev->Push( PUSH_LINECOLOR ); + if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) + mpOutDev->SetLineColor( Color( COL_BLACK ) ); + else + mpOutDev->SetLineColor( rStyleSettings.GetShadowColor() ); + + mpOutDev->DrawLine( aStart, aStop ); + if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ) + { + mpOutDev->SetLineColor( rStyleSettings.GetLightColor() ); + if( bVertical ) + { + aStart.X()++; + aStop.X()++; + } + else + { + aStart.Y()++; + aStop.Y()++; + } + mpOutDev->DrawLine( aStart, aStop ); + } + mpOutDev->Pop(); +} + diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 274092db3d77..29ad0f0812cb 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -65,13 +65,15 @@ public: VirtualDevice* mpVirDev; long mnItemBorderWidth; - BOOL mbTopBorder:1; + bool mbTopBorder:1; + bool mbDrawItemFrames:1; }; StatusBar::ImplData::ImplData() { mpVirDev = NULL; - mbTopBorder = FALSE; + mbTopBorder = false; + mbDrawItemFrames = false; mnItemBorderWidth = 0; } @@ -355,9 +357,7 @@ Rectangle StatusBar::ImplGetItemRectPos( USHORT nPos ) const { Rectangle aRect; ImplStatusItem* pItem; - pItem = mpItemList->GetObject( nPos ); - if ( pItem ) { if ( pItem->mbVisible ) @@ -376,6 +376,25 @@ Rectangle StatusBar::ImplGetItemRectPos( USHORT nPos ) const // ----------------------------------------------------------------------- +USHORT StatusBar::ImplGetFirstVisiblePos() const +{ + ImplStatusItem* pItem; + + for( USHORT nPos = 0; nPos < mpItemList->Count(); nPos++ ) + { + pItem = mpItemList->GetObject( nPos ); + if ( pItem ) + { + if ( pItem->mbVisible ) + return nPos; + } + } + + return ~0; +} + +// ----------------------------------------------------------------------- + void StatusBar::ImplDrawText( BOOL bOffScreen, long nOldTextWidth ) { // Das ueberschreiben der Item-Box verhindern @@ -475,17 +494,36 @@ void StatusBar::ImplDrawItem( BOOL bOffScreen, USHORT nPos, BOOL bDrawText, BOOL SetClipRegion(); // Frame ausgeben - if ( bDrawFrame && !(pItem->mnBits & SIB_FLAT) ) + if ( bDrawFrame ) { - USHORT nStyle; + if( mpImplData->mbDrawItemFrames ) + { + if( !(pItem->mnBits & SIB_FLAT) ) + { + USHORT nStyle; - if ( pItem->mnBits & SIB_IN ) - nStyle = FRAME_DRAW_IN; - else - nStyle = FRAME_DRAW_OUT; + if ( pItem->mnBits & SIB_IN ) + nStyle = FRAME_DRAW_IN; + else + nStyle = FRAME_DRAW_OUT; + + DecorationView aDecoView( this ); + aDecoView.DrawFrame( aRect, nStyle ); + } + } + else if( nPos != ImplGetFirstVisiblePos() ) + { + // draw separator + Point aFrom( aRect.TopLeft() ); + aFrom.X()--; + aFrom.Y()++; + Point aTo( aRect.BottomLeft() ); + aTo.X()--; + aTo.Y()--; - DecorationView aDecoView( this ); - aDecoView.DrawFrame( aRect, nStyle ); + DecorationView aDecoView( this ); + aDecoView.DrawSeparator( aFrom, aTo ); + } } if ( !ImplIsRecordLayout() ) @@ -693,8 +731,6 @@ void StatusBar::ImplCalcProgressRect() } if( ! bNativeOK ) maPrgsTxtPos.Y() = mnTextY; - - } // ----------------------------------------------------------------------- @@ -1699,7 +1735,8 @@ Size StatusBar::CalcWindowSizePixel() const } } - if( pThis->IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) ) + if( mpImplData->mbDrawItemFrames && + pThis->IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) ) { ImplControlValue aControlValue( FRAME_DRAW_NODRAW ); Region aBound, aContent; -- cgit v1.2.3 From 8786083eb9dabb0d7b328a217ba99a1d71493ad7 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 18 Jan 2010 16:29:56 +0100 Subject: sw33bf02: #i107437#: sax::Converter: support XMLSchema-2 "dateTime" better: reimplement convertDateOrDateTime() to parse all "dateTime" features. also fix serialization function to write leading zeros if year < 1000. --- sax/source/tools/converter.cxx | 437 +++++++++++++++++++++++++++++++++-------- 1 file changed, 356 insertions(+), 81 deletions(-) diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index e13df493628a..6eb66db984dd 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -962,8 +962,9 @@ readUnsignedNumber(const ::rtl::OUString & rString, { bool bOverflow(false); sal_Int32 nTemp(0); + sal_Int32 nPos(io_rnPos); - for (sal_Int32 nPos = io_rnPos; (nPos < rString.getLength()); ++nPos) + while (nPos < rString.getLength()) { const sal_Unicode c = rString[nPos]; if ((sal_Unicode('0') <= c) && (c <= sal_Unicode('9'))) @@ -977,25 +978,20 @@ readUnsignedNumber(const ::rtl::OUString & rString, } else { - if (io_rnPos != nPos) // read something? - { - io_rnPos = nPos; - if (bOverflow) - { - return R_OVERFLOW; - } - else - { - o_rNumber = nTemp; - return R_SUCCESS; - } - } - else break; + break; } + ++nPos; + } + + if (io_rnPos == nPos) // read something? + { + o_rNumber = -1; + return R_NOTHING; } - o_rNumber = -1; - return R_NOTHING; + io_rnPos = nPos; + o_rNumber = nTemp; + return (bOverflow) ? R_OVERFLOW : R_SUCCESS; } static bool @@ -1288,6 +1284,15 @@ void Converter::convertDateTime( const sal_Unicode zero('0'); const sal_Unicode tee ('T'); + if (i_rDateTime.Year < 1000) { + i_rBuffer.append(zero); + } + if (i_rDateTime.Year < 100) { + i_rBuffer.append(zero); + } + if (i_rDateTime.Year < 10) { + i_rBuffer.append(zero); + } i_rBuffer.append( static_cast(i_rDateTime.Year) ).append(dash); if( i_rDateTime.Month < 10 ) { i_rBuffer.append(zero); @@ -1355,6 +1360,46 @@ bool Converter::convertDateTime( util::DateTime& rDateTime, } } +static bool +readDateTimeComponent(const ::rtl::OUString & rString, + sal_Int32 & io_rnPos, sal_Int32 & o_rnTarget, + const sal_Int32 nMinLength, const bool bExactLength) +{ + const sal_Int32 nOldPos(io_rnPos); + sal_Int32 nTemp(0); + if (R_SUCCESS != readUnsignedNumber(rString, io_rnPos, nTemp)) + { + return false; + } + const sal_Int32 nTokenLength(io_rnPos - nOldPos); + if ((nTokenLength < nMinLength) || + (bExactLength && (nTokenLength > nMinLength))) + { + return false; // bad length + } + o_rnTarget = nTemp; + return true; +} + +static bool lcl_isLeapYear(const sal_uInt32 nYear) +{ + return ((nYear % 4) == 0) + && !(((nYear % 100) == 0) || ((nYear % 400) == 0)); +} + +static sal_uInt16 +lcl_MaxDaysPerMonth(const sal_Int32 nMonth, const sal_Int32 nYear) +{ + static sal_uInt16 s_MaxDaysPerMonth[12] = + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + OSL_ASSERT(0 < nMonth && nMonth <= 12); + if ((2 == nMonth) && lcl_isLeapYear(nYear)) + { + return 29; + } + return s_MaxDaysPerMonth[nMonth - 1]; +} + /** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */ bool Converter::convertDateOrDateTime( util::Date & rDate, util::DateTime & rDateTime, @@ -1362,97 +1407,233 @@ bool Converter::convertDateOrDateTime( { bool bSuccess = true; - rtl::OUString aDateStr, aTimeStr, sDoubleStr; - sal_Int32 nPos = rString.indexOf( (sal_Unicode) 'T' ); - sal_Int32 nPos2 = rString.indexOf( (sal_Unicode) ',' ); - if (nPos2 < 0) - nPos2 = rString.indexOf( (sal_Unicode) '.' ); - if ( nPos >= 0 ) + const ::rtl::OUString string = rString.trim().toAsciiUpperCase(); + sal_Int32 nPos(0); + bool bNegative(false); + if ((string.getLength() > nPos) && (sal_Unicode('-') == string[nPos])) { - aDateStr = rString.copy( 0, nPos ); - if ( nPos2 >= 0 ) - { - aTimeStr = rString.copy( nPos + 1, nPos2 - nPos - 1 ); - sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.")); - sDoubleStr += rString.copy( nPos2 + 1 ); - } - else - { - aTimeStr = rString.copy(nPos + 1); - sDoubleStr = OUString(RTL_CONSTASCII_USTRINGPARAM("0.0")); - } + ++nPos; + bNegative = true; } - else - aDateStr = rString; // no separator: only date part - sal_Int32 nYear = 1899; - sal_Int32 nMonth = 12; - sal_Int32 nDay = 30; - sal_Int32 nHour = 0; - sal_Int32 nMin = 0; - sal_Int32 nSec = 0; + sal_Int32 nYear(0); + { + bSuccess = readDateTimeComponent(string, nPos, nYear, 4, false); + bSuccess &= (0 < nYear); + bSuccess &= (nPos < string.getLength()); // not last token + } + if (bSuccess && (sal_Unicode('-') != string[nPos])) // separator + { + bSuccess = false; + } + if (bSuccess) + { + ++nPos; + } - const sal_Unicode* pStr = aDateStr.getStr(); - sal_Int32 nDateTokens = 1; - while ( *pStr ) + sal_Int32 nMonth(0); + if (bSuccess) { - if ( *pStr == '-' ) - nDateTokens++; - pStr++; + bSuccess = readDateTimeComponent(string, nPos, nMonth, 2, true); + bSuccess &= (0 < nMonth) && (nMonth <= 12); + bSuccess &= (nPos < string.getLength()); // not last token } - if ( nDateTokens > 3 || aDateStr.getLength() == 0 ) + if (bSuccess && (sal_Unicode('-') != string[nPos])) // separator + { bSuccess = false; - else + } + if (bSuccess) { - sal_Int32 n = 0; - if ( !convertNumber( nYear, aDateStr.getToken( 0, '-', n ), 0, 9999 ) ) + ++nPos; + } + + sal_Int32 nDay(0); + if (bSuccess) + { + bSuccess = readDateTimeComponent(string, nPos, nDay, 2, true); + bSuccess &= (0 < nDay) && (nDay <= lcl_MaxDaysPerMonth(nMonth, nYear)); + } + + bool bHaveTime(false); + if (bSuccess && (nPos < string.getLength())) + { + if (sal_Unicode('T') == string[nPos]) // time separator + { + bHaveTime = true; + ++nPos; + } + } + + sal_Int32 nHours(0); + sal_Int32 nMinutes(0); + sal_Int32 nSeconds(0); + sal_Int32 nMilliSeconds(0); + if (bSuccess && bHaveTime) + { + { + bSuccess = readDateTimeComponent(string, nPos, nHours, 2, true); + bSuccess &= (0 <= nHours) && (nHours <= 24); + bSuccess &= (nPos < string.getLength()); // not last token + } + if (bSuccess && (sal_Unicode(':') != string[nPos])) // separator + { bSuccess = false; - if ( nDateTokens >= 2 ) - if ( !convertNumber( nMonth, aDateStr.getToken( 0, '-', n ), 0, 12 ) ) - bSuccess = false; - if ( nDateTokens >= 3 ) - if ( !convertNumber( nDay, aDateStr.getToken( 0, '-', n ), 0, 31 ) ) + } + if (bSuccess) + { + ++nPos; + } + + if (bSuccess) + { + bSuccess = readDateTimeComponent(string, nPos, nMinutes, 2, true); + bSuccess &= (0 <= nMinutes) && (nMinutes < 60); + bSuccess &= (nPos < string.getLength()); // not last token + } + if (bSuccess && (sal_Unicode(':') != string[nPos])) // separator + { + bSuccess = false; + } + if (bSuccess) + { + ++nPos; + } + + if (bSuccess) + { + bSuccess = readDateTimeComponent(string, nPos, nSeconds, 2, true); + bSuccess &= (0 <= nSeconds) && (nSeconds < 60); + } + if (bSuccess && (nPos < string.getLength()) && + (sal_Unicode('.') == string[nPos])) // fraction separator + { + ++nPos; + const sal_Int32 nStart(nPos); + sal_Int32 nTemp(0); + if (R_NOTHING == readUnsignedNumber(string, nPos, nTemp)) + { bSuccess = false; + } + if (bSuccess) + { + // cannot use nTemp because of possible leading zeros + // and possible overflow => read digits directly + const sal_Int32 nDigits(nPos - nStart); + OSL_ENSURE(nDigits > 0, "bad code monkey"); + const sal_Unicode cZero('0'); + nMilliSeconds = 100 * (string[nStart] - cZero); + if (nDigits >= 2) + { + nMilliSeconds += 10 * (string[nStart+1] - cZero); + if (nDigits >= 3) + { + nMilliSeconds += (string[nStart+2] - cZero); + } + } + } + } + + if (bSuccess && (nHours == 24)) + { + if (!((0 == nMinutes) && (0 == nSeconds) && (0 == nMilliSeconds))) + { + bSuccess = false; // only 24:00:00 is valid + } +#if 0 + else + { + nHours = 0; // normalize 24:00:00 to 00:00:00 of next day + lcl_addDay(bNegative, nYear, nMonth, nDay, 1); + } +#endif + } } - if ( aTimeStr.getLength() > 0 ) // time is optional + bool bHaveTimezone(false); + bool bHaveTimezonePlus(false); + bool bHaveTimezoneMinus(false); + if (bSuccess && (nPos < string.getLength())) { - pStr = aTimeStr.getStr(); - sal_Int32 nTimeTokens = 1; - while ( *pStr ) + const sal_Unicode c(string[nPos]); + if (sal_Unicode('+') == c) { - if ( *pStr == ':' ) - nTimeTokens++; - pStr++; + bHaveTimezone = true; + bHaveTimezonePlus = true; + ++nPos; + } + else if (sal_Unicode('-') == c) + { + bHaveTimezone = true; + bHaveTimezoneMinus = true; + ++nPos; + } + else if (sal_Unicode('Z') == c) + { + bHaveTimezone = true; + ++nPos; } - if ( nTimeTokens > 3 ) - bSuccess = false; else { - sal_Int32 n = 0; - if ( !convertNumber( nHour, aTimeStr.getToken( 0, ':', n ), 0, 23 ) ) - bSuccess = false; - if ( nTimeTokens >= 2 ) - if ( !convertNumber( nMin, aTimeStr.getToken( 0, ':', n ), 0, 59 ) ) - bSuccess = false; - if ( nTimeTokens >= 3 ) - if ( !convertNumber( nSec, aTimeStr.getToken( 0, ':', n ), 0, 59 ) ) - bSuccess = false; + bSuccess = false; } } + sal_Int32 nTimezoneHours(0); + sal_Int32 nTimezoneMinutes(0); + if (bSuccess && (bHaveTimezonePlus || bHaveTimezoneMinus)) + { + bSuccess = readDateTimeComponent( + string, nPos, nTimezoneHours, 2, true); + bSuccess &= (0 <= nTimezoneHours) && (nTimezoneHours <= 14); + bSuccess &= (nPos < string.getLength()); // not last token + if (bSuccess && (sal_Unicode(':') != string[nPos])) // separator + { + bSuccess = false; + } + if (bSuccess) + { + ++nPos; + } + if (bSuccess) + { + bSuccess = readDateTimeComponent( + string, nPos, nTimezoneMinutes, 2, true); + bSuccess &= (0 <= nTimezoneMinutes) && (nTimezoneMinutes < 60); + } + if (bSuccess && (nTimezoneHours == 14)) + { + if (0 != nTimezoneMinutes) + { + bSuccess = false; // only +-14:00 is valid + } + } + } + + bSuccess &= (nPos == string.getLength()); // trailing junk? + + if (bSuccess && bHaveTimezone) + { + // util::DateTime does not support timezones! +#if 0 + // do not add timezone, just strip it (as suggested by er) + lcl_addTimezone(bNegative, nYear, nMonth, nDay, nHours, nMinutes, + !bHaveTimezoneMinus, nTimezoneHours, nTimezoneMinutes); +#endif + } if (bSuccess) { - if ( aTimeStr.getLength() > 0 ) // time is optional + if (bHaveTime) // time is optional { + // util::DateTime does not support negative years! rDateTime.Year = static_cast(nYear); rDateTime.Month = static_cast(nMonth); rDateTime.Day = static_cast(nDay); - rDateTime.Hours = static_cast(nHour); - rDateTime.Minutes = static_cast(nMin); - rDateTime.Seconds = static_cast(nSec); + rDateTime.Hours = static_cast(nHours); + rDateTime.Minutes = static_cast(nMinutes); + rDateTime.Seconds = static_cast(nSeconds); + // util::DateTime does not support 3 decimal digits of precision! rDateTime.HundredthSeconds = - static_cast((sDoubleStr).toDouble() * 100); + static_cast(nMilliSeconds / 10); rbDateTime = true; } else @@ -1466,6 +1647,100 @@ bool Converter::convertDateOrDateTime( return bSuccess; } +#if 0 +struct Test { + static bool eqDateTime(util::DateTime a, util::DateTime b) { + return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.HundredthSeconds == b.HundredthSeconds; + } + static void doTest(util::DateTime const & rdt, char const*const pis, + char const*const i_pos = 0) + { + char const*const pos((i_pos) ? i_pos : pis); + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + util::DateTime odt; + bool bSuccess( Converter::convertDateTime(odt, is) ); + OSL_TRACE("Y:%d M:%d D:%d H:%d M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + OSL_ASSERT(bSuccess); + OSL_ASSERT(eqDateTime(rdt, odt)); + ::rtl::OUStringBuffer buf; + Converter::convertDateTime(buf, odt, true); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); + } + static void doTestF(const char * pis) + { + util::DateTime odt; + bool bSuccess = Converter::convertDateTime(odt, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("Y:%d M:%d D:%d H:%dH M:%d S:%d H:%d", + odt.Year, odt.Month, odt.Day, + odt.Hours, odt.Minutes, odt.Seconds, odt.HundredthSeconds); + OSL_ASSERT(!bSuccess); + } + Test() { + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00Z", "0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00" ); +// doTest( util::DateTime(0, 0, 0, 0, 1, 1, -1), "-0001-01-01T00:00:00Z" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00-00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 1, 1, 1), + "0001-01-01T00:00:00+00:00", "0001-01-01T00:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 2, 1, 1)*/, + "0001-01-02T00:00:00-12:00", "0001-01-02T00:00:00" ); +// "0001-02-01T12:00:00" ); + doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, + "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); +// "0001-01-01T12:00:00" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", + "9999-12-31T23:59:59.99" ); + doTest( util::DateTime(0, 0, 0, 24, 1, 1, 333) + /*(0, 0, 0, 0, 2, 1, 333)*/, + "0333-01-01T24:00:00"/*, "0333-01-02T00:00:00"*/ ); + doTestF( "+0001-01-01T00:00:00" ); // invalid: ^+ + doTestF( "1-01-01T00:00:00" ); // invalid: < 4 Y + doTestF( "0001-1-01T00:00:00" ); // invalid: < 2 M + doTestF( "0001-01-1T00:00:00" ); // invalid: < 2 D + doTestF( "0001-01-01T0:00:00" ); // invalid: < 2 H + doTestF( "0001-01-01T00:0:00" ); // invalid: < 2 M + doTestF( "0001-01-01T00:00:0" ); // invalid: < 2 S + doTestF( "0001-01-01T00:00:00." ); // invalid: .$ + doTestF( "0001-01-01T00:00:00+1:00" ); // invalid: < 2 TZ H + doTestF( "0001-01-01T00:00:00+00:1" ); // invalid: < 2 TZ M + doTestF( "0001-13-01T00:00:00" ); // invalid: M > 12 + doTestF( "0001-01-32T00:00:00" ); // invalid: D > 31 + doTestF( "0001-01-01T25:00:00" ); // invalid: H > 24 + doTestF( "0001-01-01T00:60:00" ); // invalid: H > 59 + doTestF( "0001-01-01T00:00:60" ); // invalid: S > 59 + doTestF( "0001-01-01T24:01:00" ); // invalid: H=24, but M != 0 + doTestF( "0001-01-01T24:00:01" ); // invalid: H=24, but S != 0 + doTestF( "0001-01-01T24:00:00.1" ); // invalid: H=24, but H != 0 + doTestF( "0001-01-02T00:00:00+15:00" ); // invalid: TZ > +14:00 + doTestF( "0001-01-02T00:00:00+14:01" ); // invalid: TZ > +14:00 + doTestF( "0001-01-02T00:00:00-15:00" ); // invalid: TZ < -14:00 + doTestF( "0001-01-02T00:00:00-14:01" ); // invalid: TZ < -14:00 + OSL_TRACE("\nSAX CONVERTER TEST END\n"); + } +}; +static Test test; +#endif + /** gets the position of the first comma after npos in the string rStr. Commas inside '"' pairs are not matched */ sal_Int32 Converter::indexOfComma( const OUString& rStr, -- cgit v1.2.3 From 3a3e1de2594a410a85e5967c90f53557fa754271 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Jan 2010 16:48:52 +0100 Subject: sw33bf02: #i108347#: change util::Duration to support MilliSeconds: SfxDocumentMetaData: adapt. dinfdlg.src: adapt dialog to milliseconds. sax::Converter: adapt. sax::Converter::convertDuration(): fix a bug in parsing fractional seconds. --- sax/source/tools/converter.cxx | 143 +++++++++++++++++++++++++---------------- 1 file changed, 87 insertions(+), 56 deletions(-) diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 6eb66db984dd..b9604efde389 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -912,10 +912,10 @@ void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, rBuffer.append(static_cast(rDuration.Days)); rBuffer.append(sal_Unicode('D')); } - const sal_Int32 nHSecs(static_cast(rDuration.Seconds) - + static_cast(rDuration.HundredthSeconds)); + const sal_Int32 nMSecs(static_cast(rDuration.Seconds) + + static_cast(rDuration.MilliSeconds)); if (static_cast(rDuration.Hours) + - static_cast(rDuration.Minutes) + nHSecs) + static_cast(rDuration.Minutes) + nMSecs) { rBuffer.append(sal_Unicode('T')); // time separator if (rDuration.Hours) @@ -928,20 +928,37 @@ void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, rBuffer.append(static_cast(rDuration.Minutes)); rBuffer.append(sal_Unicode('M')); } - if (nHSecs) + if (nMSecs) { // seconds must not be omitted (i.e. ".42S" is not valid) rBuffer.append(static_cast(rDuration.Seconds)); - if (rDuration.HundredthSeconds) + if (rDuration.MilliSeconds) { rBuffer.append(sal_Unicode('.')); - const sal_Int32 nHundredthSeconds( - rDuration.HundredthSeconds % 100); - if (nHundredthSeconds < 10) + const sal_Int32 nMilliSeconds(rDuration.MilliSeconds % 1000); + if (nMilliSeconds < 100) { rBuffer.append(sal_Unicode('0')); } - rBuffer.append(nHundredthSeconds); + if (nMilliSeconds < 10) + { + rBuffer.append(sal_Unicode('0')); + } + if (0 == (nMilliSeconds % 10)) + { + if (0 == (nMilliSeconds % 100)) + { + rBuffer.append(nMilliSeconds / 100); + } + else + { + rBuffer.append(nMilliSeconds / 10); + } + } + else + { + rBuffer.append(nMilliSeconds); + } } rBuffer.append(sal_Unicode('S')); } @@ -1068,7 +1085,7 @@ bool Converter::convertDuration(util::Duration& rDuration, sal_Int32 nHours(0); sal_Int32 nMinutes(0); sal_Int32 nSeconds(0); - sal_Int32 nHundredthSeconds(0); + sal_Int32 nMilliSeconds(0); bTimePart = readDurationT(string, nPos); bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); @@ -1122,30 +1139,39 @@ bool Converter::convertDuration(util::Duration& rDuration, nTemp = -1; const sal_Int32 nStart(nPos); bSuccess = - (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + (R_NOTHING != readUnsignedNumber(string, nPos, nTemp)); if ((nPos < string.getLength()) && bSuccess) { - if (sal_Unicode('S') == string[nPos]) + if (-1 != nTemp) { - ++nPos; - if (-1 != nTemp) + nTemp = -1; + const sal_Int32 nDigits = nPos - nStart; + OSL_ENSURE(nDigits > 0, "bad code monkey"); + const sal_Unicode cZero('0'); + nMilliSeconds = 100 * (string[nStart] - cZero); + if (nDigits >= 2) { - nTemp = -1; - const sal_Int32 nDigits = nPos - nStart; - OSL_ENSURE(nDigits > 0, "bad code monkey"); - nHundredthSeconds = 10 * - (string[nStart] - sal_Unicode('0')); - if (nDigits >= 2) + nMilliSeconds += 10 * + (string[nStart+1] - cZero); + if (nDigits >= 3) { - nHundredthSeconds += - (string[nStart+1] - sal_Unicode('0')); + nMilliSeconds += (string[nStart+2] - cZero); } } + + if (sal_Unicode('S') == string[nPos]) + { + ++nPos; + } else { bSuccess = false; } } + else + { + bSuccess = false; + } } } else @@ -1181,14 +1207,14 @@ bool Converter::convertDuration(util::Duration& rDuration, if (bSuccess) { - rDuration.Negative = bIsNegativeDuration; - rDuration.Years = static_cast(nYears); - rDuration.Months = static_cast(nMonths); - rDuration.Days = static_cast(nDays); - rDuration.Hours = static_cast(nHours); - rDuration.Minutes = static_cast(nMinutes); - rDuration.Seconds = static_cast(nSeconds); - rDuration.HundredthSeconds = static_cast(nHundredthSeconds); + rDuration.Negative = bIsNegativeDuration; + rDuration.Years = static_cast(nYears); + rDuration.Months = static_cast(nMonths); + rDuration.Days = static_cast(nDays); + rDuration.Hours = static_cast(nHours); + rDuration.Minutes = static_cast(nMinutes); + rDuration.Seconds = static_cast(nSeconds); + rDuration.MilliSeconds = static_cast(nMilliSeconds); } return bSuccess; @@ -1201,24 +1227,26 @@ struct Test { return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days && a.Hours == b.Hours && a.Minutes == b.Minutes && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds + && a.MilliSeconds == b.MilliSeconds && a.Negative == b.Negative; } - static void doTest(util::Duration const & rid, const char * pis) + static void doTest(util::Duration const & rid, char const*const pis, + char const*const i_pos = 0) { - bool bSuccess(false); - ::rtl::OUStringBuffer buf; - Converter::convertDuration(buf, rid); - ::rtl::OUString os(buf.makeStringAndClear()); - OSL_TRACE(::rtl::OUStringToOString(os.getStr(), RTL_TEXTENCODING_UTF8)); - OSL_ASSERT(os.equalsAscii(pis)); + char const*const pos((i_pos) ? i_pos : pis); util::Duration od; - bSuccess = Converter::convertDuration(od, os); - OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + ::rtl::OUString is(::rtl::OUString::createFromAscii(pis)); + bool bSuccess = Converter::convertDuration(od, is); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dm", od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); OSL_ASSERT(bSuccess); OSL_ASSERT(eqDuration(rid, od)); + ::rtl::OUStringBuffer buf; + Converter::convertDuration(buf, od); + OSL_TRACE( + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); } static void doTestF(const char * pis) { @@ -1227,7 +1255,7 @@ struct Test { ::rtl::OUString::createFromAscii(pis)); OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", od.Negative, od.Years, od.Months, od.Days, - od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + od.Hours, od.Minutes, od.Seconds, od.MilliSeconds); OSL_ASSERT(!bSuccess); } Test() { @@ -1238,24 +1266,27 @@ struct Test { doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 19), "PT0.19S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.09S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), + "PT9.999999999999999999999999999999S", "PT9.999S" ); doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); - doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 1), + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), "-P7Y6M5DT4H3M2.01S" ); doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); - doTestF("1Y1M"); - doTestF("P-1Y1M"); - doTestF("P1M1Y"); - doTestF("PT1Y"); - doTestF("P1Y1M1M"); - doTestF("P1YT1MT1M"); - doTestF("P1YT"); - doTestF("P99999999999Y"); - doTestF("PT.1S"); - doTestF("PT5M.134S"); - doTestF("PT1.S"); + doTestF("1Y1M"); // invalid: no ^P + doTestF("P-1Y1M"); // invalid: - after P + doTestF("P1M1Y"); // invalid: Y after M + doTestF("PT1Y"); // invalid: Y after T + doTestF("P1Y1M1M"); // invalid: M twice, no T + doTestF("P1YT1MT1M"); // invalid: T twice + doTestF("P1YT"); // invalid: T but no H,M,S + doTestF("P99999999999Y"); // cannot parse so many Ys + doTestF("PT.1S"); // invalid: no 0 preceding . + doTestF("PT5M.134S"); // invalid: no 0 preceding . + doTestF("PT1.S"); // invalid: no digit following . OSL_TRACE("\nSAX CONVERTER TEST END\n"); } }; -- cgit v1.2.3 From a334752d091f61781a0ece7f5331aaf44a0e0516 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 19 Jan 2010 18:33:02 +0100 Subject: vcl109: #i65128# avoid breaking polygonal clip regions into rectangles in PDF export --- vcl/inc/vcl/outdev.hxx | 23 ++++ vcl/inc/vcl/pdfwriter.hxx | 5 +- vcl/inc/vcl/region.hxx | 4 + vcl/source/gdi/outmap.cxx | 210 ++++++++++++++++++++++++++++++++ vcl/source/gdi/pdfextoutdevdata.cxx | 15 ++- vcl/source/gdi/pdfwriter.cxx | 4 +- vcl/source/gdi/pdfwriter_impl.cxx | 231 ++++++++++++++++++++++++++---------- vcl/source/gdi/pdfwriter_impl.hxx | 45 ++++--- vcl/source/gdi/region.cxx | 27 +++++ 9 files changed, 472 insertions(+), 92 deletions(-) diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 1e1f784f0f49..cff866d39459 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -931,6 +931,10 @@ public: basegfx::B2DHomMatrix GetViewTransformation() const; basegfx::B2DHomMatrix GetInverseViewTransformation() const; + basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const; + basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const; + + /** Set an offset in pixel This method offsets every drawing operation that converts its @@ -967,7 +971,9 @@ public: Size LogicToPixel( const Size& rLogicSize ) const; Rectangle LogicToPixel( const Rectangle& rLogicRect ) const; Polygon LogicToPixel( const Polygon& rLogicPoly ) const; + basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPolyPoly ) const; PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly ) const; + basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const; Region LogicToPixel( const Region& rLogicRegion )const; Point LogicToPixel( const Point& rLogicPt, const MapMode& rMapMode ) const; @@ -977,15 +983,21 @@ public: const MapMode& rMapMode ) const; Polygon LogicToPixel( const Polygon& rLogicPoly, const MapMode& rMapMode ) const; + basegfx::B2DPolygon LogicToPixel( const basegfx::B2DPolygon& rLogicPoly, + const MapMode& rMapMode ) const; PolyPolygon LogicToPixel( const PolyPolygon& rLogicPolyPoly, const MapMode& rMapMode ) const; + basegfx::B2DPolyPolygon LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode ) const; Region LogicToPixel( const Region& rLogicRegion, const MapMode& rMapMode ) const; Point PixelToLogic( const Point& rDevicePt ) const; Size PixelToLogic( const Size& rDeviceSize ) const; Rectangle PixelToLogic( const Rectangle& rDeviceRect ) const; Polygon PixelToLogic( const Polygon& rDevicePoly ) const; + basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly ) const; PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly ) const; + basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly ) const; Region PixelToLogic( const Region& rDeviceRegion ) const; Point PixelToLogic( const Point& rDevicePt, const MapMode& rMapMode ) const; @@ -995,8 +1007,12 @@ public: const MapMode& rMapMode ) const; Polygon PixelToLogic( const Polygon& rDevicePoly, const MapMode& rMapMode ) const; + basegfx::B2DPolygon PixelToLogic( const basegfx::B2DPolygon& rDevicePoly, + const MapMode& rMapMode ) const; PolyPolygon PixelToLogic( const PolyPolygon& rDevicePolyPoly, const MapMode& rMapMode ) const; + basegfx::B2DPolyPolygon PixelToLogic( const basegfx::B2DPolyPolygon& rDevicePolyPoly, + const MapMode& rMapMode ) const; Region PixelToLogic( const Region& rDeviceRegion, const MapMode& rMapMode ) const; @@ -1026,6 +1042,13 @@ public: MapUnit eUnitSource, MapUnit eUnitDest ); + static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + Size GetOutputSizePixel() const { return Size( mnOutWidth, mnOutHeight ); } long GetOutputWidthPixel() const { return mnOutWidth; } diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index dbfaf9eda18d..275478d30549 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -50,7 +50,6 @@ class Font; class Point; class OutputDevice; -class Region; class MapMode; class Polygon; class LineInfo; @@ -674,10 +673,10 @@ The following structure describes the permissions used in PDF security void Pop(); void SetClipRegion(); - void SetClipRegion( const Region& rRegion ); + void SetClipRegion( const basegfx::B2DPolyPolygon& rRegion ); void MoveClipRegion( long nHorzMove, long nVertMove ); void IntersectClipRegion( const Rectangle& rRect ); - void IntersectClipRegion( const Region& rRegion ); + void IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ); void SetAntialiasing( USHORT nMode = 0 ); diff --git a/vcl/inc/vcl/region.hxx b/vcl/inc/vcl/region.hxx index 8c1ed78b154f..68ed321fff2e 100644 --- a/vcl/inc/vcl/region.hxx +++ b/vcl/inc/vcl/region.hxx @@ -116,7 +116,11 @@ public: BOOL HasPolyPolygon() const; PolyPolygon GetPolyPolygon() const; + // returns an empty polypolygon in case HasPolyPolygon is FALSE const basegfx::B2DPolyPolygon GetB2DPolyPolygon() const; + // returns a PolyPolygon either copied from the set PolyPolygon region + // or created from the constituent rectangles + basegfx::B2DPolyPolygon ConvertToB2DPolyPolygon(); ULONG GetRectCount() const; RegionHandle BeginEnumRects(); diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index dfa346dbab05..686f10da4b4d 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #define USE_64BIT_INTS @@ -1100,6 +1101,41 @@ basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation() const // ----------------------------------------------------------------------- +// #i75163# +basegfx::B2DHomMatrix OutputDevice::GetViewTransformation( const MapMode& rMapMode ) const +{ + // #i82615# + ImplMapRes aMapRes; + ImplThresholdRes aThresRes; + ImplCalcMapResolution( rMapMode, mnDPIX, mnDPIY, aMapRes, aThresRes ); + + basegfx::B2DHomMatrix aTransform; + + const double fScaleFactorX((double)mnDPIX * (double)aMapRes.mnMapScNumX / (double)aMapRes.mnMapScDenomX); + const double fScaleFactorY((double)mnDPIY * (double)aMapRes.mnMapScNumY / (double)aMapRes.mnMapScDenomY); + const double fZeroPointX(((double)aMapRes.mnMapOfsX * fScaleFactorX) + (double)mnOutOffOrigX); + const double fZeroPointY(((double)aMapRes.mnMapOfsY * fScaleFactorY) + (double)mnOutOffOrigY); + + aTransform.set(0, 0, fScaleFactorX); + aTransform.set(1, 1, fScaleFactorY); + aTransform.set(0, 2, fZeroPointX); + aTransform.set(1, 2, fZeroPointY); + + return aTransform; +} + +// ----------------------------------------------------------------------- + +// #i75163# +basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation( const MapMode& rMapMode ) const +{ + basegfx::B2DHomMatrix aMatrix( GetViewTransformation( rMapMode ) ); + aMatrix.invert(); + return aMatrix; +} + +// ----------------------------------------------------------------------- + basegfx::B2DHomMatrix OutputDevice::ImplGetDeviceTransformation() const { basegfx::B2DHomMatrix aTransformation = GetViewTransformation(); @@ -1221,6 +1257,26 @@ PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly ) cons // ----------------------------------------------------------------------- +basegfx::B2DPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolygon& rLogicPoly ) const +{ + basegfx::B2DPolygon aTransformedPoly = rLogicPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation(); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolyPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const +{ + basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation(); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + Region OutputDevice::LogicToPixel( const Region& rLogicRegion ) const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -1405,6 +1461,28 @@ PolyPolygon OutputDevice::LogicToPixel( const PolyPolygon& rLogicPolyPoly, // ----------------------------------------------------------------------- +basegfx::B2DPolyPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly, + const MapMode& rMapMode ) const +{ + basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation( rMapMode ); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolygon& rLogicPoly, + const MapMode& rMapMode ) const +{ + basegfx::B2DPolygon aTransformedPoly = rLogicPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetViewTransformation( rMapMode ); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + Region OutputDevice::LogicToPixel( const Region& rLogicRegion, const MapMode& rMapMode ) const { @@ -1556,6 +1634,26 @@ PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly ) con // ----------------------------------------------------------------------- +basegfx::B2DPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolygon& rPixelPoly ) const +{ + basegfx::B2DPolygon aTransformedPoly = rPixelPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation(); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygon& rPixelPolyPoly ) const +{ + basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation(); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + Region OutputDevice::PixelToLogic( const Region& rDeviceRegion ) const { DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -1735,6 +1833,28 @@ PolyPolygon OutputDevice::PixelToLogic( const PolyPolygon& rDevicePolyPoly, // ----------------------------------------------------------------------- +basegfx::B2DPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolygon& rPixelPoly, + const MapMode& rMapMode ) const +{ + basegfx::B2DPolygon aTransformedPoly = rPixelPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode ); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygon& rPixelPolyPoly, + const MapMode& rMapMode ) const +{ + basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly; + const ::basegfx::B2DHomMatrix& rTransformationMatrix = GetInverseViewTransformation( rMapMode ); + aTransformedPoly.transform( rTransformationMatrix ); + return aTransformedPoly; +} + +// ----------------------------------------------------------------------- + Region OutputDevice::PixelToLogic( const Region& rDeviceRegion, const MapMode& rMapMode ) const { @@ -2162,6 +2282,96 @@ Size OutputDevice::LogicToLogic( const Size& rSzSource, // ----------------------------------------------------------------------- +basegfx::B2DPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolygon& rPolySource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ) +{ + if ( rMapModeSource == rMapModeDest ) + return rPolySource; + + MapUnit eUnitSource = rMapModeSource.GetMapUnit(); + MapUnit eUnitDest = rMapModeDest.GetMapUnit(); + ENTER2( eUnitSource, eUnitDest ); + + basegfx::B2DHomMatrix aTransform; + + if ( rMapModeSource.mpImplMapMode->mbSimple && + rMapModeDest.mpImplMapMode->mbSimple ) + { + ENTER3( eUnitSource, eUnitDest ); + + const double fScaleFactor((double)nNumerator / (double)nDenominator); + aTransform.set(0, 0, fScaleFactor); + aTransform.set(1, 1, fScaleFactor); + } + else + { + ENTER4( rMapModeSource, rMapModeDest ); + + const double fScaleFactorX( (double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) + / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)) ); + const double fScaleFactorY( (double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) + / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)) ); + const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX)); + const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY)); + + aTransform.set(0, 0, fScaleFactorX); + aTransform.set(1, 1, fScaleFactorY); + aTransform.set(0, 2, fZeroPointX); + aTransform.set(1, 2, fZeroPointY); + } + basegfx::B2DPolygon aPoly( rPolySource ); + aPoly.transform( aTransform ); + return aPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolyPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolyPolygon& rPolySource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ) +{ + if ( rMapModeSource == rMapModeDest ) + return rPolySource; + + MapUnit eUnitSource = rMapModeSource.GetMapUnit(); + MapUnit eUnitDest = rMapModeDest.GetMapUnit(); + ENTER2( eUnitSource, eUnitDest ); + + basegfx::B2DHomMatrix aTransform; + + if ( rMapModeSource.mpImplMapMode->mbSimple && + rMapModeDest.mpImplMapMode->mbSimple ) + { + ENTER3( eUnitSource, eUnitDest ); + + const double fScaleFactor((double)nNumerator / (double)nDenominator); + aTransform.set(0, 0, fScaleFactor); + aTransform.set(1, 1, fScaleFactor); + } + else + { + ENTER4( rMapModeSource, rMapModeDest ); + + const double fScaleFactorX( (double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) + / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)) ); + const double fScaleFactorY( (double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) + / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)) ); + const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX)); + const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY)); + + aTransform.set(0, 0, fScaleFactorX); + aTransform.set(1, 1, fScaleFactorY); + aTransform.set(0, 2, fZeroPointX); + aTransform.set(1, 2, fZeroPointY); + } + basegfx::B2DPolyPolygon aPoly( rPolySource ); + aPoly.transform( aTransform ); + return aPoly; +} + +// ----------------------------------------------------------------------- + Rectangle OutputDevice::LogicToLogic( const Rectangle& rRectSource, const MapMode& rMapModeSource, const MapMode& rMapModeDest ) diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 9c8c1ec1bf5e..42071c2f4c0e 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -30,10 +30,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include -#include -#include -#include +#include "vcl/pdfextoutdevdata.hxx" +#include "vcl/graph.hxx" +#include "vcl/outdev.hxx" +#include "vcl/gfxlink.hxx" +#include "basegfx/polygon/b2dpolygon.hxx" +#include "basegfx/polygon/b2dpolygontools.hxx" #include @@ -433,7 +435,10 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM if ( bClippingNeeded ) { rWriter.Push(); - rWriter.SetClipRegion( aVisibleOutputRect ); + basegfx::B2DPolyPolygon aRect( basegfx::tools::createPolygonFromRect( + basegfx::B2DRectangle( aVisibleOutputRect.Left(), aVisibleOutputRect.Top(), + aVisibleOutputRect.Right(), aVisibleOutputRect.Bottom() ) ) ); + rWriter.SetClipRegion( aRect); } Bitmap aMask; SvMemoryStream aTmp; diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 4959a505ec41..4e323015dbac 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -349,7 +349,7 @@ void PDFWriter::SetClipRegion() ((PDFWriterImpl*)pImplementation)->clearClipRegion(); } -void PDFWriter::SetClipRegion( const Region& rRegion ) +void PDFWriter::SetClipRegion( const basegfx::B2DPolyPolygon& rRegion ) { ((PDFWriterImpl*)pImplementation)->setClipRegion( rRegion ); } @@ -359,7 +359,7 @@ void PDFWriter::MoveClipRegion( long nHorzMove, long nVertMove ) ((PDFWriterImpl*)pImplementation)->moveClipRegion( nHorzMove, nVertMove ); } -void PDFWriter::IntersectClipRegion( const Region& rRegion ) +void PDFWriter::IntersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ) { ((PDFWriterImpl*)pImplementation)->intersectClipRegion( rRegion ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 4146f1764204..723f856cac4a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include #include @@ -117,7 +119,7 @@ void doTestCode() aDocInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) ); aDocInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) ); aWriter.SetDocInfo( aDocInfo ); - aWriter.NewPage(); + aWriter.NewPage( 595, 842 ); aWriter.BeginStructureElement( PDFWriter::Document ); // set duration of 3 sec for first page aWriter.SetAutoAdvanceTime( 3 ); @@ -168,7 +170,7 @@ void doTestCode() TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - aWriter.NewPage(); + aWriter.NewPage( 595, 842 ); // test AddStream interface aWriter.AddStream( String( RTL_CONSTASCII_USTRINGPARAM( "text/plain" ) ), new PDFTestOutputStream(), true ); // set transitional mode @@ -210,7 +212,25 @@ void doTestCode() aWriter.BeginStructureElement( PDFWriter::Caption ); aWriter.DrawText( Point( 4500, 9000 ), String( RTL_CONSTASCII_USTRINGPARAM( "Some drawing stuff inside the structure" ) ) ); aWriter.EndStructureElement(); + + // test clipping + basegfx::B2DPolyPolygon aClip; + basegfx::B2DPolygon aClipPoly; + aClipPoly.append( basegfx::B2DPoint( 8250, 9600 ) ); + aClipPoly.append( basegfx::B2DPoint( 16500, 11100 ) ); + aClipPoly.append( basegfx::B2DPoint( 8250, 12600 ) ); + aClipPoly.append( basegfx::B2DPoint( 4500, 11100 ) ); + aClipPoly.setClosed( true ); + //aClipPoly.flip(); + aClip.append( aClipPoly ); + + aWriter.Push( PUSH_CLIPREGION | PUSH_FILLCOLOR ); + aWriter.SetClipRegion( aClip ); + aWriter.DrawEllipse( Rectangle( Point( 4500, 9600 ), Size( 12000, 3000 ) ) ); + aWriter.MoveClipRegion( 1000, 500 ); + aWriter.SetFillColor( Color( COL_RED ) ); aWriter.DrawEllipse( Rectangle( Point( 4500, 9600 ), Size( 12000, 3000 ) ) ); + aWriter.Pop(); // test transparency // draw background Rectangle aTranspRect( Point( 7500, 13500 ), Size( 9000, 6000 ) ); @@ -290,7 +310,7 @@ void doTestCode() aLIPoly.Move( 1000, 1000 ); aWriter.DrawPolyLine( aLIPoly, aLI ); - aWriter.NewPage(); + aWriter.NewPage( 595, 842 ); aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); Wallpaper aWall( aTransMask ); aWall.SetStyle( WALLPAPER_TILE ); @@ -314,7 +334,7 @@ void doTestCode() aWriter.SetLineColor( Color( COL_LIGHTBLUE ) ); aWriter.DrawRect( aPolyRect ); - aWriter.NewPage(); + aWriter.NewPage( 595, 842 ); aWriter.SetMapMode( MapMode( MAP_100TH_MM ) ); aWriter.SetFont( Font( String( RTL_CONSTASCII_USTRINGPARAM( "Times" ) ), Size( 0, 500 ) ) ); aWriter.SetTextColor( Color( COL_BLACK ) ); @@ -722,7 +742,7 @@ static void appendFixedInt( sal_Int32 nValue, OStringBuffer& rBuffer, sal_Int32 // appends a double. PDF does not accept exponential format, only fixed point -static void appendDouble( double fValue, OStringBuffer& rBuffer, int nPrecision = 5 ) +static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrecision = 5 ) { bool bNeg = false; if( fValue < 0.0 ) @@ -1275,6 +1295,19 @@ void PDFWriterImpl::PDFPage::appendPoint( const Point& rPoint, OStringBuffer& rB appendFixedInt( nValue, rBuffer ); } +void PDFWriterImpl::PDFPage::appendPixelPoint( const basegfx::B2DPoint& rPoint, OStringBuffer& rBuffer ) const +{ + double fValue = pixelToPoint(rPoint.getX()); + + appendDouble( fValue, rBuffer, nLog10Divisor ); + + rBuffer.append( ' ' ); + + fValue = double(getHeight()) - pixelToPoint(rPoint.getY()); + + appendDouble( fValue, rBuffer, nLog10Divisor ); +} + void PDFWriterImpl::PDFPage::appendRect( const Rectangle& rRect, OStringBuffer& rBuffer ) const { appendPoint( rRect.BottomLeft() + Point( 0, 1 ), rBuffer ); @@ -1347,6 +1380,82 @@ void PDFWriterImpl::PDFPage::appendPolygon( const Polygon& rPoly, OStringBuffer& } } +void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OStringBuffer& rBuffer, bool bClose ) const +{ + basegfx::B2DPolygon aPoly( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, + m_pWriter->m_aMapMode, + m_pWriter->getReferenceDevice(), + rPoly ) ); + + if( basegfx::tools::isRectangle( aPoly ) ) + { + basegfx::B2DRange aRange( aPoly.getB2DRange() ); + basegfx::B2DPoint aBL( aRange.getMinX(), aRange.getMaxY() ); + appendPixelPoint( aBL, rBuffer ); + rBuffer.append( ' ' ); + appendMappedLength( aRange.getWidth(), rBuffer, false, NULL, nLog10Divisor ); + rBuffer.append( ' ' ); + appendMappedLength( aRange.getHeight(), rBuffer, true, NULL, nLog10Divisor ); + rBuffer.append( " re\n" ); + return; + } + sal_uInt32 nPoints = aPoly.count(); + if( nPoints > 0 ) + { + sal_uInt32 nBufLen = rBuffer.getLength(); + basegfx::B2DPoint aLastPoint( aPoly.getB2DPoint( 0 ) ); + appendPixelPoint( aLastPoint, rBuffer ); + rBuffer.append( " m\n" ); + for( sal_uInt32 i = 1; i <= nPoints; i++ ) + { + if( i != nPoints || aPoly.isClosed() ) + { + sal_uInt32 nCurPoint = i % nPoints; + sal_uInt32 nLastPoint = i-1; + basegfx::B2DPoint aPoint( aPoly.getB2DPoint( nCurPoint ) ); + if( aPoly.isNextControlPointUsed( nLastPoint ) && + aPoly.isPrevControlPointUsed( nCurPoint ) ) + { + appendPixelPoint( aPoly.getNextControlPoint( nLastPoint ), rBuffer ); + rBuffer.append( ' ' ); + appendPixelPoint( aPoly.getPrevControlPoint( nCurPoint ), rBuffer ); + rBuffer.append( ' ' ); + appendPixelPoint( aPoint, rBuffer ); + rBuffer.append( " c" ); + } + else if( aPoly.isNextControlPointUsed( nLastPoint ) ) + { + appendPixelPoint( aPoly.getNextControlPoint( nLastPoint ), rBuffer ); + rBuffer.append( ' ' ); + appendPixelPoint( aPoint, rBuffer ); + rBuffer.append( " y" ); + } + else if( aPoly.isPrevControlPointUsed( nCurPoint ) ) + { + appendPixelPoint( aPoly.getPrevControlPoint( nCurPoint ), rBuffer ); + rBuffer.append( ' ' ); + appendPixelPoint( aPoint, rBuffer ); + rBuffer.append( " v" ); + } + else + { + appendPixelPoint( aPoint, rBuffer ); + rBuffer.append( " l" ); + } + if( (rBuffer.getLength() - nBufLen) > 65 ) + { + rBuffer.append( "\n" ); + nBufLen = rBuffer.getLength(); + } + else + rBuffer.append( " " ); + } + } + if( bClose ) + rBuffer.append( "h\n" ); + } +} + void PDFWriterImpl::PDFPage::appendPolyPolygon( const PolyPolygon& rPolyPoly, OStringBuffer& rBuffer, bool bClose ) const { USHORT nPolygons = rPolyPoly.Count(); @@ -1354,6 +1463,13 @@ void PDFWriterImpl::PDFPage::appendPolyPolygon( const PolyPolygon& rPolyPoly, OS appendPolygon( rPolyPoly[n], rBuffer, bClose ); } +void PDFWriterImpl::PDFPage::appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, OStringBuffer& rBuffer, bool bClose ) const +{ + sal_uInt32 nPolygons = rPolyPoly.count(); + for( sal_uInt32 n = 0; n < nPolygons; n++ ) + appendPolygon( rPolyPoly.getB2DPolygon( n ), rBuffer, bClose ); +} + void PDFWriterImpl::PDFPage::appendMappedLength( sal_Int32 nLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32* pOutLength ) const { sal_Int32 nValue = nLength; @@ -1373,7 +1489,7 @@ void PDFWriterImpl::PDFPage::appendMappedLength( sal_Int32 nLength, OStringBuffe appendFixedInt( nValue, rBuffer, 1 ); } -void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32* pOutLength ) const +void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32* pOutLength, sal_Int32 nPrecision ) const { Size aSize( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, m_pWriter->m_aMapMode, @@ -1382,7 +1498,7 @@ void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& if( pOutLength ) *pOutLength = (sal_Int32)(fLength*(double)(bVertical ? aSize.Height() : aSize.Width())/1000.0); fLength *= pixelToPoint((double)(bVertical ? aSize.Height() : aSize.Width()) / 1000.0); - appendDouble( fLength, rBuffer ); + appendDouble( fLength, rBuffer, nPrecision ); } bool PDFWriterImpl::PDFPage::appendLineInfo( const LineInfo& rInfo, OStringBuffer& rBuffer ) const @@ -8257,7 +8373,7 @@ void PDFWriterImpl::beginRedirect( SvStream* pStream, const Rectangle& rTargetRe { push( PUSH_ALL ); - setClipRegion( Region() ); + clearClipRegion(); updateGraphicsState(); m_aOutputStreams.push_front( StreamRedirect() ); @@ -10194,25 +10310,17 @@ void PDFWriterImpl::updateGraphicsState() { rNewState.m_nUpdateFlags &= ~GraphicsState::updateClipRegion; - Region& rNewClip = rNewState.m_aClipRegion; - - /* #103137# equality operator is not implemented - * const as API promises but may change Region - * from Polygon to rectangles. Arrrgghh !!!! - */ - Region aLeft = m_aCurrentPDFState.m_aClipRegion; - Region aRight = rNewClip; - if( aLeft != aRight ) + if( m_aCurrentPDFState.m_bClipRegion != rNewState.m_bClipRegion || + ( rNewState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion != rNewState.m_aClipRegion ) ) { - if( ! m_aCurrentPDFState.m_aClipRegion.IsEmpty() && - ! m_aCurrentPDFState.m_aClipRegion.IsNull() ) + if( m_aCurrentPDFState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion.count() ) { aLine.append( "Q " ); // invalidate everything but the clip region m_aCurrentPDFState = GraphicsState(); rNewState.m_nUpdateFlags = sal::static_int_cast(~GraphicsState::updateClipRegion); } - if( ! rNewClip.IsEmpty() && ! rNewClip.IsNull() ) + if( rNewState.m_bClipRegion && rNewState.m_aClipRegion.count() ) { // clip region is always stored in private PDF mapmode MapMode aNewMapMode = rNewState.m_aMapMode; @@ -10221,32 +10329,8 @@ void PDFWriterImpl::updateGraphicsState() m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode; aLine.append( "q " ); - if( rNewClip.HasPolyPolygon() ) - { - m_aPages.back().appendPolyPolygon( rNewClip.GetPolyPolygon(), aLine ); - aLine.append( "W* n\n" ); - } - else - { - // need to clip all rectangles - RegionHandle aHandle = rNewClip.BeginEnumRects(); - Rectangle aRect; - while( rNewClip.GetNextEnumRect( aHandle, aRect ) ) - { - m_aPages.back().appendRect( aRect, aLine ); - if( aLine.getLength() > 80 ) - { - aLine.append( "\n" ); - writeBuffer( aLine.getStr(), aLine.getLength() ); - aLine.setLength( 0 ); - } - else - aLine.append( ' ' ); - } - rNewClip.EndEnumRects( aHandle ); - aLine.append( "W* n\n" ); - } - + m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine ); + aLine.append( "W* n\n" ); rNewState.m_aMapMode = aNewMapMode; getReferenceDevice()->SetMapMode( rNewState.m_aMapMode ); m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode; @@ -10360,9 +10444,12 @@ void PDFWriterImpl::pop() if( ! (aState.m_nFlags & PUSH_MAPMODE) ) setMapMode( aState.m_aMapMode ); if( ! (aState.m_nFlags & PUSH_CLIPREGION) ) + { // do not use setClipRegion here // it would convert again assuming the current mapmode rOld.m_aClipRegion = aState.m_aClipRegion; + rOld.m_bClipRegion = aState.m_bClipRegion; + } if( ! (aState.m_nFlags & PUSH_TEXTLINECOLOR ) ) setTextLineColor( aState.m_aTextLineColor ); if( ! (aState.m_nFlags & PUSH_OVERLINECOLOR ) ) @@ -10386,45 +10473,59 @@ void PDFWriterImpl::setMapMode( const MapMode& rMapMode ) m_aCurrentPDFState.m_aMapMode = rMapMode; } -void PDFWriterImpl::setClipRegion( const Region& rRegion ) +void PDFWriterImpl::setClipRegion( const basegfx::B2DPolyPolygon& rRegion ) { - Region aRegion = getReferenceDevice()->LogicToPixel( rRegion, m_aGraphicsStack.front().m_aMapMode ); + basegfx::B2DPolyPolygon aRegion = getReferenceDevice()->LogicToPixel( rRegion, m_aGraphicsStack.front().m_aMapMode ); aRegion = getReferenceDevice()->PixelToLogic( aRegion, m_aMapMode ); m_aGraphicsStack.front().m_aClipRegion = aRegion; + m_aGraphicsStack.front().m_bClipRegion = true; m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; } void PDFWriterImpl::moveClipRegion( sal_Int32 nX, sal_Int32 nY ) { - Point aPoint( lcl_convert( m_aGraphicsStack.front().m_aMapMode, + if( m_aGraphicsStack.front().m_bClipRegion && m_aGraphicsStack.front().m_aClipRegion.count() ) + { + Point aPoint( lcl_convert( m_aGraphicsStack.front().m_aMapMode, + m_aMapMode, + getReferenceDevice(), + Point( nX, nY ) ) ); + aPoint -= lcl_convert( m_aGraphicsStack.front().m_aMapMode, m_aMapMode, getReferenceDevice(), - Point( nX, nY ) ) ); - aPoint -= lcl_convert( m_aGraphicsStack.front().m_aMapMode, - m_aMapMode, - getReferenceDevice(), - Point() ); - m_aGraphicsStack.front().m_aClipRegion.Move( aPoint.X(), aPoint.Y() ); - m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; + Point() ); + basegfx::B2DHomMatrix aMat; + aMat.translate( aPoint.X(), aPoint.Y() ); + m_aGraphicsStack.front().m_aClipRegion.transform( aMat ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; + } } bool PDFWriterImpl::intersectClipRegion( const Rectangle& rRect ) { - Rectangle aRect( lcl_convert( m_aGraphicsStack.front().m_aMapMode, - m_aMapMode, - getReferenceDevice(), - rRect ) ); - m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; - return m_aGraphicsStack.front().m_aClipRegion.Intersect( aRect ); + basegfx::B2DPolyPolygon aRect( basegfx::tools::createPolygonFromRect( + basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); + return intersectClipRegion( aRect ); } -bool PDFWriterImpl::intersectClipRegion( const Region& rRegion ) +bool PDFWriterImpl::intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ) { - Region aRegion = getReferenceDevice()->LogicToPixel( rRegion, m_aGraphicsStack.front().m_aMapMode ); + basegfx::B2DPolyPolygon aRegion( getReferenceDevice()->LogicToPixel( rRegion, m_aGraphicsStack.front().m_aMapMode ) ); aRegion = getReferenceDevice()->PixelToLogic( aRegion, m_aMapMode ); m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; - return m_aGraphicsStack.front().m_aClipRegion.Intersect( aRegion ); + if( m_aGraphicsStack.front().m_bClipRegion ) + { + basegfx::B2DPolyPolygon aOld( basegfx::tools::prepareForPolygonOperation( m_aGraphicsStack.front().m_aClipRegion ) ); + aRegion = basegfx::tools::prepareForPolygonOperation( aRegion ); + m_aGraphicsStack.front().m_aClipRegion = basegfx::tools::solvePolygonOperationAnd( aOld, aRegion ); + } + else + { + m_aGraphicsStack.front().m_aClipRegion = aRegion; + m_aGraphicsStack.front().m_bClipRegion = true; + } + return true; } void PDFWriterImpl::createNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr ) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index e058cfa487db..15158714cfee 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -144,14 +144,20 @@ public: // if pOutPoint is set it will be updated to the emitted point // (in PDF map mode, that is 10th of point) void appendPoint( const Point& rPoint, rtl::OStringBuffer& rBuffer, bool bNeg = false, Point* pOutPoint = NULL ) const; + // appends a B2DPoint without further transformation + void appendPixelPoint( const basegfx::B2DPoint& rPoint, rtl::OStringBuffer& rBuffer ) const; // appends a rectangle void appendRect( const Rectangle& rRect, rtl::OStringBuffer& rBuffer ) const; // converts a rectangle to 10th points page space void convertRect( Rectangle& rRect ) const; // appends a polygon optionally closing it void appendPolygon( const Polygon& rPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const; + // appends a polygon optionally closing it + void appendPolygon( const basegfx::B2DPolygon& rPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const; // appends a polypolygon optionally closing the subpaths void appendPolyPolygon( const PolyPolygon& rPolyPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const; + // appends a polypolygon optionally closing the subpaths + void appendPolyPolygon( const basegfx::B2DPolyPolygon& rPolyPoly, rtl::OStringBuffer& rBuffer, bool bClose = true ) const; // converts a length (either vertical or horizontal; this // can be important if the source MapMode is not // symmetrical) to page length and appends it to the buffer @@ -159,7 +165,7 @@ public: // (in PDF map mode, that is 10th of point) void appendMappedLength( sal_Int32 nLength, rtl::OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL ) const; // the same for double values - void appendMappedLength( double fLength, rtl::OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL ) const; + void appendMappedLength( double fLength, rtl::OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = NULL, sal_Int32 nPrecision = 5 ) const; // appends LineInfo // returns false if too many dash array entry were created for // the implementation limits of some PDF readers @@ -650,19 +656,20 @@ private: // graphics state struct GraphicsState { - Font m_aFont; - MapMode m_aMapMode; - Color m_aLineColor; - Color m_aFillColor; - Color m_aTextLineColor; - Color m_aOverlineColor; - Region m_aClipRegion; - sal_Int32 m_nAntiAlias; - sal_Int32 m_nLayoutMode; - LanguageType m_aDigitLanguage; - sal_Int32 m_nTransparentPercent; - sal_uInt16 m_nFlags; - sal_uInt16 m_nUpdateFlags; + Font m_aFont; + MapMode m_aMapMode; + Color m_aLineColor; + Color m_aFillColor; + Color m_aTextLineColor; + Color m_aOverlineColor; + basegfx::B2DPolyPolygon m_aClipRegion; + bool m_bClipRegion; + sal_Int32 m_nAntiAlias; + sal_Int32 m_nLayoutMode; + LanguageType m_aDigitLanguage; + sal_Int32 m_nTransparentPercent; + sal_uInt16 m_nFlags; + sal_uInt16 m_nUpdateFlags; static const sal_uInt16 updateFont = 0x0001; static const sal_uInt16 updateMapMode = 0x0002; @@ -681,6 +688,7 @@ private: m_aFillColor( COL_TRANSPARENT ), m_aTextLineColor( COL_TRANSPARENT ), m_aOverlineColor( COL_TRANSPARENT ), + m_bClipRegion( false ), m_nAntiAlias( 1 ), m_nLayoutMode( 0 ), m_aDigitLanguage( 0 ), @@ -696,6 +704,7 @@ private: m_aTextLineColor( rState.m_aTextLineColor ), m_aOverlineColor( rState.m_aOverlineColor ), m_aClipRegion( rState.m_aClipRegion ), + m_bClipRegion( rState.m_bClipRegion ), m_nAntiAlias( rState.m_nAntiAlias ), m_nLayoutMode( rState.m_nLayoutMode ), m_aDigitLanguage( rState.m_aDigitLanguage ), @@ -714,6 +723,7 @@ private: m_aTextLineColor = rState.m_aTextLineColor; m_aOverlineColor = rState.m_aOverlineColor; m_aClipRegion = rState.m_aClipRegion; + m_bClipRegion = rState.m_bClipRegion; m_nAntiAlias = rState.m_nAntiAlias; m_nLayoutMode = rState.m_nLayoutMode; m_aDigitLanguage = rState.m_aDigitLanguage; @@ -1164,17 +1174,18 @@ public: void clearClipRegion() { - m_aGraphicsStack.front().m_aClipRegion.SetNull(); + m_aGraphicsStack.front().m_aClipRegion.clear(); + m_aGraphicsStack.front().m_bClipRegion = false; m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateClipRegion; } - void setClipRegion( const Region& rRegion ); + void setClipRegion( const basegfx::B2DPolyPolygon& rRegion ); void moveClipRegion( sal_Int32 nX, sal_Int32 nY ); bool intersectClipRegion( const Rectangle& rRect ); - bool intersectClipRegion( const Region& rRegion ); + bool intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion ); void setLayoutMode( sal_Int32 nLayoutMode ) { diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 66865759db4b..642690a8d32d 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -48,6 +48,7 @@ #include #include +#include #include // ======================================================================= @@ -2010,6 +2011,32 @@ const basegfx::B2DPolyPolygon Region::GetB2DPolyPolygon() const // ----------------------------------------------------------------------- +basegfx::B2DPolyPolygon Region::ConvertToB2DPolyPolygon() +{ + DBG_CHKTHIS( Region, ImplDbgTestRegion ); + + basegfx::B2DPolyPolygon aRet; + + if( HasPolyPolygon() ) + aRet = GetB2DPolyPolygon(); + else + { + RegionHandle aHdl = BeginEnumRects(); + Rectangle aSubRect; + while( GetNextEnumRect( aHdl, aSubRect ) ) + { + basegfx::B2DPolygon aPoly( basegfx::tools::createPolygonFromRect( + basegfx::B2DRectangle( aSubRect.Left(), aSubRect.Top(), aSubRect.Right(), aSubRect.Bottom() ) ) ); + aRet.append( aPoly ); + } + EndEnumRects( aHdl ); + } + + return aRet; +} + +// ----------------------------------------------------------------------- + BOOL Region::ImplGetFirstRect( ImplRegionInfo& rImplRegionInfo, long& rX, long& rY, long& rWidth, long& rHeight ) const -- cgit v1.2.3 From 2490e4eeaadb02419d4ca6535f7954bcea6c4872 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 19 Jan 2010 18:45:21 +0100 Subject: vcl109: #i108451# fix unitialized member (thanks dtardon !) --- vcl/source/gdi/pngwrite.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index 372be81aaef6..45f462fdf52e 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -134,6 +134,7 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx, mpAccess ( NULL ), mpMaskAccess ( NULL ), mpZCodec ( new ZCodec( DEFAULT_IN_BUFSIZE, DEFAULT_OUT_BUFSIZE, MAX_MEM_USAGE ) ), + mnCRC(0UL), mnLastPercent ( 0UL ) { if ( !rBmpEx.IsEmpty() ) -- cgit v1.2.3 From 69b370043eab28f099943e65beb89ed3238eaec7 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 20 Jan 2010 16:01:08 +0100 Subject: vcl109: #i108459# fix a crash when deleting the current focus frame (thanks mst) --- vcl/unx/headless/svpframe.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index 04ab08b4cc91..68c9d99e0627 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -85,6 +85,33 @@ SvpSalFrame::~SvpSalFrame() (*it)->SetParent( m_pParent ); if( m_pParent ) m_pParent->m_aChildren.remove( this ); + + if( s_pFocusFrame == this ) + { + s_pFocusFrame = NULL; + // call directly here, else an event for a destroyed frame would be dispatched + CallCallback( SALEVENT_LOSEFOCUS, NULL ); + // if the handler has not set a new focus frame + // pass focus to another frame, preferably a document style window + if( s_pFocusFrame == NULL ) + { + const std::list< SalFrame* >& rFrames( m_pInstance->getFrames() ); + for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) + { + SvpSalFrame* pFrame = static_cast(*it); + if( pFrame->m_bVisible && + pFrame->m_pParent == NULL && + (pFrame->m_nStyle & (SAL_FRAME_STYLE_MOVEABLE | + SAL_FRAME_STYLE_SIZEABLE | + SAL_FRAME_STYLE_CLOSEABLE) ) != 0 + ) + { + pFrame->GetFocus(); + break; + } + } + } + } } void SvpSalFrame::GetFocus() -- cgit v1.2.3 From 4250acf9a20c7f2e3692c4663c2d1c196fa23102 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Jan 2010 11:44:59 +0100 Subject: vcl109: #i108501# remove unused files (thanks dtardon !) --- rsc/source/parser/makefile.mk | 11 -------- rsc/source/parser/parser.cxx | 62 ------------------------------------------- rsc/source/parser/parser.hxx | 29 -------------------- 3 files changed, 102 deletions(-) delete mode 100644 rsc/source/parser/parser.cxx delete mode 100644 rsc/source/parser/parser.hxx diff --git a/rsc/source/parser/makefile.mk b/rsc/source/parser/makefile.mk index 68c12479261b..49d07bd1ebe5 100644 --- a/rsc/source/parser/makefile.mk +++ b/rsc/source/parser/makefile.mk @@ -49,17 +49,6 @@ ENABLE_EXCEPTIONS=true YACCTARGET= $(INCCOM)$/yyrscyacc.cxx YACCFILES= rscyacc.y -CXXFILES= rscpar.cxx \ - rscyacc.cxx \ - rsclex.cxx \ - erscerr.cxx \ - rsckey.cxx \ - rscinit.cxx \ - rscibas.cxx \ - rscdb.cxx \ - rscicpx.cxx \ - parser.cxx - OBJFILES= $(OBJ)$/rscpar.obj \ $(OBJ)$/rscyacc.obj \ $(OBJ)$/rsclex.obj \ diff --git a/rsc/source/parser/parser.cxx b/rsc/source/parser/parser.cxx deleted file mode 100644 index a5b6da55d1f3..000000000000 --- a/rsc/source/parser/parser.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: parser.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_rsc.hxx" -#include -#include -#include -#include -#include - -#include -#define RSC_COMPILER - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - diff --git a/rsc/source/parser/parser.hxx b/rsc/source/parser/parser.hxx deleted file mode 100644 index 10651edd76c1..000000000000 --- a/rsc/source/parser/parser.hxx +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: parser.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -- cgit v1.2.3 From 9d701361f47e438ac8cf2fec49789688919cd277 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Jan 2010 11:52:34 +0100 Subject: vcl109: #i108510# remove unused files --- vcl/aqua/inc/salpixmaputils.hxx | 50 ---------------------------------- vcl/aqua/source/gdi/makefile.mk | 1 - vcl/aqua/source/gdi/salpixmaputils.cxx | 39 -------------------------- vcl/inc/vcl/opengl.hxx | 0 vcl/inc/vcl/outdev3d.hxx | 0 vcl/inc/vcl/salogl.hxx | 0 vcl/inc/vcl/salotype.hxx | 0 7 files changed, 90 deletions(-) delete mode 100755 vcl/aqua/inc/salpixmaputils.hxx delete mode 100755 vcl/aqua/source/gdi/salpixmaputils.cxx delete mode 100644 vcl/inc/vcl/opengl.hxx delete mode 100644 vcl/inc/vcl/outdev3d.hxx delete mode 100644 vcl/inc/vcl/salogl.hxx delete mode 100644 vcl/inc/vcl/salotype.hxx diff --git a/vcl/aqua/inc/salpixmaputils.hxx b/vcl/aqua/inc/salpixmaputils.hxx deleted file mode 100755 index 13406431a8e8..000000000000 --- a/vcl/aqua/inc/salpixmaputils.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: salpixmaputils.hxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SV_SALPIXMAPUTILS_HXX -#define _SV_SALPIXMAPUTILS_HXX - -#include "premac.h" -#include -#include "postmac.h" - -#include "tools/gen.hxx" -#include "vcl/salbtype.hxx" -#include "vcl/salgtype.hxx" -#include "salconst.h" -#include "salcolorutils.hxx" - -// ------------------------------------------------------------------ - -// Empty. Do we need this? - -// ------------------------------------------------------------------ - -#endif // _SV_SALPIXMAPUTILS_HXX diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk index deb6832a5525..6598ac71ae91 100644 --- a/vcl/aqua/source/gdi/makefile.mk +++ b/vcl/aqua/source/gdi/makefile.mk @@ -53,7 +53,6 @@ dummy: SLOFILES= $(SLO)$/salmathutils.obj \ $(SLO)$/salcolorutils.obj \ - $(SLO)$/salpixmaputils.obj \ $(SLO)$/salgdiutils.obj \ $(SLO)$/salnativewidgets.obj \ $(SLO)$/salatsuifontutils.obj \ diff --git a/vcl/aqua/source/gdi/salpixmaputils.cxx b/vcl/aqua/source/gdi/salpixmaputils.cxx deleted file mode 100755 index 0e6df6d19e1a..000000000000 --- a/vcl/aqua/source/gdi/salpixmaputils.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: salpixmaputils.cxx,v $ - * $Revision: 1.11 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" - -#include "salpixmaputils.hxx" - -// ======================================================================= - -// ======================================================================= - diff --git a/vcl/inc/vcl/opengl.hxx b/vcl/inc/vcl/opengl.hxx deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/inc/vcl/outdev3d.hxx b/vcl/inc/vcl/outdev3d.hxx deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/inc/vcl/salogl.hxx b/vcl/inc/vcl/salogl.hxx deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vcl/inc/vcl/salotype.hxx b/vcl/inc/vcl/salotype.hxx deleted file mode 100644 index e69de29bb2d1..000000000000 -- cgit v1.2.3 From 1d859143c51805f074e8dfd211795a365eb2e52d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Jan 2010 13:56:38 +0100 Subject: fix some compile problems --- vcl/aqua/inc/salbmp.h | 1 - vcl/unx/headless/svpframe.cxx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/vcl/aqua/inc/salbmp.h b/vcl/aqua/inc/salbmp.h index bc940b571d26..9d0da7246e8c 100644 --- a/vcl/aqua/inc/salbmp.h +++ b/vcl/aqua/inc/salbmp.h @@ -39,7 +39,6 @@ #include "salconst.h" #include "vcl/salvd.hxx" #include "salcolorutils.hxx" -#include "salpixmaputils.hxx" #include "vcl/salbmp.hxx" #include "salgdi.h" #include "basebmp/bitmapdevice.hxx" diff --git a/vcl/unx/headless/svpframe.cxx b/vcl/unx/headless/svpframe.cxx index 68c9d99e0627..bbc21529470d 100644 --- a/vcl/unx/headless/svpframe.cxx +++ b/vcl/unx/headless/svpframe.cxx @@ -98,7 +98,7 @@ SvpSalFrame::~SvpSalFrame() const std::list< SalFrame* >& rFrames( m_pInstance->getFrames() ); for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) { - SvpSalFrame* pFrame = static_cast(*it); + SvpSalFrame* pFrame = const_cast(static_cast(*it)); if( pFrame->m_bVisible && pFrame->m_pParent == NULL && (pFrame->m_nStyle & (SAL_FRAME_STYLE_MOVEABLE | -- cgit v1.2.3 From 620e42f173d1d4921a21c8cdfeb6297492c03f49 Mon Sep 17 00:00:00 2001 From: hdu Date: Mon, 25 Jan 2010 11:16:11 +0100 Subject: #i108630# allow compile with Xrender.h older than v0.9 --- vcl/unx/source/gdi/xrender_peer.cxx | 5 +---- vcl/unx/source/gdi/xrender_peer.hxx | 10 ++++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx index fc8de818fafd..d292886db800 100644 --- a/vcl/unx/source/gdi/xrender_peer.cxx +++ b/vcl/unx/source/gdi/xrender_peer.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile$ - * $Revision$ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -175,7 +172,7 @@ void XRenderPeer::InitRenderLib() #if 0 // not having trapezoid support is supported if( !pFunc ) return; #endif - mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const XTrap*,int))pFunc; + mpXRenderAddTraps = (void(*)(Display*,Picture,int,int,const _XTrap*,int))pFunc; #endif // XRENDER_LINK diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx index 27c8fb3dcaeb..cc9d121ee21f 100644 --- a/vcl/unx/source/gdi/xrender_peer.hxx +++ b/vcl/unx/source/gdi/xrender_peer.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile$ - * $Revision$ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -32,6 +29,7 @@ #define _SV_XRENDER_PEER_HXX #include +struct _XTrap; // on some older systems this is not declared within Xrender.h #include #include @@ -87,7 +85,7 @@ public: const XRenderPictFormat*, int nXSrc, int nYSrc, const XTrapezoid*, int nCount ) const; bool AddTraps( Picture aDst, int nXOfs, int nYOfs, - const XTrap*, int nCount ) const; + const _XTrap*, int nCount ) const; bool AreTrapezoidsSupported() const #ifdef XRENDER_LINK @@ -123,7 +121,7 @@ private: const XRenderColor*,int,int,unsigned int,unsigned int); void (*mpXRenderCompositeTrapezoids)(Display*,int,Picture,Picture, const XRenderPictFormat*,int,int,const XTrapezoid*,int); - void (*mpXRenderAddTraps)(Display*,Picture,int,int,const XTrap*,int); + void (*mpXRenderAddTraps)(Display*,Picture,int,int,const _XTrap*,int); #endif // XRENDER_LINK }; @@ -329,7 +327,7 @@ inline void XRenderPeer::CompositeTrapezoids( int nOp, } inline bool XRenderPeer::AddTraps( Picture aDst, int nXOfs, int nYOfs, - const XTrap* pTraps, int nCount ) const + const _XTrap* pTraps, int nCount ) const { #ifdef XRENDER_LINK XRenderAddTraps( mpDisplay, aDst, nXOfs, nYOfs, pTraps, nCount ); -- cgit v1.2.3 From c0917ec4a978a81a07324a374e974fefe322e7b6 Mon Sep 17 00:00:00 2001 From: hdu Date: Mon, 25 Jan 2010 11:20:58 +0100 Subject: add missing precompiled header include --- vcl/unx/source/gdi/xrender_peer.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx index d292886db800..4af202a1ca65 100644 --- a/vcl/unx/source/gdi/xrender_peer.cxx +++ b/vcl/unx/source/gdi/xrender_peer.cxx @@ -25,6 +25,9 @@ * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + #include #include #include -- cgit v1.2.3 From 4797c34002c513f5adc65f2fefe843df606a0233 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 26 Jan 2010 11:23:25 +0100 Subject: vcl109: #i108454# do not depend on onsolete PICT format as image clipboard content --- vcl/aqua/source/dtrans/DataFlavorMapping.cxx | 60 ++++++++++++------ vcl/aqua/source/dtrans/DataFlavorMapping.hxx | 5 ++ vcl/aqua/source/dtrans/OSXTransferable.cxx | 5 +- vcl/aqua/source/dtrans/PictToBmpFlt.cxx | 91 +++++++++++++++++++++++++++- vcl/aqua/source/dtrans/PictToBmpFlt.hxx | 15 +++++ 5 files changed, 155 insertions(+), 21 deletions(-) diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index af05f084a97e..d69b83a58394 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include using namespace ::com::sun::star::datatransfer; @@ -132,6 +132,7 @@ namespace // private { { NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", CPPUTYPE_OUSTRING }, { NSRTFPboardType, "text/richtext", "Rich Text Format", CPPUTYPE_SEQINT8 }, + { NSTIFFPboardType, "image/bmp", "Windows Bitmap", CPPUTYPE_SEQINT8 }, { NSPICTPboardType, "image/bmp", "Windows Bitmap", CPPUTYPE_SEQINT8 }, { NSHTMLPboardType, "text/html", "Plain Html", CPPUTYPE_SEQINT8 }, { NSFilenamesPboardType, "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", CPPUTYPE_SEQINT8 }, @@ -146,9 +147,6 @@ namespace // private { PBTYPE_EMF, FLAVOR_EMF, "Windows Enhanced MetaFile", CPPUTYPE_SEQINT8 }, { PBTYPE_SODX, FLAVOR_SODX, "Star Object Descriptor (XML)", CPPUTYPE_SEQINT8 }, { PBTYPE_DUMMY_INTERNAL, FLAVOR_DUMMY_INTERNAL, "internal data",CPPUTYPE_SEQINT8 } - // { PBTYPE_UT16, "text/plain;charset=utf-16", "Unicode Text (UTF-16)", CPPUTYPE_OUSTRING } - // { kUTTypePICT, @"PICT", "image/x-macpict;windows_formatname=\"Mac Pict\"", "Mac Pict", CPPUTYPE_SEQINT8 } - // { kUTTypeHTML, @"HTML", "text/html", "Plain Html", CPPUTYPE_SEQINT8 } }; @@ -382,23 +380,26 @@ Any HTMLFormatDataProvider::getOOoData() class BMPDataProvider : public DataProviderBaseImpl { + NSBitmapImageFileType meImageType; public: - BMPDataProvider(const Any& data); + BMPDataProvider(const Any& data, NSBitmapImageFileType eImageType ); - BMPDataProvider(NSData* data); + BMPDataProvider(NSData* data, NSBitmapImageFileType eImageType); virtual NSData* getSystemData(); virtual Any getOOoData(); }; -BMPDataProvider::BMPDataProvider(const Any& data) : - DataProviderBaseImpl(data) +BMPDataProvider::BMPDataProvider(const Any& data, NSBitmapImageFileType eImageType) : + DataProviderBaseImpl(data), + meImageType( eImageType ) { } -BMPDataProvider::BMPDataProvider(NSData* data) : - DataProviderBaseImpl(data) +BMPDataProvider::BMPDataProvider(NSData* data, NSBitmapImageFileType eImageType) : + DataProviderBaseImpl(data), + meImageType( eImageType ) { } @@ -410,7 +411,7 @@ NSData* BMPDataProvider::getSystemData() Sequence pictData; NSData* sysData = NULL; - if (BMPtoPICT(bmpData, pictData)) + if (BMPToImage(bmpData, pictData, meImageType)) { sysData = [NSData dataWithBytes: pictData.getArray() length: pictData.getLength()]; } @@ -436,7 +437,7 @@ Any BMPDataProvider::getOOoData() Sequence bmpData; - if (PICTtoBMP(pictData, bmpData)) + if (ImageToBMP(pictData, bmpData, meImageType)) { oOOData = makeAny(bmpData); } @@ -558,6 +559,13 @@ NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor& oOOFlavor return sysFlavor; } +NSString* DataFlavorMapper::openOfficeImageToSystemFlavor(NSPasteboard* pPasteboard) const +{ + NSArray *supportedTypes = [NSArray arrayWithObjects: NSTIFFPboardType, NSPICTPboardType, nil]; + NSString *sysFlavor = [pPasteboard availableTypeFromArray:supportedTypes]; + return sysFlavor; +} + DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Reference rTransferable) const { DataProviderPtr_t dp; @@ -576,7 +584,11 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe } else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { - dp = DataProviderPtr_t(new BMPDataProvider(data)); + dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType)); + } + else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame) + { + dp = DataProviderPtr_t(new BMPDataProvider(data, NSTIFFFileType)); } else if ([systemFlavor caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame) { @@ -621,7 +633,11 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(const NSString* systemFlavor } else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame) { - dp = DataProviderPtr_t(new BMPDataProvider(systemData)); + dp = DataProviderPtr_t(new BMPDataProvider(systemData, PICTImageFileType)); + } + else if ([systemFlavor caseInsensitiveCompare: NSTIFFPboardType] == NSOrderedSame) + { + dp = DataProviderPtr_t(new BMPDataProvider(systemData, NSTIFFFileType)); } else if ([systemFlavor caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame) { @@ -658,11 +674,19 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno: for (sal_uInt32 i = 0; i < nFlavors; i++) { - NSString* str = openOfficeToSystemFlavor(flavors[i]); - - if (str != NULL) + if( flavors[i].MimeType.compareToAscii( "image/bmp", 9 ) == 0 ) { - [array addObject: str]; + [array addObject: NSTIFFPboardType]; + [array addObject: NSPICTPboardType]; + } + else + { + NSString* str = openOfficeToSystemFlavor(flavors[i]); + + if (str != NULL) + { + [array addObject: str]; + } } } diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx index 03cb77e319f7..4690fe2886a6 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.hxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.hxx @@ -92,6 +92,11 @@ public: */ NSString* openOfficeToSystemFlavor(const com::sun::star::datatransfer::DataFlavor& oooDataFlavor) const; + /* Select the best available image data type + If there is no suiteable mapping available NULL will + be returned. + */ + NSString* openOfficeImageToSystemFlavor(NSPasteboard* pPasteboard) const; /* Get a data provider which is able to provide the data 'rTransferable' offers in a format that can be put on to the system clipboard. diff --git a/vcl/aqua/source/dtrans/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx index a893f09d89cc..e38e1e741cf7 100644 --- a/vcl/aqua/source/dtrans/OSXTransferable.cxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx @@ -91,7 +91,10 @@ Any SAL_CALL OSXTransferable::getTransferData( const DataFlavor& aFlavor ) static_cast(this)); } - NSString* sysFormat = (NSString*)mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor); + NSString* sysFormat = + (aFlavor.MimeType.compareToAscii( "image/bmp", 9 ) == 0) + ? mDataFlavorMapper->openOfficeImageToSystemFlavor( mPasteboard ) + : mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor); DataProviderPtr_t dp; if ([sysFormat caseInsensitiveCompare: NSFilenamesPboardType] == NSOrderedSame) diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx index 0643efae33ca..15f99cbef8eb 100644 --- a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx @@ -1,22 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSXTransferable.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + #include "PictToBmpFlt.hxx" /* This is a work-around to prevent 'deprecated' warning for 'KillPicture' API Hopefully we can get rid of this whole code again when the OOo PICT filter are good enough to be used see #i78953 thus this hack would vanish to again. */ +#include #include #undef DEPRECATED_ATTRIBUTE #define DEPRECATED_ATTRIBUTE -#include #include #include #include - bool PICTtoBMP(com::sun::star::uno::Sequence& aPict, com::sun::star::uno::Sequence& aBmp) { + bool result = false; ComponentInstance bmpExporter; @@ -112,3 +142,60 @@ bool BMPtoPICT(com::sun::star::uno::Sequence& aBmp, return result; } + +bool ImageToBMP( com::sun::star::uno::Sequence& aPict, + com::sun::star::uno::Sequence& aBmp, + NSBitmapImageFileType eInFormat) +{ + if( eInFormat == PICTImageFileType ) + return PICTtoBMP( aPict, aBmp ); + + bool bResult = false; + + NSData* pData = [NSData dataWithBytesNoCopy: (void*)aPict.getConstArray() length: aPict.getLength() freeWhenDone: 0]; + if( pData ) + { + NSBitmapImageRep* pRep = [NSBitmapImageRep imageRepWithData: pData]; + if( pRep ) + { + NSData* pOut = [pRep representationUsingType: NSBMPFileType properties: nil]; + if( pOut ) + { + aBmp.realloc( [pOut length] ); + [pOut getBytes: aBmp.getArray() length: aBmp.getLength()]; + bResult = (aBmp.getLength() != 0); + } + } + } + + return bResult; +} + +bool BMPToImage( com::sun::star::uno::Sequence& aBmp, + com::sun::star::uno::Sequence& aPict, + NSBitmapImageFileType eOutFormat + ) +{ + if( eOutFormat == PICTImageFileType ) + return BMPtoPICT( aBmp, aPict ); + + bool bResult = false; + + NSData* pData = [NSData dataWithBytesNoCopy: const_cast(aBmp.getConstArray()) length: aBmp.getLength() freeWhenDone: 0]; + if( pData ) + { + NSBitmapImageRep* pRep = [NSBitmapImageRep imageRepWithData: pData]; + if( pRep ) + { + NSData* pOut = [pRep representationUsingType: eOutFormat properties: nil]; + if( pOut ) + { + aPict.realloc( [pOut length] ); + [pOut getBytes: aPict.getArray() length: aPict.getLength()]; + bResult = (aPict.getLength() != 0); + } + } + } + + return bResult; +} diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx index 29e9c535546f..12a73452ad7b 100644 --- a/vcl/aqua/source/dtrans/PictToBmpFlt.hxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.hxx @@ -3,6 +3,10 @@ #include +#include +#include +#include + /* Transform PICT into the a Window BMP. Returns true if the conversion was successful false @@ -19,4 +23,15 @@ bool PICTtoBMP(com::sun::star::uno::Sequence& aPict, bool BMPtoPICT(com::sun::star::uno::Sequence& aBmp, com::sun::star::uno::Sequence& aPict); +#define PICTImageFileType ((NSBitmapImageFileType)~0) + +bool ImageToBMP( com::sun::star::uno::Sequence& aPict, + com::sun::star::uno::Sequence& aBmp, + NSBitmapImageFileType eInFormat); + +bool BMPToImage( com::sun::star::uno::Sequence& aBmp, + com::sun::star::uno::Sequence& aPict, + NSBitmapImageFileType eOutFormat + ); + #endif -- cgit v1.2.3 From cc053a3e354ddcbdb5e6d9be95ef046972bb3d25 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 26 Jan 2010 15:53:58 +0100 Subject: vcl109: #i108518# recognize OTF files --- padmin/source/fontentry.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx index d76171e704c1..47266915e96a 100644 --- a/padmin/source/fontentry.cxx +++ b/padmin/source/fontentry.cxx @@ -558,7 +558,7 @@ IMPL_LINK( FontImportDialog, RefreshTimeoutHdl, void*, EMPTYARG ) std::list< String > aFiles; m_aNewFonts.clear(); OUString aDirectory( m_aFromDirEdt.GetText() ); - FindFiles( aDirectory, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PFA;PFB;TTF;TTC" ) ), m_aSubDirsBox.IsChecked() ); + FindFiles( aDirectory, aFiles, String( RTL_CONSTASCII_USTRINGPARAM( "PFA;PFB;TTF;TTC;OTF" ) ), m_aSubDirsBox.IsChecked() ); OString aDir( OUStringToOString( aDirectory, aEncoding ) ); aDir += "/"; while( aFiles.begin() != aFiles.end() ) -- cgit v1.2.3 From 54b1b7d41738902616ff8ed3253a4caad02736ed Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- basegfx/inc/basegfx/polygon/b2dpolygontools.hxx | 4 ++++ basegfx/source/polygon/b2dpolygontools.cxx | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index 47ff41b75e70..cba5a4920ca2 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -274,6 +274,10 @@ namespace basegfx */ B2DPolygon createPolygonFromRect( const B2DRectangle& rRect ); + /** Create the unit polygon + */ + B2DPolygon createUnitPolygon(); + /** Create a circle polygon with given radius. This method creates a circle approximation consisting of diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index d62462b8c097..dcdaad4b5e37 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1837,6 +1837,24 @@ namespace basegfx return aRetval; } + B2DPolygon createUnitPolygon() + { + static B2DPolygon aRetval; + + if(!aRetval.count()) + { + aRetval.append( B2DPoint( 0.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 0.0 ) ); + aRetval.append( B2DPoint( 1.0, 1.0 ) ); + aRetval.append( B2DPoint( 0.0, 1.0 ) ); + + // close + aRetval.setClosed( true ); + } + + return aRetval; + } + B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius ) { return createPolygonFromEllipse( rCenter, fRadius, fRadius ); -- cgit v1.2.3 From 1dde425a12be0ea92ada5152e0d40b4ac9358f1c Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- vcl/source/gdi/bitmapex.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 4e2ed20a7966..8d7ef4ccb3be 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -814,7 +814,7 @@ sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const } else { - if(0x00 != aBitmapColor.GetIndex()) + if(0x00 == aBitmapColor.GetIndex()) { nTransparency = 0x00; } -- cgit v1.2.3 From 40ae7d9aca558a8ebfd3279b9bc96ec0e03bbd48 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:49:42 +0100 Subject: autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value --- canvas/source/directx/dx_5rm.cxx | 2 +- canvas/source/directx/dx_9rm.cxx | 2 +- .../source/directx/dx_canvashelper_texturefill.cxx | 2 +- canvas/source/vcl/canvashelper.cxx | 2 +- cppcanvas/source/mtfrenderer/implrenderer.cxx | 30 +++++++++++----------- tools/inc/tools/diagnose_ex.h | 12 ++++++--- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/canvas/source/directx/dx_5rm.cxx b/canvas/source/directx/dx_5rm.cxx index 4937934732cd..71c65feb3b6f 100755 --- a/canvas/source/directx/dx_5rm.cxx +++ b/canvas/source/directx/dx_5rm.cxx @@ -1008,7 +1008,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index acef323ddc1b..a50d0d5abeb7 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -544,7 +544,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 73a2d49bfb62..f5836e56d668 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -345,7 +345,7 @@ namespace dxcanvas GraphicsPathSharedPtr pGradientPath( tools::graphicsPathFromB2DPolygon( rValues.maGradientPoly ) ); - ENSURE_OR_RETURN( pGradientPath.get(), + ENSURE_OR_RETURN_FALSE( pGradientPath.get(), "ParametricPolyPolygon::fillPolygonalGradient(): Could not clone path" ); PathGradientBrushSharedPtr pGradientBrush; diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 20b489144d0e..144a41fb0212 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -1390,7 +1390,7 @@ namespace vclcanvas const ::Size& rSz, const GraphicAttr& rAttr ) const { - ENSURE_OR_RETURN( rGrf, + ENSURE_OR_RETURN_FALSE( rGrf, "Invalid Graphic" ); if( !mpOutDev ) diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 8ea2ae453a97..0f51216b190e 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1876,16 +1876,16 @@ namespace cppcanvas ::vcl::unotools::xBitmapFromBitmapEx( rCanvas->getUNOCanvas()->getDevice(), aBmpEx ); - if( aFill.isTiling() ) - { - aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; - aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; - } - else - { - aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; - aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; - } + if( aFill.isTiling() ) + { + aTexture.RepeatModeX = rendering::TexturingMode::REPEAT; + aTexture.RepeatModeY = rendering::TexturingMode::REPEAT; + } + else + { + aTexture.RepeatModeX = rendering::TexturingMode::CLAMP; + aTexture.RepeatModeY = rendering::TexturingMode::CLAMP; + } ::PolyPolygon aPath; aFill.getPath( aPath ); @@ -2877,7 +2877,7 @@ namespace cppcanvas aSubset.mnSubsetEnd = ::std::min( aRangeBegin->mpAction->getActionCount(), nEndIndex - aRangeBegin->mnOrigIndex ); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2893,7 +2893,7 @@ namespace cppcanvas nStartIndex - aRangeBegin->mnOrigIndex ); aSubset.mnSubsetEnd = aRangeBegin->mpAction->getActionCount(); - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeBegin, aSubset ); @@ -2922,7 +2922,7 @@ namespace cppcanvas aSubset.mnSubsetBegin = 0; aSubset.mnSubsetEnd = nEndIndex - aRangeEnd->mnOrigIndex; - ENSURE_OR_RETURN( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, + ENSURE_OR_RETURN_FALSE( aSubset.mnSubsetBegin >= 0 && aSubset.mnSubsetEnd >= 0, "ImplRenderer::forSubsetRange(): Invalid indices" ); rFunctor( *aRangeEnd, aSubset ); @@ -2937,10 +2937,10 @@ namespace cppcanvas ActionVector::const_iterator& o_rRangeBegin, ActionVector::const_iterator& o_rRangeEnd ) const { - ENSURE_OR_RETURN( io_rStartIndex<=io_rEndIndex, + ENSURE_OR_RETURN_FALSE( io_rStartIndex<=io_rEndIndex, "ImplRenderer::getSubsetIndices(): invalid action range" ); - ENSURE_OR_RETURN( !maActions.empty(), + ENSURE_OR_RETURN_FALSE( !maActions.empty(), "ImplRenderer::getSubsetIndices(): no actions to render" ); const sal_Int32 nMinActionIndex( maActions.front().mnOrigIndex ); diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index 5ca7a71cf62c..eee965fcfd76 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -121,11 +121,17 @@ ifc ); } /** This macro asserts the given condition (in debug mode), and - returns false afterwards. + returns the given value afterwards. */ -#define ENSURE_OR_RETURN(c, m) if( !(c) ) { \ +#define ENSURE_OR_RETURN(c, m, r) if( !(c) ) { \ OSL_ENSURE(c, m); \ - return false; } + return r; } + +/** This macro asserts the given condition (in debug mode), and + returns false afterwards. + */ +#define ENSURE_OR_RETURN_FALSE(c, m) \ + ENSURE_OR_RETURN(c, m, false) -- cgit v1.2.3 From 4603fb29dc5661d175804121aed28972fa999572 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 1 Feb 2010 16:37:26 +0100 Subject: mtaccfixes: #110353 Handle Ctrl+Tab and Key-Up/Down for parent events if it's a dialog --- vcl/inc/vcl/tabctrl.hxx | 3 ++ vcl/source/control/tabctrl.cxx | 93 ++++++++++++++++++++++++++++++------------ 2 files changed, 70 insertions(+), 26 deletions(-) diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index f6646426b2e7..deb5f1267aa2 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -95,8 +95,11 @@ private: SAL_DLLPRIVATE void ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bool bLayout = false, bool bFirstInGroup = false, bool bLastInGroup = false, bool bIsCurrentItem = false ); SAL_DLLPRIVATE void ImplPaint( const Rectangle& rRect, bool bLayout = false ); SAL_DLLPRIVATE void ImplFreeLayoutData(); + SAL_DLLPRIVATE long ImplHandleKeyEvent( const KeyEvent& rKeyEvent ); + DECL_DLLPRIVATE_LINK( ImplScrollBtnHdl, PushButton* pBtn ); DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox* ); + DECL_DLLPRIVATE_LINK( ImplWindowEventListener, VclSimpleEvent* ); protected: using Window::ImplInit; diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 56cc2c3fb012..c5fab9eab97d 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -177,6 +177,9 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) // otherwise they will paint with a wrong background if( IsNativeControlSupported(CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) EnableChildTransparentMode( TRUE ); + + if ( pParent->IsDialog() ) + pParent->AddChildEventListener( LINK( this, TabControl, ImplWindowEventListener ) ); } // ----------------------------------------------------------------- @@ -291,6 +294,9 @@ void TabControl::ImplLoadRes( const ResId& rResId ) TabControl::~TabControl() { + if ( GetParent()->IsDialog() ) + GetParent()->RemoveChildEventListener( LINK( this, TabControl, ImplWindowEventListener ) ); + ImplFreeLayoutData(); // TabCtrl-Daten loeschen @@ -1071,6 +1077,42 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo } } +// ----------------------------------------------------------------------- + +long TabControl::ImplHandleKeyEvent( const KeyEvent& rKeyEvent ) +{ + long nRet = 0; + + if ( GetPageCount() > 1 ) + { + KeyCode aKeyCode = rKeyEvent.GetKeyCode(); + USHORT nKeyCode = aKeyCode.GetCode(); + + if ( aKeyCode.IsMod1() ) + { + if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) ) + { + if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) ) + { + ImplActivateTabPage( FALSE ); + nRet = 1; + } + } + else + { + if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) ) + { + ImplActivateTabPage( TRUE ); + nRet = 1; + } + } + } + } + + return nRet; +} + + // ----------------------------------------------------------------------- IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG ) @@ -1087,6 +1129,24 @@ IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG ) return 0; } +// ----------------------------------------------------------------------- + +IMPL_LINK( TabControl, ImplWindowEventListener, VclSimpleEvent*, pEvent ) +{ + if ( pEvent && pEvent->ISA( VclWindowEvent ) && (pEvent->GetId() == VCLEVENT_WINDOW_KEYINPUT) ) + { + VclWindowEvent* pWindowEvent = static_cast< VclWindowEvent* >(pEvent); + // Do not handle events from TabControl or it's children, which is done in Notify(), where the events can be consumed. + if ( !IsWindowOrChild( pWindowEvent->GetWindow() ) ) + { + KeyEvent* pKeyEvent = static_cast< KeyEvent* >(pWindowEvent->GetData()); + ImplHandleKeyEvent( *pKeyEvent ); + } + } + return 0; +} + + // ----------------------------------------------------------------------- void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) @@ -1660,34 +1720,15 @@ long TabControl::PreNotify( NotifyEvent& rNEvt ) long TabControl::Notify( NotifyEvent& rNEvt ) { - if ( (rNEvt.GetType() == EVENT_KEYINPUT) && (GetPageCount() > 1) ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - KeyCode aKeyCode = pKEvt->GetKeyCode(); - USHORT nKeyCode = aKeyCode.GetCode(); + // after upgrading to m71, remove changes from VCL108 + // http://hg.services.openoffice.org/cws/vcl108/rev/68a2dcff2b44 - if ( aKeyCode.IsMod1() ) - { - if ( aKeyCode.IsShift() || (nKeyCode == KEY_PAGEUP) ) - { - if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEUP) ) - { - ImplActivateTabPage( FALSE ); - return TRUE; - } - } - else - { - if ( (nKeyCode == KEY_TAB) || (nKeyCode == KEY_PAGEDOWN) ) - { - ImplActivateTabPage( TRUE ); - return TRUE; - } - } - } - } + long nRet = 0; + + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + nRet = ImplHandleKeyEvent( *rNEvt.GetKeyEvent() ); - return Control::Notify( rNEvt ); + return nRet ? nRet : Control::Notify( rNEvt ); } // ----------------------------------------------------------------------- -- cgit v1.2.3 From cbe4a5dfaab60fb56810a9a2001a9999b840d381 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- svtools/source/dialogs/addresstemplate.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index aa18a3683916..ed761194bd3d 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -857,7 +857,7 @@ void AssignmentPersistentData::Commit() m_aDatasource.SaveValue(); // create an interaction handler (may be needed for connecting) - const String sInteractionHandlerServiceName = String::CreateFromAscii("com.sun.star.sdb.InteractionHandler"); + const String sInteractionHandlerServiceName = String::CreateFromAscii("com.sun.star.task.InteractionHandler"); Reference< XInteractionHandler > xHandler; try { -- cgit v1.2.3 From e99873a9d21b2e7fc897b582252e3693f719a81a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 09:53:26 +0100 Subject: autorecovery: add assignment operator --- comphelper/inc/comphelper/namedvaluecollection.hxx | 2 ++ comphelper/source/misc/namedvaluecollection.cxx | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/comphelper/inc/comphelper/namedvaluecollection.hxx b/comphelper/inc/comphelper/namedvaluecollection.hxx index e84f29f02580..dbc5763b1b73 100644 --- a/comphelper/inc/comphelper/namedvaluecollection.hxx +++ b/comphelper/inc/comphelper/namedvaluecollection.hxx @@ -64,6 +64,8 @@ namespace comphelper NamedValueCollection( const NamedValueCollection& _rCopySource ); + NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource ); + /** constructs a collection @param _rElements the wrapped elements of the collection. The Any might contain a sequence of diff --git a/comphelper/source/misc/namedvaluecollection.cxx b/comphelper/source/misc/namedvaluecollection.cxx index a644b072d303..6278c456e471 100644 --- a/comphelper/source/misc/namedvaluecollection.cxx +++ b/comphelper/source/misc/namedvaluecollection.cxx @@ -88,7 +88,14 @@ namespace comphelper NamedValueCollection::NamedValueCollection( const NamedValueCollection& _rCopySource ) :m_pImpl( new NamedValueCollection_Impl ) { - m_pImpl->aValues = _rCopySource.m_pImpl->aValues; + *this = _rCopySource; + } + + //-------------------------------------------------------------------- + NamedValueCollection& NamedValueCollection::operator=( const NamedValueCollection& i_rCopySource ) + { + m_pImpl->aValues = i_rCopySource.m_pImpl->aValues; + return *this; } //-------------------------------------------------------------------- -- cgit v1.2.3 From 7cd5747f92be002cb31ea52b3f9a8e59d86525e4 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Wed, 3 Feb 2010 16:23:21 +0100 Subject: ause113: #i108416# update windows version defines --- vcl/win/source/window/MAKEFILE.MK | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/vcl/win/source/window/MAKEFILE.MK b/vcl/win/source/window/MAKEFILE.MK index 67cb1bf3e080..d648619b3dc6 100644 --- a/vcl/win/source/window/MAKEFILE.MK +++ b/vcl/win/source/window/MAKEFILE.MK @@ -42,12 +42,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : $(PRJ)$/util$/makefile2.pmk # --- #105371# -.IF "$(COM)"=="GCC" -CFLAGS += -D_WIN32_WINNT=0x0501 -.ELSE -CFLAGS += -DWINVER=0x0400 -D_WIN32_WINNT=0x0501 - -.ENDIF +CDEFS +=-U_WIN32_WINNT -D_WIN32_WINNT=0x0501 # --- Files -------------------------------------------------------- -- cgit v1.2.3 From 0f149cdc6cacca2039f95003bbd036291aad319a Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 4 Feb 2010 15:26:07 +0100 Subject: fix a warning --- vcl/source/window/status.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index e6f0c73378c6..ca84fe9b9c71 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1570,9 +1570,9 @@ void StatusBar::SetBottomBorder( BOOL bBottomBorder ) void StatusBar::SetTopBorder( BOOL bTopBorder ) { - if ( mpImplData->mbTopBorder != bTopBorder ) + if ( mpImplData->mbTopBorder != static_cast(bTopBorder) ) { - mpImplData->mbTopBorder = bTopBorder; + mpImplData->mbTopBorder = static_cast(bTopBorder); ImplCalcBorder(); } } -- cgit v1.2.3 From 614e8a2cb080c30cbbec0bd670d1730abb6ed0a3 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 8 Feb 2010 16:03:09 +0100 Subject: mtaccfixes: #i87415 Mnemonics need to be unambiguous --- vcl/source/window/mnemonic.cxx | 68 ++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 42e9b4aebdeb..bfb19a185bf9 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -335,39 +335,41 @@ BOOL MnemonicGenerator::CreateMnemonic( XubString& rKey ) } } - if( ! bChanged ) - { - /* - * #97809# if all else fails use the first character of a word - * anyway and live with duplicate mnemonics - */ - nIndex = 0; - do - { - c = aKey.GetChar( nIndex ); - - nMnemonicIndex = ImplGetMnemonicIndex( c ); - if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND ) - { - maMnemonics[nMnemonicIndex] = 0; - rKey.Insert( MNEMONIC_CHAR, nIndex ); - bChanged = TRUE; - break; - } - - // Search for next word - do - { - nIndex++; - c = aKey.GetChar( nIndex ); - if ( c == ' ' ) - break; - } - while ( nIndex < nLen ); - nIndex++; - } - while ( nIndex < nLen ); - } +// #i87415# Duplicates mnemonics are bad for consistent keyboard accessibility +// It's probably better to not have mnemonics for some widgets, than to have ambiguous ones. +// if( ! bChanged ) +// { +// /* +// * #97809# if all else fails use the first character of a word +// * anyway and live with duplicate mnemonics +// */ +// nIndex = 0; +// do +// { +// c = aKey.GetChar( nIndex ); +// +// nMnemonicIndex = ImplGetMnemonicIndex( c ); +// if ( nMnemonicIndex != MNEMONIC_INDEX_NOTFOUND ) +// { +// maMnemonics[nMnemonicIndex] = 0; +// rKey.Insert( MNEMONIC_CHAR, nIndex ); +// bChanged = TRUE; +// break; +// } +// +// // Search for next word +// do +// { +// nIndex++; +// c = aKey.GetChar( nIndex ); +// if ( c == ' ' ) +// break; +// } +// while ( nIndex < nLen ); +// nIndex++; +// } +// while ( nIndex < nLen ); +// } return bChanged; } -- cgit v1.2.3 From 0dfee188e8a60865f622dbb990f401be848b70a5 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 10 Feb 2010 12:16:22 +0100 Subject: aw079: changes after resync (linux) --- basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx index f484f3807759..70ffdf2b7339 100644 --- a/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx +++ b/basegfx/inc/basegfx/polygon/b2dtrapezoid.hxx @@ -32,7 +32,7 @@ #define _BGFX_POLYGON_B2DTRAPEZOID_HXX #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From feaa085d543cd91a5094dd11c0dc90d1f299325d Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Wed, 10 Feb 2010 12:26:51 +0100 Subject: mtaccfixes: #i102694# and #i102803#: removed MetaCity focus hack --- vcl/unx/gtk/window/gtkframe.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 92ff2d3b8d8e..10011dc4d83e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -809,8 +809,15 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME at some point that may be fixed in metacity and we will have to revisit this */ - bool bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && - (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); + + // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack + // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues + // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo. + // As a work around for such old systems, people might consider to not use the GTK plugin. + + bool bMetaCityToolWindowHack = false; + // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW ); + if( bDecoHandling ) { bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) ); -- cgit v1.2.3 From 6a5e0eee1b3d35ac94116844265bd38bad66f867 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 10 Feb 2010 14:33:58 +0100 Subject: vcl109: #i109085# fix CTRL_STATE_SELECTED for menu item --- vcl/aqua/source/gdi/salnativewidgets.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 9e23e357de47..076ea80baf1d 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -569,7 +569,7 @@ BOOL AquaSalGraphics::drawNativeControl(ControlType nType, // the Aqua grey theme when the item is selected is drawn here. aMenuItemDrawInfo.itemType = kThemeMenuItemPlain; - if ((nPart == PART_MENU_ITEM )) + if ((nPart == PART_MENU_ITEM ) && (nState & CTRL_STATE_SELECTED)) { // the blue theme when the item is selected is drawn here. aMenuItemDrawInfo.state = kThemeMenuSelected; -- cgit v1.2.3 From 6c6d2d2b8434bcdd25fcaa72a128554d68572434 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 12 Feb 2010 10:45:01 +0100 Subject: autorecovery: +ENSURE_OR_RETURN_VOID --- tools/inc/tools/diagnose_ex.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/inc/tools/diagnose_ex.h b/tools/inc/tools/diagnose_ex.h index eee965fcfd76..0d74195d6437 100644 --- a/tools/inc/tools/diagnose_ex.h +++ b/tools/inc/tools/diagnose_ex.h @@ -134,5 +134,16 @@ ENSURE_OR_RETURN(c, m, false) +/** This macro asserts the given condition (in debug mode), and + returns afterwards, without return value "void". + */ +#define ENSURE_OR_RETURN_VOID( c, m ) \ + if( !(c) ) \ + { \ + OSL_ENSURE( c, m ); \ + return; \ + } + + #endif // TOOLS_DIAGNOSE_EX_H -- cgit v1.2.3 From d783777932057729d1e7e49c3e3721d2b617eef6 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Feb 2010 14:22:47 +0100 Subject: autorecovery: +clear --- comphelper/inc/comphelper/namedvaluecollection.hxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comphelper/inc/comphelper/namedvaluecollection.hxx b/comphelper/inc/comphelper/namedvaluecollection.hxx index dbc5763b1b73..c76f06e99671 100644 --- a/comphelper/inc/comphelper/namedvaluecollection.hxx +++ b/comphelper/inc/comphelper/namedvaluecollection.hxx @@ -109,6 +109,11 @@ namespace comphelper impl_assign( _rArguments ); } + inline void clear() + { + impl_assign( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() ); + } + /// returns the number of elements in the collection size_t size() const; -- cgit v1.2.3 From 7b241f13b9536a0fc713752b1cc4947b1cff4555 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Wed, 17 Feb 2010 17:36:38 +0100 Subject: mtaccfixes #i104290# FOCUSED state for compund controls --- toolkit/source/awt/vclxaccessiblecomponent.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 9bdbfcfc21f7..e451122e58da 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -493,10 +493,18 @@ void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHel getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891# rStateSet.AddState( accessibility::AccessibleStateType::ACTIVE ); + // #104290# MT: This way, a ComboBox doesn't get state FOCUSED. + // I also don't understand + // a) why WINDOW_FIRSTCHILD is used here (which btw is a border window in the case of a combo box) + // b) why HasFocus() is nout "enough" for a compound control + /* Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD ); if ( ( !pWindow->IsCompoundControl() && pWindow->HasFocus() ) || ( pWindow->IsCompoundControl() && pChild && pChild->HasFocus() ) ) rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED ); + */ + if ( pWindow->HasFocus() || ( pWindow->IsCompoundControl() && pWindow->HasChildPathFocus() ) ) + rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED ); if ( pWindow->IsWait() ) rStateSet.AddState( accessibility::AccessibleStateType::BUSY ); -- cgit v1.2.3 From 1ab1215dd4ac9f4914b3fdb0a780acb180b7682f Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Wed, 17 Feb 2010 18:14:41 +0100 Subject: mtaccfixes #i104290# removed some code which shouldn't be needed anymore --- vcl/unx/gtk/a11y/atkutil.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index c92a69d3fb49..41c5cb85187e 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -503,6 +503,7 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent) /*****************************************************************************/ +/* currently not needed anymore... static void create_wrapper_for_children(Window *pWindow) { if( pWindow && pWindow->IsReallyVisible() ) @@ -520,6 +521,7 @@ static void create_wrapper_for_children(Window *pWindow) } } } +*/ /*****************************************************************************/ @@ -689,7 +691,11 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent) break; case VCLEVENT_COMBOBOX_SETTEXT: - create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); + // MT 2010/02: This looks quite strange to me. Stumbled over this when fixing #i104290#. + // This kicked in when leaving the combobox in the toolbar, after that the events worked. + // I guess this was a try to work around missing combobox events, which didn't do the full job, and shouldn't be necessary anymore. + // Fix for #i104290# was done in toolkit/source/awt/vclxaccessiblecomponent, FOCUSED state for compound controls in general. + // create_wrapper_for_children(static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow()); break; default: -- cgit v1.2.3 From f82dcbead55ca073976a27c972eac2fee046c1a3 Mon Sep 17 00:00:00 2001 From: hdu Date: Thu, 18 Feb 2010 13:06:18 +0100 Subject: #i109400# no special handling required when textlen matches with strlen --- vcl/source/gdi/outdev3.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 28fa4f8f5461..0f8a17077ce9 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5893,15 +5893,16 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, ImplInitFont(); // check string index and length - String aStr = rOrigStr; - if( (ULONG)nMinIndex + nLen >= aStr.Len() ) + if( (unsigned)nMinIndex + nLen > rOrigStr.Len() ) { - if( nMinIndex < aStr.Len() ) - nLen = aStr.Len() - nMinIndex; - else + const int nNewLen = (int)rOrigStr.Len() - nMinIndex; + if( nNewLen <= 0 ) return NULL; + nLen = static_cast(nNewLen); } + String aStr = rOrigStr; + // filter out special markers if( bFilter ) { -- cgit v1.2.3 From 362c3481b358712fc8504c5f473f23b8522c3191 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 18 Feb 2010 14:10:43 +0100 Subject: vcl109: #i82785# support full/partial field names, allow spaces in partial field names --- vcl/inc/vcl/pdfwriter.hxx | 2 +- vcl/source/gdi/pdfwriter_impl.cxx | 365 +++++++++++++++++++++++--------------- vcl/source/gdi/pdfwriter_impl.hxx | 2 +- 3 files changed, 224 insertions(+), 145 deletions(-) diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 275478d30549..261d65c9dd1a 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -201,7 +201,7 @@ public: enum WidgetType { - PushButton, RadioButton, CheckBox, Edit, ListBox, ComboBox + PushButton, RadioButton, CheckBox, Edit, ListBox, ComboBox, Hierarchy }; enum WidgetState diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 17326bcfb7eb..3471ddac2a21 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -652,30 +652,25 @@ static void appendUnicodeTextString( const rtl::OUString& rString, OStringBuffer } } -OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString ) +void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWriter::AnyWidget& i_rControl ) { - OStringBuffer aBuffer( rString.getLength()+64 ); - /* #i80258# previously we use appendName here however we need a slightly different coding scheme than the normal name encoding for field names - - also replace all '.' by '_' as '.' indicates a hierarchy level which - we do not have here */ - - OString aStr( OUStringToOString( rString, RTL_TEXTENCODING_UTF8 ) ); + const OUString& rName = (m_aContext.Version > PDFWriter::PDF_1_2) ? i_rControl.Name : i_rControl.Text; + OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ) ); const sal_Char* pStr = aStr.getStr(); int nLen = aStr.getLength(); + + OStringBuffer aBuffer( rName.getLength()+64 ); for( int i = 0; i < nLen; i++ ) { /* #i16920# PDF recommendation: output UTF8, any byte - * outside the interval [33(=ASCII'!');126(=ASCII'~')] + * outside the interval [32(=ASCII' ');126(=ASCII'~')] * should be escaped hexadecimal */ - if( pStr[i] == '.' ) - aBuffer.append( '_' ); - else if( (pStr[i] >= 33 && pStr[i] <= 126 ) ) + if( (pStr[i] >= 32 && pStr[i] <= 126 ) ) aBuffer.append( pStr[i] ); else { @@ -684,31 +679,135 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString ) } } - OString aRet = aBuffer.makeStringAndClear(); + OString aFullName( aBuffer.makeStringAndClear() ); + + /* #i82785# create hierarchical fields down to the for each dot in i_rName */ + sal_Int32 nTokenIndex = 0, nLastTokenIndex = 0; + OString aPartialName; + OString aDomain; + do + { + nLastTokenIndex = nTokenIndex; + aPartialName = aFullName.getToken( 0, '.', nTokenIndex ); + if( nTokenIndex != -1 ) + { + // find or create a hierarchical field + // first find the fully qualified name up to this field + aDomain = aFullName.copy( 0, nTokenIndex-1 ); + std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + if( it == m_aFieldNameMap.end() ) + { + // create new hierarchy field + sal_Int32 nNewWidget = m_aWidgets.size(); + m_aWidgets.push_back( PDFWidget() ); + m_aWidgets[nNewWidget].m_nObject = createObject(); + m_aWidgets[nNewWidget].m_eType = PDFWriter::Hierarchy; + m_aWidgets[nNewWidget].m_aName = aPartialName; + m_aWidgets[i_nWidgetIndex].m_nParent = m_aWidgets[nNewWidget].m_nObject; + m_aFieldNameMap[aDomain] = nNewWidget; + m_aWidgets[i_nWidgetIndex].m_nParent = m_aWidgets[nNewWidget].m_nObject; + if( nLastTokenIndex > 0 ) + { + // this field is not a root field and + // needs to be inserted to its parent + OString aParentDomain( aDomain.copy( 0, nLastTokenIndex-1 ) ); + it = m_aFieldNameMap.find( aParentDomain ); + OSL_ENSURE( it != m_aFieldNameMap.end(), "field name not found" ); + if( it != m_aFieldNameMap.end() ) + { + OSL_ENSURE( it->second < sal_Int32(m_aWidgets.size()), "invalid field number entry" ); + if( it->second < sal_Int32(m_aWidgets.size()) ) + { + PDFWidget& rParentField( m_aWidgets[it->second] ); + rParentField.m_aKids.push_back( m_aWidgets[nNewWidget].m_nObject ); + rParentField.m_aKidsIndex.push_back( nNewWidget ); + m_aWidgets[nNewWidget].m_nParent = rParentField.m_nObject; + } + } + } + } + else if( m_aWidgets[it->second].m_eType != PDFWriter::Hierarchy ) + { + // this is invalid, someone tries to have a terminal field as parent + // example: a button with the name foo.bar exists and + // another button is named foo.bar.no + // workaround: put the second terminal field as much up in the hierarchy as + // necessary to have a non-terminal field as parent (or none at all) + // since it->second already is terminal, we just need to use its parent + aDomain = OString(); + aPartialName = aFullName.copy( aFullName.lastIndexOf( '.' )+1 ); + if( nLastTokenIndex > 0 ) + { + aDomain = aFullName.copy( 0, nLastTokenIndex-1 ); + OStringBuffer aBuf( aDomain.getLength() + 1 + aPartialName.getLength() ); + aBuf.append( aDomain ); + aBuf.append( '.' ); + aBuf.append( aPartialName ); + aFullName = aBuf.makeStringAndClear(); + } + else + aFullName = aPartialName; + break; + } + } + } while( nTokenIndex != -1 ); + + // insert widget into its hierarchy field + if( aDomain.getLength() ) + { + std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain ); + if( it != m_aFieldNameMap.end() ) + { + OSL_ENSURE( it->second >= 0 && it->second < sal_Int32( m_aWidgets.size() ), "invalid field index" ); + if( it->second >= 0 && it->second < sal_Int32(m_aWidgets.size()) ) + { + m_aWidgets[i_nWidgetIndex].m_nParent = m_aWidgets[it->second].m_nObject; + m_aWidgets[it->second].m_aKids.push_back( m_aWidgets[i_nWidgetIndex].m_nObject); + m_aWidgets[it->second].m_aKidsIndex.push_back( i_nWidgetIndex ); + } + } + } + + if( aPartialName.getLength() == 0 ) + { + // how funny, an empty field name + if( i_rControl.getType() == PDFWriter::RadioButton ) + { + aPartialName = "RadioGroup"; + aPartialName += OString::valueOf( static_cast(i_rControl).RadioGroup ); + } + else + aPartialName = OString( "Widget" ); + } + if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map::iterator it = m_aFieldNameMap.find( aRet ); + std::hash_map::iterator it = m_aFieldNameMap.find( aFullName ); if( it != m_aFieldNameMap.end() ) // not unique { std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; OString aTry; + sal_Int32 nTry = 2; do { - OStringBuffer aUnique( aRet.getLength() + 16 ); - aUnique.append( aRet ); + OStringBuffer aUnique( aFullName.getLength() + 16 ); + aUnique.append( aFullName ); aUnique.append( '_' ); - aUnique.append( it->second ); - it->second++; + aUnique.append( nTry++ ); aTry = aUnique.makeStringAndClear(); check_it = m_aFieldNameMap.find( aTry ); } while( check_it != m_aFieldNameMap.end() ); - aRet = aTry; + aFullName = aTry; + m_aFieldNameMap[ aFullName ] = i_nWidgetIndex; + aPartialName = aFullName.copy( aFullName.lastIndexOf( '.' )+1 ); } else - m_aFieldNameMap[ aRet ] = 2; + m_aFieldNameMap[ aFullName ] = i_nWidgetIndex; } - return aRet; + + // finally + m_aWidgets[i_nWidgetIndex].m_aName = aPartialName; } static void appendFixedInt( sal_Int32 nValue, OStringBuffer& rBuffer, sal_Int32 nPrecision = nLog10Divisor ) @@ -5305,78 +5404,82 @@ bool PDFWriterImpl::emitWidgetAnnotations() aLine.append( rWidget.m_nObject ); aLine.append( " 0 obj\n" "<<" ); - // emit widget annotation only for terminal fields - if( rWidget.m_aKids.empty() ) + if( rWidget.m_eType != PDFWriter::Hierarchy ) { - aLine.append( "/Type/Annot/Subtype/Widget/F 4\n" - "/Rect[" ); - appendFixedInt( rWidget.m_aRect.Left()-1, aLine ); - aLine.append( ' ' ); - appendFixedInt( rWidget.m_aRect.Top()+1, aLine ); - aLine.append( ' ' ); - appendFixedInt( rWidget.m_aRect.Right()+1, aLine ); - aLine.append( ' ' ); - appendFixedInt( rWidget.m_aRect.Bottom()-1, aLine ); - aLine.append( "]\n" ); - } - aLine.append( "/FT/" ); - switch( rWidget.m_eType ) - { - case PDFWriter::RadioButton: - case PDFWriter::CheckBox: - // for radio buttons only the RadioButton field, not the - // CheckBox children should have a value, else acrobat reader - // does not always check the right button - // of course real check boxes (not belonging to a readio group) - // need their values, too - if( rWidget.m_eType == PDFWriter::RadioButton || rWidget.m_nRadioGroup < 0 ) - { - aValue.append( "/" ); - // check for radio group with all buttons unpressed - if( rWidget.m_aValue.getLength() == 0 ) - aValue.append( "Off" ); - else - appendName( rWidget.m_aValue, aValue ); - } - case PDFWriter::PushButton: - aLine.append( "Btn" ); - break; - case PDFWriter::ListBox: - if( rWidget.m_nFlags & 0x200000 ) // multiselect - { - aValue.append( "[" ); - for( unsigned int i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) + // emit widget annotation only for terminal fields + if( rWidget.m_aKids.empty() ) + { + aLine.append( "/Type/Annot/Subtype/Widget/F 4\n" + "/Rect[" ); + appendFixedInt( rWidget.m_aRect.Left()-1, aLine ); + aLine.append( ' ' ); + appendFixedInt( rWidget.m_aRect.Top()+1, aLine ); + aLine.append( ' ' ); + appendFixedInt( rWidget.m_aRect.Right()+1, aLine ); + aLine.append( ' ' ); + appendFixedInt( rWidget.m_aRect.Bottom()-1, aLine ); + aLine.append( "]\n" ); + } + aLine.append( "/FT/" ); + switch( rWidget.m_eType ) + { + case PDFWriter::RadioButton: + case PDFWriter::CheckBox: + // for radio buttons only the RadioButton field, not the + // CheckBox children should have a value, else acrobat reader + // does not always check the right button + // of course real check boxes (not belonging to a readio group) + // need their values, too + if( rWidget.m_eType == PDFWriter::RadioButton || rWidget.m_nRadioGroup < 0 ) { - sal_Int32 nEntry = rWidget.m_aSelectedEntries[i]; - if( nEntry >= 0 && nEntry < sal_Int32(rWidget.m_aListEntries.size()) ) - appendUnicodeTextStringEncrypt( rWidget.m_aListEntries[ nEntry ], rWidget.m_nObject, aValue ); + aValue.append( "/" ); + // check for radio group with all buttons unpressed + if( rWidget.m_aValue.getLength() == 0 ) + aValue.append( "Off" ); + else + appendName( rWidget.m_aValue, aValue ); } - aValue.append( "]" ); - } - else if( rWidget.m_aSelectedEntries.size() > 0 && - rWidget.m_aSelectedEntries[0] >= 0 && - rWidget.m_aSelectedEntries[0] < sal_Int32(rWidget.m_aListEntries.size()) ) - { - appendUnicodeTextStringEncrypt( rWidget.m_aListEntries[ rWidget.m_aSelectedEntries[0] ], rWidget.m_nObject, aValue ); - } - else - appendUnicodeTextStringEncrypt( rtl::OUString(), rWidget.m_nObject, aValue ); - aLine.append( "Ch" ); - break; - case PDFWriter::ComboBox: - appendUnicodeTextStringEncrypt( rWidget.m_aValue, rWidget.m_nObject, aValue ); - aLine.append( "Ch" ); - break; - case PDFWriter::Edit: - aLine.append( "Tx" ); - appendUnicodeTextStringEncrypt( rWidget.m_aValue, rWidget.m_nObject, aValue ); - break; + case PDFWriter::PushButton: + aLine.append( "Btn" ); + break; + case PDFWriter::ListBox: + if( rWidget.m_nFlags & 0x200000 ) // multiselect + { + aValue.append( "[" ); + for( unsigned int i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) + { + sal_Int32 nEntry = rWidget.m_aSelectedEntries[i]; + if( nEntry >= 0 && nEntry < sal_Int32(rWidget.m_aListEntries.size()) ) + appendUnicodeTextStringEncrypt( rWidget.m_aListEntries[ nEntry ], rWidget.m_nObject, aValue ); + } + aValue.append( "]" ); + } + else if( rWidget.m_aSelectedEntries.size() > 0 && + rWidget.m_aSelectedEntries[0] >= 0 && + rWidget.m_aSelectedEntries[0] < sal_Int32(rWidget.m_aListEntries.size()) ) + { + appendUnicodeTextStringEncrypt( rWidget.m_aListEntries[ rWidget.m_aSelectedEntries[0] ], rWidget.m_nObject, aValue ); + } + else + appendUnicodeTextStringEncrypt( rtl::OUString(), rWidget.m_nObject, aValue ); + aLine.append( "Ch" ); + break; + case PDFWriter::ComboBox: + appendUnicodeTextStringEncrypt( rWidget.m_aValue, rWidget.m_nObject, aValue ); + aLine.append( "Ch" ); + break; + case PDFWriter::Edit: + aLine.append( "Tx" ); + appendUnicodeTextStringEncrypt( rWidget.m_aValue, rWidget.m_nObject, aValue ); + break; + case PDFWriter::Hierarchy: // make the compiler happy + break; + } + aLine.append( "\n" ); + aLine.append( "/P " ); + aLine.append( m_aPages[ rWidget.m_nPage ].m_nPageObject ); + aLine.append( " 0 R\n" ); } - aLine.append( "\n" ); - aLine.append( "/P " ); - aLine.append( m_aPages[ rWidget.m_nPage ].m_nPageObject ); - aLine.append( " 0 R\n" ); - if( rWidget.m_nParent ) { aLine.append( "/Parent " ); @@ -5400,7 +5503,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() appendLiteralStringEncrypt( rWidget.m_aName, rWidget.m_nObject, aLine ); aLine.append( "\n" ); } - if( m_aContext.Version > PDFWriter::PDF_1_2 ) + if( m_aContext.Version > PDFWriter::PDF_1_2 && rWidget.m_aDescription.getLength() ) { // the alternate field name should be unicode able since it is // supposed to be used in UI @@ -5462,7 +5565,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if(!m_bIsPDF_A1) { OStringBuffer aDest; - if( appendDest( rWidget.m_nDest, aDest ) ) + if( rWidget.m_nDest != -1 && appendDest( rWidget.m_nDest, aDest ) ) { aLine.append( "/AA<= 0 ) + { + AnnotSortContainer& rCont = sorted[ rWidget.m_nPage ]; + // optimize vector allocation + if( rCont.aSortedAnnots.empty() ) + rCont.aSortedAnnots.reserve( m_aPages[ rWidget.m_nPage ].m_aAnnotations.size() ); + // insert widget to tab sorter + // RadioButtons are not page annotations, only their individual check boxes are + if( rWidget.m_eType != PDFWriter::RadioButton ) + { + rCont.aObjects.insert( rWidget.m_nObject ); + rCont.aSortedAnnots.push_back( AnnotationSortEntry( rWidget.m_nTabOrder, rWidget.m_nObject, nW ) ); + } } } for( std::hash_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it ) @@ -11629,18 +11735,7 @@ sal_Int32 PDFWriterImpl::findRadioGroupWidget( const PDFWriter::RadioButtonWidge m_aWidgets.back().m_nRadioGroup = rBtn.RadioGroup; m_aWidgets.back().m_nFlags |= 0x00008000; - // create radio button field name - const rtl::OUString& rName = (m_aContext.Version > PDFWriter::PDF_1_2) ? - rBtn.Name : rBtn.Text; - if( rName.getLength() ) - { - m_aWidgets.back().m_aName = convertWidgetFieldName( rName ); - } - else - { - m_aWidgets.back().m_aName = "RadioGroup"; - m_aWidgets.back().m_aName += OString::valueOf( rBtn.RadioGroup ); - } + createWidgetFieldName( sal_Int32(m_aWidgets.size()-1), rBtn ); } else nRadioGroupWidget = it->second; @@ -11656,44 +11751,27 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa if( nPageNr < 0 || nPageNr >= (sal_Int32)m_aPages.size() ) return -1; + sal_Int32 nNewWidget = m_aWidgets.size(); m_aWidgets.push_back( PDFWidget() ); - sal_Int32 nNewWidget = m_aWidgets.size()-1; - // create eventual radio button before getting any references - // from m_aWidgets as the push_back operation potentially assigns new - // memory to the vector and thereby invalidates the reference - int nRadioGroupWidget = -1; - if( rControl.getType() == PDFWriter::RadioButton ) - nRadioGroupWidget = findRadioGroupWidget( static_cast(rControl) ); - - PDFWidget& rNewWidget = m_aWidgets[nNewWidget]; - rNewWidget.m_nObject = createObject(); - rNewWidget.m_aRect = rControl.Location; - rNewWidget.m_nPage = nPageNr; - rNewWidget.m_eType = rControl.getType(); + m_aWidgets.back().m_nObject = createObject(); + m_aWidgets.back().m_aRect = rControl.Location; + m_aWidgets.back().m_nPage = nPageNr; + m_aWidgets.back().m_eType = rControl.getType(); + sal_Int32 nRadioGroupWidget = -1; // for unknown reasons the radio buttons of a radio group must not have a // field name, else the buttons are in fact check boxes - // that is multiple buttons of the radio group can be selected - if( rControl.getType() != PDFWriter::RadioButton ) + if( rControl.getType() == PDFWriter::RadioButton ) + nRadioGroupWidget = findRadioGroupWidget( static_cast(rControl) ); + else { - // acrobat reader since 3.0 does not support unicode text - // strings for the field name; so we need to encode unicodes - // larger than 255 - - rNewWidget.m_aName = - convertWidgetFieldName( (m_aContext.Version > PDFWriter::PDF_1_2) ? - rControl.Name : rControl.Text ); - // #i88040# acrobat reader crashes on empty field names, - // so always create one - if( rNewWidget.m_aName.getLength() == 0 ) - { - OUStringBuffer aBuf( 32 ); - aBuf.appendAscii( "Widget" ); - aBuf.append( nNewWidget ); - rNewWidget.m_aName = convertWidgetFieldName( aBuf.makeStringAndClear() ); - } + createWidgetFieldName( nNewWidget, rControl ); } + + // caution: m_aWidgets must not be changed after here or rNewWidget may be invalid + PDFWidget& rNewWidget = m_aWidgets[nNewWidget]; rNewWidget.m_aDescription = rControl.Description; rNewWidget.m_aText = rControl.Text; rNewWidget.m_nTextStyle = rControl.TextStyle & @@ -11924,6 +12002,7 @@ bool PDFWriterImpl::endControlAppearance( PDFWriter::WidgetState eState ) break; case PDFWriter::ListBox: case PDFWriter::ComboBox: + case PDFWriter::Hierarchy: break; } if( aState.getLength() && aStyle.getLength() ) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 83270b56159b..be548375dd62 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1059,7 +1059,7 @@ i12626 void createDefaultListBoxAppearance( PDFWidget&, const PDFWriter::ListBoxWidget& rWidget ); /* ensure proper escapement and uniqueness of field names */ - rtl::OString convertWidgetFieldName( const rtl::OUString& rString ); + void createWidgetFieldName( sal_Int32 i_nWidgetsIndex, const PDFWriter::AnyWidget& i_rInWidget ); /* adds an entry to m_aObjects and returns its index+1, * sets the offset to ~0 */ -- cgit v1.2.3 From 9c5f039ce227402f6cb1e133368c5b63e5ab3757 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 18 Feb 2010 14:28:59 +0100 Subject: autorecovery: #i109405# --- svtools/source/contnr/templwin.cxx | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 06de35ba19aa..74146d5b2a61 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -1843,26 +1843,7 @@ sal_Bool SvtDocumentTemplateDialog::CanEnableEditBtn() const if ( pImpl->pWin->IsFileSelected() && aFolderURL.getLength() ) { ::rtl::OUString aFileTargetURL = pImpl->pWin->GetSelectedFile(); - ::rtl::OUString aFolderTargetURL; - - ::ucbhelper::Content aFolderContent; - Reference< XCommandEnvironment > xEnv; - if ( ::ucbhelper::Content::create( aFolderURL, xEnv, aFolderContent ) ) - try - { - ::rtl::OUString aTmpURL; - uno::Any aValue = aFolderContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TargetDirURL") ) ); - aValue >>= aTmpURL; - - uno::Reference< util::XOfficeInstallationDirectories > xOffInstDirs = pImpl->getOfficeInstDirs(); - if ( xOffInstDirs.is() ) - aFolderTargetURL = xOffInstDirs->makeAbsoluteURL( aTmpURL ); - } - catch( uno::Exception& ) - {} - - if ( aFolderTargetURL.getLength() && ::utl::UCBContentHelper::IsSubPath( aFolderTargetURL, aFileTargetURL ) ) - bEnable = sal_True; + bEnable = aFileTargetURL.getLength() > 0; } return bEnable; -- cgit v1.2.3 From 044a770c3e9885aaaa0574c7a5385f7170f385aa Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Fri, 19 Feb 2010 10:44:47 +0100 Subject: mtaccfixes: #100833# FixedLine and GroupBox can also lable a FixedText --- vcl/source/window/dlgctrl.cxx | 50 +++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index c6f64d74c5fc..3e11d55f7628 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1081,10 +1081,15 @@ Window* Window::GetLabelFor() const return pWindow; sal_Unicode nAccel = getAccel( GetText() ); - if( GetType() == WINDOW_FIXEDTEXT || - GetType() == WINDOW_FIXEDLINE || - GetType() == WINDOW_GROUPBOX ) + + WindowType nMyType = GetType(); + if( nMyType == WINDOW_FIXEDTEXT || + nMyType == WINDOW_FIXEDLINE || + nMyType == WINDOW_GROUPBOX ) { + // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text. + // See tools/options/print for example. + BOOL bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE); Window* pSWindow = NULL; // get index, form start and form end USHORT nIndex=0, nFormStart=0, nFormEnd=0; @@ -1116,9 +1121,14 @@ Window* Window::GetLabelFor() const FALSE ); if( pSWindow && pSWindow->IsVisible() && ! (pSWindow->GetStyle() & WB_NOLABEL) ) { - if( pSWindow->GetType() != WINDOW_FIXEDTEXT && - pSWindow->GetType() != WINDOW_FIXEDLINE && - pSWindow->GetType() != WINDOW_GROUPBOX ) + WindowType nType = pSWindow->GetType(); + if( nType != WINDOW_FIXEDTEXT && + nType != WINDOW_FIXEDLINE && + nType != WINDOW_GROUPBOX ) + { + pWindow = pSWindow; + } + else if( bThisIsAGroupControl && ( nType == WINDOW_FIXEDTEXT ) ) { pWindow = pSWindow; } @@ -1151,9 +1161,13 @@ Window* Window::GetLabeledBy() const if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON ) return NULL; - if( ! ( GetType() == WINDOW_FIXEDTEXT || - GetType() == WINDOW_FIXEDLINE || - GetType() == WINDOW_GROUPBOX ) ) +// if( ! ( GetType() == WINDOW_FIXEDTEXT || +// GetType() == WINDOW_FIXEDLINE || +// GetType() == WINDOW_GROUPBOX ) ) + // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text. + // See tools/options/print for example. + WindowType nMyType = GetType(); + if ( (nMyType != WINDOW_GROUPBOX) && (nMyType != WINDOW_FIXEDLINE) ) { // search for a control that labels this window // a label is considered the last fixed text, fixed line or group box @@ -1184,14 +1198,18 @@ Window* Window::GetLabeledBy() const nSearchIndex, nFoundIndex, FALSE ); - if( pSWindow && pSWindow->IsVisible() && - ! (pSWindow->GetStyle() & WB_NOLABEL) && - ( pSWindow->GetType() == WINDOW_FIXEDTEXT || - pSWindow->GetType() == WINDOW_FIXEDLINE || - pSWindow->GetType() == WINDOW_GROUPBOX ) ) + if( pSWindow && pSWindow->IsVisible() && !(pSWindow->GetStyle() & WB_NOLABEL) ) { - pWindow = pSWindow; - break; + WindowType nType = pSWindow->GetType(); + if ( ( nType == WINDOW_FIXEDTEXT || + nType == WINDOW_FIXEDLINE || + nType == WINDOW_GROUPBOX ) ) + { + // a fixed text can't be labeld by a fixed text. + if ( ( nMyType != WINDOW_FIXEDTEXT ) || ( nType != WINDOW_FIXEDTEXT ) ) + pWindow = pSWindow; + break; + } } if( nFoundIndex > nSearchIndex || nSearchIndex == 0 ) break; -- cgit v1.2.3 From b9bf85ffe5c1b22bb096cb63fc7059ebe590134e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 19 Feb 2010 11:45:31 +0100 Subject: workaround deprecation warning for KillPicture --- vcl/aqua/source/dtrans/PictToBmpFlt.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx index 15f99cbef8eb..1410fc2bd66d 100644 --- a/vcl/aqua/source/dtrans/PictToBmpFlt.cxx +++ b/vcl/aqua/source/dtrans/PictToBmpFlt.cxx @@ -28,8 +28,6 @@ * ************************************************************************/ -#include "PictToBmpFlt.hxx" - /* This is a work-around to prevent 'deprecated' warning for 'KillPicture' API Hopefully we can get rid of this whole code again when the OOo PICT filter are good enough to be used see #i78953 thus this hack would vanish to again. @@ -43,6 +41,8 @@ #include #include +#include "PictToBmpFlt.hxx" + bool PICTtoBMP(com::sun::star::uno::Sequence& aPict, com::sun::star::uno::Sequence& aBmp) { -- cgit v1.2.3 From 8083244e8119b6efc2d2f8615fffbb3568259e44 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 20 Feb 2010 23:34:03 +0100 Subject: locales33: #i109095# added Unicode 5.1.0 mappings to Simplified/Traditional Chinese character conversion table; patch from --- i18npool/source/textconversion/data/stc_char.dic | 378 +++++++++++++++++++---- i18npool/source/textconversion/data/stc_word.dic | 1 + 2 files changed, 325 insertions(+), 54 deletions(-) diff --git a/i18npool/source/textconversion/data/stc_char.dic b/i18npool/source/textconversion/data/stc_char.dic index 27560f3bc34f..32c2b3c66502 100644 --- a/i18npool/source/textconversion/data/stc_char.dic +++ b/i18npool/source/textconversion/data/stc_char.dic @@ -59,11 +59,11 @@ 丰:ä¸°è± ä¸´:臨 丸:ä¸¸æ± -为:為 +为:為爲 丽:麗 举:舉 乃:乃迺 -么:么麼 +么:么麼麽 义:義 乌:çƒ ä¹:樂 @@ -76,15 +76,17 @@ 了:了暸瞭 争:爭 äº:äºè±– +于:æ–¼ äº:虧 云:云雲 井:井丼 亘:亙 亚:亞 -产:產 +产:產産 亩:ç• äº²:親 亵:褻 +亸:åš² 亿:å„„ 仂:ä»‚æ‰ ä»„:仄庂 @@ -99,7 +101,7 @@ 们:們 ä»·:價价 仿:仿倣髣 -ä¼—:眾 +ä¼—:眾衆 优:優优 ä¼™:伙夥 会:會 @@ -107,11 +109,12 @@ 伞:傘 伟:å‰ ä¼ :傳 +ä¼£:ä¿” 伤:å‚· ä¼¥:倀 伦:倫 伧:å‚– -伪:å½ +伪:å½åƒž 伫:佇 佑:ä½‘ç¥ ä½“:體体 @@ -136,6 +139,7 @@ 俨:儼 ä¿©:倆 俪:å„· +ä¿«:倈 ä¿­:儉 ä¿®:修脩 俯:俯頫 @@ -188,7 +192,7 @@ 凛:凜 几:几幾 凤:é³³ -凫:鳧 +凫:鳧鳬 凭:憑 凯:凱 凶:凶兇 @@ -196,7 +200,7 @@ 击:æ“Š 凿:é‘¿ åˆ:芻 -划:划劃 +划:划劃畫 刘:劉 则:則 刚:剛 @@ -204,6 +208,7 @@ 删:刪 刨:刨鉋鑤 别:別彆 +刬:剗 刭:剄 刮:刮颳 制:制製 @@ -232,6 +237,7 @@ å‹‹:勛勳 å‹–:å‹—å‹– 勤:勤懃 +å‹š:å‹© 匀:å‹» 匡:匡劻 匦:匭 @@ -262,7 +268,8 @@ 压:壓 厌:厭 åŽ:厙 -厕:å» +åŽ:龎 +厕:å»åŽ  厘:é‡åŽ˜ 厢:廂 厣:厴 @@ -271,6 +278,7 @@ 厩:廄 厮:å» åŽ¿:縣 +å:å„ å‚:åƒ åŒ:é›™ å‘:發髮醱 @@ -287,14 +295,16 @@ åƒ:åƒå–« åˆ:åˆé–¤ åŠ:å¼”åŠ +åŒ:è¡• åŽ:åŽå¾Œ å‘:å‘åš®æ› å“:嚇 å•:å‘‚ å—:å—Ž +å£:唚 å¨:å™¸å¨ å¬:è½å¬ -å¯:å•Ÿ +å¯:å•Ÿå•“ å´:å³ å‘†:呆çƒé¨ƒ å‘:å¶ @@ -315,6 +325,8 @@ å’›:嚀 å’¯:咯詻 å’±:å’±åº +å’:å™ +å’¤:å’ å’¸:咸鹹 å’½:咽嚥 å“„:哄鬨 @@ -333,7 +345,9 @@ 唇:唇脣 唉:唉欸 å”›:嘜 +å”:å—Š å” :嘮 +唡:å•¢ 唢:å—© 唤:å–š å••:å••å’· @@ -342,6 +356,7 @@ 啬:å—‡ å•­:囀 å•®:齧嚙囓 +å•´:嘽 啸:嘯 å–‚:喂餵 å–§:喧諠 @@ -374,6 +389,7 @@ 圹:壙 场:å ´ å€:å€é˜¯ +å‚:阪 å:壞å å‘:å‘阬 å—:å¡Š @@ -385,17 +401,21 @@ åŸ:墳 å :墜 åž„:壟 +åž…:壠 垆:壚 åž’:壘 垦:墾 åž©:å Š åž«:墊 åž­:埡 +åž±:壋 åž²:å¡ +åž´:å – 埘:å¡’ 埙:壎塤 埚:å  å ‡:å ‡è« +埯:åžµ å ‘:塹 å •:墮 å ¤:堤隄 @@ -403,11 +423,12 @@ 墙:牆墻 壮:壯 声:è² -壳:殼 +壳:殼殻 壶:壺 +壸:壼 处:處 备:å‚™ -å¤:å¾©è¤‡å¤ +å¤:復複å¤è¦† 够:夠 夫:夫伕 夭:夭殀 @@ -418,7 +439,7 @@ å¥:奩 奂:å¥ å¥‹:奮 -奖:çŽ +奖:çŽå¥¬ 奥:奧 奶:奶嬭 奸:奸姦 @@ -428,9 +449,10 @@ 妙:妙玅 妩:嫵 妪:å«— -妫:媯 +妫:媯嬀 姗:å§ å§œ:姜薑 +姹:奼 娄:å© å¨…:å©­ 娆:嬈 @@ -480,6 +502,7 @@ å°½:盡儘 å±€:局侷跼挶 层:層 +屃:屓 屉:屜 届:屆 属:屬 @@ -491,12 +514,13 @@ å²–:嶇 å²—:å´— 岘:å³´ +å²™:嶴 岚:åµ å²›:島 岩:岩巖嵒 å²­:嶺岭 å²³:岳嶽 -å²½:å´  +å²½:å´ å´¬ 岿:å·‹ 峄:嶧 峡:å³½ @@ -561,11 +585,13 @@ 强:強彊 å½’:æ­¸ 当:當儅噹 -录:錄 +录:錄録 +å½:彞 å½—:彗篲 彦:å½¥ 彩:彩綵 å½»:å¾¹ +å¾:å¾µ 径:徑 徇:徇侚 徊:徊佪 @@ -600,7 +626,7 @@ æ¼:惱 æ½:惲 悦:æ‚… -æ‚«:愨 +æ‚«:愨慤 悬:懸 æ‚­:æ…³ 悯:憫 @@ -630,6 +656,7 @@ 战:戰 戚:戚慼 戬:戩 +戯:戱 户:戶 æ‰:æ‰ç¨¨ 扉:å±æ‰‰ @@ -669,6 +696,7 @@ 拨:æ’¥ æ‹©:擇 挂:掛挂 +挜:掗 挚:摯 挛:攣 æŒ:æ’¾ @@ -680,6 +708,7 @@ 挣:掙 挤:æ“  挥:æ® +挦:æ’ æŒ½:挽輓 æ‚:æ‚æ‘€ æ†:æ†æ¢±ç¶‘ @@ -701,6 +730,7 @@ 掼:æ‘œ æ’:æ’扱 æ½:攬 +æ¾:æµ æ¿:æ’³ æ€:æ”™ æ:擱 @@ -745,9 +775,11 @@ æ—·:æ›  昂:æ˜‚å¬ æ˜†:昆崑 +æ—¸:暘 昙:曇 昵:暱昵 昼:æ™ +昽:曨 显:顯 晋:晉 æ™’:曬晒 @@ -788,6 +820,7 @@ 枢:樞 枣:棗 枥:櫪 +枧:梘 枨:棖 枪:æ§éŽ— æž«:楓 @@ -824,6 +857,9 @@ æ¡©:æ¨ æ¢:æ¢æ¨‘ 梦:夢 +梼:檮 +梾:棶 +梿:槤 检:檢 棂:櫺欞 棋:æ£‹ç¢ @@ -837,10 +873,12 @@ 椭:æ©¢ 楼:樓 榄:欖 +榅:榲 榇:櫬 榈:æ«š 榉:櫸 榨:æ¾æ¦¨ +槚:檟 槛:檻 槟:檳 槠:櫧 @@ -896,7 +934,7 @@ æ²¥:ç€ æ²¦:æ·ª 沧:滄 -沩:溈 +沩:溈潙 沪:滬 æ²¾:沾霑 泄:泄洩 @@ -925,6 +963,7 @@ æµ:æ¾® 济:æ¿Ÿ æµ:ç€ +æµ:æ»» 浑:渾 æµ’:滸 浓:濃 @@ -970,7 +1009,7 @@ æ»—:æ½· 滚:滾 滞:滯 -滟:ç© +滟:ç©ç§ æ» :ç„ æ»¡:滿 滢:瀅 @@ -979,9 +1018,11 @@ 滦:ç¤ æ»¨:濱 滩:ç˜ +滪:澦 漓:æ¼“ç• æ¼”:演縯 æ¼¾:æ¼¾ç€ +漤:ç  æ½†:瀠 潇:瀟 潋:瀲 @@ -996,6 +1037,7 @@ ç­:æ»… ç¯:燈 çµ:éˆ +ç¶:竈 ç¾:ç½ ç¿:燦 ç‚€:ç…¬ @@ -1032,12 +1074,13 @@ 爱:æ„› 爷:爺 ç‰:牘 -牦:犛 +牦:犛氂 牵:牽 牺:犧 犊:犢 状:ç‹€ 犷:ç· +犸:ç 犹:猶 狈:狽 ç‹ž:ç° @@ -1059,14 +1102,17 @@ 献:ç» ç­:çº çŽ‘:ç’£ +玚:ç‘’ 玛:瑪 玮:ç‘‹ 环:ç’°é¶ çŽ°:ç¾ +玱:瑲 玺:ç’½ ç:玨 ç:çº ç‘:ç“ +ç°:ç’« ç²:ç¿ çƒ:çƒæ¯¬ ç…:ç…瑯 @@ -1091,6 +1137,8 @@ ç–Ÿ:瘧 ç– :癘 ç–¡:ç˜ +ç–¬:癧 +ç–­:瘲 ç–®:瘡 ç–¯:瘋 ç–±:çš° @@ -1099,6 +1147,7 @@ ç—ˆ:廱癰 ç—‰:ç—™ ç—’:癢痒 +ç—–:瘂 ç—¨:癆 ç—ª:瘓 ç—«:癇 @@ -1107,7 +1156,7 @@ ç—¹:痺痹 瘅:癉 瘗:瘞 -瘘:瘺 +瘘:瘺瘻 瘪:癟 瘫:ç™± 瘾:ç™® @@ -1125,14 +1174,18 @@ ç›–:è“‹ ç›—:盜 盘:槃盤 +çœ:瞘 眦:眥 眯:瞇眯 眺:眺覜 +眬:矓 +ç€:è‘— ç:çœ ç:çž ç‘:çž¼ ç¾:çªç¾ ç¿:ç¿å¡ +瞆:瞶 çž’:çžž çž©:矚 矫:矯 @@ -1145,15 +1198,18 @@ ç —:硨 ç š:硯 ç §:砧碪 +ç œ:碸 ç º:礪 ç »:礱 ç ¾:礫 ç¡€:礎 +ç¡:ç¡œ ç¡•:碩 ç¡–:硤 ç¡—:磽 +ç¡™:磑 ç¡®:確确 -ç¡·:é¹¼ +ç¡·:鹼礆 ç¢:礙 碛:磧 碜:磣 @@ -1164,6 +1220,8 @@ 礼:禮 祆:祆祅 祛:祛袪 +祃:禡 +祎:禕 祢:禰 祯:禎 祷:禱 @@ -1180,6 +1238,8 @@ 积:ç© ç§°:稱 秽:ç©¢ +秾:ç©  +稆:ç©­ 税:稅 稣:ç©Œ 稳:ç©© @@ -1187,13 +1247,14 @@ ç©·:窮 窃:ç«Š çª:ç«… +窎:窵 窑:窯 窜:ç«„ çª:窩 窥:窺 窦:竇 窭:窶 -ç«–:豎 +ç«–:豎竪 ç«ž:競 端:端耑 笃:篤 @@ -1210,9 +1271,11 @@ ç­–:ç­–ç­´ ç­š:篳 ç­›:篩 +ç­œ:ç°¹ ç­:ç® ç­±:筱篠 ç­¹:籌 +ç­¼:篔 ç­¾:簽籤 简:ç°¡ ç®…:箄箅 @@ -1246,6 +1309,7 @@ ç´§:ç·Š ç´¯:ç´¯æ«çº çµ·:縶 +纟:ç³¹ 纠:ç³¾ 纡:ç´† 红:ç´… @@ -1260,20 +1324,24 @@ 纫:ç´‰ 纬:ç·¯ 纭:ç´œ +纮:ç´˜ 纯:ç´” 纰:ç´• 纱:ç´— 纲:綱 纳:ç´ +纴:ç´ çºµ:縱 纶:綸 纷:ç´› 纸:ç´™ 纹:ç´‹ 纺:ç´¡ +纻:ç´µ +纼:ç´– 纽:ç´ çº¾:ç´“ -线:ç·š +线:線綫 绀:ç´º ç»:ç´² 绂:ç´± @@ -1294,44 +1362,50 @@ 绑:ç¶ ç»’:絨 结:çµ +ç»”:çµ ç»•:繞 +ç»–:çµ° ç»—:絎 绘:繪 ç»™:給 绚:çµ¢ ç»›:çµ³ 络:絡 -ç»:絕 +ç»:絕絶 绞:絞 统:çµ± ç» :綆 绡:綃 绢:çµ¹ -绣:繡 +绣:繡綉 +绤:綌 绥:ç¶ -绦:絛縚 +绦:絛縚縧 继:ç¹¼ 绨:綈 绩:績勣 绪:ç·’ 绫:綾 +绬:ç·“ ç»­:續 ç»®:綺 绯:ç·‹ ç»°:綽 +ç»±:ç·”éž ç»²:ç·„ 绳:繩 ç»´:維 绵:綿 绶:綬 -ç»·:繃 +ç»·:繃綳 绸:綢 +绹:綯 绺:綹 ç»»:綣 综:綜 绽:綻 绾:綰 -绿:綠 +绿:綠緑 ç¼€:綴 ç¼:ç·‡ 缂:ç·™ @@ -1342,6 +1416,7 @@ 缇:ç·¹ 缈:ç·² 缉:ç· +缊:縕 缋:ç¹¢ 缌:ç·¦ ç¼:綞 @@ -1360,6 +1435,7 @@ ç¼›:縟 缜:ç¸ ç¼:縫 +缞:縗 缟:縞 ç¼ :çº ç¼¡:縭 @@ -1377,7 +1453,7 @@ ç¼­:繚 ç¼®:繕 缯:ç¹’ -ç¼°:éŸ +ç¼°:éŸç¹® ç¼±:ç¹¾ ç¼²:ç¹° ç¼³:繯 @@ -1400,6 +1476,7 @@ 耀:耀燿 考:考攷 耗:è€—ç§ +耢:耮 耧:耬 耸:è³ è€»:æ¥ @@ -1426,6 +1503,7 @@ 胜:å‹èƒœ 胡:胡é¬æ¥œè¡š 胧:朧矓 +胨:è…– 胪:臚 胫:è„› 胭:胭臙 @@ -1452,6 +1530,7 @@ 膑:è‡ è†˜:膘臕 膻:羶膻 +臜:臢 致:致緻 舄:舄潟 舆:輿 @@ -1478,6 +1557,7 @@ è‹:è’¼ è‹Ž:苧 è‹:蘇甦囌 +苧:è–´ è‹Ÿ:è‹ŸèŒ è‹¹:蘋苹 茂:茂楙 @@ -1490,6 +1570,7 @@ 茧:繭茧 è†:èŠ è:èè–¦ +è™:è–˜ èš:莢 è›:蕘 èœ:蓽 @@ -1506,8 +1587,9 @@ è©:è—Ž èª:è“€ è«:è”­ -è¬:è—š +è¬:è—šè•’ è­:è‘’ +è®:葤 è¯:藥葯 莅:è’ž 莓:莓苺 @@ -1520,7 +1602,7 @@ 莸:è•• 莹:ç‘© 莺:鶯 -莼:è“´ +莼:è“´è’“ è±:è±è”† è:蘿 è¤:螢 @@ -1542,10 +1624,12 @@ è“¥:鎣 蓦:é©€ 蔑:蔑衊 +蔂:虆 è”·:è–” 蔹:蘞 蔺:è—º 蔼:è—¹ +è•°:è–€ 蕲:蘄 è•´:蘊 è–®:è—ª @@ -1553,7 +1637,7 @@ è—‰:藉耤 è—“:蘚 è—¤:è—¤ç± -蘖:蘗 +蘖:蘗櫱 è™:虜 虑:æ…® 虚:è™› @@ -1590,8 +1674,11 @@ è¼:èž» è¾:è ‘ 蟮:蟺 +螀:èž¿ +螨:蟎 è ¢:蠢惷 è ¼:è ·è ¼ +èŸ:è ¨ è¡…:é‡èˆ‹ è¡”:銜啣 è¡¥:補 @@ -1601,14 +1688,17 @@ 袄:襖 袅:裊å¬å«‹ 袖:袖褎 +袆:褘 袜:襪 袭:襲 +袯:è¥ è£…:è£ è£†:襠 +裈:褌 裢:褳 裣:è¥ è£¤:褲 -裥:襉 +裥:襉襇 裸:裸祼 褛:褸 褴:襤 @@ -1625,6 +1715,7 @@ 觊:覬 觋:覡 觌:覿 +è§:覥 觎:覦 è§:覯 è§:覲 @@ -1633,8 +1724,10 @@ 觞:觴 触:觸触 觯:觶 +訚:誾 誉:è­½ 誊:謄 +è® :è¨ è®¡:計 订:訂 讣:訃 @@ -1646,10 +1739,12 @@ 让:讓 讪:訕 讫:訖 +讬:託 è®­:訓 è®®:è­° 讯:訊 è®°:記 +è®±:訒 讲:講 讳:諱 è®´:謳 @@ -1659,6 +1754,7 @@ 许:許 讹:訛 论:è«– +è®»:訩 讼:訟 讽:è«· 设:設 @@ -1670,6 +1766,7 @@ 评:è©• 诅:è©› 识:è­˜ +诇:è©— 诈:è© è¯‰:訴 诊:診 @@ -1678,6 +1775,7 @@ è¯:è©ž 诎:詘 è¯:è©” +è¯:è©– 译:è­¯ 诒:è©’ 诓:誆 @@ -1703,6 +1801,7 @@ 诧:è©« 诨:è«¢ 诩:è©¡ +诪:è­¸ 诫:誡 诬:誣 语:語 @@ -1712,7 +1811,7 @@ 诱:誘 诲:誨 诳:誑 -说:說 +说:說説 诵:誦 诶:誒 请:è«‹ @@ -1753,11 +1852,12 @@ è°›:諦 è°œ:謎 è°:è«ž +è°ž:è« è°Ÿ:謨 è° :讜 è°¡:謖 è°¢:è¬ -è°£:謠 +è°£:謠謡 è°¤:謗 è°¥:謚 è°¦:謙 @@ -1765,7 +1865,7 @@ è°¨:謹 è°©:謾 è°ª:謫 -è°«:è­¾ +è°«:譾謭 è°¬:謬 è°­:è­š è°®:è­– @@ -1780,9 +1880,11 @@ è°·:è°·ç©€ 豆:è±†è³ è±š:豚魨 +è±®:豶 è´:è² è´ž:貞 è´Ÿ:è²  +è´ :貟 è´¡:è²¢ è´¢:財 è´£:責 @@ -1817,7 +1919,7 @@ èµ€:è²² èµ:賃 赂:賂 -赃:è´“ +赃:è´“è´œ 资:資 èµ…:è³… 赆:è´ @@ -1827,25 +1929,30 @@ 赊:è³’ 赋:賦 赌:è³­ -èµ:齎 +èµ:齎賫 赎:è´– èµ:賞 èµ:賜 +赑:è´” +èµ’:è³™ 赓:賡 èµ”:è³  赕:賧 èµ–:è³´ +èµ—:è³µ 赘:è´… èµ™:è³» 赚:賺 èµ›:è³½ 赜:è³¾ -èµ:è´— +èµ:è´—è´‹ 赞:贊讚 +赟:è´‡ èµ :è´ˆ 赡:è´ èµ¢:è´ èµ£:è´› +赪:赬 èµµ:趙 赶:趕赶 趋:趨 @@ -1856,6 +1963,7 @@ è·–:è·–è¹  è·ž:躒 è·µ:è¸ +è·¶:躂 è··:蹺 è·¸:蹕 è·¹:躚 @@ -1876,17 +1984,20 @@ 轧:軋 轨:軌 轩:è»’ +轪:軑 轫:è»” 转:轉 è½­:è»› è½®:輪 软:軟 è½°:轟 +è½±:軲 è½²:è»» è½³:轤 è½´:軸 è½µ:軹 轶:軼 +è½·:軤 轸:軫 è½¹:è½¢ 轺:軺 @@ -1895,6 +2006,7 @@ è½½:載 è½¾:輊 轿:轎 +è¾€:輈 è¾:輇 辂:è¼… 较:較 @@ -1906,11 +2018,13 @@ 辉:è¼ è¾Š:è¼¥ 辋:輞 +辌:輬 è¾:輟 辎:輜 è¾:è¼³ è¾:è¼» 辑:輯 +è¾’:è½€ 输:輸 è¾”:轡 辕:è½… @@ -1966,20 +2080,23 @@ 郦:é…ˆ 郧:é„– 郸:鄲 +é…‚:é…‡ é…:醞 é…¬:酬詶 +é…¦:醱 é…±:醬 é…¸:酸痠 é…½:釅 é…¾:釃 é…¿:釀 -采:釆采採 +采:釆采採埰 释:釋 里:é‡Œæµ¬è£¡è£ é‡Ž:野埜 鉴:鑒鋻鑑 銮:鑾 錾:é¨ +é’…:釒 é’†:釓 é’‡:釔 é’ˆ:é‡é¼ @@ -1988,16 +2105,21 @@ é’‹:釙 é’Œ:釕 é’:釷 -é’Ž:釬 +é’Ž:釬釺 é’:釧 é’:釤 +é’‘:鈒 é’’:釩 é’“:釣 é’”:é† é’•:釹 +é’–:éš é’—:釵 +é’˜:鈃 é’™:鈣 +é’š:鈈 é’›:鈦 +é’œ:鉅 é’:éˆ é’ž:鈔 é’Ÿ:é˜é¾ @@ -2010,7 +2132,7 @@ é’¦:欽 é’§:鈞 é’¨:鎢 -é’©:鉤 +é’©:鈎鉤 é’ª:鈧 é’«:éˆ é’¬:鈥 @@ -2022,8 +2144,9 @@ é’²:鉦 é’³:鉗拑 é’´:鈷 -é’µ:ç¼½ +é’µ:缽鉢 é’¶:鈳 +é’·:鉕 é’¸:鈽 é’¹:鈸 é’º:鉞戉 @@ -2039,6 +2162,7 @@ é“„:é‘  é“…:鉛 铆:鉚 +铇:鉋 铈:鈰 铉:鉉 é“Š:鉈 @@ -2046,16 +2170,22 @@ é“Œ:鈮 é“:鈹 é“Ž:é¸ +é“:鉶 é“:銬 é“‘:銠 é“’:鉺 +é““:é‹© +é“”:éŒ é“•:銪 é“–:é‹® é“—:é‹ +铘:é‹£ é“™:éƒ +é“š:éŠ é“›:éº é“œ:銅 é“:é‹ +é“ž:銱 é“Ÿ:銦 é“ :鎧 é“¡:é˜ @@ -2063,6 +2193,7 @@ é“£:éŠ‘é‰ é“¤:é‹Œ é“¥:銩 +铦:銛 铧:éµ é“¨:銓 é“©:鎩 @@ -2083,6 +2214,7 @@ 铸:é‘„ 铹:é’ é“º:鋪舖 +é“»:é‹™ 铼:錸 铽:鋱 链:éˆ @@ -2090,6 +2222,7 @@ 销:銷 é”:鎖 锂:é‹° +锃:é‹¥ 锄:鋤 é”…:é‹ é”†:鋯 @@ -2099,7 +2232,10 @@ 锊:é‹ é”‹:é‹’ 锌:é‹… -é”:銳 +é”:鋶 +锎:é¦ +é”:é§ +é”:銳鋭 锑:銻 é”’:鋃 锓:é‹Ÿ @@ -2107,18 +2243,26 @@ 锕:錒 é”–:錆 é”—:éº +锘:é© é”™:錯 锚:錨 é”›:錛 +锜:錡 +é”:é€ é”ž:éŒ é”Ÿ:錕 +é” :錩 锡:錫 锢:錮 锣:鑼 锤:錘鎚 锥:éŒ é”¦:錦 +锧:é‘• +锨:æ´é 锩:錈 +锪:éƒ +锫:錇 锬:錟 é”­:錠 é”®:éµ @@ -2126,6 +2270,7 @@ é”°:錳 é”±:錙 锲:é¥ +锳:éˆ é”´:é‡ é”µ:é˜ é”¶:é¶ @@ -2134,52 +2279,70 @@ 锹:é¬ é”»:é› é”¼:鎪 +锽:é  é”¾:é° +锿:鎄 é•€:é é•:鎂 é•‚:é¤ +镃:鎡 é•„:é¨ +é•…:鎇 镆:éŒ é•‡:鎮 +镈:鎛 镉:鎘 é•Š:é‘· -é•Œ:é« +é•‹:鎲 +é•Œ:é«éŽ¸ é•:鎳 +é•Ž:鎿 é•:鎦 é•:鎬 é•‘:鎊 é•’:鎰 é•“:鎵 é•”:é‘Œ +é••:鎔 é•–:é¢ é•—:éœ é•˜:é é•™:é +é•š:é° é•›:éž é•œ:é¡ é•:é‘ é•ž:éƒ é•Ÿ:é‡ +é• :é é•¡:é” +é•¢:éé’ é•£:é 镤:é· +é•¥:é‘¥ 镦:é“ é•§:é‘­ 镨:é  +é•©:鑹 镪:é¹ é•«:é™ é•¬:é‘Š é•­:é³ +é•®:é¶ é•¯:é² é•°:é®éŽŒ 镱:é¿ +镲:é‘” 镳:é‘£ +é•´:é‘ž +镵:鑱 镶:鑲瓖 é•¿:é•· é—¨:é–€ é—©:é–‚ é—ª:é–ƒ é—«:é–† +é—¬:é–ˆ é—­:é–‰ é—®:å• é—¯:é—– @@ -2198,13 +2361,15 @@ é—¼:é—¥ é—½:é–© é—¾:é–­ +é—¿:é—“ 阀:é–¥ é˜:é–£ 阂:é–¡ 阃:é–« 阄:鬮 -阅:é–± +阅:閱閲 阆:é–¬ +阇:é— é˜ˆ:é–¾ 阉:é–¹ 阊:é–¶ @@ -2216,12 +2381,15 @@ é˜:é—¡ 阑:é—Œ 阒:é—ƒ +阓:é—  阔:é—Š 阕:é—‹ 阖:é—” 阗:é— +阘:é—’ 阙:é—• 阚:é—ž +阛:é—¤ 队:隊 阳:陽暘 阴:é™° @@ -2253,15 +2421,18 @@ éœ:霽 霉:霉黴 霓:霓蜺 +霡:霢 霭:é„ é“:éš é™:éœ é¢:é¢éºµ é¥:é¨ éž‘:韃 +éž’:éž½ 鞯:韉 韦:韋 韧:韌 +韨:éŸ éŸ©:韓 韪:韙 韫:韞 @@ -2289,19 +2460,23 @@ 颈:é ¸ 颉:é ¡ 颊:é ° +颋:é ² 颌:é œ é¢:æ½ +颎:熲 é¢:é ¦ é¢:é ¤ 频:é » -颓:頹隤穨 +颓:頹隤穨頽 颔:é · +颕:é ´ 颖:ç©Ž 颗:顆 题:é¡Œ +颙:é¡’ 颚:é¡Ž 颛:é¡“ -颜:é¡ +颜:é¡é¡” é¢:é¡ é¢ž:顳 颟:é¡¢ @@ -2309,19 +2484,29 @@ 颡:é¡™ 颢:é¡¥ 颤:é¡« +颥:顬 颦:é¡° 颧:é¡´ 风:風 +é£:颺 +é£:颭 飑:颮 飒:颯 飓:颶 +飔:颸 飕:颼 +飖:颻 +飗:飀 飘:飄 飙:飆 +飚:飈 飞:飛 飨:饗 é¤:饜 +饣:飠 +饤:飣 饥:飢饑 +饦:飥 饧:餳 饨:飩 饩:餼 @@ -2338,29 +2523,41 @@ 饵:餌 饶:饒 饷:餉饟 +饹:餎 饺:餃 +饻:é¤ é¥¼:餅 饽:餑 +饾:餖 饿:餓 +馀:ä½™ é¦:餒 +馂:餕 +馃:餜 馄:餛 馅:餡 馆:館 +馇:餷 馈:饋餽 馊:餿 馋:饞 +馌:é¥ é¦:饃糢 +馎:餺 é¦:餾 é¦:饈 馑:饉 馒:饅 +馓:饊 馔:饌 +馕:饢 马:馬 é©­:馭 é©®:馱 驯:馴 é©°:馳 驱:é©… +驲:馹 驳:é§é§® é©´:é©¢ 驵:駔 @@ -2376,23 +2573,30 @@ é©¿:é©› 骀:駘 éª:é© -骂:ç½µ +骂:罵駡 +骃:駰 骄:é©• 骅:é©Š 骆:駱 骇:駭 骈:駢 +骉:é©« 骊:驪 骋:é¨ éªŒ:é©— +éª:騂 +骎:駸 éª:駿 éª:é¨ éª‘:騎 骒:é¨ éª“:騅 +骔:騌 +骕:é©Œ 骖:é©‚ 骗:騙 骘:騭 +骙:騤 骚:騷 骛:騖 骜:é© @@ -2405,6 +2609,7 @@ 骣:é© éª¤:é©Ÿ 骥:é©¥ +骦:驦 骧:驤 é«…:é« é«‹:é«– @@ -2414,23 +2619,37 @@ é­‡:é­˜ é­‰:é­Ž é±¼:é­š +é±½:é­› 鱿:é­· +é²€:é­¨ é²:é­¯ 鲂:é­´ -鲇:鯰 +鲃:ä°¾ +鲄:é­º +é²…:é® +鲆:鮃 +鲇:鯰鮎 鲈:鱸 +鲉:鮋 +鲊:鮓 鲋:é®’ +鲌:鮊 é²:鮑 鲎:鱟 +é²:é® é²:é® é²‘:é®­ é²’:鮚 é²”:鮪 鲕:鮞 +é²–:鮦 +é²—:é°‚ +鲘:鮜 +é²™:é±  鲚:é±­ é²›:鮫 鲜:é®® -鲞:鯗 +鲞:é¯—é® é²Ÿ:鱘 é² :é¯ é²¡:鱺 @@ -2442,64 +2661,92 @@ 鲧:鯀 鲨:鯊 鲩:鯇 +鲪:鮶 鲫:鯽 +鲬:鯒 é²­:鯖 é²®:鯪 +鲯:鯕 é²°:鯫 é²±:鯡 é²²:鯤 é²³:鯧 +é²´:é¯ é²µ:鯢 é²·:鯛 鲸:鯨 +é²¹:é°º +鲺:鯴 é²»:鯔 +é²¼:é± é²½:é°ˆ +é²¾:é° +鲿:鱨 +é³€:鯷 +é³:é°® 鳃:é°“ -鳄:é±· +鳄:é±·é° é³…:é° é³†:é°’ 鳇:é°‰ +鳊:鯿 +鳋:é°  鳌:鰲鼇 é³:é°­ 鳎:é°¨ é³:é°¥ é³:é°© +鳑:é°Ÿ +é³’:é°œ 鳓:é°³ é³”:é°¾ 鳕:鱈 é³–:鱉 é³—:é°» +鳘:é°µ +é³™:é±… +鳚:ä² +é³›:é°¼ 鳜:é±– é³:é±” 鳞:é±— 鳟:é±’ é³¢:鱧 +é³£:é±£ 鸟:é³¥ 鸠:鳩 -鸡:雞 +鸡:雞鷄 鸢:鳶 鸣:é³´ +鸤:é³² 鸥:é·— 鸦:é´‰ +鸧:鶬 鸨:é´‡ 鸩:鴆酖 鸪:é´£ 鸫:鶇 鸬:鸕 鸭:é´¨ +鸮:é´ž 鸯:é´¦ +鸰:é´’ 鸱:é´Ÿ 鸲:é´ é¸³:é´› +鸴:é·½ 鸵:é´• 鸶:é·¥ 鸷:é·™ 鸸:é´¯ 鸹:é´° 鸺:鵂 +鸻:é´´ +鸼:鵃 鸽:é´¿ 鸾:鸞 鸿:é´» +é¹€:éµ é¹:鵓 鹂:é¸ é¹ƒ:鵑 @@ -2510,18 +2757,33 @@ 鹈:鵜 鹉:鵡 鹊:éµ² +鹋:鶓 鹌:鵪 +é¹:éµ¾ 鹎:鵯 é¹:鵬 +é¹:éµ® 鹑:鶉 +é¹’:鶊 +鹓:éµ· +é¹”:é·« 鹕:鶘 +é¹–:鶡 é¹—:鶚 鹘:鶻 -鹚:鶿 +é¹™:鶖 +鹚:鶿鷀 +é¹›:鶥 鹜:鶩 +é¹:é·Š 鹞:é·‚ +鹟:鶲 +é¹ :鶹 +鹡:鶺 +é¹¢:é· é¹£:鶼 鹤:鶴 +é¹¥:é·– 鹦:鸚 鹧:é·“ 鹨:é·š @@ -2530,24 +2792,32 @@ 鹫:é·² 鹬:é·¸ é¹­:é·º +鹯:鸇 é¹°:é·¹ +é¹±:鸌 +é¹²:é¸ é¹³:鸛 +é¹´:鸘 é¹¾:鹺 麦:麥 麸:麩 麻:麻痲痳 黄:黃 黉:黌 +黡:黶 黩:é»· 黪:黲 黾:黽 鼋:黿 é¼:鼉 +é¼—:鞀 é¼¹:é¼´ é½:齊 齑:é½ é½¿:é½’ é¾€:é½” +é¾:齕 +龂:é½— 龃:齟 龄:齡 é¾…:é½™ diff --git a/i18npool/source/textconversion/data/stc_word.dic b/i18npool/source/textconversion/data/stc_word.dic index 314c6223cc70..4ae42366888d 100644 --- a/i18npool/source/textconversion/data/stc_word.dic +++ b/i18npool/source/textconversion/data/stc_word.dic @@ -1147,3 +1147,4 @@ 音频文件<音頻檔 模拟信å·<類比信號 驱动程åº<é©…å‹•ç¨‹å¼ +什么<甚麼 -- cgit v1.2.3 From 8fc29cd7c8abb80d4def90ac12602887e2a13fde Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 01:02:01 +0100 Subject: locales33: additional check for ]) currency symbol with parentheses negative format code --- i18npool/source/localedata/LocaleNode.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 3f09e394a833..905fe67b894f 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -657,7 +657,9 @@ void LCFormatNode::generateCode (const OFileWriter &of) const OUString aPar1( RTL_CONSTASCII_USTRINGPARAM( "0)" )); OUString aPar2( RTL_CONSTASCII_USTRINGPARAM( "-)" )); OUString aPar3( RTL_CONSTASCII_USTRINGPARAM( " )" )); - if (aCode.indexOf( aPar1 ) > 0 || aCode.indexOf( aPar2 ) > 0 || aCode.indexOf( aPar3 ) > 0) + OUString aPar4( RTL_CONSTASCII_USTRINGPARAM( "])" )); + if (aCode.indexOf( aPar1 ) > 0 || aCode.indexOf( aPar2 ) > 0 || + aCode.indexOf( aPar3 ) > 0 || aCode.indexOf( aPar4 ) > 0) fprintf( stderr, "Warning: FormatCode formatindex=\"%d\" for currency uses parentheses for negative amounts, which probably is not correct for locales not based on en_US.\n", formatindex); } break; -- cgit v1.2.3 From 2e33398a2732a66d54e63aae9c3e1b92897381d8 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 01:14:28 +0100 Subject: locales33: #i108675# added Latgalian_Latvia [ltg-LV]; locale data contributed by --- i18npool/inc/i18npool/lang.h | 1 + i18npool/source/isolang/isolang.cxx | 1 + .../source/localedata/data/localedata_euro.map | 17 + i18npool/source/localedata/data/ltg_LV.xml | 358 +++++++++++++++++++++ i18npool/source/localedata/data/makefile.mk | 2 + i18npool/source/localedata/localedata.cxx | 1 + svtools/source/misc/langtab.src | 1 + 7 files changed, 381 insertions(+) create mode 100644 i18npool/source/localedata/data/ltg_LV.xml diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index eaf7eb9c2ea8..9b14892b398f 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -503,5 +503,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ #define LANGUAGE_USER_ANCIENT_GREEK 0x0649 #define LANGUAGE_USER_ASTURIAN 0x064A +#define LANGUAGE_USER_LATGALIAN 0x064B #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index c321f62c95f9..4efa20856b0c 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -448,6 +448,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_SHUSWAP, "shs", "CA" }, { LANGUAGE_USER_ANCIENT_GREEK, "grc", "GR" }, { LANGUAGE_USER_ASTURIAN, "ast", "ES" }, + { LANGUAGE_USER_LATGALIAN, "ltg", "LV" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 1a28eb537bd5..14c79c77ed00 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -39,6 +39,7 @@ getAllCalendars_ka_GE; getAllCalendars_kl_GL; getAllCalendars_la_VA; getAllCalendars_lb_LU; +getAllCalendars_ltg_LV; getAllCalendars_lt_LT; getAllCalendars_lv_LV; getAllCalendars_mk_MK; @@ -106,6 +107,7 @@ getAllCurrencies_ka_GE; getAllCurrencies_kl_GL; getAllCurrencies_la_VA; getAllCurrencies_lb_LU; +getAllCurrencies_ltg_LV; getAllCurrencies_lt_LT; getAllCurrencies_lv_LV; getAllCurrencies_mk_MK; @@ -173,6 +175,7 @@ getAllFormats0_ka_GE; getAllFormats0_kl_GL; getAllFormats0_la_VA; getAllFormats0_lb_LU; +getAllFormats0_ltg_LV; getAllFormats0_lt_LT; getAllFormats0_lv_LV; getAllFormats0_mk_MK; @@ -240,6 +243,7 @@ getBreakIteratorRules_ka_GE; getBreakIteratorRules_kl_GL; getBreakIteratorRules_la_VA; getBreakIteratorRules_lb_LU; +getBreakIteratorRules_ltg_LV; getBreakIteratorRules_lt_LT; getBreakIteratorRules_lv_LV; getBreakIteratorRules_mk_MK; @@ -307,6 +311,7 @@ getCollationOptions_ka_GE; getCollationOptions_kl_GL; getCollationOptions_la_VA; getCollationOptions_lb_LU; +getCollationOptions_ltg_LV; getCollationOptions_lt_LT; getCollationOptions_lv_LV; getCollationOptions_mk_MK; @@ -374,6 +379,7 @@ getCollatorImplementation_ka_GE; getCollatorImplementation_kl_GL; getCollatorImplementation_la_VA; getCollatorImplementation_lb_LU; +getCollatorImplementation_ltg_LV; getCollatorImplementation_lt_LT; getCollatorImplementation_lv_LV; getCollatorImplementation_mk_MK; @@ -441,6 +447,7 @@ getContinuousNumberingLevels_ka_GE; getContinuousNumberingLevels_kl_GL; getContinuousNumberingLevels_la_VA; getContinuousNumberingLevels_lb_LU; +getContinuousNumberingLevels_ltg_LV; getContinuousNumberingLevels_lt_LT; getContinuousNumberingLevels_lv_LV; getContinuousNumberingLevels_mk_MK; @@ -508,6 +515,7 @@ getFollowPageWords_ka_GE; getFollowPageWords_kl_GL; getFollowPageWords_la_VA; getFollowPageWords_lb_LU; +getFollowPageWords_ltg_LV; getFollowPageWords_lt_LT; getFollowPageWords_lv_LV; getFollowPageWords_mk_MK; @@ -575,6 +583,7 @@ getForbiddenCharacters_ka_GE; getForbiddenCharacters_kl_GL; getForbiddenCharacters_la_VA; getForbiddenCharacters_lb_LU; +getForbiddenCharacters_ltg_LV; getForbiddenCharacters_lt_LT; getForbiddenCharacters_lv_LV; getForbiddenCharacters_mk_MK; @@ -642,6 +651,7 @@ getIndexAlgorithm_ka_GE; getIndexAlgorithm_kl_GL; getIndexAlgorithm_la_VA; getIndexAlgorithm_lb_LU; +getIndexAlgorithm_ltg_LV; getIndexAlgorithm_lt_LT; getIndexAlgorithm_lv_LV; getIndexAlgorithm_mk_MK; @@ -709,6 +719,7 @@ getLCInfo_ka_GE; getLCInfo_kl_GL; getLCInfo_la_VA; getLCInfo_lb_LU; +getLCInfo_ltg_LV; getLCInfo_lt_LT; getLCInfo_lv_LV; getLCInfo_mk_MK; @@ -776,6 +787,7 @@ getLocaleItem_ka_GE; getLocaleItem_kl_GL; getLocaleItem_la_VA; getLocaleItem_lb_LU; +getLocaleItem_ltg_LV; getLocaleItem_lt_LT; getLocaleItem_lv_LV; getLocaleItem_mk_MK; @@ -843,6 +855,7 @@ getOutlineNumberingLevels_ka_GE; getOutlineNumberingLevels_kl_GL; getOutlineNumberingLevels_la_VA; getOutlineNumberingLevels_lb_LU; +getOutlineNumberingLevels_ltg_LV; getOutlineNumberingLevels_lt_LT; getOutlineNumberingLevels_lv_LV; getOutlineNumberingLevels_mk_MK; @@ -910,6 +923,7 @@ getReservedWords_ka_GE; getReservedWords_kl_GL; getReservedWords_la_VA; getReservedWords_lb_LU; +getReservedWords_ltg_LV; getReservedWords_lt_LT; getReservedWords_lv_LV; getReservedWords_mk_MK; @@ -977,6 +991,7 @@ getSearchOptions_ka_GE; getSearchOptions_kl_GL; getSearchOptions_la_VA; getSearchOptions_lb_LU; +getSearchOptions_ltg_LV; getSearchOptions_lt_LT; getSearchOptions_lv_LV; getSearchOptions_mk_MK; @@ -1044,6 +1059,7 @@ getTransliterations_ka_GE; getTransliterations_kl_GL; getTransliterations_la_VA; getTransliterations_lb_LU; +getTransliterations_ltg_LV; getTransliterations_lt_LT; getTransliterations_lv_LV; getTransliterations_mk_MK; @@ -1111,6 +1127,7 @@ getUnicodeScripts_ka_GE; getUnicodeScripts_kl_GL; getUnicodeScripts_la_VA; getUnicodeScripts_lb_LU; +getUnicodeScripts_ltg_LV; getUnicodeScripts_lt_LT; getUnicodeScripts_lv_LV; getUnicodeScripts_mk_MK; diff --git a/i18npool/source/localedata/data/ltg_LV.xml b/i18npool/source/localedata/data/ltg_LV.xml new file mode 100644 index 000000000000..d6548a492da1 --- /dev/null +++ b/i18npool/source/localedata/data/ltg_LV.xml @@ -0,0 +1,358 @@ + + + + + + ltg + Latgalian + + + LV + Latvia + + + + + . +   + , + : + , + ; + , + , + + + + + ' + ' + ' + ' + + AM + PM + metric + + + + General + + + 0 + + + 0,00 + + + # ##0 + + + # ##0,00 + + + # ###,00 + + + 0,00E+00 + + + 0,00E+000 + + + 0% + + + 0,00% + + + # ##0 [CURRENCY];-# ##0 [CURRENCY] + + + # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] + + + # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] + + + # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] + + + # ##0,00 CCC + + + # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] + + + D.MM.YY + + + NNNNDD, MMMM YYYY + + + DD.MM.YY + + + DD.MM.YYYY + + + D, MMM YY + + + D, MMM YYYY + + + D, MMM YYYY + + + D, MMMM YYYY + + + D, MMMM YY + + + NN, DD.MMM.YY + + + NN, D, MMM YY + + + NN, D, MMMM YYYY + + + NNNND, MMMM YYYY + + + MM.DD + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM.YY + + + MMM.DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS,00 + + + [HH]:MM:SS,00 + + + DD.MM.YY HH:MM + + + DD.MM.YYYY HH:MM:SS AM/PM + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + A-Ž + 0 + 1 + lpp. + lpp. + + + + + + sun + Sv + svÄtdÄ«ne + + + mon + P + pyrmÅ«dÄ«ne + + + tue + Ū + Å«tardÄ«ne + + + wed + T + treÅ¡dÄ«ne + + + thu + C + catÅ«rtdÄ«ne + + + fri + Pk + pÄ«ktdÄ«ne + + + sat + S + sastdÄ«ne + + + + + jan + Jan + janvars + + + feb + Peb + pebraļs + + + mar + Mar + marts + + + apr + Apr + apreļs + + + may + Maj + majs + + + jun + Juņ + juņs + + + jul + Juļ + juļs + + + aug + Aug + augusts + + + sep + Seņ + seņtebris + + + oct + Okt + oktebris + + + nov + Noj + nojabris + + + dec + Dek + dekabris + + + + + bc + p.k. + pyrms Kristus + + + ad + AD + pec Kristus + + + + mon + + 1 + + + + + LVL + Ls + LVL + Lats + 2 + + + + + + + + + + patÄ«ss + oploms + 1. catÅ«rksnis + 2. catÅ«rksnis + 3. catÅ«rksnis + 4. catÅ«rksnis + viers + zam + C1 + C2 + C3 + C4 + + + + + + + + + + + + + + + diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 9fc29c722fb2..b8679758234d 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -177,6 +177,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_ln_CD.cxx \ $(MISC)$/localedata_lo_LA.cxx \ $(MISC)$/localedata_lt_LT.cxx \ + $(MISC)$/localedata_ltg_LV.cxx \ $(MISC)$/localedata_lv_LV.cxx \ $(MISC)$/localedata_mk_MK.cxx \ $(MISC)$/localedata_ml_IN.cxx \ @@ -365,6 +366,7 @@ SHL3OBJS= \ $(SLO)$/localedata_la_VA.obj \ $(SLO)$/localedata_lb_LU.obj \ $(SLO)$/localedata_lt_LT.obj \ + $(SLO)$/localedata_ltg_LV.obj \ $(SLO)$/localedata_lv_LV.obj \ $(SLO)$/localedata_mk_MK.obj \ $(SLO)$/localedata_mt_MT.obj \ diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index e119e71ec14c..ffa3db8a2139 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -170,6 +170,7 @@ static const struct { { "mt_MT", lcl_DATA_EURO }, { "sc_IT", lcl_DATA_EURO }, { "ast_ES", lcl_DATA_EURO }, + { "ltg_LV", lcl_DATA_EURO }, { "ja_JP", lcl_DATA_OTHERS }, { "ko_KR", lcl_DATA_OTHERS }, diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 0aa90f8e96b9..9189ff7f10de 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -310,6 +310,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Asturian" ; LANGUAGE_USER_ASTURIAN ; > ; < "Sorbian, Upper" ; LANGUAGE_UPPER_SORBIAN_GERMANY ; > ; < "Sorbian, Lower" ; LANGUAGE_LOWER_SORBIAN_GERMANY ; > ; + < "Latgalian" ; LANGUAGE_USER_LATGALIAN ; > ; }; }; -- cgit v1.2.3 From 4c4af063f2bc48cd7cca8de14c82fdef429eca11 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 01:46:17 +0100 Subject: locales33: #i108600# added Maore [swb-YT], Bushi [buc-YT] and Tahitian [ty-PF] to language list --- i18npool/inc/i18npool/lang.h | 3 +++ i18npool/source/isolang/isolang.cxx | 3 +++ svtools/source/misc/langtab.src | 3 +++ 3 files changed, 9 insertions(+) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 9b14892b398f..9d33fb73843b 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -504,5 +504,8 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_ANCIENT_GREEK 0x0649 #define LANGUAGE_USER_ASTURIAN 0x064A #define LANGUAGE_USER_LATGALIAN 0x064B +#define LANGUAGE_USER_MAORE 0x064C +#define LANGUAGE_USER_BUSHI 0x064D +#define LANGUAGE_USER_TAHITIAN 0x064E #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 4efa20856b0c..ba600a464ad7 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -449,6 +449,9 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_ANCIENT_GREEK, "grc", "GR" }, { LANGUAGE_USER_ASTURIAN, "ast", "ES" }, { LANGUAGE_USER_LATGALIAN, "ltg", "LV" }, + { LANGUAGE_USER_MAORE, "swb", "YT" }, + { LANGUAGE_USER_BUSHI, "buc", "YT" }, + { LANGUAGE_USER_TAHITIAN, "ty", "PF" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 9189ff7f10de..b829127ab531 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -311,6 +311,9 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Sorbian, Upper" ; LANGUAGE_UPPER_SORBIAN_GERMANY ; > ; < "Sorbian, Lower" ; LANGUAGE_LOWER_SORBIAN_GERMANY ; > ; < "Latgalian" ; LANGUAGE_USER_LATGALIAN ; > ; + < "Maore" ; LANGUAGE_USER_MAORE ; > ; + < "Bushi" ; LANGUAGE_USER_BUSHI ; > ; + < "Tahitian" ; LANGUAGE_USER_TAHITIAN ; > ; }; }; -- cgit v1.2.3 From 7e0816c658373323b5f247e6356d766aba868d4c Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 02:57:56 +0100 Subject: locales33: #i95769# added Malagasy,Plateau_Madagascar [plt-MG]; locale data contributed by --- i18npool/inc/i18npool/lang.h | 1 + i18npool/source/isolang/isolang.cxx | 1 + .../source/localedata/data/localedata_others.map | 17 + i18npool/source/localedata/data/makefile.mk | 2 + i18npool/source/localedata/data/plt_MG.xml | 358 +++++++++++++++++++++ i18npool/source/localedata/localedata.cxx | 1 + svtools/source/misc/langtab.src | 1 + 7 files changed, 381 insertions(+) create mode 100644 i18npool/source/localedata/data/plt_MG.xml diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 9d33fb73843b..a04e2c91f4cb 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -507,5 +507,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_MAORE 0x064C #define LANGUAGE_USER_BUSHI 0x064D #define LANGUAGE_USER_TAHITIAN 0x064E +#define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index ba600a464ad7..ff141282c6ac 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -452,6 +452,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_MAORE, "swb", "YT" }, { LANGUAGE_USER_BUSHI, "buc", "YT" }, { LANGUAGE_USER_TAHITIAN, "ty", "PF" }, + { LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index a8212624e8e8..6857e29ce5db 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -48,6 +48,7 @@ getAllCalendars_nso_ZA; getAllCalendars_om_ET; getAllCalendars_or_IN; getAllCalendars_pa_IN; +getAllCalendars_plt_MG; getAllCalendars_rw_RW; getAllCalendars_sg_CF; getAllCalendars_shs_CA; @@ -123,6 +124,7 @@ getAllCurrencies_nso_ZA; getAllCurrencies_om_ET; getAllCurrencies_or_IN; getAllCurrencies_pa_IN; +getAllCurrencies_plt_MG; getAllCurrencies_rw_RW; getAllCurrencies_sg_CF; getAllCurrencies_shs_CA; @@ -198,6 +200,7 @@ getAllFormats0_nso_ZA; getAllFormats0_om_ET; getAllFormats0_or_IN; getAllFormats0_pa_IN; +getAllFormats0_plt_MG; getAllFormats0_rw_RW; getAllFormats0_sg_CF; getAllFormats0_shs_CA; @@ -273,6 +276,7 @@ getBreakIteratorRules_nso_ZA; getBreakIteratorRules_om_ET; getBreakIteratorRules_or_IN; getBreakIteratorRules_pa_IN; +getBreakIteratorRules_plt_MG; getBreakIteratorRules_rw_RW; getBreakIteratorRules_sg_CF; getBreakIteratorRules_shs_CA; @@ -348,6 +352,7 @@ getCollationOptions_nso_ZA; getCollationOptions_om_ET; getCollationOptions_or_IN; getCollationOptions_pa_IN; +getCollationOptions_plt_MG; getCollationOptions_rw_RW; getCollationOptions_sg_CF; getCollationOptions_shs_CA; @@ -423,6 +428,7 @@ getCollatorImplementation_nso_ZA; getCollatorImplementation_om_ET; getCollatorImplementation_or_IN; getCollatorImplementation_pa_IN; +getCollatorImplementation_plt_MG; getCollatorImplementation_rw_RW; getCollatorImplementation_sg_CF; getCollatorImplementation_shs_CA; @@ -498,6 +504,7 @@ getContinuousNumberingLevels_nso_ZA; getContinuousNumberingLevels_om_ET; getContinuousNumberingLevels_or_IN; getContinuousNumberingLevels_pa_IN; +getContinuousNumberingLevels_plt_MG; getContinuousNumberingLevels_rw_RW; getContinuousNumberingLevels_sg_CF; getContinuousNumberingLevels_shs_CA; @@ -573,6 +580,7 @@ getFollowPageWords_nso_ZA; getFollowPageWords_om_ET; getFollowPageWords_or_IN; getFollowPageWords_pa_IN; +getFollowPageWords_plt_MG; getFollowPageWords_rw_RW; getFollowPageWords_sg_CF; getFollowPageWords_shs_CA; @@ -648,6 +656,7 @@ getForbiddenCharacters_nso_ZA; getForbiddenCharacters_om_ET; getForbiddenCharacters_or_IN; getForbiddenCharacters_pa_IN; +getForbiddenCharacters_plt_MG; getForbiddenCharacters_rw_RW; getForbiddenCharacters_sg_CF; getForbiddenCharacters_shs_CA; @@ -723,6 +732,7 @@ getIndexAlgorithm_nso_ZA; getIndexAlgorithm_om_ET; getIndexAlgorithm_or_IN; getIndexAlgorithm_pa_IN; +getIndexAlgorithm_plt_MG; getIndexAlgorithm_rw_RW; getIndexAlgorithm_sg_CF; getIndexAlgorithm_shs_CA; @@ -798,6 +808,7 @@ getLCInfo_nso_ZA; getLCInfo_om_ET; getLCInfo_or_IN; getLCInfo_pa_IN; +getLCInfo_plt_MG; getLCInfo_rw_RW; getLCInfo_sg_CF; getLCInfo_shs_CA; @@ -873,6 +884,7 @@ getLocaleItem_nso_ZA; getLocaleItem_om_ET; getLocaleItem_or_IN; getLocaleItem_pa_IN; +getLocaleItem_plt_MG; getLocaleItem_rw_RW; getLocaleItem_sg_CF; getLocaleItem_shs_CA; @@ -948,6 +960,7 @@ getOutlineNumberingLevels_nso_ZA; getOutlineNumberingLevels_om_ET; getOutlineNumberingLevels_or_IN; getOutlineNumberingLevels_pa_IN; +getOutlineNumberingLevels_plt_MG; getOutlineNumberingLevels_rw_RW; getOutlineNumberingLevels_sg_CF; getOutlineNumberingLevels_shs_CA; @@ -1023,6 +1036,7 @@ getReservedWords_nso_ZA; getReservedWords_om_ET; getReservedWords_or_IN; getReservedWords_pa_IN; +getReservedWords_plt_MG; getReservedWords_rw_RW; getReservedWords_sg_CF; getReservedWords_shs_CA; @@ -1098,6 +1112,7 @@ getSearchOptions_nso_ZA; getSearchOptions_om_ET; getSearchOptions_or_IN; getSearchOptions_pa_IN; +getSearchOptions_plt_MG; getSearchOptions_rw_RW; getSearchOptions_sg_CF; getSearchOptions_shs_CA; @@ -1173,6 +1188,7 @@ getTransliterations_nso_ZA; getTransliterations_om_ET; getTransliterations_or_IN; getTransliterations_pa_IN; +getTransliterations_plt_MG; getTransliterations_rw_RW; getTransliterations_sg_CF; getTransliterations_shs_CA; @@ -1248,6 +1264,7 @@ getUnicodeScripts_nso_ZA; getUnicodeScripts_om_ET; getUnicodeScripts_or_IN; getUnicodeScripts_pa_IN; +getUnicodeScripts_plt_MG; getUnicodeScripts_rw_RW; getUnicodeScripts_sg_CF; getUnicodeScripts_shs_CA; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index b8679758234d..7635a9ba98a2 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -199,6 +199,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_or_IN.cxx \ $(MISC)$/localedata_pa_IN.cxx \ $(MISC)$/localedata_pl_PL.cxx \ + $(MISC)$/localedata_plt_MG.cxx \ $(MISC)$/localedata_pt_BR.cxx \ $(MISC)$/localedata_pt_PT.cxx \ $(MISC)$/localedata_ro_RO.cxx \ @@ -461,6 +462,7 @@ SHL4OBJS= \ $(SLO)$/localedata_om_ET.obj \ $(SLO)$/localedata_or_IN.obj \ $(SLO)$/localedata_pa_IN.obj \ + $(SLO)$/localedata_plt_MG.obj \ $(SLO)$/localedata_rw_RW.obj \ $(SLO)$/localedata_sg_CF.obj \ $(SLO)$/localedata_shs_CA.obj \ diff --git a/i18npool/source/localedata/data/plt_MG.xml b/i18npool/source/localedata/data/plt_MG.xml new file mode 100644 index 000000000000..63906044f6e3 --- /dev/null +++ b/i18npool/source/localedata/data/plt_MG.xml @@ -0,0 +1,358 @@ + + + + + + plt + Malagasy, Plateau + + + MG + Madagascar + + + + + . + . + , + : + . + ; + , + , + + + + + “ + †+ ‘ + ’ + + AM + PM + metric + + + + General + + + 0 + + + 0,00 + + + #.##0 + + + #.##0,00 + + + #.###,00 + + + 0,00E+00 + + + 0,00E+000 + + + 0% + + + 0,00% + + + #.##0 [CURRENCY];- #.##0 [CURRENCY] + + + #.##0,00 [CURRENCY];- #.##0,00 [CURRENCY] + + + #.##0 [CURRENCY];[RED]- #.##0 [CURRENCY] + + + #.##0,00 [CURRENCY];[RED]- #.##0,00 [CURRENCY] + + + CCC#.##0,00 + + + #.##0,-- [CURRENCY];[RED]- #.##0,-- [CURRENCY] + + + D.MM.YY + + + NNNNDD, MMMM YYYY + + + DD.MM.YY + + + DD.MM.YYYY + + + D, MMM YY + + + D, MMM YYYY + + + D, MMM YYYY + + + D, MMMM YYYY + + + D, MMMM YY + + + NN, DD.MMM.YY + + + NN, D, MMM YY + + + NN, D, MMMM YYYY + + + NNNND, MMMM YYYY + + + MM.DD + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM.YY + + + MMM.DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS.00 + + + [HH]:MM:SS.00 + + + DD.MM.YY HH:MM + + + DD.MM.YYYY HH:MM:SS AM/PM + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + A-Z + 0 + 1 + p + pp + + + + + + sun + Alah + Alahady + + + mon + Alat + Alatsinainy + + + tue + Tal + Talata + + + wed + Alar + Alarobia + + + thu + Alak + Alakamisy + + + fri + Zom + Zoma + + + sat + Asab + Asabotsy + + + + + jan + Jan + Janoary + + + feb + Feb + Febroary + + + mar + Mar + Marsa + + + apr + Apr + Aprily + + + may + May + May + + + jun + Jon + Jona + + + jul + Jol + Jolay + + + aug + Aog + Aogosta + + + sep + Sep + Septambra + + + oct + Okt + Oktobra + + + nov + Nov + Novambra + + + dec + Des + Desambra + + + + + bc + BC + BC + + + ad + AD + Anno Domini + + + + mon + + 1 + + + + + MGA + Ar. + MGA + Ariary + 2 + + + + + + + + + + Marina + Diso + Quarter 1 + Quarter 2 + Quarter 3 + Quarter 4 + Ambony + Ambany + Q1 + Q2 + Q3 + Q4 + + + + + + + + + + + + + + + diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index ffa3db8a2139..72a2227a8eb5 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -249,6 +249,7 @@ static const struct { { "ar_OM", lcl_DATA_OTHERS }, { "ug_CN", lcl_DATA_OTHERS }, { "om_ET", lcl_DATA_OTHERS }, + { "plt_MG", lcl_DATA_OTHERS }, }; static const sal_Unicode under = sal_Unicode('_'); diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index b829127ab531..aff7bf245506 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -314,6 +314,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Maore" ; LANGUAGE_USER_MAORE ; > ; < "Bushi" ; LANGUAGE_USER_BUSHI ; > ; < "Tahitian" ; LANGUAGE_USER_TAHITIAN ; > ; + < "Malagasy, Plateau" ; LANGUAGE_USER_MALAGASY_PLATEAU ; > ; }; }; -- cgit v1.2.3 From 6269f93155cccba461727fa084602580df76d596 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 16:21:19 +0100 Subject: locales33: #i107230# added Papiamentu (Netherlands Antilles) [pap-AN] and Papiamento (Aruba) [pap-AW] to language list --- i18npool/inc/i18npool/lang.h | 8 +++++--- i18npool/source/isolang/isolang.cxx | 1 + svtools/source/misc/langtab.src | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index a04e2c91f4cb..5edb1f3c3edf 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -67,9 +67,10 @@ Language Identifier Constants and Strings http://msdn2.microsoft.com/en-us/library/ms776294.aspx - Lists for 2003, XP and Vista, overview with URLs pointing to regional settings: - NLS information page - http://www.microsoft.com/globaldev/nlsweb/default.mspx + Hey, yet another list, maybe this one will not move around? It seems to be + quite complete.. + Language Identifier Constants and Strings (Windows) + http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx List of supported locale identifiers in Word http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435 @@ -508,5 +509,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_BUSHI 0x064D #define LANGUAGE_USER_TAHITIAN 0x064E #define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F +#define LANGUAGE_USER_PAPIAMENTU_ARUBA 0x8079 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */ #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index ff141282c6ac..941b2fb94f96 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -352,6 +352,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_YORUBA, "yo", "NG" }, { LANGUAGE_SOMALI, "so", "SO" }, { LANGUAGE_PAPIAMENTU, "pap", "AN" }, + { LANGUAGE_USER_PAPIAMENTU_ARUBA, "pap", "AW" }, { LANGUAGE_ENGLISH_SINGAPORE, "en", "SG" }, { LANGUAGE_YIDDISH, "yi", "IL" }, // new: old was "ji" { LANGUAGE_YIDDISH, "ji", "IL" }, // old: new is "yi" diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index aff7bf245506..4f48fa68c718 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -315,6 +315,8 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Bushi" ; LANGUAGE_USER_BUSHI ; > ; < "Tahitian" ; LANGUAGE_USER_TAHITIAN ; > ; < "Malagasy, Plateau" ; LANGUAGE_USER_MALAGASY_PLATEAU ; > ; + < "Papiamentu (Netherlands Antilles)" ; LANGUAGE_PAPIAMENTU ; > ; + < "Papiamento (Aruba)" ; LANGUAGE_USER_PAPIAMENTU_ARUBA ; > ; }; }; -- cgit v1.2.3 From 0c862740842bdcdf0201d0e7d8f5db1d5596147e Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 17:28:36 +0100 Subject: locales33: #i107288# added Sardinian,Campidanese [sro-IT], Sardinian,Gallurese [sdn-IT], Sardinian,Logudorese [src-IT] and Sardinian,Sassarese [sdc-IT] to language list --- i18npool/inc/i18npool/lang.h | 4 ++++ i18npool/source/isolang/isolang.cxx | 6 +++++- svtools/source/misc/langtab.src | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 5edb1f3c3edf..0b9e1e6c54d4 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -510,5 +510,9 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_TAHITIAN 0x064E #define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F #define LANGUAGE_USER_PAPIAMENTU_ARUBA 0x8079 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */ +#define LANGUAGE_USER_SARDINIAN_CAMPIDANESE 0x0650 +#define LANGUAGE_USER_SARDINIAN_GALLURESE 0x0651 +#define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652 +#define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653 #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 941b2fb94f96..b93001584236 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -405,7 +405,11 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_KURDISH_SYRIA, "ku", "SY" }, { LANGUAGE_USER_KURDISH_IRAQ, "ku", "IQ" }, { LANGUAGE_USER_KURDISH_IRAN, "ku", "IR" }, - { LANGUAGE_USER_SARDINIAN, "sc", "IT" }, + { LANGUAGE_USER_SARDINIAN, "sc", "IT" }, // macrolanguage code + { LANGUAGE_USER_SARDINIAN_CAMPIDANESE, "sro", "IT" }, + { LANGUAGE_USER_SARDINIAN_GALLURESE, "sdn", "IT" }, + { LANGUAGE_USER_SARDINIAN_LOGUDORESE, "src", "IT" }, + { LANGUAGE_USER_SARDINIAN_SASSARESE, "sdc", "IT" }, { LANGUAGE_BRETON_FRANCE, "br", "FR" }, { LANGUAGE_OBSOLETE_USER_BRETON, "br", "FR" }, { LANGUAGE_KALAALLISUT_GREENLAND, "kl", "GL" }, diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 4f48fa68c718..35196b2e293b 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -317,6 +317,10 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Malagasy, Plateau" ; LANGUAGE_USER_MALAGASY_PLATEAU ; > ; < "Papiamentu (Netherlands Antilles)" ; LANGUAGE_PAPIAMENTU ; > ; < "Papiamento (Aruba)" ; LANGUAGE_USER_PAPIAMENTU_ARUBA ; > ; + < "Sardinian, Campidanese" ; LANGUAGE_USER_SARDINIAN_CAMPIDANESE ; > ; + < "Sardinian, Gallurese" ; LANGUAGE_USER_SARDINIAN_GALLURESE ; > ; + < "Sardinian, Logudorese" ; LANGUAGE_USER_SARDINIAN_LOGUDORESE ; > ; + < "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ; }; }; -- cgit v1.2.3 From 8bdc92ae63a8ec4b2874be67c2381fefd4646e01 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 18:12:58 +0100 Subject: locales33: #i107017# added Sorbian,Upper [hsb-DE] locale data; contributed by --- i18npool/source/localedata/data/hsb_DE.xml | 350 +++++++++++++++++++++ .../source/localedata/data/localedata_euro.map | 17 + i18npool/source/localedata/data/makefile.mk | 2 + i18npool/source/localedata/localedata.cxx | 1 + 4 files changed, 370 insertions(+) create mode 100644 i18npool/source/localedata/data/hsb_DE.xml diff --git a/i18npool/source/localedata/data/hsb_DE.xml b/i18npool/source/localedata/data/hsb_DE.xml new file mode 100644 index 000000000000..6513dad5f57e --- /dev/null +++ b/i18npool/source/localedata/data/hsb_DE.xml @@ -0,0 +1,350 @@ + + + + + + hsb + Sorbian, Upper + + + DE + Germany + + + + + . + . + , + : + , + ; + , + . + + + + + ‚ + ‘ + „ + “ + + dopoÅ‚dnja + popoÅ‚dnju + metric + + + + Standard + + + 0 + + + 0,00 + + + #.##0 + + + #.##0,00 + + + #.###,00 + + + 0,00E+000 + + + 0,00E+00 + + + 0% + + + 0,00% + + + [CURRENCY]#.##0;-[CURRENCY]#.##0 + + + [CURRENCY]#.##0,00;-[CURRENCY]#.##0,00 + + + [CURRENCY]#.##0;[RED]-[CURRENCY]#.##0 + + + [CURRENCY]#.##0,00;[RED]-[CURRENCY]#.##0,00 + + + CCC#.##0,00 + + + [CURRENCY]#.##0,--;[RED]-[CURRENCY]#.##0,-- + + + D.MM.YY + + + NNNNDD, MMMM YYYY + + + DD.MM.YY + + + DD.MM.YYYY + + + D, MMM YY + + + D, MMM YYYY + + + D, MMM YYYY + + + D, MMMM YYYY + + + D, MMMM YY + + + NN, DD.MMM.YY + + + NN, D, MMM YY + + + NN, D, MMMM YYYY + + + NNNND, MMMM YYYY + + + MM.DD + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM.YY + + + MMM.DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS,00 + + + [HH]:MM:SS,00 + + + DD.MM.YY HH:MM + + + DD.MM.YYYY HH:MM:SS AM/PM + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + A-C ÄŒ Ć D {Dź} E F-H {Ch} I-K Å L-N Ń O Ó P {PÅ™} Q R S Å  T {TÅ™} U-Z Ž + 0 + 1 + 2 + sć. + sć.sć. + + + + + + sun + nje + njedźela + + + mon + pón + póndźela + + + tue + wut + wutora + + + wed + srj + srjeda + + + thu + Å¡tw + Å¡twórtk + + + fri + pja + pjatk + + + sat + sob + sobota + + + + + jan + jan + januar + + + feb + feb + februar + + + mar + mÄ›rc + mÄ›rc + + + apr + apr + apryl + + + may + meja + meja + + + jun + jun + junij + + + jul + jul + julij + + + aug + awg + awgust + + + sep + sep + september + + + oct + okt + oktober + + + nov + now + nowember + + + dec + dec + december + + + + + bc + pÅ™. Chr. + pÅ™ed Chrystusom + + + ad + po Chr. + po Chrystusu + + + + mon + + 4 + + + + + EUR + € + EUR + Euro + 2 + + + + + + + + + + prawje + wopak + prÄ›ni kwartal + druhi kwartal + tÅ™eći kwartal + Å¡twórty kwartal + horjeka + deleka + K1 + K2 + K3 + K4 + + + + + + diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 14c79c77ed00..bc93cbfc5d89 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -32,6 +32,7 @@ getAllCalendars_fy_NL; getAllCalendars_ga_IE; getAllCalendars_gsc_FR; getAllCalendars_hr_HR; +getAllCalendars_hsb_DE; getAllCalendars_is_IS; getAllCalendars_it_CH; getAllCalendars_it_IT; @@ -100,6 +101,7 @@ getAllCurrencies_fy_NL; getAllCurrencies_ga_IE; getAllCurrencies_gsc_FR; getAllCurrencies_hr_HR; +getAllCurrencies_hsb_DE; getAllCurrencies_is_IS; getAllCurrencies_it_CH; getAllCurrencies_it_IT; @@ -168,6 +170,7 @@ getAllFormats0_fy_NL; getAllFormats0_ga_IE; getAllFormats0_gsc_FR; getAllFormats0_hr_HR; +getAllFormats0_hsb_DE; getAllFormats0_is_IS; getAllFormats0_it_CH; getAllFormats0_it_IT; @@ -236,6 +239,7 @@ getBreakIteratorRules_fy_NL; getBreakIteratorRules_ga_IE; getBreakIteratorRules_gsc_FR; getBreakIteratorRules_hr_HR; +getBreakIteratorRules_hsb_DE; getBreakIteratorRules_is_IS; getBreakIteratorRules_it_CH; getBreakIteratorRules_it_IT; @@ -304,6 +308,7 @@ getCollationOptions_fy_NL; getCollationOptions_ga_IE; getCollationOptions_gsc_FR; getCollationOptions_hr_HR; +getCollationOptions_hsb_DE; getCollationOptions_is_IS; getCollationOptions_it_CH; getCollationOptions_it_IT; @@ -372,6 +377,7 @@ getCollatorImplementation_fy_NL; getCollatorImplementation_ga_IE; getCollatorImplementation_gsc_FR; getCollatorImplementation_hr_HR; +getCollatorImplementation_hsb_DE; getCollatorImplementation_is_IS; getCollatorImplementation_it_CH; getCollatorImplementation_it_IT; @@ -440,6 +446,7 @@ getContinuousNumberingLevels_fy_NL; getContinuousNumberingLevels_ga_IE; getContinuousNumberingLevels_gsc_FR; getContinuousNumberingLevels_hr_HR; +getContinuousNumberingLevels_hsb_DE; getContinuousNumberingLevels_is_IS; getContinuousNumberingLevels_it_CH; getContinuousNumberingLevels_it_IT; @@ -508,6 +515,7 @@ getFollowPageWords_fy_NL; getFollowPageWords_ga_IE; getFollowPageWords_gsc_FR; getFollowPageWords_hr_HR; +getFollowPageWords_hsb_DE; getFollowPageWords_is_IS; getFollowPageWords_it_CH; getFollowPageWords_it_IT; @@ -576,6 +584,7 @@ getForbiddenCharacters_fy_NL; getForbiddenCharacters_ga_IE; getForbiddenCharacters_gsc_FR; getForbiddenCharacters_hr_HR; +getForbiddenCharacters_hsb_DE; getForbiddenCharacters_is_IS; getForbiddenCharacters_it_CH; getForbiddenCharacters_it_IT; @@ -644,6 +653,7 @@ getIndexAlgorithm_fy_NL; getIndexAlgorithm_ga_IE; getIndexAlgorithm_gsc_FR; getIndexAlgorithm_hr_HR; +getIndexAlgorithm_hsb_DE; getIndexAlgorithm_is_IS; getIndexAlgorithm_it_CH; getIndexAlgorithm_it_IT; @@ -712,6 +722,7 @@ getLCInfo_fy_NL; getLCInfo_ga_IE; getLCInfo_gsc_FR; getLCInfo_hr_HR; +getLCInfo_hsb_DE; getLCInfo_is_IS; getLCInfo_it_CH; getLCInfo_it_IT; @@ -780,6 +791,7 @@ getLocaleItem_fy_NL; getLocaleItem_ga_IE; getLocaleItem_gsc_FR; getLocaleItem_hr_HR; +getLocaleItem_hsb_DE; getLocaleItem_is_IS; getLocaleItem_it_CH; getLocaleItem_it_IT; @@ -848,6 +860,7 @@ getOutlineNumberingLevels_fy_NL; getOutlineNumberingLevels_ga_IE; getOutlineNumberingLevels_gsc_FR; getOutlineNumberingLevels_hr_HR; +getOutlineNumberingLevels_hsb_DE; getOutlineNumberingLevels_is_IS; getOutlineNumberingLevels_it_CH; getOutlineNumberingLevels_it_IT; @@ -916,6 +929,7 @@ getReservedWords_fy_NL; getReservedWords_ga_IE; getReservedWords_gsc_FR; getReservedWords_hr_HR; +getReservedWords_hsb_DE; getReservedWords_is_IS; getReservedWords_it_CH; getReservedWords_it_IT; @@ -984,6 +998,7 @@ getSearchOptions_fy_NL; getSearchOptions_ga_IE; getSearchOptions_gsc_FR; getSearchOptions_hr_HR; +getSearchOptions_hsb_DE; getSearchOptions_is_IS; getSearchOptions_it_CH; getSearchOptions_it_IT; @@ -1052,6 +1067,7 @@ getTransliterations_fy_NL; getTransliterations_ga_IE; getTransliterations_gsc_FR; getTransliterations_hr_HR; +getTransliterations_hsb_DE; getTransliterations_is_IS; getTransliterations_it_CH; getTransliterations_it_IT; @@ -1120,6 +1136,7 @@ getUnicodeScripts_fy_NL; getUnicodeScripts_ga_IE; getUnicodeScripts_gsc_FR; getUnicodeScripts_hr_HR; +getUnicodeScripts_hsb_DE; getUnicodeScripts_is_IS; getUnicodeScripts_it_CH; getUnicodeScripts_it_IT; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index 7635a9ba98a2..b5c1e8c1eb1b 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -155,6 +155,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_hi_IN.cxx \ $(MISC)$/localedata_hil_PH.cxx \ $(MISC)$/localedata_hr_HR.cxx \ + $(MISC)$/localedata_hsb_DE.cxx \ $(MISC)$/localedata_hu_HU.cxx \ $(MISC)$/localedata_hy_AM.cxx \ $(MISC)$/localedata_ia.cxx \ @@ -359,6 +360,7 @@ SHL3OBJS= \ $(SLO)$/localedata_ga_IE.obj \ $(SLO)$/localedata_gsc_FR.obj \ $(SLO)$/localedata_hr_HR.obj \ + $(SLO)$/localedata_hsb_DE.obj \ $(SLO)$/localedata_is_IS.obj \ $(SLO)$/localedata_it_CH.obj \ $(SLO)$/localedata_it_IT.obj \ diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 72a2227a8eb5..9be84dbf4763 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -171,6 +171,7 @@ static const struct { { "sc_IT", lcl_DATA_EURO }, { "ast_ES", lcl_DATA_EURO }, { "ltg_LV", lcl_DATA_EURO }, + { "hsb_DE", lcl_DATA_EURO }, { "ja_JP", lcl_DATA_OTHERS }, { "ko_KR", lcl_DATA_OTHERS }, -- cgit v1.2.3 From 823d7d45163ef201332d082da098a7c09fcad723 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 18:51:56 +0100 Subject: locales33: changed validation instruction's doctype URLs from SVN trunk to HG tip --- i18npool/source/localedata/data/locale.dtd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd index b9ee78f69e79..995340e08b81 100644 --- a/i18npool/source/localedata/data/locale.dtd +++ b/i18npool/source/localedata/data/locale.dtd @@ -20,13 +20,16 @@ A second possiblity is: - temporarily change the DOCTYPE of your file to read (all on one line) - + - upload it to the form available at http://www.validome.org/ - This will validate the file against the HEAD revision of locale.dtd, for - other revisions you'll have to specify the corresponding tags or cws branch - instead of trunk. + This will validate the file against the HEAD revision of locale.dtd on the + DEV300 development code line, for other revisions you'll have to specify + the corresponding tags or cws branch instead. For example, to validate + against a modified locale.dtd in CWS locales33 you would use + + Please test locale data files either in a non-product (!) build, which -- cgit v1.2.3 From 25df13034ca7f2cd940a017c0eedaaa742c867b5 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 21:27:28 +0100 Subject: locales33: some more documentation --- i18npool/source/localedata/data/locale.dtd | 117 +++++++++++++++++++++++------ 1 file changed, 93 insertions(+), 24 deletions(-) diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd index 995340e08b81..d47d4ad26edc 100644 --- a/i18npool/source/localedata/data/locale.dtd +++ b/i18npool/source/localedata/data/locale.dtd @@ -19,7 +19,7 @@ A second possiblity is: - - temporarily change the DOCTYPE of your file to read (all on one line) + - temporarily (!) change the DOCTYPE of your file to read (all on one line) - upload it to the form available at http://www.validome.org/ @@ -59,16 +59,22 @@ + + + + - + + @@ -87,28 +93,35 @@ --> + - - + - + + + + - + - + - - @@ -237,34 +254,54 @@ + + + - + + + + - + - + + + + + + - + + - + + @@ -279,10 +316,14 @@ is in the new year. --> + + + + + + + + + + + + - - - + + + + + + + + + - - - - + + + + + -- cgit v1.2.3 From 7fcc368b90f38a57829d093bf9361d78a3a7177b Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 22:25:04 +0100 Subject: locales33: indent, cleanup, sort FormatElement by formatindex for diff --- i18npool/source/localedata/data/lv_LV.xml | 869 ++++++++++++++---------------- 1 file changed, 411 insertions(+), 458 deletions(-) diff --git a/i18npool/source/localedata/data/lv_LV.xml b/i18npool/source/localedata/data/lv_LV.xml index e29a06eaf274..27bb0f13e409 100644 --- a/i18npool/source/localedata/data/lv_LV.xml +++ b/i18npool/source/localedata/data/lv_LV.xml @@ -1,462 +1,415 @@ - - -lv -Latvian - - -LV -Latvia - - -generic - - - - -. -  -, -: -, -; - - - - g. - - -‘ -’ -“ -†- -AM -PM -Metric - - - -D.M.YY - - - -NN DD MMM YY - - - -MM.YY - - - -MMM DD - - - -MMMM - - - -QQ YY - - - -DD.MM.YYYY - - - -DD.MM.YY - - - -DD. NNNNMMMM, YYYY - - - -D. MMM, YY - - - -D. MMM, YYYY - - - -D. MMMM, YYYY - - - -NN, D. MMMM, YY - - - -NN, D. MMMM, YYYY - - - -NNNNMMMM D, YYYY - - - -D. MMM. YYYY - - - -D. MMMM YYYY - - - -DD-MM - - - -YY-MM-DD -ISO 8601 - - -YYYY-MM-DD -ISO 8601 - - -WW - - - -HH:MM - - - -HH:MM:SS - - - -HH:MM AM/PM - - - -HH:MM:SS AM/PM - - - -[HH]:MM:SS - - - -MM:SS,00 - - - -[HH]:MM:SS,00 - - - -DD.MM.YY HH:MM - - - -DD.MM.YYYY HH:MM:SS - - - -Standard - - - -0 - - - -0,00 - - - -# ##0 - - - -# ##0,00 - - - -# ###,00 - - - -# ##0[$Ls-426];-# ##0[$Ls-426] - - - -# ##0,00[$Ls-426];-# ##0,00[$Ls-426] - - - -# ##0[$Ls-426];[RED]-# ##0[$Ls-426] - - - -# ##0,00[$Ls-426];[RED]-# ##0,00[$Ls-426] - - - -# ##0,00 CCC - - - -# ##0,--[$Ls-426];[RED]-# ##0,--[$Ls-426] - - - -0% - - - -0,00% - - - -0,00E+000 - - - -0,00E+00 - - - - - - -IGNORE_CASE - - - - -IGNORE_CASE - - - -A-Y ÄŒ Ä¢ Ķ Ä» Å… Å  Ž -0 -1 -2 -p. -pp. - - - - - -sun -Sv -svÄ“tdiena - - -mon -P -pirmdiena - - -tue -O -otrdiena - - -wed -T -treÅ¡diena - - -thu -C -ceturtdiena - - -fri -Pk -piektdiena - - -sat -S -sestdiena - - - - -jan -jan -janvÄris - - -feb -feb -februÄris - - -mar -mar -marts - - -apr -apr -aprÄ«lis - - -may -mai -maijs - - -jun -jÅ«n -jÅ«nijs - - -jul -jÅ«l -jÅ«lijs - - -aug -aug -augusts - - -sep -sep -septembris - - -oct -okt -oktobris - - -nov -nov -novembris - - -dec -dec -decembris - - - - -bc -pmÄ“ -pirms mÅ«su Ä“ras - - -ad -mÄ“ -mÅ«su Ä“rÄ - - - -mon - -1 - - - - -LVL -Ls -LVL -Lats -2 - - - - - - - - - -patiess -aplams -1. ceturksnis -2. ceturksnis -3. ceturksnis -4. ceturksnis -augstÄk -zemÄk -C1 -C2 -C3 -C4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + lv + Latvian + + + LV + Latvia + + + + + . +   + , + : + , + ; + + + + g. + + + ‘ + ’ + “ + †+ + AM + PM + metric + + + + Standard + + + 0 + + + 0,00 + + + # ##0 + + + # ##0,00 + + + # ###,00 + + + 0,00E+000 + + + 0,00E+00 + + + 0% + + + 0,00% + + + # ##0[$Ls-426];-# ##0[$Ls-426] + + + # ##0,00[$Ls-426];-# ##0,00[$Ls-426] + + + # ##0[$Ls-426];[RED]-# ##0[$Ls-426] + + + # ##0,00[$Ls-426];[RED]-# ##0,00[$Ls-426] + + + # ##0,00 CCC + + + # ##0,--[$Ls-426];[RED]-# ##0,--[$Ls-426] + + + D.M.YY + + + DD. NNNNMMMM, YYYY + + + DD.MM.YY + + + DD.MM.YYYY + + + D. MMM, YY + + + D. MMM, YYYY + + + D. MMM. YYYY + + + D. MMMM, YYYY + + + D. MMMM YYYY + + + NN, D. MMMM, YY + + + NN DD MMM YY + + + NN, D. MMMM, YYYY + + + NNNNMMMM D, YYYY + + + DD-MM + + + YY-MM-DD + ISO 8601 + + + YYYY-MM-DD + ISO 8601 + + + MM.YY + + + MMM DD + + + MMMM + + + QQ YY + + + WW + + + HH:MM + + + HH:MM:SS + + + HH:MM AM/PM + + + HH:MM:SS AM/PM + + + [HH]:MM:SS + + + MM:SS,00 + + + [HH]:MM:SS,00 + + + DD.MM.YY HH:MM + + + DD.MM.YYYY HH:MM:SS + + + + + + IGNORE_CASE + + + + + IGNORE_CASE + + + + A-Y ÄŒ Ä¢ Ķ Ä» Å… Å  Ž + 0 + 1 + 2 + p. + pp. + + + + + + sun + Sv + svÄ“tdiena + + + mon + P + pirmdiena + + + tue + O + otrdiena + + + wed + T + treÅ¡diena + + + thu + C + ceturtdiena + + + fri + Pk + piektdiena + + + sat + S + sestdiena + + + + + jan + jan + janvÄris + + + feb + feb + februÄris + + + mar + mar + marts + + + apr + apr + aprÄ«lis + + + may + mai + maijs + + + jun + jÅ«n + jÅ«nijs + + + jul + jÅ«l + jÅ«lijs + + + aug + aug + augusts + + + sep + sep + septembris + + + oct + okt + oktobris + + + nov + nov + novembris + + + dec + dec + decembris + + + + + bc + pmÄ“ + pirms mÅ«su Ä“ras + + + ad + mÄ“ + mÅ«su Ä“rÄ + + + + mon + + 1 + + + + + LVL + Ls + LVL + Lats + 2 + + + + + + + + + + patiess + aplams + 1. ceturksnis + 2. ceturksnis + 3. ceturksnis + 4. ceturksnis + augstÄk + zemÄk + C1 + C2 + C3 + C4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 8d79c317d5aafc4512b72d94e93f27134316fbda Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sun, 21 Feb 2010 23:19:06 +0100 Subject: locales33: #i108675# * adapted quotation marks and currency formats to lv_LV + added UnicodeScript 2 --- i18npool/source/localedata/data/ltg_LV.xml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/i18npool/source/localedata/data/ltg_LV.xml b/i18npool/source/localedata/data/ltg_LV.xml index d6548a492da1..95f3cedefbad 100644 --- a/i18npool/source/localedata/data/ltg_LV.xml +++ b/i18npool/source/localedata/data/ltg_LV.xml @@ -25,16 +25,16 @@ - ' - ' - ' - ' + ‘ + ’ + “ + †AM PM metric - + General @@ -66,22 +66,22 @@ 0,00% - # ##0 [CURRENCY];-# ##0 [CURRENCY] + # ##0[$Ls-64B];-# ##0[$Ls-64B] - # ##0,00 [CURRENCY];-# ##0,00 [CURRENCY] + # ##0,00[$Ls-64B];-# ##0,00[$Ls-64B] - # ##0 [CURRENCY];[RED]-# ##0 [CURRENCY] + # ##0[$Ls-64B];[RED]-# ##0[$Ls-64B] - # ##0,00 [CURRENCY];[RED]-# ##0,00 [CURRENCY] + # ##0,00[$Ls-64B];[RED]-# ##0,00[$Ls-64B] # ##0,00 CCC - # ##0,-- [CURRENCY];[RED]-# ##0,-- [CURRENCY] + # ##0,--[$Ls-64B];[RED]-# ##0,--[$Ls-64B] D.MM.YY @@ -191,6 +191,7 @@ A-Ž 0 1 + 2 lpp. lpp. -- cgit v1.2.3 From 24bd18f021c14c386c2c18c7cc61fb11442414f5 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 22 Feb 2010 01:33:33 +0100 Subject: "locales33: #i106992# Canada uses ISO 8601 YYYY-MM-DD date format" --- i18npool/source/localedata/data/en_CA.xml | 24 ++++++++++++------------ i18npool/source/localedata/data/fr_CA.xml | 8 ++++---- i18npool/source/localedata/data/shs_CA.xml | 20 ++++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/i18npool/source/localedata/data/en_CA.xml b/i18npool/source/localedata/data/en_CA.xml index 31d24643b44a..121de11814a7 100644 --- a/i18npool/source/localedata/data/en_CA.xml +++ b/i18npool/source/localedata/data/en_CA.xml @@ -13,14 +13,14 @@ - / + - , . : . ; , - , + , @@ -84,16 +84,16 @@ [$$-1009]#,##0.--;[RED]-[$$-1009]#,##0.-- - DD/MM/YY + YY-M-D MMMM D, YYYY - - DD/MM/YY + + YY-MM-DD - - DD/MM/YYYY + + YYYY-MM-DD MMM D, YY @@ -114,7 +114,7 @@ NN, MMM D, YY - NN DD/MMM YY + NN DD-MMM YY NN, MMMM D, YYYY @@ -134,10 +134,10 @@ ISO 8601 - MM/YY + YY-MM - DD/MMM + MMM DD MMMM @@ -170,10 +170,10 @@ [HH]:MM:SS.00 - DD/MM/YY HH:MM + YYYY-MM-DD HH:MM - DD/MM/YYYY HH:MM:SS + YYYY-MM-DD HH:MM:SS diff --git a/i18npool/source/localedata/data/fr_CA.xml b/i18npool/source/localedata/data/fr_CA.xml index fcc99570bae9..c5976c73e741 100644 --- a/i18npool/source/localedata/data/fr_CA.xml +++ b/i18npool/source/localedata/data/fr_CA.xml @@ -87,15 +87,15 @@ # ##0,-- [$$-C0C];[RED]-# ##0,-- [$$-C0C] - AA-MM-JJ + AA-M-J J MMMM AAAA - + AA-MM-JJ - + AAAA-MM-JJ @@ -173,7 +173,7 @@ [HH]:MM:SS,00 - AA-MM-JJ HH:MM + AAAA-MM-JJ HH:MM AAAA-MM-JJ HH:MM:SS diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml index 4060d002bbe2..c7e46fa3453d 100644 --- a/i18npool/source/localedata/data/shs_CA.xml +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -13,7 +13,7 @@ - / + - , . : @@ -84,16 +84,16 @@ [CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.-- - M/D/YY + YY-M-D NNNNMMMM DD, YYYY - - MM/DD/YY + + YY-MM-DD - - MM/DD/YYYY + + YYYY-MM-DD MMM D, YY @@ -114,7 +114,7 @@ NN, MMM D, YY - NN DD/MMM YY + NN DD-MMM YY NN, MMMM D, YYYY @@ -134,7 +134,7 @@ ISO 8601 - MM/YY + YY-MM MMM DD @@ -170,10 +170,10 @@ [HH]:MM:SS.00 - MM/DD/YY HH:MM AM/PM + YYYY-MM-DD HH:MM - MM/DD/YYYY HH:MM:SS + YYYY-MM-DD HH:MM:SS -- cgit v1.2.3 From d21bee58ee779f1d666b991e429975bab885762d Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 23 Feb 2010 01:45:22 +0100 Subject: locales33: #i105121# added U+0218 Ș and U+021A Èš to IndexKey, UnicodeScript 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18npool/source/localedata/data/ro_RO.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i18npool/source/localedata/data/ro_RO.xml b/i18npool/source/localedata/data/ro_RO.xml index ed92d9243cb6..c03ebd990f88 100644 --- a/i18npool/source/localedata/data/ro_RO.xml +++ b/i18npool/source/localedata/data/ro_RO.xml @@ -223,10 +223,11 @@ - A Ä‚  B-I ÃŽ J-S Åž T Å¢ U-Z + A Ä‚  B-I ÃŽ J-S Ș Åž T Èš Å¢ U-Z 0 1 2 + 3 p. pp. -- cgit v1.2.3 From e7dfeb601ace259eba7a2bc4685224acd1748ecf Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 24 Feb 2010 20:24:47 +0100 Subject: locales33: #i108675# refer to lv_LV for LC_NumberingLevel and LC_OutLineNumberingLevel --- i18npool/source/localedata/data/ltg_LV.xml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/i18npool/source/localedata/data/ltg_LV.xml b/i18npool/source/localedata/data/ltg_LV.xml index 95f3cedefbad..c41c38c86b9c 100644 --- a/i18npool/source/localedata/data/ltg_LV.xml +++ b/i18npool/source/localedata/data/ltg_LV.xml @@ -344,16 +344,7 @@ C4 - - - - - - - - - - - + + -- cgit v1.2.3 From e4cc3b23c9485b242883795c5381a412fc0e2fa3 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 1 Mar 2010 14:32:01 +0100 Subject: mtaccfixes: #i50760 BASEPROPERTY_HIGHCONTRASTMODE --- toolkit/inc/toolkit/helper/property.hxx | 1 + toolkit/source/awt/vclxwindow.cxx | 4 ++++ toolkit/source/helper/property.cxx | 1 + 3 files changed, 6 insertions(+) diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index f82df1f5b53f..e501a4d99fe2 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -198,6 +198,7 @@ namespace rtl { #define BASEPROPERTY_GRID_SELECTIONMODE 144 #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool #define BASEPROPERTY_REFERENCE_DEVICE 146 +#define BASEPROPERTY_HIGHCONTRASTMODE 147 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 3d2069ab8385..ee5ec62716a3 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -2166,6 +2166,10 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: aProp <<= (sal_Bool) mpImpl->isEnableVisible(); break; + case BASEPROPERTY_HIGHCONTRASTMODE: + aProp <<= (sal_Bool) GetWindow()->GetSettings().GetStyleSettings().GetHighContrastMode(); + break; + case BASEPROPERTY_TEXT: case BASEPROPERTY_LABEL: case BASEPROPERTY_TITLE: diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index a59af95a2e1f..304886a856ea 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -188,6 +188,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "HighContrastMode", HIGHCONTRASTMODE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT), -- cgit v1.2.3 From 48c79177a1a29420b3d8adfa8e00703ab62789a1 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 1 Mar 2010 18:40:29 +0100 Subject: locales33: #i109687# added Bafia_Cameroon [ksf-CM] to language list --- i18npool/inc/i18npool/lang.h | 1 + i18npool/source/isolang/isolang.cxx | 1 + svtools/source/misc/langtab.src | 1 + 3 files changed, 3 insertions(+) diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index 0b9e1e6c54d4..0b393cdfb5a9 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -514,5 +514,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_SARDINIAN_GALLURESE 0x0651 #define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652 #define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653 +#define LANGUAGE_USER_BAFIA 0x0654 #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index b93001584236..3aaab05617bf 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -458,6 +458,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_BUSHI, "buc", "YT" }, { LANGUAGE_USER_TAHITIAN, "ty", "PF" }, { LANGUAGE_USER_MALAGASY_PLATEAU, "plt", "MG" }, + { LANGUAGE_USER_BAFIA, "ksf", "CM" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 35196b2e293b..5f67eddfb801 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -321,6 +321,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Sardinian, Gallurese" ; LANGUAGE_USER_SARDINIAN_GALLURESE ; > ; < "Sardinian, Logudorese" ; LANGUAGE_USER_SARDINIAN_LOGUDORESE ; > ; < "Sardinian, Sassarese" ; LANGUAGE_USER_SARDINIAN_SASSARESE ; > ; + < "Bafia" ; LANGUAGE_USER_BAFIA ; > ; }; }; -- cgit v1.2.3 From 525ea6a5f57aa0863cb4c80fec1e6e183e781912 Mon Sep 17 00:00:00 2001 From: "Malte Timmermann [mt]" Date: Wed, 3 Mar 2010 09:52:31 +0100 Subject: mtaccfixes: undo some changes from vcl108, which I solved differenlty with mtaccfixes (tab control) --- vcl/inc/vcl/tabctrl.hxx | 3 --- vcl/inc/vcl/tabdlg.hxx | 2 -- vcl/source/control/tabctrl.cxx | 3 --- vcl/source/window/dlgctrl.cxx | 14 -------------- vcl/source/window/tabdlg.cxx | 17 ----------------- 5 files changed, 39 deletions(-) diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 13e4384a9a48..4c63b12f15fe 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -98,9 +98,6 @@ private: DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox* ); DECL_DLLPRIVATE_LINK( ImplWindowEventListener, VclSimpleEvent* ); -public: - // just for dialog control - SAL_DLLPRIVATE bool ImplHandleNotifyEvent( NotifyEvent& rEvt ); protected: using Window::ImplInit; diff --git a/vcl/inc/vcl/tabdlg.hxx b/vcl/inc/vcl/tabdlg.hxx index b5f1dc14de5d..35543bb6aac0 100644 --- a/vcl/inc/vcl/tabdlg.hxx +++ b/vcl/inc/vcl/tabdlg.hxx @@ -59,8 +59,6 @@ public: virtual void Resize(); virtual void StateChanged( StateChangedType nStateChange ); - SAL_DLLPRIVATE TabControl* ImplGetFirstTabControl() const; - void AdjustLayout(); void SetViewWindow( Window* pWindow ) { mpViewWindow = pWindow; } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index aac67a3428bf..741267044829 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1717,9 +1717,6 @@ long TabControl::PreNotify( NotifyEvent& rNEvt ) long TabControl::Notify( NotifyEvent& rNEvt ) { - // after upgrading to m71, remove changes from VCL108 - // http://hg.services.openoffice.org/cws/vcl108/rev/68a2dcff2b44 - long nRet = 0; if ( rNEvt.GetType() == EVENT_KEYINPUT ) diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 741d1983ea4f..64f2b7e0d2a1 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -886,20 +886,6 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput ) return TRUE; } - // if we have come here (and therefore the strange "formular" logic above - // turned up no result, then let's try to find a customer for Ctrl-TAB - if ( nKeyCode == KEY_TAB && aKeyCode.IsMod1() && ! aKeyCode.IsMod2() ) - { - TabDialog* pDlg = dynamic_cast(this); - if( pDlg ) - { - TabControl* pTabCtrl = pDlg->ImplGetFirstTabControl(); - NotifyEvent aEvt( bKeyInput ? EVENT_KEYINPUT : EVENT_KEYUP, - pTabCtrl, &rKEvt ); - return pTabCtrl->ImplHandleNotifyEvent( aEvt ); - } - } - return FALSE; } diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index 02a8b6a5b717..874881c0c5ef 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -274,20 +274,3 @@ void TabDialog::AdjustLayout() ImplPosControls(); } -// ----------------------------------------------------------------------- - -TabControl* TabDialog::ImplGetFirstTabControl() const -{ - Window* pChild = GetWindow( WINDOW_FIRSTCHILD ); - while ( pChild ) - { - if ( pChild->IsVisible() && (pChild != mpViewWindow) ) - { - if ( pChild->GetType() == WINDOW_TABCONTROL ) - return (TabControl*)pChild; - } - pChild = pChild->GetWindow( WINDOW_NEXT ); - } - return NULL; -} - -- cgit v1.2.3 From e928c6ea018816085ab2b665105bf7e1b1292d05 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Sat, 6 Mar 2010 01:23:57 +0100 Subject: locales33: leading whitespace is not mandatory in postset.mk --- i18npool/source/isolang/langid.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18npool/source/isolang/langid.pl b/i18npool/source/isolang/langid.pl index 629f08901a7d..06883279345b 100755 --- a/i18npool/source/isolang/langid.pl +++ b/i18npool/source/isolang/langid.pl @@ -390,7 +390,7 @@ sub main() '^\s*completelangiso\s*[= ](.{2,3}(-..)?)*' . $langcoun . '', "$SRC_ROOT", "solenv", "inc/postset.mk", # needs a duplicated pair of backslashes to produce a literal \\ - ('^\s*completelangiso\s*=', '^\s+' . $langcoun . '\s*\\\\*$')); + ('^\s*completelangiso\s*=', '^\s*' . $langcoun . '\s*\\\\*$')); } } return 0; -- cgit v1.2.3 From a614e489f61b0dd6fad4e54329a9be0a4160beac Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Wed, 24 Mar 2010 15:36:04 +0100 Subject: #i108917# fixed confusing behaviour of context menu and meta drop down menu in impress comments window - transplanted from 263351@impresscomments1 --- vcl/source/window/winproc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 93e1b0837429..95ac5940b6d2 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -295,7 +295,7 @@ static BOOL ImplCallCommand( Window* pChild, USHORT nEvt, void* pData = NULL, else { // simulate mouseposition at center of window - Size aSize = pChild->GetOutputSize(); + Size aSize( pChild->GetOutputSizePixel() ); aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 ); } } -- cgit v1.2.3 From b4198879145910d444b4e613fe8177ab746b0fb7 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 25 Mar 2010 13:37:28 +0100 Subject: CWS-TOOLING: integrate CWS ooo321gsl01_DEV300 --- vcl/inc/vcl/fontmanager.hxx | 2 +- vcl/source/gdi/outdev3.cxx | 1 + vcl/unx/source/fontmanager/fontconfig.cxx | 7 +++++-- vcl/unx/source/fontmanager/fontmanager.cxx | 8 +++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/vcl/inc/vcl/fontmanager.hxx b/vcl/inc/vcl/fontmanager.hxx index 6ebd777f1c61..33fece8d88e1 100644 --- a/vcl/inc/vcl/fontmanager.hxx +++ b/vcl/inc/vcl/fontmanager.hxx @@ -437,7 +437,7 @@ class VCL_DLLPUBLIC PrintFontManager false else (e.g. no libfontconfig found) */ bool initFontconfig(); - int countFontconfigFonts(); + int countFontconfigFonts( std::hash_map& o_rVisitedPaths ); /* deinitialize fontconfig */ void deinitFontconfig(); diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 963b7a3daa30..e13ae6cbe64a 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -1337,6 +1337,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const "muktinarrow", "", "phetsarathot", "", "padauk", "pinlonmyanmar", "", + "iskoolapota", "lklug", "", 0 }; diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 18d8a8d85a43..bc6de4fbc94a 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -643,7 +643,7 @@ namespace } } -int PrintFontManager::countFontconfigFonts() +int PrintFontManager::countFontconfigFonts( std::hash_map& o_rVisitedPaths ) { int nFonts = 0; @@ -704,6 +704,9 @@ int PrintFontManager::countFontconfigFonts() std::list< PrintFont* > aFonts; OString aDir, aBase, aOrgPath( (sal_Char*)file ); splitPath( aOrgPath, aDir, aBase ); + + o_rVisitedPaths[aDir] = 1; + int nDirID = getDirectoryAtom( aDir, true ); if( ! m_pFontCache->getFontCacheFile( nDirID, aBase, aFonts ) ) { @@ -1183,7 +1186,7 @@ bool PrintFontManager::initFontconfig() return false; } -int PrintFontManager::countFontconfigFonts() +int PrintFontManager::countFontconfigFonts( std::hash_map& ) { return 0; } diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx index 7d5224707f72..93e3eef53ab3 100644 --- a/vcl/unx/source/fontmanager/fontmanager.cxx +++ b/vcl/unx/source/fontmanager/fontmanager.cxx @@ -2149,10 +2149,14 @@ void PrintFontManager::initialize() } while( nIndex >= 0 ); } + // protect against duplicate paths + std::hash_map< OString, int, OStringHash > visited_dirs; + // now that all global and local font dirs are known to fontconfig // check that there are fonts actually managed by fontconfig + // also don't search directories that fontconfig already did if( m_bFontconfigSuccess ) - m_bFontconfigSuccess = (countFontconfigFonts() > 0); + m_bFontconfigSuccess = (countFontconfigFonts( visited_dirs ) > 0); // don't search through many directories fontconfig already told us about if( ! m_bFontconfigSuccess ) @@ -2163,8 +2167,6 @@ void PrintFontManager::initialize() // search for font files in each path std::list< OString >::iterator dir_it; - // protect against duplicate paths - std::hash_map< OString, int, OStringHash > visited_dirs; for( dir_it = m_aFontDirectories.begin(); dir_it != m_aFontDirectories.end(); ++dir_it ) { OString aPath( *dir_it ); -- cgit v1.2.3 From 48b326358ecbfd1d085d052dc977e99265808cd5 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 25 Mar 2010 13:46:55 +0100 Subject: CWS-TOOLING: integrate CWS ooo321gsl03_DEV300 --- vcl/unx/gtk/window/gtkframe.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 7724311cfa29..ef356eb57aa9 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -2088,7 +2088,14 @@ void GtkSalFrame::ToTop( USHORT nFlags ) * is set to false. */ if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) ) + { + // sad but true: this can cause an XError, we need to catch that + // to do this we need to synchronize with the XServer + getDisplay()->GetXLib()->PushXErrorLevel( true ); XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); + XSync( getDisplay()->GetDisplay(), False ); + getDisplay()->GetXLib()->PopXErrorLevel(); + } } else { -- cgit v1.2.3 From 56956223966f211b72e1bfa5777fac0d7be9eeb5 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 25 Mar 2010 14:14:26 +0100 Subject: CWS-TOOLING: integrate CWS ooo321gsl04_DEV300 --- vcl/unx/gtk/app/gtkdata.cxx | 3 +-- vcl/unx/inc/saldisp.hxx | 1 + vcl/unx/source/app/saldisp.cxx | 58 ++++++++++++++++++++++-------------------- vcl/unx/source/gdi/salgdi3.cxx | 2 +- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index b1529e060270..e722a03a29b9 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -221,8 +221,7 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen ) { GdkRectangle dest; gdk_screen_get_monitor_geometry(pScreen, i, &dest); - m_aXineramaScreens.push_back( Rectangle( Point(dest.x, - dest.y ), Size( dest.width, dest.height ) ) ); + addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height ); } m_bXinerama = m_aXineramaScreens.size() > 1; if( ! m_aFrames.empty() ) diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx index 368e554794ad..e54d6e828911 100644 --- a/vcl/unx/inc/saldisp.hxx +++ b/vcl/unx/inc/saldisp.hxx @@ -404,6 +404,7 @@ protected: int processRandREvent( XEvent* ); void doDestruct(); + void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ); public: static SalDisplay *GetSalDisplay( Display* display ); static BOOL BestVisual( Display *pDisp, diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 97116626894e..2ed699ad0eb5 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -2594,6 +2594,28 @@ void SalDisplay::PrintInfo() const sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) ); } +void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight ) +{ + // see if any frame buffers are at the same coordinates + // this can happen with weird configuration e.g. on + // XFree86 and Clone displays + const size_t nScreens = m_aXineramaScreens.size(); + for( size_t n = 0; n < nScreens; n++ ) + { + if( m_aXineramaScreens[n].Left() == i_nX && + m_aXineramaScreens[n].Top() == i_nY ) + { + if( m_aXineramaScreens[n].GetWidth() < i_nWidth || + m_aXineramaScreens[n].GetHeight() < i_nHeight ) + { + m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) ); + } + return; + } + } + m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) ); +} + void SalDisplay::InitXinerama() { if( m_aScreens.size() > 1 ) @@ -2618,10 +2640,10 @@ void SalDisplay::InitXinerama() m_bXinerama = true; m_aXineramaScreens = std::vector( nFramebuffers ); for( int i = 0; i < nFramebuffers; i++ ) - m_aXineramaScreens[i] = Rectangle( Point( pFramebuffers[i].x, - pFramebuffers[i].y ), - Size( pFramebuffers[i].width, - pFramebuffers[i].height ) ); + addXineramaScreenUnique( pFramebuffers[i].x, + pFramebuffers[i].y, + pFramebuffers[i].width, + pFramebuffers[i].height ); } } #elif defined(USE_XINERAMA_XORG) @@ -2637,30 +2659,10 @@ if( XineramaIsActive( pDisp_ ) ) m_aXineramaScreens = std::vector(); for( int i = 0; i < nFramebuffers; i++ ) { - // see if any frame buffers are at the same coordinates - // this can happen with weird configuration e.g. on - // XFree86 and Clone displays - bool bDuplicate = false; - for( int n = 0; n < i; n++ ) - { - if( m_aXineramaScreens[n].Left() == pScreens[i].x_org && - m_aXineramaScreens[n].Top() == pScreens[i].y_org ) - { - bDuplicate = true; - if( m_aXineramaScreens[n].GetWidth() < pScreens[i].width || - m_aXineramaScreens[n].GetHeight() < pScreens[i].height ) - { - m_aXineramaScreens[n].SetSize( Size( pScreens[i].width, - pScreens[i].height ) ); - } - break; - } - } - if( ! bDuplicate ) - m_aXineramaScreens.push_back( Rectangle( Point( pScreens[i].x_org, - pScreens[i].y_org ), - Size( pScreens[i].width, - pScreens[i].height ) ) ); + addXineramaScreenUnique( pScreens[i].x_org, + pScreens[i].y_org, + pScreens[i].width, + pScreens[i].height ); } m_bXinerama = m_aXineramaScreens.size() > 1; } diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 0c1fcd7c77bd..7cf2009a3e07 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -1088,7 +1088,7 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout ) } // set font foreground color and opacity - XRenderColor aRenderColor = GetXRenderColor( nTextPixel_ ); + XRenderColor aRenderColor = GetXRenderColor( nTextColor_ ); rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 ); // set clipping -- cgit v1.2.3 From 5615b97d1b230519251ec98c0139d1f321f3742c Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 12:26:34 +0000 Subject: #i108159# ODF-Icons for OOo build --- svtools/source/misc/imagemgr.cxx | 69 +++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index e57c0d21d98a..391ad02e6aa1 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -73,33 +73,35 @@ struct SvtExtensionResIdMapping_Impl static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = { - { "awk", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, - { "bas", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, - { "bat", TRUE, STR_DESCRIPTION_BATCHFILE, IMG_APP }, + { "awk", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, + { "bas", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, + { "bat", TRUE, STR_DESCRIPTION_BATCHFILE, 0 }, { "bmk", FALSE, STR_DESCRIPTION_BOOKMARKFILE, 0 }, { "bmp", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_BITMAP }, - { "c", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "c", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "cfg", FALSE, STR_DESCRIPTION_CFGFILE, 0 }, - { "cmd", TRUE, STR_DESCRIPTION_BATCHFILE, IMG_APP }, - { "cob", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, - { "com", TRUE, STR_DESCRIPTION_APPLICATION, IMG_APP }, - { "cxx", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "cmd", TRUE, STR_DESCRIPTION_BATCHFILE, 0 }, + { "cob", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, + { "com", TRUE, STR_DESCRIPTION_APPLICATION, 0 }, + { "cxx", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "dbf", TRUE, STR_DESCRIPTION_DATABASE_TABLE, IMG_TABLE }, - { "def", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "def", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "dll", TRUE, STR_DESCRIPTION_SYSFILE, 0 }, - { "doc", FALSE, STR_DESCRIPTION_WORD_DOC, IMG_WORD }, + { "doc", FALSE, STR_DESCRIPTION_WORD_DOC, IMG_WRITER }, + { "dot", FALSE, STR_DESCRIPTION_WORD_DOC, IMG_WRITERTEMPLATE }, + { "docx", FALSE, STR_DESCRIPTION_WORD_DOC, IMG_WRITER }, { "dxf", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_DXF }, - { "exe", TRUE, STR_DESCRIPTION_APPLICATION, IMG_APP }, + { "exe", TRUE, STR_DESCRIPTION_APPLICATION, 0 }, { "gif", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_GIF }, - { "h", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, - { "hlp", FALSE, STR_DESCRIPTION_HELP_DOC, IMG_HELP }, - { "hrc", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "h", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, + { "hlp", FALSE, STR_DESCRIPTION_HELP_DOC, 0 }, + { "hrc", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "htm", FALSE, STR_DESCRIPTION_HTMLFILE, IMG_HTML }, { "html", FALSE, STR_DESCRIPTION_HTMLFILE, IMG_HTML }, { "asp", FALSE, STR_DESCRIPTION_HTMLFILE, IMG_HTML }, - { "hxx", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "hxx", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "ini", FALSE, STR_DESCRIPTION_CFGFILE, 0 }, - { "java", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "java", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "jpeg", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_JPG }, { "jpg", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_JPG }, { "lha", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, @@ -110,7 +112,7 @@ static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = { "lst", TRUE, STR_DESCRIPTION_LOGFILE, 0 }, { "met", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_MET }, { "mml", FALSE, STR_DESCRIPTION_MATHML_DOC, IMG_MATH }, - { "mod", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "mod", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "odb", FALSE, STR_DESCRIPTION_OO_DATABASE_DOC, IMG_OO_DATABASE_DOC }, { "odg", FALSE, STR_DESCRIPTION_OO_DRAW_DOC, IMG_OO_DRAW_DOC }, { "odf", FALSE, STR_DESCRIPTION_OO_MATH_DOC, IMG_OO_MATH_DOC }, @@ -122,31 +124,32 @@ static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = { "otp", FALSE, STR_DESCRIPTION_OO_IMPRESS_TEMPLATE, IMG_OO_IMPRESS_TEMPLATE }, { "ots", FALSE, STR_DESCRIPTION_OO_CALC_TEMPLATE, IMG_OO_CALC_TEMPLATE }, { "ott", FALSE, STR_DESCRIPTION_OO_WRITER_TEMPLATE, IMG_OO_WRITER_TEMPLATE }, - { "pas", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "pas", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "pcd", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCD }, { "pct", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCT }, { "pcx", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_PCX }, - { "pl", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, + { "pl", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, { "png", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_PNG }, { "rar", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, - { "sbl", FALSE, 0, IMG_MACROLIB }, + { "rtf", FALSE, STR_DESCRIPTION_WORD_DOC, IMG_WRITER }, + { "sbl", FALSE, 0, 0 }, { "sch", FALSE, 0, 0 }, { "sda", FALSE, STR_DESCRIPTION_SDRAW_DOC, IMG_DRAW }, { "sdb", FALSE, STR_DESCRIPTION_SDATABASE_DOC, IMG_DATABASE }, { "sdc", FALSE, STR_DESCRIPTION_SCALC_DOC, IMG_CALC }, { "sdd", FALSE, STR_DESCRIPTION_SIMPRESS_DOC, IMG_IMPRESS }, - { "sdp", FALSE, STR_DESCRIPTION_SIMPRESS_DOC, IMG_IMPRESSPACKED }, - { "sds", FALSE, STR_DESCRIPTION_SCHART_DOC, IMG_CHART }, + { "sdp", FALSE, STR_DESCRIPTION_SIMPRESS_DOC, 0 }, + { "sds", FALSE, STR_DESCRIPTION_SCHART_DOC, 0 }, { "sdw", FALSE, STR_DESCRIPTION_SWRITER_DOC, IMG_WRITER }, - { "sga", FALSE, 0, IMG_GALLERY }, + { "sga", FALSE, 0, 0 }, { "sgf", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_SGF }, { "sgl", FALSE, STR_DESCRIPTION_GLOBALDOC, IMG_GLOBAL_DOC }, { "sgv", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_SGV }, { "shtml", FALSE, STR_DESCRIPTION_HTMLFILE, IMG_HTML }, { "sim", FALSE, STR_DESCRIPTION_SIMAGE_DOC, IMG_SIM }, { "smf", FALSE, STR_DESCRIPTION_SMATH_DOC, IMG_MATH }, - { "src", TRUE, STR_DESCRIPTION_SOURCEFILE, IMG_TEXTFILE }, - { "svh", FALSE, STR_DESCRIPTION_HELP_DOC, IMG_SVHELP }, + { "src", TRUE, STR_DESCRIPTION_SOURCEFILE, 0 }, + { "svh", FALSE, STR_DESCRIPTION_HELP_DOC, 0 }, { "svm", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_SVM }, { "stc", FALSE, STR_DESCRIPTION_CALC_TEMPLATE, IMG_CALCTEMPLATE }, { "std", FALSE, STR_DESCRIPTION_DRAW_TEMPLATE, IMG_DRAWTEMPLATE }, @@ -157,27 +160,29 @@ static SvtExtensionResIdMapping_Impl __READONLY_DATA ExtensionMap_Impl[] = { "sxg", FALSE, STR_DESCRIPTION_SXGLOBAL_DOC, IMG_GLOBAL_DOC }, { "sxi", FALSE, STR_DESCRIPTION_SXIMPRESS_DOC, IMG_IMPRESS }, { "sxm", FALSE, STR_DESCRIPTION_SXMATH_DOC, IMG_MATH }, - { "sxs", FALSE, STR_DESCRIPTION_SXCHART_DOC, IMG_CHART }, + { "sxs", FALSE, STR_DESCRIPTION_SXCHART_DOC, 0 }, { "sxw", FALSE, STR_DESCRIPTION_SXWRITER_DOC, IMG_WRITER }, { "sys", TRUE, STR_DESCRIPTION_SYSFILE, 0 }, { "tif", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_TIFF }, { "tiff", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_TIFF }, { "txt", FALSE, STR_DESCRIPTION_TEXTFILE, IMG_TEXTFILE }, - { "url", FALSE, STR_DESCRIPTION_LINK, IMG_HTML }, + { "url", FALSE, STR_DESCRIPTION_LINK, 0 }, { "vor", FALSE, STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC, IMG_WRITERTEMPLATE }, { "vxd", TRUE, STR_DESCRIPTION_SYSFILE, 0 }, { "wmf", TRUE, STR_DESCRIPTION_GRAPHIC_DOC, IMG_WMF }, - { "xls", FALSE, STR_DESCRIPTION_EXCEL_DOC, IMG_EXCEL }, - { "xlt", FALSE, STR_DESCRIPTION_EXCEL_TEMPLATE_DOC, IMG_EXCELTEMPLATE }, + { "xls", FALSE, STR_DESCRIPTION_EXCEL_DOC, IMG_CALC }, + { "xlt", FALSE, STR_DESCRIPTION_EXCEL_TEMPLATE_DOC, IMG_CALCTEMPLATE }, + { "xlsx", FALSE, STR_DESCRIPTION_EXCEL_DOC, IMG_CALC }, { "uu", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, { "uue", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, { "z", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, { "zip", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, { "zoo", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, { "gz", TRUE, STR_DESCRIPTION_ARCHIVFILE, 0 }, - { "ppt", FALSE, STR_DESCRIPTION_POWERPOINT, IMG_POWERPOINT }, - { "pot", FALSE, STR_DESCRIPTION_POWERPOINT_TEMPLATE, IMG_POWERPOINTTEMPLATE }, - { "pps", FALSE, STR_DESCRIPTION_POWERPOINT_SHOW, IMG_POWERPOINT }, + { "ppt", FALSE, STR_DESCRIPTION_POWERPOINT, IMG_IMPRESS }, + { "pot", FALSE, STR_DESCRIPTION_POWERPOINT_TEMPLATE, IMG_IMPRESSTEMPLATE }, + { "pps", FALSE, STR_DESCRIPTION_POWERPOINT_SHOW, IMG_IMPRESS }, + { "pptx", FALSE, STR_DESCRIPTION_POWERPOINT, IMG_IMPRESS }, { "oxt", FALSE, STR_DESCRIPTION_EXTENSION, IMG_EXTENSION }, { 0, FALSE, 0, 0 } }; -- cgit v1.2.3 From 9caca59ebf7cd89f2c741d30d2dcdede6b5f280a Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 14 Dec 2009 13:46:00 +0100 Subject: Support png instead of bmp file format for splash/about images --- vcl/inc/vcl/introwin.hxx | 2 ++ vcl/source/window/introwin.cxx | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/vcl/inc/vcl/introwin.hxx b/vcl/inc/vcl/introwin.hxx index 5ffefe0950f8..40644019bc15 100644 --- a/vcl/inc/vcl/introwin.hxx +++ b/vcl/inc/vcl/introwin.hxx @@ -31,6 +31,7 @@ #include #include #include +#include // -------------- // - IntroWindow - @@ -46,6 +47,7 @@ public: ~IntroWindow(); void SetBackgroundBitmap( const Bitmap& rBitmap ); + void SetBackgroundBitmap( const BitmapEx& rBitmapEx ); }; #endif // _SV_INTROWIN_HXX diff --git a/vcl/source/window/introwin.cxx b/vcl/source/window/introwin.cxx index 02ccc2282a42..03f88adc3566 100644 --- a/vcl/source/window/introwin.cxx +++ b/vcl/source/window/introwin.cxx @@ -77,3 +77,12 @@ void IntroWindow::SetBackgroundBitmap( const Bitmap& rBitmap ) ImplGetFrame()->SetBackgroundBitmap( pBmp ); } } + +void IntroWindow::SetBackgroundBitmap( const BitmapEx& rBitmapEx ) +{ + if( ! rBitmapEx.IsEmpty() ) + { + SalBitmap* pBmp = rBitmapEx.ImplGetBitmapImpBitmap()->ImplGetSalBitmap(); + ImplGetFrame()->SetBackgroundBitmap( pBmp ); + } +} -- cgit v1.2.3 From e8e237788ed721ddd37f04cb4577328fbf363581 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 14 Dec 2009 15:00:09 +0100 Subject: Removed obsolete msgbox test code --- desktop/source/splash/splash.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 4dbecbd9dcc7..97029b0701f4 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #define NOT_LOADED ((long)-1) @@ -376,9 +375,6 @@ void SplashScreen::loadConfig() void SplashScreen::initBitmap() { - MessBox aMsgBox(0, WB_OK, String::CreateFromAscii("Oracle OpenOffice.org"), String::CreateFromAscii("Stop!")); - aMsgBox.Execute(); - if ( _bShowLogo ) { OUString sExecutePath; -- cgit v1.2.3 From e556015935380c2deba4ddc2d93bea0097d887d0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- scp2/source/ooo/file_ooo.scp | 14 ++++++++++++++ scp2/source/ooo/module_hidden_ooo.scp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index 5e571e0b2e03..2e25e2b8bdea 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -2034,6 +2034,20 @@ File gid_File_Oo_Ucb_InteractionHandler_Xcs Name = "/registry/schema/org/openoffice/ucb/InteractionHandler.xcs"; End +File gid_File_Oo_Interaction_Xcs + TXT_FILE_BODY; + Styles = (PACKED); + Dir = gid_Dir_Share_Registry_Schema_Org_Openoffice; + Name = "/registry/schema/org/openoffice/Interaction.xcs"; +End + +File gid_File_Oo_Interaction_Xcu + TXT_FILE_BODY; + Styles = (PACKED); + Dir = gid_Dir_Share_Registry_Data_Org_Openoffice; + Name = "/registry/data/org/openoffice/Interaction.xcu"; +End + File gid_File_Oo_Ucb_Configuration_Xcu TXT_FILE_BODY; Styles = (PACKED); diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 4b293e0a6126..bf1de6471df0 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -748,6 +748,8 @@ Module gid_Module_Root_Files_6 gid_File_Oo_Ucb_Configuration_Xcs, gid_File_Oo_Ucb_Configuration_Xcu, gid_File_Oo_Ucb_InteractionHandler_Xcs, + gid_File_Oo_Interaction_Xcs, + gid_File_Oo_Interaction_Xcu, gid_File_Oo_Ucb_Hierarchy_Xcs, gid_File_Oo_Ucb_Store_Xcs, gid_File_Oo_Userprofile_Xcs, -- cgit v1.2.3 From 0300d23b73b72da4388922367c83b5dea185bd87 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Wed, 3 Feb 2010 16:23:21 +0100 Subject: ause113: #i108416# update windows version defines --- solenv/inc/wntgcci.mk | 2 +- solenv/inc/wntmsci10.mk | 3 +-- solenv/inc/wntmsci11.mk | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/solenv/inc/wntgcci.mk b/solenv/inc/wntgcci.mk index b45b659d5f84..ad120d23bda1 100644 --- a/solenv/inc/wntgcci.mk +++ b/solenv/inc/wntgcci.mk @@ -81,7 +81,7 @@ CFLAGSNOOPT=-O0 # Compiler flags for describing the output path CFLAGSOUTOBJ=-o #plattform hart setzen -CDEFS+=-DWIN32 -DWINVER=0x500 -D_WIN32_IE=0x500 -D_M_IX86 -DSTLPORT_VERSION=450 -D_NATIVE_WCHAR_T_DEFINED +CDEFS+=-DWIN32 -DWINVER=0x500 -D_WIN32_WINNT=0x500 -D_WIN32_IE=0x500 -D_M_IX86 -DSTLPORT_VERSION=450 -D_NATIVE_WCHAR_T_DEFINED .IF "$(DYNAMIC_CRT)"!="" CDEFS+=-D_DLL .ENDIF diff --git a/solenv/inc/wntmsci10.mk b/solenv/inc/wntmsci10.mk index 09ec567fbd62..fab6860a5bdf 100644 --- a/solenv/inc/wntmsci10.mk +++ b/solenv/inc/wntmsci10.mk @@ -213,8 +213,7 @@ MODULES_WITH_WARNINGS := \ lingucomponent \ soldep -CDEFS+=-DSTLPORT_VERSION=$(STLPORT_VER) -DWINVER=0x400 -D_WIN32_IE=0x400 -CDEFS+=-D_MT +CDEFS+=-DSTLPORT_VERSION=$(STLPORT_VER) -D_MT -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 COMMENTFLAG=/COMMENT:"$(PRJNAME)_$(UPD)_$(VCSID)_" diff --git a/solenv/inc/wntmsci11.mk b/solenv/inc/wntmsci11.mk index 3d2750fd2dc6..d04666677cc2 100644 --- a/solenv/inc/wntmsci11.mk +++ b/solenv/inc/wntmsci11.mk @@ -218,12 +218,10 @@ CFLAGSWERRCC=-WX MODULES_WITH_WARNINGS := \ soldep -CDEFS+=-DSTLPORT_VERSION=400 -D_MT +CDEFS+=-DSTLPORT_VERSION=400 -D_MT -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500 .IF "$(COMEX)" == "11" -CDEFS+=-DWINVER=0x0400 -D_WIN32_IE=0x0400 _VC_MANIFEST_BASENAME=__VC80 .ELSE -CDEFS+=-DWINVER=0x0500 -D_WIN32_IE=0x0500 _VC_MANIFEST_BASENAME=__VC90 .ENDIF -- cgit v1.2.3 From 336d580b9a0f9f96efb198530bf1f4b45a79f7ab Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 1 Mar 2010 12:26:50 +0100 Subject: ause115: #i109703# deal with new bison version on cygwin --- solenv/config/sdev300.ini | 7 ++----- solenv/inc/settings.mk | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/solenv/config/sdev300.ini b/solenv/config/sdev300.ini index 055c5c146d98..7785ab1762da 100644 --- a/solenv/config/sdev300.ini +++ b/solenv/config/sdev300.ini @@ -201,8 +201,8 @@ finish } common_1 { - BISON_HAIRY %SOLARROOT%$/btools$/bison.hairy - BISON_SIMPLE %SOLARROOT%$/btools$/bison.simple + BISON_HAIRY %SOLARROOT%$/btools$/bison.hairy + BISON_SIMPLE %SOLARROOT%$/btools$/bison.simple DPKG %BUILD_TOOLS%$/dpkg PATH .$:$cp(%SOLARENV%$/bin)$:$cp(%COMMON_BUILD_TOOLS%)$:$cp(%BUILD_TOOLS%$/dmake412)$:$cp(%BUILD_TOOLS%)$:$cp(%COMMON_ENV_TOOLS%)$:$cp(%ENV_TOOLS%)$:$cp(%COMPATH%$/bin)$:$cp(%JDKPATH%)$:$cp(%PATHEXTRA%)$:%PATH% PATH_SEPERATOR $; @@ -2666,7 +2666,6 @@ wntmsci11 *s cdd %SOLARVERSION% *zipdep %PERL% %SOLARENV%$/bin$/zipdep.pl BIG_SVX - BISON_PKGDATADIR %BUILD_TOOLS%$/share$/bison COPYPRJ %PERL% %COMMON_ENV_TOOLS%/copyprj.pl DELIVER %PERL% %SOLARENV%$/bin$/deliver.pl DMAKEROOT %SOLARENV%$/inc$/startup @@ -2933,7 +2932,6 @@ wntmsci12 *zipdep %PERL% %SOLARENV%$/bin$/zipdep.pl *z_ooo %PERL% %SOLARENV%$/bin$/z_ooo.pl BIG_SVX - BISON_PKGDATADIR %BUILD_TOOLS%$/share$/bison COPYPRJ %PERL% %COMMON_ENV_TOOLS%$/copyprj.pl CXX_X64_BINARY %COMPROOT%$/bin$/x86_amd64$/cl.exe DELIVER %PERL% %SOLARENV%$/bin$/deliver.pl @@ -3276,7 +3274,6 @@ wntmsci13 *zipdep %PERL% %SOLARENV%$/bin$/zipdep.pl *z_ooo %PERL% %SOLARENV%$/bin$/z_ooo.pl BIG_SVX - BISON_PKGDATADIR %BUILD_TOOLS%$/share$/bison COPYPRJ %PERL% %COMMON_ENV_TOOLS%$/copyprj.pl CXX_X64_BINARY %COMPROOT%$/bin$/x86_amd64$/cl.exe DELIVER %PERL% %SOLARENV%$/bin$/deliver.pl diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk index 2980d939a2ce..3bd60920f55d 100644 --- a/solenv/inc/settings.mk +++ b/solenv/inc/settings.mk @@ -947,7 +947,7 @@ MKDEPFLAGS+=$(MKDEPSOLVER) MKDEPFLAGS+=$(MKDEPLOCAL) #.ENDIF -BISON=bison +BISON*=bison YACCFLAGS*=-d SVIDL=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/svidl -- cgit v1.2.3 From d1aac769d17e7e9576f8ffe52177e3fc53efe8e0 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 1 Mar 2010 14:51:33 +0100 Subject: ause115: #i77247# complete switch to gnu tar --- solenv/inc/unitools.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/solenv/inc/unitools.mk b/solenv/inc/unitools.mk index e76d1e292a62..af6065224c5e 100644 --- a/solenv/inc/unitools.mk +++ b/solenv/inc/unitools.mk @@ -188,7 +188,6 @@ MKDIRHIER*=mkdir$E -p RMDIR*=rmdir XARGS*=xargs GNUTAR*:=tar -TAR*:=tar RM+=$(RMFLAGS) ADJUSTVISIBILITY*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/adjustvisibility -- cgit v1.2.3 From 8b6932bb1e4abf11cb21caf020a288a4b958116a Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 4 Mar 2010 11:25:02 +0100 Subject: native287 #i92147# fixing langpack problem --- scp2/source/ooo/file_ooo.scp | 2 +- solenv/bin/modules/installer/worker.pm | 41 +++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index d21afbc07c5a..9b60afe3d308 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -2098,7 +2098,7 @@ End File gid_File_Extension_Dictionary_Sr Dir = gid_Brand_Dir_Share_Extension_Install; Name = "dict-sr.oxt"; - Styles = (PACKED); + Styles = (PACKED, FORCELANGUAGEPACK); UnixRights = 444; End #endif diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index b5b6af308d0e..ff1d172c9b8f 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -3022,6 +3022,24 @@ sub key_in_a_is_also_key_in_b return $returnvalue; } +###################################################### +# Getting the first entry from a list of languages +###################################################### + +sub get_first_from_list +{ + my ( $list ) = @_; + + my $first = $list; + + if ( $list =~ /^\s*(.+?),(.+)\s*$/) # "?" for minimal matching + { + $first = $1; + } + + return $first; +} + ################################################ # Setting all spellchecker languages ################################################ @@ -3054,16 +3072,29 @@ sub set_spellcheckerlanguages { my $onelang = $1; my $languagelist = $2; - $spellcheckhash{$onelang} = $languagelist; - # Special handling for language packs. Do only include that one language of the language pack, no further language. - # And this only, if the language of the language pack is also already part of the language list + # Special handling for language packs. Only include the first language of the language list. + # If no spellchecker shall be included, the keyword "EMPTY" can be used. if ( $installer::globals::languagepack ) { - if ( $languagelist =~ /\b$onelang\b/ ) { $spellcheckhash{$onelang} = $onelang; } - else { $spellcheckhash{$onelang} = ""; } + my $first = get_first_from_list($languagelist); + + if ( $first eq "EMPTY" ) # no spellchecker into language pack + { + $languagelist = ""; + } + else + { + $languagelist = $first; + } + } + else # no language pack, so EMPTY is not required + { + $languagelist =~ s/^\s*EMPTY\s*,//; # removing the entry EMPTY } + + $spellcheckhash{$onelang} = $languagelist; } } -- cgit v1.2.3 From 84e33fab9bc35bd4ac6e5ccd831f529e91e324f0 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Fri, 5 Mar 2010 10:05:32 +0100 Subject: native287 #i109807# no more soffice.exe into msi database --- solenv/bin/modules/installer/windows/property.pm | 2 +- solenv/bin/modules/installer/windows/shortcut.pm | 37 +++++++----------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 4679e0e19a1b..7b890d06d58f 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -540,7 +540,7 @@ sub set_languages_in_property_table if ($installer::globals::sofficeiconadded) # set in shortcut.pm { - $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.exe" . "\n"; + $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n"; push(@{$propertyfile}, $onepropertyline); } diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm index dac740bcd9de..b15c7418352f 100644 --- a/solenv/bin/modules/installer/windows/shortcut.pm +++ b/solenv/bin/modules/installer/windows/shortcut.pm @@ -665,40 +665,25 @@ sub create_shortcut_table } } - # if it is part of the product, the soffice.exe has to be included into the icon table + # The soffice.ico has to be included into the icon table # as icon for the ARP applet - my $sofficefile = "soffice.exe"; - my $onefile = get_file_by_name($filesref, $sofficefile); + my $onefile = ""; + my $sofficefile = "soffice.ico"; - if ( $onefile ne "" ) - { - my $sourcepath = $onefile->{'sourcepath'}; - if (! installer::existence::exists_in_array($sourcepath, $iconfilecollector)) - { - unshift(@{$iconfilecollector}, $sourcepath); - $installer::globals::sofficeiconadded = 1; - } - } + my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$sofficefile, $includepatharrayref, 0); - # For language packs and patches the soffice.exe has to be included, even if it is not part of the product. - # Also as part of the ARP applet (no substitution needed for ProductName, because the file is not installed!) + if ($$sourcepathref eq "") { installer::exiter::exit_program("ERROR: Could not find $sofficefile as icon!", "create_shortcut_table"); } - if (( $onefile eq "" ) && (( $installer::globals::languagepack ) || ( $installer::globals::patch ))) + if (! installer::existence::exists_in_array($$sourcepathref, $iconfilecollector)) { - my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$sofficefile, $includepatharrayref, 1); - if ($$sourcepathref eq "") { installer::exiter::exit_program("ERROR: Could not find $sofficefile as icon in language pack!", "create_shortcut_table"); } - - if (! installer::existence::exists_in_array($$sourcepathref, $iconfilecollector)) - { - unshift(@{$iconfilecollector}, $$sourcepathref); - $installer::globals::sofficeiconadded = 1; - } - - my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; - push(@installer::globals::logfileinfo, $localinfoline); + unshift(@{$iconfilecollector}, $$sourcepathref); + $installer::globals::sofficeiconadded = 1; } + my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; + push(@installer::globals::logfileinfo, $localinfoline); + # Saving the file my $shortcuttablename = $basedir . $installer::globals::separator . "Shortcut.idt" . "." . $onelanguage; -- cgit v1.2.3 From 225b810d0e04d49988b63989de2d5d84409d9d6d Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 25 Mar 2010 15:26:27 +0100 Subject: #i108159# new ODF-Icons in OOo transplanted from 77e2f3138467@odficons01 --- scp2/source/binfilter/registryitem_binfilter.scp | 26 +++---- scp2/source/calc/registryitem_calc.scp | 96 +++++++++-------------- scp2/source/draw/registryitem_draw.scp | 20 ++--- scp2/source/impress/registryitem_impress.scp | 35 ++++----- scp2/source/math/registryitem_math.scp | 13 +--- scp2/source/ooo/registryitem_ooo.scp | 7 -- scp2/source/writer/registryitem_writer.scp | 98 +++++++++--------------- 7 files changed, 111 insertions(+), 184 deletions(-) mode change 100755 => 100644 scp2/source/calc/registryitem_calc.scp mode change 100755 => 100644 scp2/source/draw/registryitem_draw.scp mode change 100755 => 100644 scp2/source/impress/registryitem_impress.scp mode change 100755 => 100644 scp2/source/math/registryitem_math.scp mode change 100755 => 100644 scp2/source/writer/registryitem_writer.scp diff --git a/scp2/source/binfilter/registryitem_binfilter.scp b/scp2/source/binfilter/registryitem_binfilter.scp index 7640e83ec20a..fa4e2297516d 100644 --- a/scp2/source/binfilter/registryitem_binfilter.scp +++ b/scp2/source/binfilter/registryitem_binfilter.scp @@ -816,7 +816,7 @@ RegistryItem gid_Regitem_OpenOffice_SDW_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sdw\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.5"; Value = " "; End @@ -825,7 +825,7 @@ RegistryItem gid_Regitem_OpenOffice_VOR_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".vor\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.5"; Value = " "; End @@ -834,7 +834,7 @@ RegistryItem gid_Regitem_OpenOffice_SGL_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sgl\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterGlobalDocument.5"; Value = " "; End @@ -843,7 +843,7 @@ RegistryItem gid_Regitem_OpenOffice_SDC_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sdc\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.5"; Value = " "; End @@ -852,7 +852,7 @@ RegistryItem gid_Regitem_OpenOffice_VOR_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".vor\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.5"; Value = " "; End @@ -861,7 +861,7 @@ RegistryItem gid_Regitem_OpenOffice_SDD_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sdd\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.5"; Value = " "; End @@ -870,7 +870,7 @@ RegistryItem gid_Regitem_OpenOffice_SDP_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sdp\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.5"; Value = " "; End @@ -879,7 +879,7 @@ RegistryItem gid_Regitem_OpenOffice_SDA_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sda\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.5"; Value = " "; End @@ -888,7 +888,7 @@ RegistryItem gid_Regitem_OpenOffice_VOR_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".vor\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.5"; Value = " "; End @@ -897,7 +897,7 @@ RegistryItem gid_Regitem_OpenOffice_SDA_OpenWith_Draw ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sda\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.DrawDocument.1"; + Name = "soffice.StarDrawDocument.5"; Value = " "; End @@ -906,7 +906,7 @@ RegistryItem gid_Regitem_OpenOffice_SDD_OpenWith_Draw ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sdd\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.DrawDocument.1"; + Name = "soffice.StarDrawDocument.5"; Value = " "; End @@ -915,7 +915,7 @@ RegistryItem gid_Regitem_OpenOffice_VOR_OpenWith_Draw ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".vor\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.DrawDocument.1"; + Name = "soffice.StarDrawDocument.5"; Value = " "; End @@ -924,7 +924,7 @@ RegistryItem gid_Regitem_OpenOffice_SMF_OpenWith_Math ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".smf\OpenWithProgIDs"; ModuleID = gid_Module_Optional_Binfilter; - Name = "opendocument.MathDocument.1"; + Name = "soffice.StarMathDocument.5"; Value = " "; End diff --git a/scp2/source/calc/registryitem_calc.scp b/scp2/source/calc/registryitem_calc.scp old mode 100755 new mode 100644 index 31742152cee1..79a49794b120 --- a/scp2/source/calc/registryitem_calc.scp +++ b/scp2/source/calc/registryitem_calc.scp @@ -345,7 +345,7 @@ RegistryItem gid_Regitem_Soffice_Starcalcdocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Calc_Bin; Subkey = "soffice.StarCalcDocument.6\shell\open\command"; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\scalc.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starcalcdocument_6_Shell_Print_Command @@ -408,7 +408,7 @@ RegistryItem gid_Regitem_Soffice_Starcalctemplate_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "soffice.StarCalcTemplate.6\shell\open\command"; ModuleID = gid_Module_Prg_Calc_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\scalc.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starcalctemplate_6_Shell_Print_Command @@ -716,13 +716,6 @@ RegistryItem gid_Regitem_Openoffice_Calcdocument_1_Shell_New_Command Value = "\"\program\soffice.exe\" -n \"%1\""; End -// RegistryItem gid_Regitem_Openoffice_Calcdocument_1_Shell_Open_Command -// ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -// ModuleID = gid_Module_Prg_Calc_Bin; -// Subkey = "opendocument.CalcDocument.1\shell\open\command"; -// Value = "\"\program\soffice.exe\" -o \"%1\""; -// End - RegistryItem gid_Regitem_Openoffice_Calcdocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Calc_Bin; @@ -837,7 +830,7 @@ RegistryItem gid_Regitem_Openoffice_Calctemplate_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.CalcTemplate.1\shell\open\command"; ModuleID = gid_Module_Prg_Calc_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\scalc.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_Calctemplate_1_Shell_Print_Command @@ -856,30 +849,12 @@ End // "OpenWith" Windows Registry keys for extensions supported by Calc -// .ODS -RegistryItem gid_Regitem_OpenOffice_ODS_OpenWith_Calc - ParentID = PREDEFINED_HKEY_CLASSES_ROOT; - Subkey = ".ods\OpenWithProgIDs"; - ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; - Value = " "; -End - -// .OTS -RegistryItem gid_Regitem_OpenOffice_OTS_OpenWith_Calc - ParentID = PREDEFINED_HKEY_CLASSES_ROOT; - Subkey = ".ots\OpenWithProgIDs"; - ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; - Value = " "; -End - // .SXC RegistryItem gid_Regitem_OpenOffice_SXC_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxc\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -888,7 +863,7 @@ RegistryItem gid_Regitem_OpenOffice_STC_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".stc\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcTemplate.6"; Value = " "; End @@ -897,7 +872,7 @@ RegistryItem gid_Regitem_OpenOffice_DIF_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".dif\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -906,7 +881,7 @@ RegistryItem gid_Regitem_OpenOffice_DBF_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".dbf\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -915,7 +890,7 @@ RegistryItem gid_Regitem_OpenOffice_XLW_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".xlw\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -924,7 +899,7 @@ RegistryItem gid_Regitem_OpenOffice_RTF_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".rtf\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -933,7 +908,7 @@ RegistryItem gid_Regitem_OpenOffice_SLK_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".slk\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -942,7 +917,7 @@ RegistryItem gid_Regitem_OpenOffice_CSV_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".csv\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -951,7 +926,7 @@ RegistryItem gid_Regitem_OpenOffice_TXT_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".txt\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -960,7 +935,7 @@ RegistryItem gid_Regitem_OpenOffice_HTM_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".htm\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -969,7 +944,7 @@ RegistryItem gid_Regitem_OpenOffice_HTML_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".html\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -978,7 +953,7 @@ RegistryItem gid_Regitem_OpenOffice_WK1_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".wk1\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -987,7 +962,7 @@ RegistryItem gid_Regitem_OpenOffice_WKS_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".wks\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -996,7 +971,7 @@ RegistryItem gid_Regitem_OpenOffice_123_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".123\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End @@ -1005,16 +980,18 @@ RegistryItem gid_Regitem_OpenOffice_XML_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".xml\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Calc_Bin; - Name = "opendocument.CalcDocument.1"; + Name = "soffice.StarCalcDocument.6"; Value = " "; End +// "FileAssociations" entries + RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Stc ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".stc"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcTemplate.6"; Styles = (); End @@ -1023,7 +1000,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".dif"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1032,7 +1009,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".dbf"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1041,7 +1018,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".slk"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1050,7 +1027,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".csv"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1059,7 +1036,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".xlw"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1068,7 +1045,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".wk1"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1077,7 +1054,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".wks"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End @@ -1086,10 +1063,11 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Calc_Bin; Name = ".123"; - Value = "opendocument.CalcDocument.1"; + Value = "soffice.StarCalcDocument.6"; Styles = (); End + RegistryItem gid_Regitem_Software_Microsoft_Windows_Currentversion_Apppaths_Scalc_Exe ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\Microsoft\Windows\CurrentVersion\App Paths\scalc.exe"; @@ -1114,11 +1092,11 @@ REGISTER_PROPERTY_HANDLER_FOR_EXTENSION( stc ) // registering the mso file types -CONDITIONAL_REGISTER_DOC_EXTENSION( Xls, gid_Module_Prg_Calc_Bin, xls, XLS, MS_EXCEL_WORKSHEET_OLD, 3, scalc.exe, open, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsx, gid_Module_Prg_Calc_Bin, xlsx, XLSX, MS_EXCEL_WORKSHEET, 3, scalc.exe, open, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsm, gid_Module_Prg_Calc_Bin, xlsm, XLSM, MS_EXCEL_WORKSHEET, 3, scalc.exe, open, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsb, gid_Module_Prg_Calc_Bin, xlsb, XLSB, MS_EXCEL_WORKSHEET, 3, scalc.exe, open, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xlt, gid_Module_Prg_Calc_Bin, xlt, XLT, MS_EXCEL_TEMPLATE_OLD, 4, scalc.exe, new, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xltx, gid_Module_Prg_Calc_Bin, xltx, XLTX, MS_EXCEL_TEMPLATE, 4, scalc.exe, new, Calc ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Xltm, gid_Module_Prg_Calc_Bin, xltm, XLTM, MS_EXCEL_TEMPLATE, 4, scalc.exe, new, Calc ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Xls, gid_Module_Prg_Calc_Bin, xls, XLS, MS_EXCEL_WORKSHEET_OLD, 29, scalc.exe, open, Calc ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsx, gid_Module_Prg_Calc_Bin, xlsx, XLSX, MS_EXCEL_WORKSHEET, 29, scalc.exe, open, Calc ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsm, gid_Module_Prg_Calc_Bin, xlsm, XLSM, MS_EXCEL_WORKSHEET, 29, scalc.exe, open, Calc ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Xlsb, gid_Module_Prg_Calc_Bin, xlsb, XLSB, MS_EXCEL_WORKSHEET, 29, scalc.exe, open, Calc ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Xlt, gid_Module_Prg_Calc_Bin, xlt, XLT, MS_EXCEL_TEMPLATE_OLD, 30, scalc.exe, new, Calc ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Xltx, gid_Module_Prg_Calc_Bin, xltx, XLTX, MS_EXCEL_TEMPLATE, 30, scalc.exe, new, Calc ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Xltm, gid_Module_Prg_Calc_Bin, xltm, XLTM, MS_EXCEL_TEMPLATE, 30, scalc.exe, new, Calc ) diff --git a/scp2/source/draw/registryitem_draw.scp b/scp2/source/draw/registryitem_draw.scp old mode 100755 new mode 100644 index 013f2cfaa9b9..0ecb21536613 --- a/scp2/source/draw/registryitem_draw.scp +++ b/scp2/source/draw/registryitem_draw.scp @@ -313,7 +313,7 @@ RegistryItem gid_Regitem_Soffice_Stardrawdocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Draw_Bin; Subkey = "soffice.StarDrawDocument.6\shell\open\command"; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\sdraw.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Stardrawdocument_6_Shell_Print_Command @@ -410,7 +410,7 @@ RegistryItem gid_Regitem_Soffice_Stardrawtemplate_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "soffice.StarDrawTemplate.6\shell\open\command"; ModuleID = gid_Module_Prg_Draw_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\sdraw.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Stardrawtemplate_6_Shell_Print_Command @@ -682,13 +682,6 @@ RegistryItem gid_Regitem_Openoffice_Drawdocument_1_Shell_New_Command Value = "\"\program\soffice.exe\" -n \"%1\""; End -// RegistryItem gid_Regitem_Openoffice_Drawdocument_1_Shell_Open_Command -// ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -// ModuleID = gid_Module_Prg_Draw_Bin; -// Subkey = "opendocument.DrawDocument.1\shell\open\command"; -// Value = "\"\program\soffice.exe\" -o \"%1\""; -// End - RegistryItem gid_Regitem_Openoffice_Drawdocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Draw_Bin; @@ -837,7 +830,7 @@ RegistryItem gid_Regitem_Openoffice_Drawtemplate_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.DrawTemplate.1\shell\open\command"; ModuleID = gid_Module_Prg_Draw_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\sdraw.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_Drawtemplate_1_Shell_Print_Command @@ -879,7 +872,7 @@ RegistryItem gid_Regitem_OpenOffice_SXD_OpenWith_Draw ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxd\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Draw_Bin; - Name = "opendocument.DrawDocument.1"; + Name = "soffice.StarDrawDocument.6"; Value = " "; End @@ -888,10 +881,11 @@ RegistryItem gid_Regitem_OpenOffice_STD_OpenWith_Draw ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".std\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Draw_Bin; - Name = "opendocument.DrawDocument.1"; + Name = "soffice.StarDrawDocument.6"; Value = " "; End + RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Otg ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; @@ -906,7 +900,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Draw_Bin; Name = ".std"; - Value = "opendocument.DrawDocument.1"; + Value = "soffice.StarDrawTemplate.6"; Styles = (); End diff --git a/scp2/source/impress/registryitem_impress.scp b/scp2/source/impress/registryitem_impress.scp old mode 100755 new mode 100644 index cf4ba3ccbcb6..689dcd7e1526 --- a/scp2/source/impress/registryitem_impress.scp +++ b/scp2/source/impress/registryitem_impress.scp @@ -347,7 +347,7 @@ RegistryItem gid_Regitem_Soffice_Starimpressdocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Impress_Bin; Subkey = "soffice.StarImpressDocument.6\shell\open\command"; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\simpress.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starimpressdocument_6_Shell_Print_Command @@ -424,7 +424,7 @@ RegistryItem gid_Regitem_Soffice_Starimpresstemplate_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "soffice.StarImpressTemplate.6\shell\open\command"; ModuleID = gid_Module_Prg_Impress_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\simpress.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starimpresstemplate_6_Shell_Print_Command @@ -731,13 +731,6 @@ RegistryItem gid_Regitem_Openoffice_Impressdocument_1_Shell_New_Command Value = "\"\program\soffice.exe\" -n \"%1\""; End -// RegistryItem gid_Regitem_Openoffice_Impressdocument_1_Shell_Open_Command -// ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -// ModuleID = gid_Module_Prg_Impress_Bin; -// Subkey = "opendocument.ImpressDocument.1\shell\open\command"; -// Value = "\"\program\soffice.exe\" -o \"%1\""; -// End - RegistryItem gid_Regitem_Openoffice_Impressdocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Impress_Bin; @@ -866,7 +859,7 @@ RegistryItem gid_Regitem_Openoffice_Impresstemplate_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.ImpressTemplate.1\shell\open\command"; ModuleID = gid_Module_Prg_Impress_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\simpress.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_Impresstemplate_1_Shell_Print_Command @@ -908,7 +901,7 @@ RegistryItem gid_Regitem_OpenOffice_SXI_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxi\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Impress_Bin; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.6"; Value = " "; End @@ -917,7 +910,7 @@ RegistryItem gid_Regitem_OpenOffice_STI_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sti\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Impress_Bin; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.6"; Value = " "; End @@ -926,7 +919,7 @@ RegistryItem gid_Regitem_OpenOffice_SXD_OpenWith_Impress ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxd\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Impress_Bin; - Name = "opendocument.ImpressDocument.1"; + Name = "soffice.StarImpressDocument.6"; Value = " "; End @@ -954,7 +947,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Impress_Bin; Name = ".sti"; - Value = "opendocument.ImpressDocument.1"; + Value = "soffice.StarImpressDocument.6"; Styles = (); End @@ -982,10 +975,10 @@ REGISTER_PROPERTY_HANDLER_FOR_EXTENSION( sti ) // registering the mso file types -CONDITIONAL_REGISTER_DOC_EXTENSION( Ppt, gid_Module_Prg_Impress_Bin, ppt, PPT, MS_POWERPOINT_PRESENTATION_OLD, 7, simpress.exe, open, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Pps, gid_Module_Prg_Impress_Bin, pps, PPS, MS_POWERPOINT_SHOW, 7, simpress.exe, open, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Pptx, gid_Module_Prg_Impress_Bin, pptx, PPTX, MS_POWERPOINT_PRESENTATION, 7, simpress.exe, open, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Pptm, gid_Module_Prg_Impress_Bin, pptm, PPTM, MS_POWERPOINT_PRESENTATION, 7, simpress.exe, open, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Pot, gid_Module_Prg_Impress_Bin, pot, POT, MS_POWERPOINT_TEMPLATE_OLD, 8, simpress.exe, new, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Potx, gid_Module_Prg_Impress_Bin, potx, POTX, MS_POWERPOINT_TEMPLATE, 8, simpress.exe, new, Impress ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Potm, gid_Module_Prg_Impress_Bin, potm, POTM, MS_POWERPOINT_TEMPLATE, 8, simpress.exe, new, Impress ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Ppt, gid_Module_Prg_Impress_Bin, ppt, PPT, MS_POWERPOINT_PRESENTATION_OLD, 33, simpress.exe, open, Impress ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Pps, gid_Module_Prg_Impress_Bin, pps, PPS, MS_POWERPOINT_SHOW, 33, simpress.exe, open, Impress ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Pptx, gid_Module_Prg_Impress_Bin, pptx, PPTX, MS_POWERPOINT_PRESENTATION, 33, simpress.exe, open, Impress ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Pptm, gid_Module_Prg_Impress_Bin, pptm, PPTM, MS_POWERPOINT_PRESENTATION, 33, simpress.exe, open, Impress ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Pot, gid_Module_Prg_Impress_Bin, pot, POT, MS_POWERPOINT_TEMPLATE_OLD, 34, simpress.exe, new, Impress ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Potx, gid_Module_Prg_Impress_Bin, potx, POTX, MS_POWERPOINT_TEMPLATE, 34, simpress.exe, new, Impress ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Potm, gid_Module_Prg_Impress_Bin, potm, POTM, MS_POWERPOINT_TEMPLATE, 34, simpress.exe, new, Impress ) diff --git a/scp2/source/math/registryitem_math.scp b/scp2/source/math/registryitem_math.scp old mode 100755 new mode 100644 index a1c71702fc42..2fa941c0b4ed --- a/scp2/source/math/registryitem_math.scp +++ b/scp2/source/math/registryitem_math.scp @@ -346,7 +346,7 @@ RegistryItem gid_Regitem_Soffice_Starmathdocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Math_Bin; Subkey = "soffice.StarMathDocument.6\shell\open\command"; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\smath.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starmathdocument_6_Shell_Print_Command @@ -600,13 +600,6 @@ RegistryItem gid_Regitem_Openoffice_Mathdocument_1_Shell_New_Command Value = "\"\program\soffice.exe\" -n \"%1\""; End -// RegistryItem gid_Regitem_Openoffice_Mathdocument_1_Shell_Open_Command -// ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -// ModuleID = gid_Module_Prg_Math_Bin; -// Subkey = "opendocument.MathDocument.1\shell\open\command"; -// Value = "\"\program\soffice.exe\" -o \"%1\""; -// End - RegistryItem gid_Regitem_Openoffice_Mathdocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Math_Bin; @@ -645,7 +638,7 @@ RegistryItem gid_Regitem_OpenOffice_SXM_OpenWith_Math ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxm\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Math_Bin; - Name = "opendocument.MathDocument.1"; + Name = "soffice.StarMathDocument.6"; Value = " "; End @@ -654,7 +647,7 @@ RegistryItem gid_Regitem_OpenOffice_MML_OpenWith_Math ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".mml\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Math_Bin; - Name = "opendocument.MathDocument.1"; + Name = "soffice.StarMathDocument.6"; Value = " "; End diff --git a/scp2/source/ooo/registryitem_ooo.scp b/scp2/source/ooo/registryitem_ooo.scp index 04162a200ccf..5d8673ef9855 100644 --- a/scp2/source/ooo/registryitem_ooo.scp +++ b/scp2/source/ooo/registryitem_ooo.scp @@ -140,13 +140,6 @@ RegistryItem gid_Regitem_Soffice_Starconfigfile_6 REG_VALUE_LNG(SO60_CONFIGFILE) End -RegistryItem gid_Regitem_Soffice_Starconfigfile_6_Defaulticon - ParentID = PREDEFINED_HKEY_CLASSES_ROOT; - ModuleID = gid_Module_Root; - Subkey = "soffice.StarConfigFile.6\DefaultIcon"; - Value = "\program\soffice.exe,17"; -End - RegistryItem gid_Regitem_Software_Microsoft_Windows_Currentversion_Apppaths_Soffice_Exe ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\Microsoft\Windows\CurrentVersion\App Paths\soffice.exe"; diff --git a/scp2/source/writer/registryitem_writer.scp b/scp2/source/writer/registryitem_writer.scp old mode 100755 new mode 100644 index b6497f889630..646e014782c2 --- a/scp2/source/writer/registryitem_writer.scp +++ b/scp2/source/writer/registryitem_writer.scp @@ -346,7 +346,7 @@ RegistryItem gid_Regitem_Soffice_Starwriterdocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Wrt_Bin; Subkey = "soffice.StarWriterDocument.6\shell\open\command"; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starwriterdocument_6_Shell_Print_Command @@ -416,7 +416,7 @@ RegistryItem gid_Regitem_Soffice_Starwriterglobaldocument_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "soffice.StarWriterGlobalDocument.6\shell\open\command"; ModuleID = gid_Module_Prg_Wrt_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starwriterglobaldocument_6_Shell_Print_Command @@ -486,7 +486,7 @@ RegistryItem gid_Regitem_Soffice_Starwritertemplate_6_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "soffice.StarWriterTemplate.6\shell\open\command"; ModuleID = gid_Module_Prg_Wrt_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Soffice_Starwritertemplate_6_Shell_Print_Command @@ -838,13 +838,6 @@ RegistryItem gid_Regitem_Openoffice_Writerdocument_1_Shell_New_Command Value = "\"\program\soffice.exe\" -n \"%1\""; End -// RegistryItem gid_Regitem_Openoffice_Writerdocument_1_Shell_Open_Command -// ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -// ModuleID = gid_Module_Prg_Wrt_Bin; -// Subkey = "opendocument.WriterDocument.1\shell\open\command"; -// Value = "\"\program\soffice.exe\" -o \"%1\""; -// End - RegistryItem gid_Regitem_Openoffice_Writerdocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; ModuleID = gid_Module_Prg_Wrt_Bin; @@ -982,7 +975,7 @@ RegistryItem gid_Regitem_Openoffice_Writertemplate_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.WriterTemplate.1\shell\open\command"; ModuleID = gid_Module_Prg_Wrt_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_Writertemplate_1_Shell_Print_Command @@ -1106,7 +1099,7 @@ RegistryItem gid_Regitem_Openoffice_Writerglobaldocument_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.WriterGlobalDocument.1\shell\open\command"; ModuleID = gid_Module_Prg_Wrt_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_Writerglobaldocument_1_Shell_Print_Command @@ -1222,7 +1215,7 @@ RegistryItem gid_Regitem_Openoffice_WriterWebTemplate_1_Shell_Open_Command ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = "opendocument.WriterWebTemplate.1\shell\open\command"; ModuleID = gid_Module_Prg_Wrt_Bin; - Value = "\"\program\soffice.exe\" -o \"%1\""; + Value = "\"\program\swriter.exe\" -o \"%1\""; End RegistryItem gid_Regitem_Openoffice_WriterWebTemplate_1_Shell_Print_Command @@ -1272,7 +1265,7 @@ RegistryItem gid_Regitem_OpenOffice_SXW_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxw\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1281,7 +1274,7 @@ RegistryItem gid_Regitem_OpenOffice_STW_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".stw\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterTemplate.6"; Value = " "; End @@ -1290,7 +1283,7 @@ RegistryItem gid_Regitem_OpenOffice_TXT_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".txt\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1299,7 +1292,7 @@ RegistryItem gid_Regitem_OpenOffice_HTM_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".htm\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterWebDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1308,7 +1301,7 @@ RegistryItem gid_Regitem_OpenOffice_HTML_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".html\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterWebDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1317,7 +1310,7 @@ RegistryItem gid_Regitem_OpenOffice_XML_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".xml\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1326,7 +1319,7 @@ RegistryItem gid_Regitem_OpenOffice_WPD_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".wpd\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1335,25 +1328,7 @@ RegistryItem gid_Regitem_OpenOffice_HWP_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".hwp\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; - Value = " "; -End - -// .OTH -RegistryItem gid_Regitem_OpenOffice_OTH_OpenWith_Writer - ParentID = PREDEFINED_HKEY_CLASSES_ROOT; - Subkey = ".oth\OpenWithProgIDs"; - ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; - Value = " "; -End - -// .ODM -RegistryItem gid_Regitem_OpenOffice_ODM_OpenWith_Writer - ParentID = PREDEFINED_HKEY_CLASSES_ROOT; - Subkey = ".odm\OpenWithProgIDs"; - ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterDocument.6"; Value = " "; End @@ -1362,10 +1337,11 @@ RegistryItem gid_Regitem_OpenOffice_SXG_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; Subkey = ".sxg\OpenWithProgIDs"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = "opendocument.WriterDocument.1"; + Name = "soffice.StarWriterGlobalDocument.6"; Value = " "; End + RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Ott ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; @@ -1380,7 +1356,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".stw"; - Value = "opendocument.WriterDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1389,7 +1365,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".txt"; - Value = "opendocument.WriterDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1398,7 +1374,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".htm"; - Value = "opendocument.WriterWebDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1407,7 +1383,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".html"; - Value = "opendocument.WriterWebDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1416,7 +1392,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".xml"; - Value = "opendocument.WriterDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1425,7 +1401,7 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".wpd"; - Value = "opendocument.WriterDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End @@ -1434,33 +1410,33 @@ RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabi Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; Name = ".hwp"; - Value = "opendocument.WriterDocument.1"; + Value = "soffice.StarWriterDocument.6"; Styles = (); End -RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Oth +RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Sxg ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = ".oth"; - Value = "opendocument.WriterDocument.1"; + Name = ".sxg"; + Name = "soffice.StarWriterGlobalDocument.6"; Styles = (); End -RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Odm +RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Oth ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = ".odm"; + Name = ".oth"; Value = "opendocument.WriterDocument.1"; Styles = (); End -RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Sxg +RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Odm ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; ModuleID = gid_Module_Prg_Wrt_Bin; - Name = ".sxg"; + Name = ".odm"; Value = "opendocument.WriterDocument.1"; Styles = (); End @@ -1494,11 +1470,11 @@ REGISTER_PROPERTY_HANDLER_FOR_EXTENSION( sxg ) // registering the mso file types // CONDITIONAL_REGISTER_DOC_EXTENSION(name,modid, key, cond, disp_name, icon_id, app, default, dox_type) -CONDITIONAL_REGISTER_DOC_EXTENSION( Doc, gid_Module_Prg_Wrt_Bin, doc, DOC, MS_WORD_DOCUMENT_OLD, 1, swriter.exe, open, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Docx, gid_Module_Prg_Wrt_Bin, docx, DOCX, MS_WORD_DOCUMENT, 1, swriter.exe, open, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Docm, gid_Module_Prg_Wrt_Bin, docm, DOCM, MS_WORD_DOCUMENT, 1, swriter.exe, open, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Dot, gid_Module_Prg_Wrt_Bin, dot, DOT, MS_WORD_TEMPLATE_OLD, 2, swriter.exe, new, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Dotx, gid_Module_Prg_Wrt_Bin, dotx, DOTX, MS_WORD_TEMPLATE, 2, swriter.exe, new, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Dotm, gid_Module_Prg_Wrt_Bin, dotm, DOTM, MS_WORD_TEMPLATE, 2, swriter.exe, new, Writer ) -CONDITIONAL_REGISTER_DOC_EXTENSION( Rtf, gid_Module_Prg_Wrt_Bin, rtf, RTF, MS_RTF_DOCUMENT, 1, swriter.exe, open, Writer ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Doc, gid_Module_Prg_Wrt_Bin, doc, DOC, MS_WORD_DOCUMENT_OLD, 27, swriter.exe, open, Writer ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Docx, gid_Module_Prg_Wrt_Bin, docx, DOCX, MS_WORD_DOCUMENT, 27, swriter.exe, open, Writer ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Docm, gid_Module_Prg_Wrt_Bin, docm, DOCM, MS_WORD_DOCUMENT, 27, swriter.exe, open, Writer ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Dot, gid_Module_Prg_Wrt_Bin, dot, DOT, MS_WORD_TEMPLATE_OLD, 28, swriter.exe, new, Writer ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Dotx, gid_Module_Prg_Wrt_Bin, dotx, DOTX, MS_WORD_TEMPLATE, 28, swriter.exe, new, Writer ) +CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION( Dotm, gid_Module_Prg_Wrt_Bin, dotm, DOTM, MS_WORD_TEMPLATE, 28, swriter.exe, new, Writer ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Rtf, gid_Module_Prg_Wrt_Bin, rtf, RTF, MS_RTF_DOCUMENT, 27, swriter.exe, open, Writer ) -- cgit v1.2.3 From 94ecf181ccde95d6bc00bc87eebbe9ab3b1e71d9 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 12:40:38 +0000 Subject: #i108159# ODF-Icons for OOo build --- scp2/source/calc/registryitem_calc.scp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scp2/source/calc/registryitem_calc.scp b/scp2/source/calc/registryitem_calc.scp index 79a49794b120..e2504579e0a0 100644 --- a/scp2/source/calc/registryitem_calc.scp +++ b/scp2/source/calc/registryitem_calc.scp @@ -849,6 +849,24 @@ End // "OpenWith" Windows Registry keys for extensions supported by Calc +// .ODS +RegistryItem gid_Regitem_OpenOffice_ODS_OpenWith_Calc + ParentID = PREDEFINED_HKEY_CLASSES_ROOT; + Subkey = ".ods\OpenWithProgIDs"; + ModuleID = gid_Module_Prg_Calc_Bin; + Name = "opendocument.CalcDocument.1"; + Value = " "; +End + +// .OTS +RegistryItem gid_Regitem_OpenOffice_OTS_OpenWith_Calc + ParentID = PREDEFINED_HKEY_CLASSES_ROOT; + Subkey = ".ots\OpenWithProgIDs"; + ModuleID = gid_Module_Prg_Calc_Bin; + Name = "opendocument.CalcDocument.1"; + Value = " "; +End + // .SXC RegistryItem gid_Regitem_OpenOffice_SXC_OpenWith_Calc ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -- cgit v1.2.3 From a972f7631f561a5c661b1b1f2151342675759646 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 15 Jan 2010 12:45:00 +0000 Subject: #i108159# ODF-Icons for OOo build --- scp2/source/writer/registryitem_writer.scp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scp2/source/writer/registryitem_writer.scp b/scp2/source/writer/registryitem_writer.scp index 646e014782c2..a1233bb1792f 100644 --- a/scp2/source/writer/registryitem_writer.scp +++ b/scp2/source/writer/registryitem_writer.scp @@ -1260,6 +1260,24 @@ RegistryItem gid_Regitem_OpenOffice_OTT_OpenWith_Writer Value = " "; End +// .OTH +RegistryItem gid_Regitem_OpenOffice_OTH_OpenWith_Writer + ParentID = PREDEFINED_HKEY_CLASSES_ROOT; + Subkey = ".oth\OpenWithProgIDs"; + ModuleID = gid_Module_Prg_Wrt_Bin; + Name = "opendocument.WriterDocument.1"; + Value = " "; +End + +// .ODM +RegistryItem gid_Regitem_OpenOffice_ODM_OpenWith_Writer + ParentID = PREDEFINED_HKEY_CLASSES_ROOT; + Subkey = ".odm\OpenWithProgIDs"; + ModuleID = gid_Module_Prg_Wrt_Bin; + Name = "opendocument.WriterDocument.1"; + Value = " "; +End + // .SXW RegistryItem gid_Regitem_OpenOffice_SXW_OpenWith_Writer ParentID = PREDEFINED_HKEY_CLASSES_ROOT; -- cgit v1.2.3 From e28b37d3a676d12b1646cfeaf9d2757c74948d81 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Mon, 18 Jan 2010 09:39:34 +0000 Subject: #i108159# fix alien Doc types associations --- scp2/inc/macros.inc | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) mode change 100755 => 100644 scp2/inc/macros.inc diff --git a/scp2/inc/macros.inc b/scp2/inc/macros.inc old mode 100755 new mode 100644 index 4d8f0b3903be..48a1ae148777 --- a/scp2/inc/macros.inc +++ b/scp2/inc/macros.inc @@ -501,7 +501,17 @@ End ModuleID = modid; \ Subkey = STRING(Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations); \ Name = STRING(CONCAT2(.,key)); \ - Value = STRING(CONCAT3(opendocument.,doc_type,Document.1)); \ + Value = STRING(CONCAT3(soffice.Star,doc_type,Document.6)); \ + Styles = (); \ + End + +#define REGISTRY_ENTRY_TEMPLATE_CAPABILITIES(name,modid,key,doc_type) \ + RegistryItem CONCAT2(gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_,name) \ + ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; \ + ModuleID = modid; \ + Subkey = STRING(Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations); \ + Name = STRING(CONCAT2(.,key)); \ + Value = STRING(CONCAT3(soffice.Star,doc_type,Template.6)); \ Styles = (); \ End @@ -518,6 +528,19 @@ End REGISTRY_ENTRY_PRINTTO_CMD(name,modid,app) \ REGISTRY_ENTRY_CAPABILITIES(name,modid,key,doc_type) \ +#define CONDITIONAL_REGISTER_DOCTEMPLATE_EXTENSION(name,modid,key,cond,disp_name,icon_id,app,default,doc_type) \ + CONDITIONAL_MODULE_ENTRY(name,modid) \ + REGISTRY_ENTRY_OPEN_WITH(name,cond,doc_type,modid,key) \ + CONDITIONAL_REGISTRY_ENTRY_EXT(name,cond,key) \ + REGISTRY_ENTRY_DOC(name,modid,disp_name) \ + REGISTRY_ENTRY_ICON(name,modid,icon_id) \ + REGISTRY_ENTRY_SHELL(name,default,modid) \ + REGISTRY_ENTRY_NEW_CMD(name,modid,app) \ + REGISTRY_ENTRY_OPEN_CMD(name,modid,app) \ + REGISTRY_ENTRY_PRINT_CMD(name,modid,app) \ + REGISTRY_ENTRY_PRINTTO_CMD(name,modid,app) \ + REGISTRY_ENTRY_TEMPLATE_CAPABILITIES(name,modid,key,doc_type) \ + // --------------------------------------- #define REGISTER_PROPERTY_HANDLER_FOR_EXTENSION(extension) \ -- cgit v1.2.3 From bda0c35e5748b5ca1dc9181bb68c25c5996dfb5f Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Mon, 18 Jan 2010 09:45:13 +0000 Subject: #i108159# fix alien Doc types associations --- scp2/source/math/registryitem_math.scp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scp2/source/math/registryitem_math.scp b/scp2/source/math/registryitem_math.scp index 2fa941c0b4ed..b87e5b940356 100644 --- a/scp2/source/math/registryitem_math.scp +++ b/scp2/source/math/registryitem_math.scp @@ -651,14 +651,14 @@ RegistryItem gid_Regitem_OpenOffice_MML_OpenWith_Math Value = " "; End -// RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Mml -// ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; -// Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; -// ModuleID = gid_Module_Prg_Math_Bin; -// Name = ".mml"; -// Value = "opendocument.MathDocument.1"; -// Styles = (); -// End +RegistryItem gid_Regitem_Software_Manufacturer_Productname_Productversion_Capabilities_FileAssociations_Mml + ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; + Subkey = "Software\%MANUFACTURER\%PRODUCTNAME%PRODUCTADDON\%PRODUCTVERSION\Capabilities\FileAssociations"; + ModuleID = gid_Module_Prg_Math_Bin; + Name = ".mml"; + Value = "soffice.StarMathDocument.6"; + Styles = (); +End RegistryItem gid_Regitem_Software_Microsoft_Windows_Currentversion_Apppaths_Smath_Exe ParentID = PREDEFINED_HKEY_LOCAL_MACHINE; -- cgit v1.2.3 From 3c20642d736d0f1c52c269abdd057464471e1505 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Mon, 14 Dec 2009 16:43:39 +0100 Subject: native0: new o5 product --- solenv/bin/modules/installer/setupscript.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index e266832e6ba6..77bbe9b50fe9 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -156,10 +156,12 @@ sub add_lowercase_productname_setupscriptvariable push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; + if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; + if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $value =~ s/\.//g; $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); -- cgit v1.2.3 From 233b0e81cc3c28c988cfc022cb13c361b13e573c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 10:31:37 +0100 Subject: autorecovery: SetDontCreateCancellable is dead --- forms/source/component/clickableimage.cxx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx index b9738ddd49ae..efb7f6087108 100644 --- a/forms/source/component/clickableimage.cxx +++ b/forms/source/component/clickableimage.cxx @@ -812,9 +812,6 @@ namespace frm if( sReferer.getLength() ) m_pMedium->SetReferer( OUStringToString(sReferer, CHARSET_SYSTEM) ); } - - // Keinen Eintrag im Roter Button Menu - m_pMedium->SetDontCreateCancellable(); } #else if( pObjSh ) @@ -832,9 +829,6 @@ namespace frm if( sReferer.getLength() ) m_pMedium->SetReferer( sReferer ); } - - // Keinen Eintrag im Roter Button Menu - m_pMedium->SetDontCreateCancellable(); #endif // Downloading-Flag auf sal_True setzen. Es werden dann auch -- cgit v1.2.3 From 9688479e09b20ba09a419931af59c04177e4373e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- starmath/source/view.cxx | 6 +++--- sw/source/ui/app/appenv.cxx | 2 +- sw/source/ui/app/apphdl.cxx | 10 +++++----- sw/source/ui/app/applab.cxx | 2 +- sw/source/ui/app/docsh2.cxx | 2 +- sw/source/ui/app/swmodul1.cxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 6 +++--- sw/source/ui/dbui/mailmergewizard.cxx | 2 +- sw/source/ui/dbui/mmoutputpage.cxx | 6 +++--- sw/source/ui/dialog/macassgn.cxx | 2 +- sw/source/ui/docvw/edtdd.cxx | 2 +- sw/source/ui/docvw/edtwin.cxx | 2 +- sw/source/ui/docvw/romenu.cxx | 2 +- sw/source/ui/fldui/fldedt.cxx | 2 +- sw/source/ui/fmtui/tmpdlg.cxx | 2 +- sw/source/ui/frmdlg/frmdlg.cxx | 2 +- sw/source/ui/lingu/olmenu.cxx | 6 +++--- sw/source/ui/misc/glossary.cxx | 2 +- sw/source/ui/misc/glshell.cxx | 2 +- sw/source/ui/misc/insfnote.cxx | 2 +- sw/source/ui/misc/srtdlg.cxx | 2 +- sw/source/ui/shells/annotsh.cxx | 2 +- sw/source/ui/shells/basesh.cxx | 6 +++--- sw/source/ui/shells/drwtxtsh.cxx | 2 +- sw/source/ui/shells/tabsh.cxx | 2 +- sw/source/ui/shells/textsh.cxx | 2 +- sw/source/ui/shells/txtattr.cxx | 2 +- sw/source/ui/uiview/pview.cxx | 4 ++-- sw/source/ui/uiview/view.cxx | 12 ++++++------ sw/source/ui/uiview/view2.cxx | 2 +- sw/source/ui/uiview/viewling.cxx | 5 ++--- sw/source/ui/uiview/viewmdi.cxx | 6 +++--- sw/source/ui/uiview/viewport.cxx | 8 ++++---- sw/source/ui/uno/unodispatch.cxx | 3 +-- sw/source/ui/utlui/navipi.cxx | 2 +- sw/source/ui/utlui/numfmtlb.cxx | 2 +- sw/source/ui/utlui/uitool.cxx | 2 +- sw/source/ui/wrtsh/wrtsh1.cxx | 2 +- 38 files changed, 64 insertions(+), 66 deletions(-) diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 79171161c861..6a35bab21be8 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -354,7 +354,7 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt) void SmGraphicWindow::Command(const CommandEvent& rCEvt) { BOOL bCallBase = TRUE; - if ( !pViewShell->GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !pViewShell->GetViewFrame()->GetFrame().IsInPlace() ) { switch ( rCEvt.GetCommand() ) { @@ -1640,7 +1640,7 @@ void SmViewShell::Execute(SfxRequest& rReq) case SID_ATTR_ZOOM: { - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { //CHINA001 SvxZoomDialog *pDlg = 0; AbstractSvxZoomDialog *pDlg = 0; @@ -1767,7 +1767,7 @@ void SmViewShell::GetState(SfxItemSet &rSet) case SID_ZOOMIN: case SID_ZOOMOUT: case SID_FITINWINDOW: - if ( GetViewFrame()->GetFrame()->IsInPlace() ) + if ( GetViewFrame()->GetFrame().IsInPlace() ) rSet.DisableItem( nWh ); break; diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index 2ee6fb9e7db8..5388924434ac 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -520,7 +520,7 @@ static USHORT nTitleNo = 0; if (nMode == ENV_NEWDOC) { - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); if ( rItem.aAddrText.indexOf('<') >= 0 ) { diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 1fe69e88eacd..e6a9f33eb730 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -243,7 +243,7 @@ SwView* lcl_LoadDoc(SwView* pView, const String& rURL) if( pViewShell->ISA(SwView) ) { pNewView = PTR_CAST(SwView,pViewShell); - pNewView->GetViewFrame()->GetFrame()->Appear(); + pNewView->GetViewFrame()->GetFrame().Appear(); } else { @@ -477,7 +477,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM { SwView* pTargetView = m_pMMConfig->GetTargetView(); uno::Reference< frame::XFrame > xFrame = - m_pView->GetViewFrame()->GetFrame()->GetFrameInterface(); + m_pView->GetViewFrame()->GetFrame().GetFrameInterface(); xFrame->getContainerWindow()->setVisible(sal_False); DBG_ASSERT(pTargetView, "No target view has been created"); if(pTargetView) @@ -523,7 +523,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM { m_pView2Close = pTargetView; pTargetView->GetViewFrame()->GetTopViewFrame()->GetWindow().Hide(); - pSourceView->GetViewFrame()->GetFrame()->AppearWithUpdate(); + pSourceView->GetViewFrame()->GetFrame().AppearWithUpdate(); // the current view has be be set when the target is destroyed m_pView = pSourceView; m_pMMConfig->SetTargetView(0); @@ -562,7 +562,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EM if(pDocShell->HasName() && !pDocShell->IsModified()) m_pMMConfig->GetSourceView()->GetViewFrame()->DoClose(); else - m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->Appear(); + m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear(); } ExecutionFinished( true ); break; @@ -596,7 +596,7 @@ IMPL_LINK( SwMailMergeWizardExecutor, CancelHdl, AbstractMailMergeWizard*, EMPTY m_pMMConfig->SetTargetView(0); } if(m_pMMConfig->GetSourceView()) - m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame()->AppearWithUpdate(); + m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().AppearWithUpdate(); m_pMMConfig->Commit(); delete m_pMMConfig; diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 122217501b64..cf62e3954d9a 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -257,7 +257,7 @@ static sal_uInt16 nBCTitleNo = 0; } xDocSh->SetTitle( aTmp ); - pViewFrame->GetFrame()->Appear(); + pViewFrame->GetFrame().Appear(); // Shell ermitteln SwWrtShell *pSh = pNewView->GetWrtShellPtr(); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 8d62d65d0b12..2fbdc79653f3 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -710,7 +710,7 @@ void SwDocShell::Execute(SfxRequest& rReq) bOnly = FALSE; else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell())) { - pTmpFrm->GetFrame()->Appear(); + pTmpFrm->GetFrame().Appear(); bFound = TRUE; } if( bFound && !bOnly ) diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx index 863ef3c22f76..a95241689b9c 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -358,7 +358,7 @@ SwChapterNumRules* SwModule::GetChapterNumRules() void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/) { - Reference xFrame = rView.GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface(); Reference xDP(xFrame, uno::UNO_QUERY); uno::Reference xBeamerFrame = xFrame->findFrame( diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 9ed35bf00e6a..ce8646239425 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -3186,11 +3186,11 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 ); //the created window has to be located at the same position as the source window - Window& rTargetWindow = pTargetFrame->GetFrame()->GetWindow(); - Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame()->GetWindow(); + Window& rTargetWindow = pTargetFrame->GetFrame().GetWindow(); + Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame().GetWindow(); rTargetWindow.SetPosPixel(rSourceWindow.GetPosPixel()); -// pTargetFrame->GetFrame()->Appear(); +// pTargetFrame->GetFrame().Appear(); SwView* pTargetView = static_cast( pTargetFrame->GetViewShell() ); rMMConfig.SetTargetView(pTargetView); //initiate SelectShell() to create sub shells diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx index 84dba4d979e6..84dd10273f0e 100644 --- a/sw/source/ui/dbui/mailmergewizard.cxx +++ b/sw/source/ui/dbui/mailmergewizard.cxx @@ -310,7 +310,7 @@ void SwMailMergeWizard::CreateTargetDocument() MergeDocuments( m_rConfigItem, *GetSwView() ); m_rConfigItem.SetMergeDone(); if( m_rConfigItem.GetTargetView() ) - m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame()->Appear(); + m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame().Appear(); } /*-- 23.08.2004 08:51:36--------------------------------------------------- diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index cf13e0911546..db8f1e6d02ea 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -695,7 +695,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveStartHdl_Impl, PushButton*, pButton) { SfxViewFrame* pSourceViewFrm = pSourceView->GetViewFrame(); uno::Reference< frame::XFrame > xFrame = - pSourceViewFrm->GetFrame()->GetFrameInterface(); + pSourceViewFrm->GetFrame().GetFrameInterface(); xFrame->getContainerWindow()->setVisible(sal_True); pSourceViewFrm->GetDispatcher()->Execute(SID_SAVEDOC, SFX_CALLMODE_SYNCHRON); xFrame->getContainerWindow()->setVisible(sal_False); @@ -859,7 +859,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); -// pTempFrame->GetFrame()->Appear(); +// pTempFrame->GetFrame().Appear(); SwView* pTempView = static_cast( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); SwgReaderOption aOpt; @@ -1245,7 +1245,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) SfxObjectShellRef xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTempDocShell->DoInitNew( 0 ); SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 ); -// pTempFrame->GetFrame()->Appear(); +// pTempFrame->GetFrame().Appear(); SwView* pTempView = static_cast( pTempFrame->GetViewShell() ); pTargetView->GetWrtShell().StartAction(); SwgReaderOption aOpt; diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 0c052223abcf..be533b05b0ad 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -152,7 +152,7 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG ); if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) { diff --git a/sw/source/ui/docvw/edtdd.cxx b/sw/source/ui/docvw/edtdd.cxx index 43efb040670f..b108ecbece76 100644 --- a/sw/source/ui/docvw/edtdd.cxx +++ b/sw/source/ui/docvw/edtdd.cxx @@ -518,7 +518,7 @@ IMPL_LINK( SwEditWin, DDHandler, Timer *, EMPTYARG ) ReleaseMouse(); bFrmDrag = FALSE; - if ( rView.GetViewFrame() && rView.GetViewFrame()->GetFrame() ) + if ( rView.GetViewFrame() ) { bExecuteDrag = TRUE; StartExecuteDrag(); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 7d8e38443ca0..3b8cf9746c39 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -4710,7 +4710,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) { SwWrtShell &rSh = rView.GetWrtShell(); - if ( !rView.GetViewFrame() || !rView.GetViewFrame()->GetFrame() ) + if ( !rView.GetViewFrame() ) { //Wenn der ViewFrame in Kuerze stirbt kein Popup mehr! Window::Command(rCEvt); diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 598cf064c7b3..d9bd5ac8f41e 100644 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -218,7 +218,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) : else EnableItem( MN_READONLY_LOADGRAPHIC, FALSE ); - BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame()->GetParentFrame(); + BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame().GetParentFrame(); EnableItem( MN_READONLY_RELOAD_FRAME, bReloadFrame ); EnableItem( MN_READONLY_RELOAD, !bReloadFrame); diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index c0ee8f2e0a98..6465e518418f 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -410,7 +410,7 @@ IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG ) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet, - pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_ADDR ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(RET_OK == pDlg->Execute()) diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 4c6f35341e30..3d451da20620 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -570,7 +570,7 @@ void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) SfxAllItemSet aNewSet(*aSet.GetPool()); aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) ); if ( pWrtShell ) - rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); rPage.PageCreated(aNewSet); break; } diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index c4b463baa297..914788a36e7a 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -196,7 +196,7 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) aNewSet.Put( SwMacroAssignDlg::AddEvents( DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) ); if ( m_pWrtShell ) - rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); rPage.PageCreated(aNewSet); break; } diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 771836c6ccd5..55afd7e55566 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -279,7 +279,7 @@ USHORT SwSpellPopup::fillLangPopupMenu( //6--all languages used in current document uno::Reference< com::sun::star::frame::XModel > xModel; - uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface()->getController(), uno::UNO_QUERY ); + uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY ); if ( xController.is() ) xModel = xController->getModel(); @@ -580,7 +580,7 @@ bGrammarResults(false) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); @@ -714,7 +714,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) nNumLanguageDocEntries = fillLangPopupMenu( pMenu, MN_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, 2 ); EnableItem( MN_LANGUAGE_ALL_TEXT, true ); */ - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index ef368f680378..f3b287156bf7 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -661,7 +661,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) const SfxPoolItem* pItem; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, - pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), SID_EVENTCONFIG ); + pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG ); if ( pMacroDlg && pMacroDlg->Execute() == RET_OK && SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) ) { diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index e82abfe2788e..4508d03b8c8e 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -346,7 +346,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS xDocSh->GetDoc()->DoUndo( bDoesUndo ); xDocSh->GetDoc()->ResetModified(); if ( bShow ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); delete pGroup; } diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index d659ceb0b6f1..c0c020141148 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -176,7 +176,7 @@ IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if (RET_OK == pDlg->Execute()) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE ); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 0b2ff55c7c41..3224fca700d8 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -396,7 +396,7 @@ IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG ) SfxAllItemSet aSet( rSh.GetAttrPool() ); aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pMap->Execute() ) { SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, FALSE ); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 1a34e2972956..6754d3d3698d 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1557,7 +1557,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) // Wenn Zeichen selektiert ist kann es angezeigt werden SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 9f5ee6195e81..41f462f06dfc 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -2548,7 +2548,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) SvxBrushItem aBrush(RES_BACKGROUND); rSh.GetBoxBackground( aBrush ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); aSet.Put( aBrush ); @@ -2567,7 +2567,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rSh.GetFlyFrmAttr( aSet ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) @@ -2582,7 +2582,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rSh.GetCurAttr( aSet ); pDlg = pFact->CreateSfxDialog( pMDI, aSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 9f1d49ebe067..f62256a5c674 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -816,7 +816,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) // Wenn Zeichen selektiert ist kann es angezeigt werden SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, - rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) { diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 7ba4d0b8e954..5bdff0ffc1b8 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -736,7 +736,7 @@ void SwTableShell::Execute(SfxRequest &rReq) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, - pView->GetViewFrame()->GetFrame()->GetFrameInterface(), + pView->GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 7e38c1297d0b..f26730b31be0 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -1149,7 +1149,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet, - GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pDlg->Execute() ) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 8e30123a192b..29a3669a9277 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -564,7 +564,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet, - rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), DLG_SWDROPCAPS ); + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (pDlg->Execute() == RET_OK) { diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 033c1fe27247..1632a0745ea6 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1822,7 +1822,7 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): pPageUpBtn(0), pPageDownBtn(0), pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(), - pViewFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )), + pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), mnPageCount( 0 ), // OD 09.01.2003 #106334# mbResetFormDesignMode( false ), @@ -1913,7 +1913,7 @@ SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): { // es gibt noch eine weitere Sicht auf unser Dokument, also // aktiviere dieses - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); break; } */} diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index cb1e7799bd6c..4e5b87dd5cfe 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -173,7 +173,7 @@ inline SfxDispatcher &SwView::GetDispatcher() void SwView::ImpSetVerb( int nSelType ) { sal_Bool bResetVerbs = bVerbsActive; - if ( !GetViewFrame()->GetFrame()->IsInPlace() && + if ( !GetViewFrame()->GetFrame().IsInPlace() && (nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType ) { if ( !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) ) @@ -755,7 +755,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pFormShell(0), pHScrollbar(0), pVScrollbar(0), - pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame()->GetParentFrame() ? 0 : WB_SIZEABLE )), + pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin, SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS | @@ -939,7 +939,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) pVRuler->SetActive( sal_True ); SfxViewFrame* pViewFrame = GetViewFrame(); - if( pViewFrame->GetFrame()->GetParentFrame()) + if( pViewFrame->GetFrame().GetParentFrame()) { aUsrPref.SetViewHRuler(sal_False); aUsrPref.SetViewVRuler(sal_False); @@ -1046,10 +1046,10 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) /*uno::Reference< awt::XWindow > aTmpRef; - _pFrame->GetFrame()->GetFrameInterface()->setComponent( aTmpRef, + _pFrame->GetFrame().GetFrameInterface()->setComponent( aTmpRef, pViewImpl->GetUNOObject_Impl());*/ - uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame().GetFrameInterface(); uno::Reference< frame::XFrame > xBeamerFrame = xFrame->findFrame( OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN); @@ -1611,7 +1611,7 @@ void SwView::ShowCursor( FASTBOOL bOn ) ErrCode SwView::DoVerb( long nVerb ) { - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { SwWrtShell &rSh = GetWrtShell(); const int nSel = rSh.GetSelectionType(); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 4aa00311c5bd..44975fe13b26 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1051,7 +1051,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) if(bQuery) { SfxViewFrame* pTmpFrame = GetViewFrame(); - SfxHelp::OpenHelpAgent( pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT ); + SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT ); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE, diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 588c30a9844d..5c1b1a37a9fd 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -842,10 +842,9 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) else { SfxViewFrame *pSfxViewFrame = GetViewFrame(); - SfxFrame *pSfxFrame = pSfxViewFrame? pSfxViewFrame->GetFrame() : 0; uno::Reference< frame::XFrame > xFrame; - if (pSfxFrame) - xFrame = pSfxFrame->GetFrameInterface(); + if ( pSfxViewFrame ) + xFrame = pSfxViewFrame->GetFrame().GetFrameInterface(); com::sun::star::util::URL aURL; uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY ); uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory(), uno::UNO_QUERY ); diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx index 702c0790012f..52509b2956e1 100644 --- a/sw/source/ui/uiview/viewmdi.cxx +++ b/sw/source/ui/uiview/viewmdi.cxx @@ -181,7 +181,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType, nFac = Max( long( MINZOOM ), nFac ); SwViewOption aOpt( *pOpt ); - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen //View updaten. @@ -264,7 +264,7 @@ void SwView::SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly ) ACT_KONTEXT(pWrtShell); - if ( !GetViewFrame()->GetFrame()->IsInPlace() && !bViewOnly ) + if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly ) { const BOOL bWeb = 0 != PTR_CAST(SwWebView, this); SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb); @@ -350,7 +350,7 @@ void SwView::CreatePageButtons(BOOL bShow) pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP); pPageDownBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), FALSE ); pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN); - Reference< XFrame > xFrame = GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = GetViewFrame()->GetFrame().GetFrameInterface(); pNaviBtn = new SwNaviImageButton(pMDI, xFrame ); pNaviBtn->SetHelpId(HID_SCRL_NAVI); Link aLk( LINK( this, SwView, BtnPage ) ); diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx index 1cc886f5d204..d10a990d8e71 100644 --- a/sw/source/ui/uiview/viewport.cxx +++ b/sw/source/ui/uiview/viewport.cxx @@ -224,7 +224,7 @@ aDocSz = rSz; SetVisArea( aNewVisArea, FALSE ); if ( UpdateScrollbars() && !bInOuterResizePixel && !bInInnerResizePixel && - !GetViewFrame()->GetFrame()->IsInPlace()) + !GetViewFrame()->GetFrame().IsInPlace()) OuterResizePixel( Point(), GetViewFrame()->GetWindow().GetOutputSizePixel() ); } @@ -358,7 +358,7 @@ void SwView::SetVisArea( const Point &rPt, BOOL bUpdateScrollbar ) void SwView::CheckVisArea() { pHScrollbar->SetAuto( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - !GetViewFrame()->GetFrame()->IsInPlace() ); + !GetViewFrame()->GetFrame().IsInPlace() ); if ( IsDocumentBorder() ) { if ( aVisArea.Left() != DOCUMENTBORDER || @@ -735,7 +735,7 @@ IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar ) { // JP 21.07.00: the end scrollhandler invalidate the FN_STAT_PAGE, // so we dont must do it agin. -// if(!GetViewFrame()->GetFrame()->IsInPlace()) +// if(!GetViewFrame()->GetFrame().IsInPlace()) // S F X_BINDINGS().Update(FN_STAT_PAGE); //QuickHelp: @@ -1056,7 +1056,7 @@ void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize ) Size aSz( rSize ); SvBorder aBorder; CalcAndSetBorderPixel( aBorder, TRUE ); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) + if ( GetViewFrame()->GetFrame().IsInPlace() ) { Size aViewSize( aSz ); Point aViewPos( rOfst ); diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx index 81849559cfc2..ba0f490da4ca 100644 --- a/sw/source/ui/uno/unodispatch.cxx +++ b/sw/source/ui/uno/unodispatch.cxx @@ -59,8 +59,7 @@ const sal_Char* cInternalDBChangeNotification = ".uno::Writer/DataSourceChanged" SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) : m_pView(&rVw) { - SfxFrame* pFrame = m_pView->GetViewFrame()->GetFrame(); - uno::Reference< frame::XFrame> xUnoFrame = pFrame->GetFrameInterface(); + uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame()->GetFrame().GetFrameInterface(); m_xIntercepted = uno::Reference< frame::XDispatchProviderInterception>(xUnoFrame, uno::UNO_QUERY); if(m_xIntercepted.is()) { diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index 78fc237f8b20..6c4636f18f44 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -503,7 +503,7 @@ void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, BOOL bSetFocus { // SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings(); // rBind.ENTERREGISTRATIONS(); - Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame()->GetFrameInterface(); + Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface(); SwScrollNaviPopup* pPopup = new SwScrollNaviPopup(FN_SCROLL_NAVIGATION, xFrame ); diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index 5a0030d9dd85..ac70127653b0 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -438,7 +438,7 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aCoreSet, - GetView()->GetViewFrame()->GetFrame()->GetFrameInterface(), + GetView()->GetViewFrame()->GetFrame().GetFrameInterface(), RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index cb6a3888d45f..6a7b6885bded 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -759,7 +759,7 @@ bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, USHORT nId } if(sCommand.Len()) { - uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame().GetFrameInterface(); uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY ); util::URL aURL; aURL.Complete = sCommand; diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index cd6bb82739ca..66c584fea88d 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -645,7 +645,7 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm void SwWrtShell::LaunchOLEObj( long nVerb ) { if ( GetCntType() == CNT_OLE && - !GetView().GetViewFrame()->GetFrame()->IsInPlace() ) + !GetView().GetViewFrame()->GetFrame().IsInPlace() ) { svt::EmbeddedObjectRef& xRef = GetOLEObject(); ASSERT( xRef.is(), "OLE not found" ); -- cgit v1.2.3 From 7f6da30d47203158923f10d5fbd85ba48b01842c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- sd/source/ui/annotations/annotationmanager.cxx | 2 +- sd/source/ui/app/sdmod1.cxx | 10 +++++----- sd/source/ui/func/fubullet.cxx | 2 +- sd/source/ui/slideshow/slideshowimpl.cxx | 8 ++++---- sd/source/ui/tools/IdleDetection.cxx | 19 ++++++++----------- sd/source/ui/view/PresentationViewShellBase.cxx | 4 ++-- sd/source/ui/view/ToolBarManager.cxx | 4 ++-- sd/source/ui/view/UpdateLockManager.cxx | 5 ++--- sd/source/ui/view/drviews3.cxx | 2 +- sd/source/ui/view/drviews5.cxx | 2 +- sd/source/ui/view/drviews7.cxx | 4 ++-- 11 files changed, 29 insertions(+), 33 deletions(-) diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index bbc9bbd539f3..7cab6480d71e 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -1075,7 +1075,7 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( Reference< XAnnotation USHORT nId = 0; // set slot images - Reference< ::com::sun::star::frame::XFrame > xFrame( mrBase.GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface() ); + Reference< ::com::sun::star::frame::XFrame > xFrame( mrBase.GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface() ); if( xFrame.is() ) { const bool bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 4a739e3ffbb0..9817c737a093 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -553,7 +553,7 @@ SfxFrame* SdModule::CreateFromTemplate( const String& rTemplatePath, const Refer { SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" ); - pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; } return pFrame; @@ -639,7 +639,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame ); const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); if ( pFrameItem && pFrameItem->GetFrame() ) - pFrame = pFrameItem->GetFrame()->GetFrame(); + pFrame = &pFrameItem->GetFrame()->GetFrame(); } else { @@ -658,7 +658,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest); const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet ); if ( pFrameItem ) - pFrame = pFrameItem->GetFrame()->GetFrame(); + pFrame = &pFrameItem->GetFrame()->GetFrame(); } catch (::com::sun::star::uno::Exception e) { @@ -684,7 +684,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq ) { pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame ); DBG_ASSERT( pViewFrame, "no ViewFrame!!" ); - pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; if(bNewDocDirect && !bStartWithTemplate) { @@ -789,7 +789,7 @@ SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame ); OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" ); - pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; } return pFrame; diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx index 64fb3783d78d..425d263e55ab 100644 --- a/sd/source/ui/func/fubullet.cxx +++ b/sd/source/ui/func/fubullet.cxx @@ -216,7 +216,7 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pDlg = pFact ? pFact->CreateSfxDialog( &mpView->GetViewShell()->GetViewFrame()->GetWindow(), aSet, - mpView->GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(), + mpView->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ) : 0; if( !pDlg ) return; diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index c0b4857f3f6b..71e4054f6170 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2119,9 +2119,9 @@ IMPL_LINK( SlideshowImpl, ContextMenuHdl, void*, EMPTYARG ) PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO ); SfxViewFrame* pViewFrame = getViewFrame(); - if( pViewFrame && pViewFrame->GetFrame() ) + if( pViewFrame ) { - Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if( xFrame.is() ) { pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:10617") ), FALSE, FALSE ) ); @@ -2538,12 +2538,12 @@ void SlideshowImpl::setActiveXToolbarsVisible( sal_Bool bVisible ) // this is a plugin/activex mode, no toolbars should be visible during slide show // after the end of slide show they should be visible again SfxViewFrame* pViewFrame = getViewFrame(); - if( pViewFrame && pViewFrame->GetFrame() && pViewFrame->GetFrame()->GetTopFrame() ) + if( pViewFrame && pViewFrame->GetFrame().GetTopFrame() ) { try { Reference< frame::XLayoutManager > xLayoutManager; - Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame()->GetTopFrame()->GetFrameInterface(), UNO_QUERY_THROW ); + Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame()->GetFrameInterface(), UNO_QUERY_THROW ); if ( ( xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ) >>= xLayoutManager ) && xLayoutManager.is() ) diff --git a/sd/source/ui/tools/IdleDetection.cxx b/sd/source/ui/tools/IdleDetection.cxx index 3d18dc014a7a..15942515cb38 100644 --- a/sd/source/ui/tools/IdleDetection.cxx +++ b/sd/source/ui/tools/IdleDetection.cxx @@ -85,18 +85,15 @@ sal_Int32 IdleDetection::CheckSlideShowRunning (void) // Ignore the current frame when it does not exist, is not valid, or // is not active. bool bIgnoreFrame (true); - if (pViewFrame->GetFrame() != NULL) + uno::Reference xFrame (pViewFrame->GetFrame().GetFrameInterface()); + try { - uno::Reference xFrame (pViewFrame->GetFrame()->GetFrameInterface()); - try - { - if (xFrame.is() && xFrame->isActive()) - bIgnoreFrame = false; - } - catch (uno::RuntimeException e) - { - (void) e; - } + if (xFrame.is() && xFrame->isActive()) + bIgnoreFrame = false; + } + catch (uno::RuntimeException e) + { + (void) e; } if (bIgnoreFrame) continue; diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx b/sd/source/ui/view/PresentationViewShellBase.cxx index 8019fb7ec1e9..3cc5a023a34b 100644 --- a/sd/source/ui/view/PresentationViewShellBase.cxx +++ b/sd/source/ui/view/PresentationViewShellBase.cxx @@ -92,10 +92,10 @@ PresentationViewShellBase::PresentationViewShellBase ( GetUpdateLockManager()->Disable(); // Hide the automatic (non-context sensitive) tool bars. - if (_pFrame!=NULL && _pFrame->GetFrame()!=NULL) + if (_pFrame!=NULL) { Reference xFrameSet ( - _pFrame->GetFrame()->GetFrameInterface(), + _pFrame->GetFrame().GetFrameInterface(), UNO_QUERY); if (xFrameSet.is()) { diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 286132c304c0..b6dde1d8b070 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -721,8 +721,8 @@ void ToolBarManager::Implementation::SetValid (bool bValid) if (mbIsValid) { Reference xFrame; - if (mrBase.GetViewFrame() != NULL && mrBase.GetViewFrame()->GetFrame()) - xFrame = mrBase.GetViewFrame()->GetFrame()->GetFrameInterface(); + if (mrBase.GetViewFrame() != NULL) + xFrame = mrBase.GetViewFrame()->GetFrame().GetFrameInterface(); try { Reference xFrameProperties (xFrame, UNO_QUERY_THROW); diff --git a/sd/source/ui/view/UpdateLockManager.cxx b/sd/source/ui/view/UpdateLockManager.cxx index 40515bf20197..51285533a389 100644 --- a/sd/source/ui/view/UpdateLockManager.cxx +++ b/sd/source/ui/view/UpdateLockManager.cxx @@ -399,11 +399,10 @@ Reference< ::com::sun::star::frame::XLayoutManager> if (mxLayoutManager.get() == NULL) { - if (mrBase.GetViewFrame()!=NULL - && mrBase.GetViewFrame()->GetFrame()!=NULL) + if (mrBase.GetViewFrame()!=NULL) { Reference xFrameProperties ( - mrBase.GetViewFrame()->GetFrame()->GetFrameInterface(), + mrBase.GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY); if (xFrameProperties.is()) { diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index d6e25701fc96..5fff8d94ce23 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -381,7 +381,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) try { - Reference< XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface(), UNO_SET_THROW ); + Reference< XFrame > xFrame( pFrame->GetFrame().GetFrameInterface(), UNO_SET_THROW ); // Save the current configuration of panes and views. Reference xControllerManager ( diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index 3f8973fbcd64..5aeb1aa00c53 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -156,7 +156,7 @@ void DrawViewShell::ArrangeGUIElements (void) if ( pIPClient && pIPClient->IsObjectInPlaceActive() ) bClientActive = TRUE; - BOOL bInPlaceActive = GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bInPlaceActive = GetViewFrame()->GetFrame().IsInPlace(); if ( mbZoomOnPage && !bInPlaceActive && !bClientActive ) { diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 983033be7b8c..380ca10ab028 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -1607,9 +1607,9 @@ void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet) // view mode is allowed. const bool bIsRunning = SlideShow::IsRunning(GetViewShellBase()); - if (GetViewFrame()->GetFrame()->IsInPlace() || bIsRunning) + if (GetViewFrame()->GetFrame().IsInPlace() || bIsRunning) { - if ( !GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !GetViewFrame()->GetFrame().IsInPlace() ) { rSet.ClearItem( SID_DRAWINGMODE ); rSet.DisableItem( SID_DRAWINGMODE ); -- cgit v1.2.3 From 20ceeaeb55b2a306b83bc02fa1842146ea4b0666 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- basctl/source/basicide/basides1.cxx | 6 +++--- basctl/source/basicide/localizationmgr.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index b821c7ca51c6..47340fe7f7ad 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -302,10 +302,10 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) { // get statusindicator SfxViewFrame *pFrame_ = GetFrame(); - if ( pFrame_ && pFrame_->GetFrame() ) + if ( pFrame_ ) { uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame_->GetFrame()->GetFrameInterface(), + pFrame_->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if( xStatFactory.is() ) xStatusIndicator = xStatFactory->createStatusIndicator(); @@ -1156,7 +1156,7 @@ void BasicIDEShell::ManageToolbars() return; Reference< beans::XPropertySet > xFrameProps - ( GetViewFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xFrameProps.is() ) { Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index fead4ae0aa4c..01b427ed8606 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -80,7 +80,7 @@ void LocalizationMgr::handleTranslationbar( void ) ::rtl::OUString::createFromAscii( "private:resource/toolbar/translationbar" ); Reference< beans::XPropertySet > xFrameProps - ( m_pIDEShell->GetViewFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + ( m_pIDEShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xFrameProps.is() ) { Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; -- cgit v1.2.3 From 89f6e13ee257f3ceccdae1ca77de7d61e50e7bc4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:07:57 +0100 Subject: autorecovery: SfxViewFrame's SfxFrame is a reference now, no pointer (it can never be NULL) --- sc/source/ui/Accessibility/AccessibleDocument.cxx | 18 ++++++-------- sc/source/ui/docshell/dbdocimp.cxx | 2 +- sc/source/ui/drawfunc/drawsh.cxx | 2 +- sc/source/ui/drawfunc/fudraw.cxx | 2 +- sc/source/ui/drawfunc/fusel.cxx | 2 +- sc/source/ui/miscdlgs/anyrefdg.cxx | 6 ++--- sc/source/ui/unoobj/dispuno.cxx | 7 ++---- sc/source/ui/vba/vbahelper.cxx | 2 +- sc/source/ui/vba/vbawindow.cxx | 4 ++-- sc/source/ui/view/cellsh.cxx | 2 +- sc/source/ui/view/cellsh1.cxx | 2 +- sc/source/ui/view/cellsh2.cxx | 2 +- sc/source/ui/view/cellsh3.cxx | 2 +- sc/source/ui/view/drawview.cxx | 17 ++++++------- sc/source/ui/view/gridwin.cxx | 28 ++++++++++------------ sc/source/ui/view/tabview.cxx | 19 +++++++-------- sc/source/ui/view/tabview3.cxx | 14 ++++------- sc/source/ui/view/tabview5.cxx | 14 ++++------- sc/source/ui/view/tabvwsh2.cxx | 2 +- sc/source/ui/view/tabvwsh3.cxx | 4 ++-- sc/source/ui/view/tabvwsh4.cxx | 29 ++++++++++------------- sc/source/ui/view/tabvwsha.cxx | 2 +- sc/source/ui/view/tabvwshb.cxx | 2 +- sc/source/ui/view/viewutil.cxx | 2 +- 24 files changed, 79 insertions(+), 107 deletions(-) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 3ed9b4062a9d..f766dbb91abd 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -966,18 +966,14 @@ void ScChildrenShapes::FillSelectionSupplier() const SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + xSelectionSupplier = uno::Reference(pViewFrame->GetFrame().GetController(), uno::UNO_QUERY); + if (xSelectionSupplier.is()) { - xSelectionSupplier = uno::Reference(pFrame->GetController(), uno::UNO_QUERY); - if (xSelectionSupplier.is()) - { - if (mpAccessibleDocument) - xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument); - uno::Reference xShapes (xSelectionSupplier->getSelection(), uno::UNO_QUERY); - if (xShapes.is()) - mnShapesSelected = xShapes->getCount(); - } + if (mpAccessibleDocument) + xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument); + uno::Reference xShapes (xSelectionSupplier->getSelection(), uno::UNO_QUERY); + if (xShapes.is()) + mnShapesSelected = xShapes->getCount(); } } } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 09e4dd7aa4af..b2c8335d6c11 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -89,7 +89,7 @@ void ScDBDocFunc::ShowInBeamer( const ScImportParam& rParam, SfxViewFrame* pFram if ( !pFrame || !rParam.bImport ) return; - uno::Reference xFrame = pFrame->GetFrame()->GetFrameInterface(); + uno::Reference xFrame = pFrame->GetFrame().GetFrameInterface(); uno::Reference xDP(xFrame, uno::UNO_QUERY); uno::Reference xBeamerFrame = xFrame->findFrame( diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 63f958763479..05bc18249973 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -338,7 +338,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, Window* pWin ) com::sun::star::uno::Reference < com::sun::star::frame::XFrame > xFrame; if (GetViewShell()) - xFrame = GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(); + xFrame = GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pWin, *pItemSet, xFrame, SID_EVENTCONFIG ); diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index fadb8270b6a6..59e279d582ba 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -313,7 +313,7 @@ BOOL __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt) const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() ) { - BOOL bOle = pViewShell->GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace(); SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); if( pObj && pObj->ISA( SdrOle2Obj ) && !bOle ) { diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 79c466f9f2c3..f2595d53c956 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -393,7 +393,7 @@ BOOL __EXPORT FuSelection::MouseButtonUp(const MouseEvent& rMEvt) BOOL bReturn = FuDraw::MouseButtonUp(rMEvt); // BOOL bOle = pViewShell->GetViewData()->IsOle(); - BOOL bOle = pViewShell->GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace(); if (aDragTimer.IsActive() ) { diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 1a3cf1f29dc1..96dba779a406 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -105,7 +105,7 @@ void ScFormulaReferenceHelper::enableInput( BOOL bEnable ) while( pFrame ) { // #71577# enable everything except InPlace, including bean frames - if ( !pFrame->GetFrame()->IsInPlace() ) + if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); @@ -601,7 +601,7 @@ void ScFormulaReferenceHelper::EnableSpreadsheets(BOOL bFlag, BOOL bChilds) while( pFrame ) { // #71577# enable everything except InPlace, including bean frames - if ( !pFrame->GetFrame()->IsInPlace() ) + if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); @@ -641,7 +641,7 @@ void lcl_InvalidateWindows() while( pFrame ) { // #71577# enable everything except InPlace, including bean frames - if ( !pFrame->GetFrame()->IsInPlace() ) + if ( !pFrame->GetFrame().IsInPlace() ) { SfxViewShell* p = pFrame->GetViewShell(); ScTabViewShell* pViewSh = PTR_CAST(ScTabViewShell,p); diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index 1e2309dd2c0a..ebb0f8022f94 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -68,9 +68,7 @@ uno::Reference lcl_GetSelectionSupplier( SfxViewShell* SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) - return uno::Reference( pFrame->GetController(), uno::UNO_QUERY ); + return uno::Reference( pViewFrame->GetFrame().GetController(), uno::UNO_QUERY ); } } return uno::Reference(); @@ -84,8 +82,7 @@ ScDispatchProviderInterceptor::ScDispatchProviderInterceptor(ScTabViewShell* pVi { if ( pViewShell ) { - SfxFrame* pFrame = pViewShell->GetViewFrame()->GetFrame(); - m_xIntercepted.set(uno::Reference(pFrame->GetFrameInterface(), uno::UNO_QUERY)); + m_xIntercepted.set(uno::Reference(pViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY)); if (m_xIntercepted.is()) { comphelper::increment( m_refCount ); diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index 353c036393c2..1c886fd17db7 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -521,7 +521,7 @@ void PrintOutHelper( const uno::Any& From, const uno::Any& To, const uno::Any& C { if ( bPreview ) { - if ( !pViewFrame->GetFrame()->IsInPlace() ) + if ( !pViewFrame->GetFrame().IsInPlace() ) { SC_MOD()->InputEnterHandler(); pViewFrame->GetDispatcher()->Execute( SID_VIEWSHELL1, SFX_CALLMODE_SYNCHRON ); diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index de1eadb7a86c..d5072c858847 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -401,7 +401,7 @@ ScVbaWindow::getWindowState() throw (uno::RuntimeException) sal_Int32 nwindowState = xlNormal; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow(); if ( pWork ) { if ( pWork -> IsMaximized()) @@ -419,7 +419,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE _windowstate >>= nwindowState; ScTabViewShell* pViewShell = getBestViewShell( m_xModel ); SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame(); - WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame()->GetSystemWindow(); + WorkWindow* pWork = (WorkWindow*) pViewFrame->GetFrame().GetSystemWindow(); if ( pWork ) { if ( nwindowState == xlMaximized) diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index c2d0f68fc6ef..f1dec2a510b8 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -521,7 +521,7 @@ void ScCellShell::GetState(SfxItemSet &rSet) // removed: SID_BORDER_OBJECT (old Basic) ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); -// BOOL bOle = pTabViewShell->GetViewFrame()->GetFrame()->IsInPlace(); +// BOOL bOle = pTabViewShell->GetViewFrame()->GetFrame().IsInPlace(); // BOOL bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScViewData* pData = GetViewData(); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f610e28b3fc5..618ac0204dd6 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1947,7 +1947,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) ); SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( pTabViewShell->GetDialogParent(), aSet, - pTabViewShell->GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + pTabViewShell->GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if ( pDlg->Execute() == RET_OK ) { diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 039e4dc256ba..433da76b21ad 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -233,7 +233,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame(); BOOL bWasOpen = FALSE; { - uno::Reference xFrame = pViewFrame->GetFrame()->GetFrameInterface(); + uno::Reference xFrame = pViewFrame->GetFrame().GetFrameInterface(); uno::Reference xBeamerFrame = xFrame->findFrame( rtl::OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index dd79bb52a112..7bead7d42e07 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -91,7 +91,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_OPENDLG_FUNCTION: // #53318# inplace macht die EditShell Aerger... //! kann nicht immer umgeschaltet werden ???? - if (!pTabViewShell->GetViewFrame()->GetFrame()->IsInPlace()) + if (!pTabViewShell->GetViewFrame()->GetFrame().IsInPlace()) pTabViewShell->SetDontSwitch(TRUE); // EditShell nicht abschalten // kein break diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index ef68bbc9bd0c..ae6f9b309d19 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -532,7 +532,7 @@ void ScDrawView::MarkListHasChanged() // Verben anpassen SfxViewFrame* pViewFrame = pViewSh->GetViewFrame(); - BOOL bOle = pViewSh->GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = pViewSh->GetViewFrame()->GetFrame().IsInPlace(); if ( pOle2Obj && !bOle ) { uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef(); @@ -573,16 +573,13 @@ void ScDrawView::MarkListHasChanged() if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + SfxFrame& rFrame = pViewFrame->GetFrame(); + uno::Reference xController = rFrame.GetController(); + if (xController.is()) { - uno::Reference xController = pFrame->GetController(); - if (xController.is()) - { - ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); - if (pImp) - pImp->SelectionChanged(); - } + ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); + if (pImp) + pImp->SelectionChanged(); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index de2b962f3272..116c2af6d1fb 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2412,24 +2412,20 @@ long ScGridWindow::PreNotify( NotifyEvent& rNEvt ) SfxViewFrame* pViewFrame = pViewData->GetViewShell()->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + com::sun::star::uno::Reference xController = pViewFrame->GetFrame().GetController(); + if (xController.is()) { - com::sun::star::uno::Reference xController = pFrame->GetController(); - if (xController.is()) + ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); + if (pImp && pImp->IsMouseListening()) { - ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); - if (pImp && pImp->IsMouseListening()) - { - ::com::sun::star::awt::MouseEvent aEvent; - lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() ); - if ( rNEvt.GetWindow() ) - aEvent.Source = rNEvt.GetWindow()->GetComponentInterface(); - if ( nType == EVENT_MOUSEBUTTONDOWN) - pImp->MousePressed( aEvent ); - else - pImp->MouseReleased( aEvent ); - } + ::com::sun::star::awt::MouseEvent aEvent; + lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() ); + if ( rNEvt.GetWindow() ) + aEvent.Source = rNEvt.GetWindow()->GetComponentInterface(); + if ( nType == EVENT_MOUSEBUTTONDOWN) + pImp->MousePressed( aEvent ); + else + pImp->MouseReleased( aEvent ); } } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 3077e852dbaf..63d675e03d15 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1168,7 +1168,7 @@ BOOL ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) const CommandWheelData* pData = rCEvt.GetWheelData(); if ( pData && pData->GetMode() == COMMAND_WHEEL_ZOOM ) { - if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() ) { // for ole inplace editing, the scale is defined by the visarea and client size // and can't be changed directly @@ -1625,7 +1625,7 @@ void ScTabView::UpdateHeaderWidth( const ScVSplitPos* pWhich, const SCROW* pPosY return; SCROW nEndPos = MAXROW; - if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame()->IsInPlace() ) + if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() ) { // fuer OLE Inplace immer MAXROW @@ -2454,16 +2454,13 @@ void ScTabView::SetNewVisArea() SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + SfxFrame& rFrame = pViewFrame->GetFrame(); + com::sun::star::uno::Reference xController = rFrame.GetController(); + if (xController.is()) { - com::sun::star::uno::Reference xController = pFrame->GetController(); - if (xController.is()) - { - ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); - if (pImp) - pImp->VisAreaChanged(); - } + ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); + if (pImp) + pImp->VisAreaChanged(); } } if (aViewData.GetViewShell()->HasAccessibilityObjects()) diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index a19760e4c277..a71a3080331d 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -370,16 +370,12 @@ void ScTabView::SelectionChanged() SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + uno::Reference xController = pViewFrame->GetFrame().GetController(); + if (xController.is()) { - uno::Reference xController = pFrame->GetController(); - if (xController.is()) - { - ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); - if (pImp) - pImp->SelectionChanged(); - } + ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); + if (pImp) + pImp->SelectionChanged(); } } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 75e961d5eeec..d1b76d06a599 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -337,16 +337,12 @@ void ScTabView::TabChanged() SfxViewFrame* pViewFrame = aViewData.GetViewShell()->GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) + uno::Reference xController = pViewFrame->GetFrame().GetController(); + if (xController.is()) { - uno::Reference xController = pFrame->GetController(); - if (xController.is()) - { - ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); - if (pImp) - pImp->SheetChanged(); - } + ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController ); + if (pImp) + pImp->SheetChanged(); } } } diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index db6ee302a792..ebd408fe6349 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -454,7 +454,7 @@ void ScTabViewShell::GetDrawState(SfxItemSet &rSet) case SID_DRAW_CHART: { - BOOL bOle = GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = GetViewFrame()->GetFrame().IsInPlace(); if ( bOle || !SvtModuleOptions().IsChart() ) rSet.DisableItem( nWhich ); } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 62824f53759b..7d1f45875005 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -492,7 +492,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } if ( bFound ) - pViewFrame->GetFrame()->Appear(); + pViewFrame->GetFrame().Appear(); rReq.Ignore();//XXX wird von SFX erledigt } @@ -503,7 +503,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) case SID_PRINTPREVIEW: { - if ( !pThisFrame->GetFrame()->IsInPlace() ) // nicht bei OLE + if ( !pThisFrame->GetFrame().IsInPlace() ) // nicht bei OLE { // print preview is now always in the same frame as the tab view // -> always switch this frame back to normal view diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 2db8f9a03f62..2ef946b768d5 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -265,7 +265,7 @@ void __EXPORT ScTabViewShell::Deactivate(BOOL bMDI) DeActivateOlk( GetViewData() ); ActivateView( FALSE, FALSE ); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) // inplace + if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace GetViewData()->GetDocShell()->UpdateOle(GetViewData(),TRUE); if ( pHdl ) @@ -293,7 +293,7 @@ void ScTabViewShell::SetActive() #if 0 SfxViewFrame* pFrame = GetViewFrame(); - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); SFX_APP()->SetViewFrame( pFrame ); // immer erst Appear, dann SetViewFrame (#29290#) #endif @@ -391,7 +391,7 @@ void __EXPORT ScTabViewShell::AdjustPosSizePixel( const Point &rPos, const Size void __EXPORT ScTabViewShell::InnerResizePixel( const Point &rOfs, const Size &rSize ) { Size aNewSize( rSize ); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) + if ( GetViewFrame()->GetFrame().IsInPlace() ) { SvBorder aBorder; GetBorderSize( aBorder, rSize ); @@ -1336,13 +1336,10 @@ ScTabViewObj* lcl_GetViewObj( ScTabViewShell& rShell ) SfxViewFrame* pViewFrame = rShell.GetViewFrame(); if (pViewFrame) { - SfxFrame* pFrame = pViewFrame->GetFrame(); - if (pFrame) - { - uno::Reference xController = pFrame->GetController(); - if (xController.is()) - pRet = ScTabViewObj::getImplementation( xController ); - } + SfxFrame& rFrame = pViewFrame->GetFrame(); + uno::Reference xController = rFrame.GetController(); + if (xController.is()) + pRet = ScTabViewObj::getImplementation( xController ); } return pRet; } @@ -1383,7 +1380,7 @@ void ScTabViewShell::StartSimpleRefDialog( // Then the view has to be activated first, the same way as in Execute for SID_CURRENTDOC. // Can't use GrabFocus here, because it needs to take effect immediately. - pViewFrm->GetFrame()->Appear(); + pViewFrm->GetFrame().Appear(); } USHORT nId = ScSimpleRefDlgWrapper::GetChildWindowId(); @@ -1525,7 +1522,7 @@ BOOL ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) // container app and are executed during Window::KeyInput. // -> don't pass keys to input handler that would be used there // but should call slots instead. - BOOL bParent = ( GetViewFrame()->GetFrame()->IsInPlace() && eFunc != KEYFUNC_DONTKNOW ); + BOOL bParent = ( GetViewFrame()->GetFrame().IsInPlace() && eFunc != KEYFUNC_DONTKNOW ); if( !bUsed && !bDraw && nCode != KEY_RETURN && !bParent ) bUsed = pScMod->InputKeyEvent( rKEvt, TRUE ); // Eingabe @@ -1734,7 +1731,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) // show the right cells GetViewData()->SetScreenPos( bNegativePage ? aVisArea.TopRight() : aVisArea.TopLeft() ); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) // inplace + if ( GetViewFrame()->GetFrame().IsInPlace() ) // inplace { pDocSh->SetInplace( TRUE ); // schon so initialisiert if (pDoc->IsEmbedded()) @@ -1874,7 +1871,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) // #105575#; update only in the first creation of the ViewShell pDocSh->SetUpdateEnabled(FALSE); - if ( GetViewFrame()->GetFrame()->IsInPlace() ) + if ( GetViewFrame()->GetFrame().IsInPlace() ) UpdateHeaderWidth(); // The implace activation requires headers to be calculated SvBorder aBorder; @@ -1896,7 +1893,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) //UNUSED2008-05 //UNUSED2008-05 UpdatePageBreakData(); //UNUSED2008-05 -//UNUSED2008-05 /*uno::Reference xFrame = pViewFrame->GetFrame()->GetFrameInterface(); +//UNUSED2008-05 /*uno::Reference xFrame = pViewFrame->GetFrame().GetFrameInterface(); //UNUSED2008-05 if (xFrame.is()) //UNUSED2008-05 xFrame->setComponent( uno::Reference(), new ScTabViewObj( this ) );*/ //UNUSED2008-05 // make Controller known to SFX @@ -1948,7 +1945,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, SetZoomType( rAppOpt.GetZoomType(), TRUE ); } - /*uno::Reference xFrame = pViewFrame->GetFrame()->GetFrameInterface(); + /*uno::Reference xFrame = pViewFrame->GetFrame().GetFrameInterface(); if (xFrame.is()) xFrame->setComponent( uno::Reference(), new ScTabViewObj( this ) );*/ // make Controller known to SFX diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 9e844f970909..4a9a2e2d5abf 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -177,7 +177,7 @@ void __EXPORT ScTabViewShell::GetState( SfxItemSet& rSet ) USHORT nMyId = 0; SfxViewFrame* pThisFrame = GetViewFrame(); - BOOL bOle = GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = GetViewFrame()->GetFrame().IsInPlace(); SCTAB nTabCount = pDoc->GetTableCount(); SCTAB nTabSelCount = rMark.GetSelectCount(); diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 37dc2c11da7f..7219a3d2b8e2 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -435,7 +435,7 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq) void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) { - BOOL bOle = GetViewFrame()->GetFrame()->IsInPlace(); + BOOL bOle = GetViewFrame()->GetFrame().IsInPlace(); BOOL bTabProt = GetViewData()->GetDocument()->IsTabProtected(GetViewData()->GetTabNo()); ScDocShell* pDocShell = ( GetViewData() ? GetViewData()->GetDocShell() : NULL ); bool bShared = ( pDocShell ? pDocShell->IsDocShared() : false ); diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index d0a6f2acf015..569e17fa51aa 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -374,7 +374,7 @@ BOOL ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont, SfxAllItemSet aSet( rFrame.GetObjectShell()->GetPool() ); aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); aSet.Put( SvxFontItem( rOldFont.GetFamily(), rOldFont.GetFamilyName(), rOldFont.GetStyleName(), rOldFont.GetPitch(), rOldFont.GetCharSet(), aSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ) ) ); - SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( &rFrame.GetWindow(), aSet, rFrame.GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( &rFrame.GetWindow(), aSet, rFrame.GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); if ( pDlg->Execute() == RET_OK ) { SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE ); -- cgit v1.2.3 From 857a0d334f01134784a983f9c50e4f920b41e2e0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:31:21 +0100 Subject: autorecovery: Sfx(View)Frame::GetTopFrame now also returning a SfxFrame& instead of an SfxFrame* --- sw/source/ui/chrdlg/chardlg.cxx | 4 ++-- sw/source/ui/shells/basesh.cxx | 2 +- sw/source/ui/shells/frmsh.cxx | 2 +- sw/source/ui/shells/grfsh.cxx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 2aff6e0cf4d1..e8246d51c03a 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -244,8 +244,8 @@ SwCharURLPage::SwCharURLPage( Window* pParent, ::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell()); TargetList* pList = new TargetList; - const SfxFrame* pFrame = pView->GetViewFrame()->GetTopFrame(); - pFrame->GetTargetList(*pList); + const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame(); + rFrame.GetTargetList(*pList); USHORT nCount = (USHORT)pList->Count(); if( nCount ) { diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 41f462f06dfc..879a2c3afdca 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -192,7 +192,7 @@ void lcl_UpdateIMapDlg( SwWrtShell& rSh ) void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType ? rSh.GetIMapInventor() : 0; TargetList* pList = new TargetList; - rSh.GetView().GetViewFrame()->GetTopFrame()->GetTargetList(*pList); + rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList); SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index f7957a66077a..6c311a7c242e 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -453,7 +453,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET) nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); - aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame())); + aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric) )); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 7203d9c91ebb..203b80fc8c8c 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -228,7 +228,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio())); aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom())); - aSet.Put(SfxFrameItem( SID_DOCFRAME, GetView().GetViewFrame()->GetTopFrame())); + aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); -- cgit v1.2.3 From 3b4faad942a61834824d9b3bc1919e1b10976f95 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 15 Dec 2009 23:31:21 +0100 Subject: autorecovery: Sfx(View)Frame::GetTopFrame now also returning a SfxFrame& instead of an SfxFrame* --- sd/source/ui/slideshow/slideshow.cxx | 4 ++-- sd/source/ui/slideshow/slideshowimpl.cxx | 4 ++-- sd/source/ui/tools/EventMultiplexer.cxx | 2 +- sd/source/ui/view/outlview.cxx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index b348a5e866ba..c2d84b89a955 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -705,9 +705,9 @@ void SAL_CALL SlideShow::end() throw(RuntimeException) { PresentationViewShell* pShell = dynamic_cast(pFullScreenViewShellBase->GetMainViewShell().get()); - if( pShell && pShell->GetViewFrame() && pShell->GetViewFrame()->GetTopFrame() ) + if( pShell && pShell->GetViewFrame() ) { - WorkWindow* pWorkWindow = dynamic_cast(pShell->GetViewFrame()->GetTopFrame()->GetWindow().GetParent()); + WorkWindow* pWorkWindow = dynamic_cast(pShell->GetViewFrame()->GetTopFrame().GetWindow().GetParent()); if( pWorkWindow ) { pWorkWindow->StartPresentationMode( FALSE, isAlwaysOnTop() ); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 71e4054f6170..513c6a012ec7 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2538,12 +2538,12 @@ void SlideshowImpl::setActiveXToolbarsVisible( sal_Bool bVisible ) // this is a plugin/activex mode, no toolbars should be visible during slide show // after the end of slide show they should be visible again SfxViewFrame* pViewFrame = getViewFrame(); - if( pViewFrame && pViewFrame->GetFrame().GetTopFrame() ) + if( pViewFrame ) { try { Reference< frame::XLayoutManager > xLayoutManager; - Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame()->GetFrameInterface(), UNO_QUERY_THROW ); + Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame().GetFrameInterface(), UNO_QUERY_THROW ); if ( ( xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ) >>= xLayoutManager ) && xLayoutManager.is() ) diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 3b9b113bf288..157abc38dc9e 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -268,7 +268,7 @@ EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase) // Connect to the frame to listen for controllers being exchanged. // Listen to changes of certain properties. Reference xFrame ( - mrBase.GetFrame()->GetTopFrame()->GetFrameInterface(), + mrBase.GetFrame()->GetTopFrame().GetFrameInterface(), uno::UNO_QUERY); mxFrameWeak = xFrame; if (xFrame.is()) diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 1e5564427ac8..e9bdd7a188f3 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -212,7 +212,7 @@ OutlineView::OutlineView( DrawDocShell* pDocSh, ::Window* pWindow, OutlineViewSh maBulletFont.SetShadow(FALSE); - Reference xFrame (mpOutlineViewShell->GetViewShellBase().GetFrame()->GetTopFrame()->GetFrameInterface(), UNO_QUERY); + Reference xFrame (mpOutlineViewShell->GetViewShellBase().GetFrame()->GetTopFrame().GetFrameInterface(), UNO_QUERY); const OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( ".uno:ShowSlide" )); maSlideImage = GetImage( xFrame, aSlotURL, true, false /* todo, hc mode */ ); -- cgit v1.2.3 From ae3daf0025db4af8550970d2e879f1efb2b22062 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 16 Dec 2009 12:22:02 +0100 Subject: dba33e: #i107715# check if parser is valid --- dbaccess/source/ui/browser/brwctrlr.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index f82839664973..7fd7ab89a21a 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1709,7 +1709,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const { // a native statement can't be filtered or sorted const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); - if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) + if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)) || !m_xParser.is() ) break; Reference< XPropertySet > xCurrentField = getBoundField(); @@ -1728,7 +1728,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const break; case ID_BROWSER_FILTERCRIT: - if ( m_bCannotSelectUnfiltered ) + if ( m_bCannotSelectUnfiltered && m_xParser.is() ) { aReturn.bEnabled = sal_True; break; @@ -1737,7 +1737,7 @@ FeatureState SbaXDataBrowserController::GetState(sal_uInt16 nId) const case ID_BROWSER_ORDERCRIT: { const Reference< XPropertySet > xFormSet(getRowSet(), UNO_QUERY); - if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING))) + if ( !::comphelper::getBOOL(xFormSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)) || !m_xParser.is() ) break; aReturn.bEnabled = getRowSet().is() -- cgit v1.2.3 From 6fd6b96682de8c9f2b8b10a896e71085a9914ecf Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 16 Dec 2009 12:46:33 +0100 Subject: dba33e: #i107717# impl first entry points for db extensions --- dbaccess/source/core/api/RowSet.cxx | 6 + .../source/core/api/SingleSelectQueryComposer.cxx | 22 +-- dbaccess/source/core/api/View.cxx | 151 ++++++++++++++++++ dbaccess/source/core/api/column.cxx | 19 ++- dbaccess/source/core/api/makefile.mk | 1 + dbaccess/source/core/api/resultcolumn.cxx | 22 ++- dbaccess/source/core/api/table.cxx | 177 ++++++--------------- dbaccess/source/core/api/viewcontainer.cxx | 82 +++------- dbaccess/source/core/dataaccess/ModelImpl.cxx | 11 ++ dbaccess/source/core/dataaccess/connection.cxx | 27 +++- dbaccess/source/core/dataaccess/connection.hxx | 50 +----- .../source/core/dataaccess/databasedocument.cxx | 37 +++-- dbaccess/source/core/dataaccess/datasource.cxx | 22 ++- dbaccess/source/core/inc/View.hxx | 92 +++++++++++ dbaccess/source/core/inc/sdbcoretools.hxx | 20 --- dbaccess/source/core/inc/table.hxx | 34 ---- dbaccess/source/core/misc/sdbcoretools.cxx | 33 ---- dbaccess/source/filter/xml/xmlDatabase.cxx | 66 ++++---- dbaccess/source/filter/xml/xmlExport.cxx | 112 +++++-------- dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 6 + dbaccess/source/ui/browser/unodatbr.cxx | 142 +++++++++++++---- dbaccess/source/ui/inc/unodatbr.hxx | 5 +- 22 files changed, 631 insertions(+), 506 deletions(-) create mode 100644 dbaccess/source/core/api/View.cxx create mode 100644 dbaccess/source/core/inc/View.hxx diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 8675ebaf0a07..3876fe47c365 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2422,6 +2422,12 @@ sal_Bool ORowSet::impl_buildActiveCommand_throw() { xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sCommand; xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING) >>= bDoEscapeProcessing; + if ( bDoEscapeProcessing != m_bUseEscapeProcessing ) + { + sal_Bool bOldValue = m_bUseEscapeProcessing; + m_bUseEscapeProcessing = bDoEscapeProcessing; + fireProperty(PROPERTY_ID_ESCAPE_PROCESSING,bOldValue,bDoEscapeProcessing); + } ::rtl::OUString aCatalog,aSchema,aTable; xQuery->getPropertyValue(PROPERTY_UPDATE_CATALOGNAME) >>= aCatalog; diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 04c5e9d37faa..c5d34665f6c3 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -37,6 +37,7 @@ #include "dbastrings.hrc" #include "HelperCollections.hxx" #include "SingleSelectQueryComposer.hxx" +#include "sdbcoretools.hxx" /** === begin UNO includes === **/ #include @@ -228,24 +229,11 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc OSL_ENSURE(m_sDecimalSep.getLength() == 1,"OSingleSelectQueryComposer::OSingleSelectQueryComposer decimal separator is not 1 length"); try { - Reference< XChild> xChild(_xConnection, UNO_QUERY); - if(xChild.is()) + Any aValue; + Reference xDs = dbaccess::getDataSource(_xConnection); + if ( dbtools::getDataSourceSetting(xDs,static_cast (PROPERTY_BOOLEANCOMPARISONMODE),aValue) ) { - Reference< XPropertySet> xProp(xChild->getParent(),UNO_QUERY); - if ( xProp.is() ) - { - Sequence< PropertyValue > aInfo; - xProp->getPropertyValue(PROPERTY_INFO) >>= aInfo; - const PropertyValue* pBegin = aInfo.getConstArray(); - const PropertyValue* pEnd = pBegin + aInfo.getLength(); - for (; pBegin != pEnd; ++pBegin) - { - if ( pBegin->Name == static_cast (PROPERTY_BOOLEANCOMPARISONMODE) ) - { - OSL_VERIFY( pBegin->Value >>= m_nBoolCompareMode ); - } - } - } + OSL_VERIFY( aValue >>= m_nBoolCompareMode ); } } catch(Exception&) diff --git a/dbaccess/source/core/api/View.cxx b/dbaccess/source/core/api/View.cxx new file mode 100644 index 000000000000..d7e5221446b0 --- /dev/null +++ b/dbaccess/source/core/api/View.cxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: View.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_dbaccess.hxx" + +#include "View.hxx" +#include "dbastrings.hrc" + +#include "connectivity/dbexception.hxx" +#include "connectivity/dbtools.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + /** === begin UNO using === **/ + using namespace ::com::sun::star::uno; + using ::com::sun::star::sdbc::XDatabaseMetaData; + using ::com::sun::star::sdbc::SQLException; + using ::com::sun::star::sdbc::XConnection; + using ::com::sun::star::lang::WrappedTargetException; + using ::com::sun::star::lang::XMultiServiceFactory; + using ::com::sun::star::sdbc::XResultSet; + using ::com::sun::star::sdbc::XStatement; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::sdbc::XRow; + /** === end UNO using === **/ + + //==================================================================== + //= View + //==================================================================== + //-------------------------------------------------------------------- + View::View( const Reference< XConnection >& _rxConnection, sal_Bool _bCaseSensitive, + const ::rtl::OUString& _rCatalogName,const ::rtl::OUString& _rSchemaName, const ::rtl::OUString& _rName ) + :View_Base( _bCaseSensitive, _rName, _rxConnection->getMetaData(), 0, ::rtl::OUString(), _rSchemaName, _rCatalogName ) + { + m_nCommandHandle = getProperty(PROPERTY_COMMAND).Handle; + try + { + Reference xFac(_rxConnection,UNO_QUERY_THROW); + static const ::rtl::OUString s_sViewSupport(RTL_CONSTASCII_USTRINGPARAM("ViewSupportServiceName")); + m_xViewSupport.set(xFac->createInstance(s_sViewSupport),UNO_QUERY); + } + catch(const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + //-------------------------------------------------------------------- + View::~View() + { + } + + //-------------------------------------------------------------------- + IMPLEMENT_FORWARD_REFCOUNT( View, View_Base ) + IMPLEMENT_GET_IMPLEMENTATION_ID( View ) + // ------------------------------------------------------------------------- + Any SAL_CALL View::queryInterface( const Type & _rType ) throw(RuntimeException) + { + if(_rType == getCppuType( (Reference*)0) && !m_xViewSupport.is() ) + return Any(); + Any aReturn = View_Base::queryInterface( _rType ); + if ( !aReturn.hasValue() ) + aReturn = View_IBASE::queryInterface( _rType ); + return aReturn; + } + // ------------------------------------------------------------------------- + Sequence< Type > SAL_CALL View::getTypes( ) throw(RuntimeException) + { + Type aAlterType = getCppuType( (Reference*)0); + + Sequence< Type > aTypes( ::comphelper::concatSequences(View_Base::getTypes(),View_IBASE::getTypes()) ); + ::std::vector aOwnTypes; + aOwnTypes.reserve(aTypes.getLength()); + + const Type* pIter = aTypes.getConstArray(); + const Type* pEnd = pIter + aTypes.getLength(); + for(;pIter != pEnd ;++pIter) + { + if( (*pIter != aAlterType || m_xViewSupport.is()) ) + aOwnTypes.push_back(*pIter); + } + + Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; + return Sequence< Type >(pTypes, aOwnTypes.size()); + } + + //-------------------------------------------------------------------- + void SAL_CALL View::alterCommand( const ::rtl::OUString& _rNewCommand ) throw (SQLException, RuntimeException) + { + OSL_ENSURE(m_xViewSupport.is(),"Illegal call to AlterView!"); + m_xViewSupport->alterCommand(this,_rNewCommand); + } + + //-------------------------------------------------------------------- + void SAL_CALL View::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const + { + if ( _nHandle == m_nCommandHandle && m_xViewSupport.is() ) + { + // retrieve the very current command, don't rely on the base classes cached value + // (which we initialized empty, anyway) + _rValue <<= m_xViewSupport->getCommand(const_cast(this)); + return; + } + + View_Base::getFastPropertyValue( _rValue, _nHandle ); + } + // ----------------------------------------------------------------------------- +//........................................................................ +} // namespace dbaccess +//........................................................................ diff --git a/dbaccess/source/core/api/column.cxx b/dbaccess/source/core/api/column.cxx index f789394d23f9..89e17d0e3ce4 100644 --- a/dbaccess/source/core/api/column.cxx +++ b/dbaccess/source/core/api/column.cxx @@ -417,7 +417,16 @@ sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString& _rForName, cons else if ( m_pTable && !m_pTable->isNew() ) { if ( m_bAddColumn ) - xReturn = OColumns_BASE::appendObject( _rForName, descriptor ); + { + Reference< ::com::sun::star::sdb::tools::XTableAlteration> xAlterService = m_pTable->getAlterService(); + if ( xAlterService.is() ) + { + xAlterService->addColumn(m_pTable,descriptor); + xReturn = createObject( _rForName ); + } + else + xReturn = OColumns_BASE::appendObject( _rForName, descriptor ); + } else ::dbtools::throwGenericSQLException( DBA_RES( RID_STR_NO_COLUMN_ADD ), static_cast(static_cast(this)) ); } @@ -443,7 +452,13 @@ void OColumns::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) else if ( m_pTable && !m_pTable->isNew() ) { if ( m_bDropColumn ) - OColumns_BASE::dropObject(_nPos,_sElementName); + { + Reference< ::com::sun::star::sdb::tools::XTableAlteration> xAlterService = m_pTable->getAlterService(); + if ( xAlterService.is() ) + xAlterService->dropColumn(m_pTable,_sElementName); + else + OColumns_BASE::dropObject(_nPos,_sElementName); + } else ::dbtools::throwGenericSQLException( DBA_RES( RID_STR_NO_COLUMN_DROP ), static_cast(static_cast(this)) ); } diff --git a/dbaccess/source/core/api/makefile.mk b/dbaccess/source/core/api/makefile.mk index f983db38b640..df80f0423e14 100644 --- a/dbaccess/source/core/api/makefile.mk +++ b/dbaccess/source/core/api/makefile.mk @@ -74,6 +74,7 @@ SLOFILES= \ $(SLO)$/SingleSelectQueryComposer.obj \ $(SLO)$/HelperCollections.obj \ $(SLO)$/datasettings.obj \ + $(SLO)$/View.obj \ $(SLO)$/columnsettings.obj # --- Targets ---------------------------------- diff --git a/dbaccess/source/core/api/resultcolumn.cxx b/dbaccess/source/core/api/resultcolumn.cxx index 33cc93b02994..1f9d1938caf8 100644 --- a/dbaccess/source/core/api/resultcolumn.cxx +++ b/dbaccess/source/core/api/resultcolumn.cxx @@ -110,20 +110,26 @@ void OResultColumn::impl_determineIsRowVersion_nothrow() getPropertyValue( PROPERTY_TABLENAME ) >>= sTable; getPropertyValue( PROPERTY_NAME ) >>= sColumnName; - Reference< XResultSet > xVersionColumns = m_xDBMetaData->getVersionColumns( - makeAny( sCatalog ), sSchema, sTable ); - if ( xVersionColumns.is() ) // allowed to be NULL + try { - Reference< XRow > xResultRow( xVersionColumns, UNO_QUERY_THROW ); - while ( xVersionColumns->next() ) + Reference< XResultSet > xVersionColumns = m_xDBMetaData->getVersionColumns( + makeAny( sCatalog ), sSchema, sTable ); + if ( xVersionColumns.is() ) // allowed to be NULL { - if ( xResultRow->getString( 2 ) == sColumnName ) + Reference< XRow > xResultRow( xVersionColumns, UNO_QUERY_THROW ); + while ( xVersionColumns->next() ) { - m_aIsRowVersion <<= (sal_Bool)(sal_True); - break; + if ( xResultRow->getString( 2 ) == sColumnName ) + { + m_aIsRowVersion <<= (sal_Bool)(sal_True); + break; + } } } } + catch(const SQLException&) + { + } } catch( const Exception& ) { diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 301038903b97..d88537fb72f8 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -31,77 +31,33 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_TABLE_HXX_ #include "table.hxx" -#endif -#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_ #include -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ #include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ #include "core_resource.hrc" -#endif -#ifndef _TOOLS_DEBUG_HXX -#include -#endif +#include "CIndexes.hxx" -#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include #include -#endif -#ifndef _COMPHELPER_ENUMHELPER_HXX_ #include -#endif -#ifndef _COMPHELPER_CONTAINER_HXX_ #include -#endif -#ifndef _COMPHELPER_SEQUENCE_HXX_ #include -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include -#endif -#ifndef _COM_SUN_STAR_UTIL_XREFRESHLISTENER_HPP_ +//#include #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_ #include -#endif +#include +#include + #include -#ifndef DBACCESS_INDEXES_HXX_ -#include "CIndexes.hxx" -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ #include -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ #include -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ -#include -#endif -#ifndef DBACORE_SDBCORETOOLS_HXX + #include "sdbcoretools.hxx" -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_ -#include -#endif -#ifndef DBA_CONTAINERMEDIATOR_HXX #include "ContainerMediator.hxx" -#endif #include using namespace dbaccess; @@ -152,6 +108,7 @@ ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables :OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers()) ,m_nPrivileges(-1) { + DBG_CTOR(ODBTable, NULL); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" ); } // ------------------------------------------------------------------------- @@ -311,18 +268,18 @@ void ODBTable::construct() describeProperties(aProps); if(!_nId) { - Property* pBegin = aProps.getArray(); - Property* pEnd = pBegin + aProps.getLength(); - for(;pBegin != pEnd;++pBegin) + Property* pIter = aProps.getArray(); + Property* pEnd = pIter + aProps.getLength(); + for(;pIter != pEnd;++pIter) { - if (0 == pBegin->Name.compareToAscii(PROPERTY_CATALOGNAME)) - pBegin->Attributes = PropertyAttribute::READONLY; - else if (0 == pBegin->Name.compareToAscii(PROPERTY_SCHEMANAME)) - pBegin->Attributes = PropertyAttribute::READONLY; - else if (0 == pBegin->Name.compareToAscii(PROPERTY_DESCRIPTION)) - pBegin->Attributes = PropertyAttribute::READONLY; - else if (0 == pBegin->Name.compareToAscii(PROPERTY_NAME)) - pBegin->Attributes = PropertyAttribute::READONLY; + if (0 == pIter->Name.compareToAscii(PROPERTY_CATALOGNAME)) + pIter->Attributes = PropertyAttribute::READONLY; + else if (0 == pIter->Name.compareToAscii(PROPERTY_SCHEMANAME)) + pIter->Attributes = PropertyAttribute::READONLY; + else if (0 == pIter->Name.compareToAscii(PROPERTY_DESCRIPTION)) + pIter->Attributes = PropertyAttribute::READONLY; + else if (0 == pIter->Name.compareToAscii(PROPERTY_NAME)) + pIter->Attributes = PropertyAttribute::READONLY; } } @@ -340,14 +297,11 @@ IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_ Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" ); - Any aRet; - if(rType == getCppuType( (Reference*)0)) + if(rType == getCppuType( (Reference*)0) && !getRenameService().is() ) return Any(); - if(rType == getCppuType( (Reference*)0)) + if(rType == getCppuType( (Reference*)0) && !getAlterService().is() ) return Any(); - aRet = OTable_Base::queryInterface( rType); - - return aRet; + return OTable_Base::queryInterface( rType); } // ------------------------------------------------------------------------- Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) @@ -360,12 +314,12 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) ::std::vector aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd ;++pBegin) + const Type* pIter = aTypes.getConstArray(); + const Type* pEnd = pIter + aTypes.getLength(); + for(;pIter != pEnd ;++pIter) { - if(*pBegin != aRenameType && *pBegin != aAlterType) - aOwnTypes.push_back(*pBegin); + if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is())) + aOwnTypes.push_back(*pIter); } Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0]; @@ -373,10 +327,17 @@ Sequence< Type > SAL_CALL ODBTable::getTypes( ) throw(RuntimeException) } // XRename, //------------------------------------------------------------------------------ -void SAL_CALL ODBTable::rename( const ::rtl::OUString& /*_rNewName*/ ) throw(SQLException, ElementExistException, RuntimeException) +void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" ); - throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() ); + ::osl::MutexGuard aGuard(m_aMutex); + checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed); + if ( !getRenameService().is() ) + throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() ); + + Reference xTable(this); + getRenameService()->rename(xTable,_rNewName); + ::connectivity::OTable_TYPEDEF::rename(_rNewName); } // XAlterTable, @@ -385,55 +346,15 @@ void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" ); ::osl::MutexGuard aGuard(m_aMutex); - checkDisposed( - connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed); - if(m_pColumns->hasByName(_rName)) - { - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); - ::rtl::OUString aQuote; - Reference xMeta = getMetaData(); - if ( xMeta.is() ) - aQuote = xMeta->getIdentifierQuoteString( ); - ::rtl::OUString sComposedName; - - sComposedName = ::dbtools::composeTableName( xMeta, m_CatalogName, m_SchemaName, m_Name, sal_True, ::dbtools::eInTableDefinitions ); - if(!sComposedName.getLength()) - ::dbtools::throwFunctionSequenceException(*this); - - sSql += sComposedName; - sSql += ::rtl::OUString::createFromAscii(" ALTER "); - sSql += ::dbtools::quoteName(aQuote,_rName); - - ::rtl::OUString sNewDefaultValue,sDefaultValue; - - Reference xColumn; - m_pColumns->getByName(_rName) >>= xColumn; - if(_rxDescriptor->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE)) - _rxDescriptor->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sNewDefaultValue; - if(xColumn.is() && xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE)) - xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sDefaultValue; - - if(sNewDefaultValue != sDefaultValue && getMetaData().is() ) - { - if(sNewDefaultValue.getLength()) - { - sSql += ::rtl::OUString::createFromAscii(" SET DEFAULT "); - sSql += sNewDefaultValue; - } - else - sSql += ::rtl::OUString::createFromAscii(" DROP DEFAULT"); - OSL_ENSURE(getMetaData()->getConnection().is(),"Connection is null!"); - Reference< XStatement > xStmt = getMetaData()->getConnection()->createStatement( ); - if(xStmt.is()) - xStmt->execute(sSql); - } - else - // not supported - throw SQLException(DBACORE_RESSTRING(RID_STR_NO_ALTER_COLUMN_DEF),*this,SQLSTATE_GENERAL,1000,Any() ); - } - else - // not supported - throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_ALTER_BY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); + checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed); + if ( !getAlterService().is() ) + throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() ); + + if ( !m_pColumns->hasByName(_rName) ) + throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() ); + + Reference xTable(this); + getAlterService()->alterColumnByName(xTable,_rName,_rxDescriptor); m_pColumns->refresh(); } // ----------------------------------------------------------------------------- @@ -476,8 +397,8 @@ sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" ); Reference xMeta = getMetaData(); OColumns* pCol = new OColumns(*this, m_aMutex, NULL, isCaseSensitive(), _rNames, this,this, - xMeta.is() && xMeta->supportsAlterTableWithAddColumn(), - xMeta.is() && xMeta->supportsAlterTableWithDropColumn()); + getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithAddColumn()), + getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithDropColumn())); static_cast(pCol)->setParent(this); pCol->setParent(*this); m_pColumnMediator = new OContainerMediator( pCol, m_xColumnDefinitions, getConnection(), OContainerMediator::eColumns ); @@ -497,7 +418,3 @@ sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames) return new OIndexes(this,m_aMutex,_rNames,NULL); } // ----------------------------------------------------------------------------- - - - - diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx index 342d68eea0ba..4f57aa29b4ec 100644 --- a/dbaccess/source/core/api/viewcontainer.cxx +++ b/dbaccess/source/core/api/viewcontainer.cxx @@ -31,74 +31,30 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef _DBA_CORE_VIEWCONTAINER_HXX_ #include "viewcontainer.hxx" -#endif -#ifndef DBACCESS_SHARED_DBASTRINGS_HRC #include "dbastrings.hrc" -#endif -#ifndef _TOOLS_DEBUG_HXX +#include "core_resource.hxx" +#include "core_resource.hrc" +#include "View.hxx" + #include -#endif -#ifndef _WLDCRD_HXX #include -#endif -#ifndef _COMPHELPER_ENUMHELPER_HXX_ #include -#endif -#ifndef _DBA_CORE_RESOURCE_HXX_ -#include "core_resource.hxx" -#endif -#ifndef _DBA_CORE_RESOURCE_HRC_ -#include "core_resource.hrc" -#endif +#include +#include +#include +#include +#include -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include -#endif - -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include -#endif -#ifndef _COMPHELPER_TYPES_HXX_ -#include -#endif -#ifndef _CONNECTIVITY_DBTOOLS_HXX_ -#include -#endif -#ifndef _COMPHELPER_EXTRACT_HXX_ -#include -#endif -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include -#endif -#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_ -#include -#endif -#ifndef _RTL_USTRBUF_HXX_ -#include -#endif +#include +#include +#include using namespace dbaccess; using namespace dbtools; @@ -159,14 +115,12 @@ ObjectType OViewContainer::createObject(const ::rtl::OUString& _rName) sSchema, sTable, ::dbtools::eInDataManipulation); - return new ::connectivity::sdbcx::OView(isCaseSensitive(), - sTable, - m_xMetaData, - 0, - ::rtl::OUString(), - sSchema, - sCatalog - ); + return new View(m_xConnection, + isCaseSensitive(), + sCatalog, + sSchema, + sTable + ); } return xProp; diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 8b050effc894..b5a7b8ddf439 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1149,6 +1149,17 @@ const AsciiPropertyValue* ODatabaseModelImpl::getDefaultDataSourceSettings() AsciiPropertyValue( "FormsCheckRequiredFields", makeAny( (sal_Bool)sal_True ) ), AsciiPropertyValue( "EscapeDateTime", makeAny( (sal_Bool)sal_True ) ), + // known services to handle database tasks + AsciiPropertyValue( "TableAlterationServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "TableRenameServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "ViewAlterationServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "ViewSupportServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "CommandDefinitionSupplier", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "FormSupplier", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "ReportSupplier", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "KeyAlterationServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue( "IndexAlterationServiceName", makeAny( ::rtl::OUString() ) ), + AsciiPropertyValue() }; return aKnownSettings; diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 043198388976..41ae7e0e0b25 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -42,6 +42,7 @@ #include "ContainerMediator.hxx" #include "SingleSelectQueryComposer.hxx" #include "querycomposer.hxx" +#include "sdbcoretools.hxx" /** === begin UNO includes === **/ #include @@ -617,7 +618,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "OConnection::refresh" ); if ( _rToBeRefreshed == Reference< XNameAccess >(m_pTables) ) { - if (!m_pTables->isInitialized()) + if (m_pTables && !m_pTables->isInitialized()) { impl_fillTableFilter(); // check if our "master connection" can supply tables @@ -635,7 +636,7 @@ void OConnection::refresh(const Reference< XNameAccess >& _rToBeRefreshed) } else if ( _rToBeRefreshed == Reference< XNameAccess >(m_pViews) ) { - if (!m_pViews->isInitialized()) + if (m_pViews && !m_pViews->isInitialized()) { impl_fillTableFilter(); // check if our "master connection" can supply tables @@ -729,6 +730,28 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const ::rtl::OUStr xRet = new OSingleSelectQueryComposer( getTables(),this, m_aContext ); m_aComposers.push_back(WeakReferenceHelper(xRet)); } + else + { + Reference xDs = dbaccess::getDataSource(*this); + Any aValue; + if ( dbtools::getDataSourceSetting(xDs,_sServiceSpecifier,aValue) ) + { + ::rtl::OUString sSupportService; + aValue >>= sSupportService; + if ( sSupportService.getLength() ) + { + TSupportServices::iterator aFind = m_aSupportServices.find(sSupportService); + if ( aFind == m_aSupportServices.end()) + { + Sequence aArgs(1); + Reference xMy(this); + aArgs[0] <<= NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ActiveConnection")),makeAny(xMy)); + aFind = m_aSupportServices.insert(TSupportServices::value_type(sSupportService,m_aContext.createComponentWithArguments(sSupportService,aArgs))).first; + } + return aFind->second; + } + } + } return Reference< XInterface >(xRet,UNO_QUERY); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx index 88e59f007a25..98b8535953db 100644 --- a/dbaccess/source/core/dataaccess/connection.hxx +++ b/dbaccess/source/core/dataaccess/connection.hxx @@ -30,62 +30,25 @@ #ifndef _DBA_CORE_CONNECTION_HXX_ #define _DBA_CORE_CONNECTION_HXX_ -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _DBA_CORE_QUERYCONTAINER_HXX_ #include "querycontainer.hxx" -#endif -#ifndef _DBA_CORE_TABLECONTAINER_HXX_ #include "tablecontainer.hxx" -#endif -#ifndef _DBA_CORE_VIEWCONTAINER_HXX_ #include "viewcontainer.hxx" -#endif -#ifndef DBA_CORE_REFRESHLISTENER_HXX #include "RefreshListener.hxx" -#endif -#ifndef DBTOOLS_WARNINGSCONTAINER_HXX -#include -#endif /** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSERFACTORY_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XCOMMANDPREPARATION_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XUSERSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XGROUPSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_TOOLS_XCONNECTIONTOOLS_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_APPLICATION_XTABLEUIPROVIDER_HPP_ #include -#endif /** === end UNO includes === **/ #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_14) @@ -93,14 +56,10 @@ #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 14 #include #endif - -#ifndef COMPHELPER_COMPONENTCONTEXT_HXX #include -#endif - -#ifndef _CONNECTIVITY_CONNECTIONWRAPPER_HXX_ +#include #include -#endif +#include //........................................................................ namespace dbaccess @@ -151,6 +110,11 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XConnectionTools > m_xConnectionTools; ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XTableUIProvider > m_xTableUIProvider; + // defines the helper services for example to query the command of a view + // @ see com.sun.star.sdb.tools.XViewSupport + DECLARE_STL_USTRINGACCESS_MAP( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>, TSupportServices); + TSupportServices m_aSupportServices; + OTableContainer* m_pTables; OViewContainer* m_pViews; diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 6708dbfa56bb..2cc3f0604c6a 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -41,15 +41,6 @@ #include "databasecontext.hxx" #include "documentcontainer.hxx" -#include -#include -#include -#include -#include -#include -#include - -#include /** === begin UNO includes === **/ #include @@ -80,6 +71,13 @@ #include #include #include +#include +#include + +#include + +#include + #include #include #include @@ -1151,8 +1149,25 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa Reference< XNameAccess > xContainer = rContainerRef; if ( !xContainer.is() ) { - TContentPtr& rContainerData( m_pImpl->getObjectContainer( _eType ) ); - rContainerRef = xContainer = new ODocumentContainer( m_pImpl->m_aContext.getLegacyServiceFactory(), *this, rContainerData, bFormsContainer ); + Any aValue; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xMy(*this); + if ( dbtools::getDataSourceSetting(xMy,bFormsContainer ? "FormSupplier" : "ReportSupplier",aValue) ) + { + ::rtl::OUString sSupportService; + aValue >>= sSupportService; + if ( sSupportService.getLength() ) + { + Sequence aArgs(1); + aArgs[0] <<= NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSource")),makeAny(xMy)); + xContainer.set(m_pImpl->m_aContext.createComponentWithArguments(sSupportService,aArgs),UNO_QUERY); + rContainerRef = xContainer; + } + } + if ( !xContainer.is() ) + { + TContentPtr& rContainerData( m_pImpl->getObjectContainer( _eType ) ); + rContainerRef = xContainer = new ODocumentContainer( m_pImpl->m_aContext.getLegacyServiceFactory(), *this, rContainerData, bFormsContainer ); + } impl_reparent_nothrow( xContainer ); } return xContainer; diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index f7fc11a5d80a..94a634c652e7 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -42,6 +42,7 @@ #include "SharedConnection.hxx" #include "databasedocument.hxx" + /** === begin UNO includes === **/ #include #include @@ -70,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -1357,8 +1359,24 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) throw( Reference< XNameAccess > xContainer = m_pImpl->m_xCommandDefinitions; if ( !xContainer.is() ) { - TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_QUERY ) ); - xContainer = new OCommandContainer( m_pImpl->m_aContext.getLegacyServiceFactory(), *this, rContainerData, sal_False ); + Any aValue; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xMy(*this); + if ( dbtools::getDataSourceSetting(xMy,"CommandDefinitionSupplier",aValue) ) + { + ::rtl::OUString sSupportService; + aValue >>= sSupportService; + if ( sSupportService.getLength() ) + { + Sequence aArgs(1); + aArgs[0] <<= NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataSource")),makeAny(xMy)); + xContainer.set(m_pImpl->m_aContext.createComponentWithArguments(sSupportService,aArgs),UNO_QUERY); + } + } + if ( !xContainer.is() ) + { + TContentPtr& rContainerData( m_pImpl->getObjectContainer( ODatabaseModelImpl::E_QUERY ) ); + xContainer = new OCommandContainer( m_pImpl->m_aContext.getLegacyServiceFactory(), *this, rContainerData, sal_False ); + } m_pImpl->m_xCommandDefinitions = xContainer; } return xContainer; diff --git a/dbaccess/source/core/inc/View.hxx b/dbaccess/source/core/inc/View.hxx new file mode 100644 index 000000000000..90226d011d84 --- /dev/null +++ b/dbaccess/source/core/inc/View.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: View.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef DBACCESS_VIEW_HXX +#define DBACCESS_VIEW_HXX + +#include "connectivity/sdbcx/VView.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + //==================================================================== + //= View + //==================================================================== + typedef ::connectivity::sdbcx::OView View_Base; + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XAlterView > View_IBASE; + class View :public View_Base + ,public View_IBASE + { + public: + View( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, + sal_Bool _bCaseSensitive, + const ::rtl::OUString& _rCatalogName, + const ::rtl::OUString& _rSchemaName, + const ::rtl::OUString& _rName + ); + + // UNO + DECLARE_XINTERFACE() + DECLARE_XTYPEPROVIDER() + + // XAlterView + virtual void SAL_CALL alterCommand( const ::rtl::OUString& NewCommand ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + virtual ~View(); + + protected: + // OPropertyContainer + virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const; + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XViewSupport> m_xViewSupport; + sal_Int32 m_nCommandHandle; + private: + using View_Base::getFastPropertyValue; + }; + +//........................................................................ +} // namespace dbaccess +//........................................................................ + +#endif // DBACCESS_VIEW_HXX diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx index a7e2b9986f7e..fd49f1faa387 100644 --- a/dbaccess/source/core/inc/sdbcoretools.hxx +++ b/dbaccess/source/core/inc/sdbcoretools.hxx @@ -51,26 +51,6 @@ namespace dbaccess getDataSource( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDependentObject ); // ----------------------------------------------------------------------------- - /** retrieves a particular indirect data source setting - - @param _rxDataSource - a data source component - @param _pAsciiSettingsName - the ASCII name of the setting to obtain - @param _rSettingsValue - the value of the setting, upon successfull return - - @return - if the setting is not present in the DataSource::Info - member of the data source - otherwise - */ - bool getDataSourceSetting( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource, - const sal_Char* _pAsciiSettingsName, - ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue - ); - //......................................................................... } // namespace dbaccess //......................................................................... diff --git a/dbaccess/source/core/inc/table.hxx b/dbaccess/source/core/inc/table.hxx index 9573f03ba40c..1f34dfd5dd9b 100644 --- a/dbaccess/source/core/inc/table.hxx +++ b/dbaccess/source/core/inc/table.hxx @@ -31,58 +31,24 @@ #ifndef _DBA_CORE_TABLE_HXX_ #define _DBA_CORE_TABLE_HXX_ -#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XINDEXESSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ #include -#endif -#ifndef _CPPUHELPER_COMPBASE2_HXX_ #include -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ #include "apitools.hxx" -#endif -#ifndef _DBA_CORE_DATASETTINGS_HXX_ #include "datasettings.hxx" -#endif -#ifndef _DBA_COREAPI_COLUMN_HXX_ #include -#endif -#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #include -#endif -#ifndef CONNECTIVITY_TABLEHELPER_HXX #include -#endif -#ifndef _COMPHELPER_UNO3_HXX_ #include -#endif -#ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX #include -#endif namespace dbaccess { diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx index 75a1cd6b36eb..ab189749783e 100644 --- a/dbaccess/source/core/misc/sdbcoretools.cxx +++ b/dbaccess/source/core/misc/sdbcoretools.cxx @@ -96,39 +96,6 @@ namespace dbaccess return xReturn; } - // ------------------------------------------------------------------------- - bool getDataSourceSetting( const Reference< XInterface >& _rxDataSource, const sal_Char* _pAsciiSettingsName, - Any& /* [out] */ _rSettingsValue ) - { - bool bIsPresent = false; - try - { - Reference< XPropertySet > xDataSource( _rxDataSource, UNO_QUERY ); - OSL_ENSURE( xDataSource.is(), "getDataSourceSetting: invalid data source object!" ); - if ( !xDataSource.is() ) - return false; - - Sequence< PropertyValue > aSettings; - OSL_VERIFY( xDataSource->getPropertyValue( PROPERTY_INFO ) >>= aSettings ); - const PropertyValue* pSetting = aSettings.getConstArray(); - const PropertyValue* pSettingEnd = aSettings.getConstArray() + aSettings.getLength(); - for ( ; pSetting != pSettingEnd; ++pSetting ) - { - if ( pSetting->Name.equalsAscii( _pAsciiSettingsName ) ) - { - _rSettingsValue = pSetting->Value; - bIsPresent = true; - break; - } - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "getDataSourceSetting: caught an exception!" ); - } - return bIsPresent; - } - // ----------------------------------------------------------------------------- //......................................................................... } // namespace dbaccess diff --git a/dbaccess/source/filter/xml/xmlDatabase.cxx b/dbaccess/source/filter/xml/xmlDatabase.cxx index 3f3f183ba038..89111c6e6e48 100644 --- a/dbaccess/source/filter/xml/xmlDatabase.cxx +++ b/dbaccess/source/filter/xml/xmlDatabase.cxx @@ -30,45 +30,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBA_XMLDATABASE_HXX #include "xmlDatabase.hxx" -#endif -#ifndef DBA_XMLFILTER_HXX #include "xmlfilter.hxx" -#endif -#ifndef _XMLOFF_XMLTOKEN_HXX #include -#endif -#ifndef _XMLOFF_XMLNMSPE_HXX #include -#endif -#ifndef DBA_XMLDATASOURCE_HXX #include "xmlDataSource.hxx" -#endif -#ifndef DBA_XMLDOCUMENTS_HXX #include "xmlDocuments.hxx" -#endif -#ifndef DBA_XMLENUMS_HXX #include "xmlEnums.hxx" -#endif -#ifndef _COM_SUN_STAR_SDB_XREPORTDOCUMENTSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XFORMDOCUMENTSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ #include -#endif -#ifndef DBACCESS_SHARED_XMLSTRINGS_HRC #include "xmlstrings.hrc" -#endif -#ifndef _TOOLS_DEBUG_HXX #include -#endif +#include namespace dbaxml { @@ -111,25 +86,46 @@ SvXMLImportContext* OXMLDatabase::CreateChildContext( case XML_TOK_FORMS: { GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - Reference xSup(GetOwnImport().GetModel(),UNO_QUERY); - if ( xSup.is() ) - pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getFormDocuments(),SERVICE_NAME_FORM_COLLECTION,SERVICE_SDB_DOCUMENTDEFINITION); + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"FormSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) + { + Reference xSup(GetOwnImport().GetModel(),UNO_QUERY); + if ( xSup.is() ) + pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getFormDocuments(),SERVICE_NAME_FORM_COLLECTION,SERVICE_SDB_DOCUMENTDEFINITION); + } } break; case XML_TOK_REPORTS: { GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - Reference xSup(GetOwnImport().GetModel(),UNO_QUERY); - if ( xSup.is() ) - pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getReportDocuments(),SERVICE_NAME_REPORT_COLLECTION,SERVICE_SDB_DOCUMENTDEFINITION); + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"ReportSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) + { + Reference xSup(GetOwnImport().GetModel(),UNO_QUERY); + if ( xSup.is() ) + pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getReportDocuments(),SERVICE_NAME_REPORT_COLLECTION,SERVICE_SDB_DOCUMENTDEFINITION); + } } break; case XML_TOK_QUERIES: { GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - Reference xSup(GetOwnImport().getDataSource(),UNO_QUERY); - if ( xSup.is() ) - pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getQueryDefinitions(),SERVICE_NAME_QUERY_COLLECTION); + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(GetOwnImport().getDataSource(),"CommandDefinitionSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) + { + Reference xSup(GetOwnImport().getDataSource(),UNO_QUERY); + if ( xSup.is() ) + pContext = new OXMLDocuments( GetOwnImport(), nPrefix, rLocalName,xSup->getQueryDefinitions(),SERVICE_NAME_QUERY_COLLECTION); + } } break; case XML_TOK_TABLES: diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 8008416956f4..370e849c40b3 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -31,82 +31,37 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_dbaccess.hxx" -#ifndef DBA_XMLEXPORT_HXX #include "xmlExport.hxx" -#endif -#ifndef DBA_XMLAUTOSTYLE_HXX #include "xmlAutoStyle.hxx" -#endif -#ifndef _FLT_REGHELPER_HXX_ #include "flt_reghelper.hxx" -#endif -#ifndef _XMLOFF_PROGRESSBARHELPER_HXX #include -#endif -#ifndef _XMLOFF_XMLTOKEN_HXX #include -#endif -#ifndef _XMLOFF_TEXTIMP_HXX_ #include -#endif -#ifndef _XMLOFF_XMLNMSPE_HXX #include -#endif -#ifndef _XMLOFF_XMLUCONV_HXX #include -#endif -#ifndef _XMLOFF_NMSPMAP_HXX #include -#endif -#ifndef _COMPHELPER_TYPES_HXX_ #include -#endif -#ifndef DBACCESS_SHARED_XMLSTRINGS_HRC #include "xmlstrings.hrc" -#endif -#ifndef DBA_XMLENUMS_HXX #include "xmlEnums.hxx" -#endif -#ifndef _XMLOFF_NMSPMAP_HXX #include -#endif -#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XFORMDOCUMENTSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XREPORTDOCUMENTSSUPPLIER_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_ #include -#endif #include #include -#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_ #include -#endif -#ifndef _XMLOFF_XMLUCONV_HXX #include -#endif -#ifndef DBA_XMLHELPER_HXX #include "xmlHelper.hxx" -#endif -#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_ #include -#endif #include #include #include #include +#include #include @@ -1110,47 +1065,68 @@ void ODBExport::exportColumns(const Reference& _xColSup) // ----------------------------------------------------------------------------- void ODBExport::exportForms() { - Reference xSup(GetModel(),UNO_QUERY); - if ( xSup.is() ) + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(getDataSource(),"ReportSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) { - Reference< XNameAccess > xCollection = xSup->getFormDocuments(); - if ( xCollection.is() && xCollection->hasElements() ) + Reference xSup(GetModel(),UNO_QUERY); + if ( xSup.is() ) { - ::comphelper::mem_fun1_t aMemFunc(&ODBExport::exportComponent); - exportCollection(xCollection,XML_FORMS,XML_COMPONENT_COLLECTION,sal_True,aMemFunc); + Reference< XNameAccess > xCollection = xSup->getFormDocuments(); + if ( xCollection.is() && xCollection->hasElements() ) + { + ::comphelper::mem_fun1_t aMemFunc(&ODBExport::exportComponent); + exportCollection(xCollection,XML_FORMS,XML_COMPONENT_COLLECTION,sal_True,aMemFunc); + } } } } // ----------------------------------------------------------------------------- void ODBExport::exportReports() { - Reference xSup(GetModel(),UNO_QUERY); - if ( xSup.is() ) + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(getDataSource(),"ReportSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) { - Reference< XNameAccess > xCollection = xSup->getReportDocuments(); - if ( xCollection.is() && xCollection->hasElements() ) + Reference xSup(GetModel(),UNO_QUERY); + if ( xSup.is() ) { - ::comphelper::mem_fun1_t aMemFunc(&ODBExport::exportComponent); - exportCollection(xCollection,XML_REPORTS,XML_COMPONENT_COLLECTION,sal_True,aMemFunc); + Reference< XNameAccess > xCollection = xSup->getReportDocuments(); + if ( xCollection.is() && xCollection->hasElements() ) + { + ::comphelper::mem_fun1_t aMemFunc(&ODBExport::exportComponent); + exportCollection(xCollection,XML_REPORTS,XML_COMPONENT_COLLECTION,sal_True,aMemFunc); + } } } } // ----------------------------------------------------------------------------- void ODBExport::exportQueries(sal_Bool _bExportContext) { - Reference xSup(getDataSource(),UNO_QUERY); - if ( xSup.is() ) + Any aValue; + ::rtl::OUString sService; + dbtools::getDataSourceSetting(getDataSource(),"CommandDefinitionSupplier",aValue); + aValue >>= sService; + if ( !sService.getLength() ) { - Reference< XNameAccess > xCollection = xSup->getQueryDefinitions(); - if ( xCollection.is() && xCollection->hasElements() ) + Reference xSup(getDataSource(),UNO_QUERY); + if ( xSup.is() ) { - ::std::auto_ptr< ::comphelper::mem_fun1_t > pMemFunc; - if ( _bExportContext ) - pMemFunc.reset( new ::comphelper::mem_fun1_t(&ODBExport::exportQuery) ); - else - pMemFunc.reset( new ::comphelper::mem_fun1_t(&ODBExport::exportAutoStyle) ); + Reference< XNameAccess > xCollection = xSup->getQueryDefinitions(); + if ( xCollection.is() && xCollection->hasElements() ) + { + ::std::auto_ptr< ::comphelper::mem_fun1_t > pMemFunc; + if ( _bExportContext ) + pMemFunc.reset( new ::comphelper::mem_fun1_t(&ODBExport::exportQuery) ); + else + pMemFunc.reset( new ::comphelper::mem_fun1_t(&ODBExport::exportAutoStyle) ); - exportCollection(xCollection,XML_QUERIES,XML_QUERY_COLLECTION,_bExportContext,*pMemFunc); + exportCollection(xCollection,XML_QUERIES,XML_QUERY_COLLECTION,_bExportContext,*pMemFunc); + } } } } diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index 51121b022e88..2af41d70cc13 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -119,7 +119,13 @@ SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType( SvLBoxEntry* return etTableOrView; if (pQueries == pEntryParent) + { + DBTreeListUserData* pEntryData = static_cast(_pEntry->GetUserData()); + if ( pEntryData ) + return pEntryData->eType; + return etQuery; + } return etUnknown; } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index b2cfbe04a515..8377edda3017 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -519,6 +519,8 @@ sal_Bool SbaTableQueryBrowser::InitializeGridModel(const Reference< ::com::sun:: DBTreeListUserData* pData = static_cast(m_pCurrentlyDisplayed->GetUserData()); OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeGridModel: No table available!" ); + if ( !pData->xObjectProperties.is() ) + return sal_False; ::rtl::OUString* pStringIter = aProperties.getArray(); Any* pValueIter = aValues.getArray(); @@ -732,7 +734,7 @@ Reference getColumnHelper(SvLBoxEntry* _pCurrentlyDisplayed,const ::rtl::OUString aName; _rxSource->getPropertyValue(PROPERTY_NAME) >>= aName; if(xNames.is() && xNames->hasByName(aName)) - ::cppu::extractInterface(xRet,xNames->getByName(aName)); + xRet.set(xNames->getByName(aName),UNO_QUERY); } return xRet; } @@ -1100,7 +1102,17 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS m_pTreeView->getListBox().Expand(pCommandType); // look for the object - pObject = m_pTreeView->getListBox().GetEntryPosByName(_rCommand, pCommandType); + ::rtl::OUString sCommand = _rCommand; + sal_Int32 nIndex = 0; + do + { + ::rtl::OUString sPath = sCommand.getToken( 0, '/', nIndex ); + pObject = m_pTreeView->getListBox().GetEntryPosByName(sPath, pCommandType); + pCommandType = pObject; + if (_bExpandAncestors && nIndex >= 0 ) + m_pTreeView->getListBox().Expand(pCommandType); + } + while ( nIndex >= 0 ); } } } @@ -1991,7 +2003,7 @@ void SbaTableQueryBrowser::initializeTreeModel() } } // ------------------------------------------------------------------------- -sal_Bool SbaTableQueryBrowser::populateTree(const Reference& _xNameAccess, +void SbaTableQueryBrowser::populateTree(const Reference& _xNameAccess, SvLBoxEntry* _pParent, EntryType _eEntryType) { @@ -2008,34 +2020,39 @@ sal_Bool SbaTableQueryBrowser::populateTree(const Reference& _xName { if(!m_pTreeView->getListBox().GetEntryPosByName(*pIter,_pParent)) { + Reference xChild(_xNameAccess->getByName(*pIter),UNO_QUERY); DBTreeListUserData* pEntryData = new DBTreeListUserData; pEntryData->eType = _eEntryType; - implAppendEntry( _pParent, *pIter, pEntryData, _eEntryType ); + if ( _eEntryType == etQuery && xChild.is() ) + { + pEntryData->eType = etQueryContainer; + } + implAppendEntry( _pParent, *pIter, pEntryData, pEntryData->eType ); } } } catch(Exception&) { DBG_ERROR("SbaTableQueryBrowser::populateTree: could not fill the tree"); - return sal_False; } - return sal_True; } //------------------------------------------------------------------------------ -void SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, EntryType _eEntryType ) +SvLBoxEntry* SbaTableQueryBrowser::implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, EntryType _eEntryType ) { ::std::auto_ptr< ImageProvider > pImageProvider( getImageProviderFor( _pParent ) ); Image aImage, aImageHC; pImageProvider->getImages( _rName, getDatabaseObjectType( _eEntryType ), aImage, aImageHC ); - SvLBoxEntry* pNewEntry = m_pTreeView->getListBox().InsertEntry( _rName, _pParent, sal_False, LIST_APPEND, _pUserData ); + SvLBoxEntry* pNewEntry = m_pTreeView->getListBox().InsertEntry( _rName, _pParent, _eEntryType == etQueryContainer , LIST_APPEND, _pUserData ); m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL ); m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImage, BMP_COLOR_NORMAL ); m_pTreeView->getListBox().SetExpandedEntryBmp( pNewEntry, aImageHC, BMP_COLOR_HIGHCONTRAST ); m_pTreeView->getListBox().SetCollapsedEntryBmp( pNewEntry, aImageHC, BMP_COLOR_HIGHCONTRAST ); + + return pNewEntry; } //------------------------------------------------------------------------------ @@ -2166,29 +2183,54 @@ sal_Bool SbaTableQueryBrowser::ensureEntryObject( SvLBoxEntry* _pEntry ) break; } - try { - Reference< XQueryDefinitionsSupplier > xQuerySup; - m_xDatabaseContext->getByName( getDataSourceAcessor( pDataSourceEntry ) ) >>= xQuerySup; - if (xQuerySup.is()) + SvLBoxEntry* pParent = m_pTreeView->getListBox().GetParent(_pEntry); + if ( pParent != pDataSourceEntry ) { - Reference< XNameAccess > xQueryDefs = xQuerySup->getQueryDefinitions(); - Reference< XContainer > xCont(xQueryDefs, UNO_QUERY); - if (xCont.is()) - // add as listener to get notified if elements are inserted or removed - xCont->addContainerListener(this); + SvLBoxString* pString = (SvLBoxString*)_pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); + OSL_ENSURE(pString,"There must be a string item!"); + ::rtl::OUString aName(pString->GetText()); + DBTreeListUserData* pData = static_cast(pParent->GetUserData()); + try + { + Reference< XNameAccess > xNameAccess(pData->xContainer,UNO_QUERY); + if ( xNameAccess.is() ) + pEntryData->xContainer.set(xNameAccess->getByName(aName),UNO_QUERY); + } + catch(const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } - pEntryData->xContainer = xQueryDefs; bSuccess = pEntryData->xContainer.is(); } - else { - DBG_ERROR("SbaTableQueryBrowser::ensureEntryObject: no XQueryDefinitionsSupplier interface!"); + else + { + try + { + Reference< XQueryDefinitionsSupplier > xQuerySup; + m_xDatabaseContext->getByName( getDataSourceAcessor( pDataSourceEntry ) ) >>= xQuerySup; + if (xQuerySup.is()) + { + Reference< XNameAccess > xQueryDefs = xQuerySup->getQueryDefinitions(); + Reference< XContainer > xCont(xQueryDefs, UNO_QUERY); + if (xCont.is()) + // add as listener to get notified if elements are inserted or removed + xCont->addContainerListener(this); + + pEntryData->xContainer = xQueryDefs; + bSuccess = pEntryData->xContainer.is(); + } + else { + DBG_ERROR("SbaTableQueryBrowser::ensureEntryObject: no XQueryDefinitionsSupplier interface!"); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } break; default: @@ -2343,7 +2385,18 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectionChange, void*, /*NOINTERESTEDIN*/) { return implSelect( m_pTreeView->getListBox().FirstSelected() ) ? 1L : 0L; } - +//------------------------------------------------------------------------------ +SvLBoxEntry* SbaTableQueryBrowser::implGetConnectionEntry(SvLBoxEntry* _pEntry) const +{ + SvLBoxEntry* pCurrentEntry = _pEntry; + DBTreeListUserData* pEntryData = static_cast< DBTreeListUserData* >( pCurrentEntry->GetUserData() ); + while(pEntryData->eType != etDatasource ) + { + pCurrentEntry = m_pTreeModel->GetParent(pCurrentEntry); + pEntryData = static_cast< DBTreeListUserData* >( pCurrentEntry->GetUserData() ); + } + return pCurrentEntry; +} //------------------------------------------------------------------------------ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) { @@ -2369,7 +2422,7 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) DBTreeListUserData* pContainerData = static_cast(pContainer->GetUserData()); // get the entry for the datasource - SvLBoxEntry* pConnection = m_pTreeModel->GetParent(pContainer); + SvLBoxEntry* pConnection = implGetConnectionEntry(pContainer); DBTreeListUserData* pConData = static_cast(pConnection->GetUserData()); // reinitialize the rowset @@ -2380,12 +2433,26 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) xRowSetProps->getPropertyValue(PROPERTY_COMMAND) >>= aOldName; sal_Int32 nOldType = 0; xRowSetProps->getPropertyValue(PROPERTY_COMMAND_TYPE) >>= nOldType; - Reference xOldConnection; - ::cppu::extractInterface(xOldConnection,xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION)); + Reference xOldConnection(xRowSetProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY); + // the name of the table or query SvLBoxString* pString = (SvLBoxString*)_pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); OSL_ENSURE(pString,"There must be a string item!"); - ::rtl::OUString aName(pString->GetText().GetBuffer()); + const ::rtl::OUString sSimpleName = pString->GetText(); + ::rtl::OUStringBuffer sNameBuffer(sSimpleName); + if ( etQueryContainer == pContainerData->eType ) + { + SvLBoxEntry* pTemp = pContainer; + while( m_pTreeModel->GetParent(pTemp) != pConnection ) + { + sNameBuffer.insert(0,sal_Unicode('/')); + pString = (SvLBoxString*)pTemp->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING); + OSL_ENSURE(pString,"There must be a string item!"); + sNameBuffer.insert(0,pString->GetText()); + pTemp = m_pTreeModel->GetParent(pTemp); + } + } + ::rtl::OUString aName = sNameBuffer.makeStringAndClear(); sal_Int32 nCommandType = ( etTableContainer == pContainerData->eType) ? CommandType::TABLE @@ -2443,9 +2510,14 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) break; case CommandType::QUERY: { - Reference xSup( pConData->xConnection, UNO_QUERY ); - if(xSup.is()) - xNameAccess = xSup->getQueries(); + if ( pContainerData->xContainer.is() ) + xNameAccess.set( pContainerData->xContainer, UNO_QUERY ); + else + { + Reference xSup( pConData->xConnection, UNO_QUERY ); + if(xSup.is()) + xNameAccess = xSup->getQueries(); + } } break; } @@ -2453,13 +2525,13 @@ bool SbaTableQueryBrowser::implSelect( SvLBoxEntry* _pEntry ) sStatus.SearchAndReplaceAscii("$name$", aName); BrowserViewStatusDisplay aShowStatus(static_cast(getView()), sStatus); - if(xNameAccess.is() && xNameAccess->hasByName(aName)) + if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName)) { DBTreeListUserData* pData = static_cast(_pEntry->GetUserData()); if ( !pData->xObjectProperties.is() ) { Reference xObject; - if(xNameAccess->getByName(aName) >>= xObject) // remember the table or query object + if(xNameAccess->getByName(sSimpleName) >>= xObject) // remember the table or query object { pData->xObjectProperties = pData->xObjectProperties.query( xObject ); // if the query contains a parameterized statement and preview is enabled we won't get any data. @@ -3499,7 +3571,7 @@ void SbaTableQueryBrowser::loadMenu(const Reference< XFrame >& _xFrame) { SvLBoxEntry* pContainer = m_pTreeModel->GetParent(m_pCurrentlyDisplayed); // get the entry for the datasource - SvLBoxEntry* pConnection = m_pTreeModel->GetParent(pContainer); + SvLBoxEntry* pConnection = implGetConnectionEntry(pContainer); ::rtl::OUString sName = m_pTreeView->getListBox().GetEntryText(m_pCurrentlyDisplayed); sTitle = GetEntryText( pConnection ); INetURLObject aURL(sTitle); diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index 23d9cfd5b542..3436d565367f 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -374,7 +374,7 @@ namespace dbaui */ void closeConnection(SvLBoxEntry* _pEntry,sal_Bool _bDisposeConnection = sal_True); - sal_Bool populateTree(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xNameAccess, SvLBoxEntry* _pParent, EntryType _eEntryType); + void populateTree(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xNameAccess, SvLBoxEntry* _pParent, EntryType _eEntryType); void initializeTreeModel(); /** search in the tree for query- or tablecontainer equal to this interface and return @@ -433,8 +433,9 @@ namespace dbaui sal_Bool _bSelectDirect = sal_False ); + SvLBoxEntry* implGetConnectionEntry(SvLBoxEntry* _pEntry) const; /// inserts an entry into the tree - void implAppendEntry( + SvLBoxEntry* implAppendEntry( SvLBoxEntry* _pParent, const String& _rName, void* _pUserData, -- cgit v1.2.3 From 018712caf37633eb7808051d9fb89f8497a61eb8 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Wed, 16 Dec 2009 12:46:33 +0100 Subject: dba33e: #i107717# impl first entry points for db extensions --- .../com/sun/star/sdb/tools/XConnectionSupport.idl | 67 ++++++++++++ offapi/com/sun/star/sdb/tools/XIndexAlteration.idl | 96 ++++++++++++++++++ offapi/com/sun/star/sdb/tools/XKeyAlteration.idl | 96 ++++++++++++++++++ offapi/com/sun/star/sdb/tools/XTableAlteration.idl | 112 +++++++++++++++++++++ offapi/com/sun/star/sdb/tools/XTableRename.idl | 78 ++++++++++++++ offapi/com/sun/star/sdb/tools/XViewSupport.idl | 88 ++++++++++++++++ offapi/com/sun/star/sdb/tools/makefile.mk | 8 +- 7 files changed, 544 insertions(+), 1 deletion(-) create mode 100644 offapi/com/sun/star/sdb/tools/XConnectionSupport.idl create mode 100644 offapi/com/sun/star/sdb/tools/XIndexAlteration.idl create mode 100644 offapi/com/sun/star/sdb/tools/XKeyAlteration.idl create mode 100644 offapi/com/sun/star/sdb/tools/XTableAlteration.idl create mode 100644 offapi/com/sun/star/sdb/tools/XTableRename.idl create mode 100644 offapi/com/sun/star/sdb/tools/XViewSupport.idl diff --git a/offapi/com/sun/star/sdb/tools/XConnectionSupport.idl b/offapi/com/sun/star/sdb/tools/XConnectionSupport.idl new file mode 100644 index 000000000000..df5af67899f8 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XConnectionSupport.idl @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XConnectionSupport.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XConnectionSupport_idl__ +#define __com_sun_star_sdb_tools_XConnectionSupport_idl__ + +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to access the active connection + + @see com::sun::star::sdbcx::XConnection + + @since OOo 3.3 +*/ +interface XConnectionSupport +{ + /** returns the source connection. + */ + [attribute, readonly] com::sun::star::sdbc::XConnection ActiveConnection; + + interface com::sun::star::lang::XInitialization; + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl new file mode 100644 index 000000000000..12ed8fd55266 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XIndexAlteration.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XIndexAlteration_idl__ +#define __com_sun_star_sdb_tools_XIndexAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include +#endif +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter the indexes of a table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XIndexAlteration +{ + interface XConnectionSupport; + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param index + the name of the column to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void dropIndex([in] com::sun::star::beans::XPropertySet table,[in] string index) + raises ( com::sun::star::sdbc::SQLException); + + /** creates a new object using the given descriptor and appends it + to the related container. + + Note: + + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void addIndex([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl new file mode 100644 index 000000000000..12b4c0bc22bc --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XKeyAlteration.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XKeyAlteration_idl__ +#define __com_sun_star_sdb_tools_XKeyAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include +#endif +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter the keys of a table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XKeyAlteration +{ + interface XConnectionSupport; + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param key + the key to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void dropKey([in] com::sun::star::beans::XPropertySet table,[in] com::sun::star::beans::XPropertySet key) + raises ( com::sun::star::sdbc::SQLException); + + /** creates a new object using the given descriptor and appends it + to the related container. + + Note: + + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void addKey([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XTableAlteration.idl b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl new file mode 100644 index 000000000000..d57feff8d4c0 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTableAlteration.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XTableAlteration_idl__ +#define __com_sun_star_sdb_tools_XTableAlteration_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include +#endif +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to alter table. + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::ColumnDescriptor + @see com::sun::star::sdbcx::XAlterTable + @see com::sun::star::sdbcx::XAppend + @see com::sun::star::sdbcx::XDrop + + @since OOo 3.3 +*/ +interface XTableAlteration +{ + interface XConnectionSupport; + + /** rename the given table to the new name + + @param table + the table to be altered + + @param columnName + the name of the column to be changed + + @param columnDescriptor + the column descriptor with the information of the new column definition + + @throws com::sun::star::sdbc::SQLException + */ + void alterColumnByName( [in] com::sun::star::beans::XPropertySet table, [in] string columnName, [in] com::sun::star::beans::XPropertySet columnDescriptor) + raises ( com::sun::star::sdbc::SQLException ); + + /** creates a new object using the given descriptor and appends it + to the related container. + + Note: + + The descriptor will not be changed and can be used again to append another object. + @param table + the table to be altered + @param descriptor + the descriptor which should be serve to append a new object + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void addColumn([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor) + raises (com::sun::star::sdbc::SQLException); + + /** drops an object of the related container identified by its name. + @param table + the table to be altered + @param columnName + the name of the column to be dropped + @throws com::sun::star::sdbc::SQLException + if a database access error occurs. + */ + void dropColumn([in] com::sun::star::beans::XPropertySet table,[in]string columnName) + raises ( com::sun::star::sdbc::SQLException); +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XTableRename.idl b/offapi/com/sun/star/sdb/tools/XTableRename.idl new file mode 100644 index 000000000000..5c4a14695ea8 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XTableRename.idl @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XTableRename.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XTableRename_idl__ +#define __com_sun_star_sdb_tools_XTableRename_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include +#endif +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to rename table. + + @see com::sun::star::sdb::DataSource::Settings + + @since OOo 3.3 +*/ +interface XTableRename +{ + interface XConnectionSupport; + + /** rename the given table to the new name + + @param table + the table to be renamed + @param newName + the new name of the table + @throws com::sun::star::sdbc::SQLException + */ + void rename( [in] com::sun::star::beans::XPropertySet table, [in] string newName) + raises ( com::sun::star::sdbc::SQLException ); + + +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/XViewSupport.idl b/offapi/com/sun/star/sdb/tools/XViewSupport.idl new file mode 100644 index 000000000000..51367386dc30 --- /dev/null +++ b/offapi/com/sun/star/sdb/tools/XViewSupport.idl @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XViewSupport.idl,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_sdb_tools_XViewSupport_idl__ +#define __com_sun_star_sdb_tools_XViewSupport_idl__ + +#ifndef __com_sun_star_sdbc_SQLException_idl__ +#include +#endif +#include +#ifndef __com_sun_star_lang_XInitialization_idl__ +#include +#endif +#ifndef __com_sun_star_beans_XPropertySet_idl__ +#include +#endif + +//============================================================================= +module com { module sun { module star { module sdb { module tools { +//============================================================================= + +//----------------------------------------------------------------------------- +/** allows to fetch the sql statements of views + + @see com::sun::star::sdb::DataSource::Settings + @see com::sun::star::sdbcx::View + + @since OOo 3.3 +*/ +interface XViewSupport +{ + interface XConnectionSupport; + + /** returns the SQL statement of the view + + @param view + the table to be renamed + @throws com::sun::star::sdbc::SQLException + */ + string getCommand( [in] com::sun::star::beans::XPropertySet view) + raises ( com::sun::star::sdbc::SQLException ); + + /** rename the given table to the new name + + @param view + the view to be altered + + @param command + the new SQL statement + + @throws com::sun::star::sdbc::SQLException + */ + void alterCommand( [in] com::sun::star::beans::XPropertySet view, [in] string command) + raises ( com::sun::star::sdbc::SQLException ); +}; +//============================================================================= +}; }; }; }; }; +//============================================================================= + +#endif + diff --git a/offapi/com/sun/star/sdb/tools/makefile.mk b/offapi/com/sun/star/sdb/tools/makefile.mk index 487ae720e4e2..d654250b5eaf 100644 --- a/offapi/com/sun/star/sdb/tools/makefile.mk +++ b/offapi/com/sun/star/sdb/tools/makefile.mk @@ -48,7 +48,13 @@ IDLFILES=\ XConnectionTools.idl \ XDataSourceMetaData.idl \ XObjectNames.idl \ - XTableName.idl + XTableName.idl \ + XTableRename.idl \ + XViewSupport.idl \ + XTableAlteration.idl \ + XKeyAlteration.idl \ + XIndexAlteration.idl \ + XConnectionSupport.idl # ------------------------------------------------------------------ .INCLUDE : target.mk -- cgit v1.2.3 From 1b78e405c0ba9cb2833bd0ee9474ac45baddaef3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 16 Dec 2009 14:21:11 +0100 Subject: dba33e: #i107623# allow finishWizard to return a success flag, and re-enable the finish button in case of failure --- .../sun/star/wizards/agenda/AgendaWizardDialogImpl.java | 7 ++++--- wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 2 +- .../com/sun/star/wizards/fax/FaxWizardDialogImpl.java | 6 +++--- wizards/com/sun/star/wizards/form/FormWizard.java | 4 +++- .../sun/star/wizards/letter/LetterWizardDialogImpl.java | 6 +++--- wizards/com/sun/star/wizards/query/Finalizer.java | 2 +- wizards/com/sun/star/wizards/query/QueryWizard.java | 11 +++++------ wizards/com/sun/star/wizards/report/ReportWizard.java | 6 ++++-- wizards/com/sun/star/wizards/table/TableWizard.java | 4 +++- wizards/com/sun/star/wizards/ui/WizardDialog.java | 16 +++++++++++++--- wizards/com/sun/star/wizards/web/WWD_Events.java | 3 ++- 11 files changed, 42 insertions(+), 25 deletions(-) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 23dec6a80191..82f767a61ca4 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -459,7 +459,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog running = false; } - public void finishWizard() { + public boolean finishWizard() { boolean bSaveSuccess = false; // pesimistic :( XTextDocument xTextDocument; @@ -480,7 +480,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resFileExists); if (answer == 3) // user said: no, do not overwrite.... - return; + return false; } agendaTemplate.xTextDocument.lockControllers(); @@ -550,10 +550,11 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog } } else { agendaTemplate.xTextDocument.unlockControllers(); - return; + return false; } xDialog.endExecute(); running = false; + return true; } private void closeDocument() { diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index db5ccd32b8f7..10677558488c 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -292,7 +292,7 @@ public class SQLQueryComposer return sFromClause; } - public boolean setQueryCommand(String QueryName, XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) + public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) { try { diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index a8dbe94e5db0..fe726c430a9b 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -212,7 +212,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog running = false; } - public void finishWizard() + public boolean finishWizard() { switchToStep(getCurrentStep(), getMaxStep()); myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription); @@ -239,7 +239,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning); if (answer == 3) // user said: no, do not overwrite.... { - return; + return false; } } } @@ -297,7 +297,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog xDialog.endExecute(); running = false; } - + return true; } public void closeDocument() diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 5b0a7939f6c2..678e5d55f3b1 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -308,7 +308,7 @@ public class FormWizard extends WizardDialog } // @Override - public void finishWizard() + public boolean finishWizard() { int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE)) @@ -326,6 +326,7 @@ public class FormWizard extends WizardDialog { bcreateForm = true; xDialog.endExecute(); + return true; } } } @@ -335,6 +336,7 @@ public class FormWizard extends WizardDialog showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage); } } + return false; } // @Override diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index 1a47712ca213..5e5ce985c0c4 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -253,7 +253,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog running = false; } - public void finishWizard() + public boolean finishWizard() { switchToStep(getCurrentStep(), getMaxStep()); try @@ -279,7 +279,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning); if (answer == 3) // user said: no, do not overwrite.... { - return; + return false; } } } @@ -356,7 +356,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog xDialog.endExecute(); running = false; } - + return true; } public void closeDocument() diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 0a7f0a42aec8..f690102ea49f 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -177,7 +177,7 @@ public class Finalizer { CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData); String queryname = getTitle(); - boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true); + boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(CurUnoDialog.xWindow, true, true); if (bsuccess) { bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname); diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 14fe9c4757a9..6d6fd34f0a88 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -292,17 +292,16 @@ public class QueryWizard extends WizardDialog } } - public void finishWizard() + public boolean finishWizard() { int ncurStep = getCurrentStep(); - if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE)) + if ( ( ncurStep == SOSUMMARY_PAGE ) + || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) ) + ) { components = CurFinalizer.finish(); - if ( components == null ) - { - setControlProperty("btnWizardFinish", "Enabled", false); - } } + return ( components != null ); } protected void enterStep(int nOldStep, int nNewStep) diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index a4b4e3af18ad..a959c2dfd183 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -329,7 +329,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple boolean bQueryCreated = false; if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false); + bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(this.xWindow, false, false); CurReportDocument.setCommandType(CommandType.COMMAND); String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery(); @@ -520,7 +520,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple enableNavigationButtons(false, false, false); } - public void finishWizard() + public boolean finishWizard() { final int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)) @@ -532,9 +532,11 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple nReportMode = CurReportFinalizer.getReportOpenMode(); m_sReportName = CurReportFinalizer.getStoreName(); xDialog.endExecute(); + return true; } } } + return false; } public void cancelWizard() diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 9144dc607a9a..bee58c071546 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -289,7 +289,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet return bIsSuccessfull; } - public void finishWizard() + public boolean finishWizard() { super.switchToStep(super.getCurrentStep(), SOFINALPAGE); tablename = curFinalizer.getTableName(curScenarioSelector.getFirstTableName()); @@ -314,6 +314,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame); } super.xDialog.endExecute(); + return true; } } else @@ -323,6 +324,7 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet curFinalizer.setFocusToTableNameControl(); } } + return false; } private void callFormWizard() diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index 15b840fa9c89..01d97c4278ed 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -685,7 +685,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL } } - public abstract void finishWizard(); + public abstract boolean finishWizard(); /** * This function will call if the finish button is pressed on the UI. @@ -693,8 +693,18 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL public void finishWizard_1() { enableFinishButton(false); - finishWizard(); - removeTerminateListener(); + boolean success = false; + try + { + success = finishWizard(); + } + finally + { + if ( !success ) + enableFinishButton( true ); + } + if ( success ) + removeTerminateListener(); } public int getMaximalStep() diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java index e396a46ddd30..88b986bb631c 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ b/wizards/com/sun/star/wizards/web/WWD_Events.java @@ -942,9 +942,10 @@ public abstract class WWD_Events extends WWD_Startup /** * the user clicks the finish/create button. */ - public void finishWizard() + public boolean finishWizard() { finishWizard(true); + return true; } /** -- cgit v1.2.3 From 1806dfd473c3753064d8f5d40e760783912195ab Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 16 Dec 2009 23:25:02 +0100 Subject: dba33e: #i107438# allow loading documents hidden, by ensuring the document definition stays alive as long as the document is alive --- dbaccess/source/core/dataaccess/documentdefinition.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 20d1ce157b45..f4426025c6fa 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -721,7 +721,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow() // ensure that we ourself are kept alive as long as the embedded object's frame is // opened - LifetimeCoupler::couple( *this, Reference< XComponent >( xFrame, UNO_QUERY_THROW ) ); + LifetimeCoupler::couple( *this, xFrame.get() ); // init the edit view if ( m_bForm && m_bOpenInDesign ) @@ -1036,6 +1036,11 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons m_xEmbeddedObject->changeState( EmbedStates::ACTIVE ); ODocumentDefinition::impl_onActivateEmbeddedObject_nothrow(); } + else + { + // ensure that we ourself are kept alive as long as the document is open + LifetimeCoupler::couple( *this, xModel.get() ); + } if ( !m_bForm && m_pImpl->m_aProps.bAsTemplate && !m_bOpenInDesign ) ODocumentDefinition::fillReportData( m_aContext, getComponent(), xConnection ); -- cgit v1.2.3 From d510bfeda9869a98f489b81ccda8c1740fd2a8c3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 17 Dec 2009 10:49:04 +0100 Subject: dba33e: #i107251#: properly buld the select statement for filling the filter list when the field we're bound to has an alias name --- forms/source/component/Filter.cxx | 245 +++++++++++++++----------------------- forms/source/component/Filter.hxx | 5 +- 2 files changed, 97 insertions(+), 153 deletions(-) diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 0ddab1faecdb..0ff3faca8beb 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -106,7 +107,7 @@ namespace frm //--------------------------------------------------------------------- OFilterControl::OFilterControl( const Reference< XMultiServiceFactory >& _rxORB ) :m_aTextListeners( *this ) - ,m_xORB( _rxORB ) + ,m_aContext( _rxORB ) ,m_aParser( _rxORB ) ,m_nControlClass( FormComponentType::TEXTFIELD ) ,m_bFilterList( sal_False ) @@ -133,12 +134,11 @@ namespace frm if ( !m_xFormatter.is() ) { // we can create one from the connection, if it's an SDB connection - Reference< XNumberFormatsSupplier > xFormatSupplier = ::dbtools::getNumberFormats( m_xConnection, sal_True, m_xORB ); + Reference< XNumberFormatsSupplier > xFormatSupplier = ::dbtools::getNumberFormats( m_xConnection, sal_True, m_aContext.getLegacyServiceFactory() ); if ( xFormatSupplier.is() ) { - m_xFormatter = m_xFormatter.query( - m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ) ); + m_aContext.createComponent( "com.sun.star.util.NumberFormatter", m_xFormatter ); if ( m_xFormatter.is() ) m_xFormatter->attachNumberFormatsSupplier( xFormatSupplier ); } @@ -380,170 +380,114 @@ namespace frm // already asserted in ensureInitialized return; - // declare here for later disposal - Reference< XResultSet > xListCursor; - Reference< XStatement > xStatement; + // ensure the cursor and the statement are disposed as soon as we leave + ::utl::SharedUNOComponent< XResultSet > xListCursor; + ::utl::SharedUNOComponent< XStatement > xStatement; try { m_bFilterListFilled = sal_True; - Reference< XPropertySet > xSet(getModel(), UNO_QUERY); - if (xSet.is() && m_xField.is()) + if ( !m_xField.is() ) + return; + + ::rtl::OUString sFieldName; + m_xField->getPropertyValue( PROPERTY_NAME ) >>= sFieldName; + + // here we need a table to which the field belongs to + const Reference< XChild > xModelAsChild( getModel(), UNO_QUERY_THROW ); + const Reference< XRowSet > xForm( xModelAsChild->getParent(), UNO_QUERY_THROW ); + const Reference< XPropertySet > xFormProps( xForm, UNO_QUERY_THROW ); + + // create a query composer + const Reference< XConnection > xConnection( ::dbtools::getConnection( xForm ), UNO_SET_THROW ); + const Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY_THROW ); + const Reference< XSQLQueryComposer > xComposer( xFactory->createQueryComposer(), UNO_SET_THROW ); + + // set the statement on the composer + ::rtl::OUString sStatement; + xFormProps->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sStatement; + xComposer->setQuery( sStatement ); + + // the field we're bound to + const Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY_THROW ); + const Reference< XNameAccess > xFieldNames( xSuppColumns->getColumns(), UNO_SET_THROW ); + if ( !xFieldNames->hasByName( sFieldName ) ) + return; + ::rtl::OUString sRealFieldName, sTableName; + const Reference< XPropertySet > xComposerFieldProps( xFieldNames->getByName( sFieldName ), UNO_QUERY_THROW ); + xComposerFieldProps->getPropertyValue( PROPERTY_REALNAME ) >>= sRealFieldName; + xComposerFieldProps->getPropertyValue( PROPERTY_TABLENAME ) >>= sTableName; + + // obtain the table of the field + const Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY_THROW ); + const Reference< XNameAccess > xTablesNames( xSuppTables->getTables(), UNO_SET_THROW ); + const Reference< XNamed > xNamedTable( xTablesNames->getByName( sTableName ), UNO_QUERY_THROW ); + sTableName = xNamedTable->getName(); + + // create a statement selecting all values for the given field + ::rtl::OUStringBuffer aStatement; + + const Reference< XDatabaseMetaData > xMeta( xConnection->getMetaData(), UNO_SET_THROW ); + const ::rtl::OUString sQuoteChar = xMeta->getIdentifierQuoteString(); + + aStatement.appendAscii( "SELECT DISTINCT " ); + aStatement.append( sQuoteChar ); + aStatement.append( sRealFieldName ); + aStatement.append( sQuoteChar ); + + // if the field had an alias in our form's statement, give it this alias in the new statement, too + if ( sFieldName.getLength() && ( sFieldName != sRealFieldName ) ) { - ::rtl::OUString sName; - m_xField->getPropertyValue(PROPERTY_NAME) >>= sName; - - // here we need a table to which the field belongs to - Reference< XChild > xModelAsChild( xSet, UNO_QUERY ); - Reference< XRowSet > xForm( xModelAsChild->getParent(), UNO_QUERY ); - Reference< XPropertySet > xFormAsSet( xForm, UNO_QUERY ); - - // Connection holen - Reference< XConnection > xConnection; - if ( xForm.is() ) - xConnection = ::dbtools::getConnection( xForm ); - Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY ); - OSL_ENSURE( xFactory.is() && xFormAsSet.is(), "OFilterControl::implInitFilterList: invalid form or invalid connection!" ); - if ( !xFactory.is() || !xFormAsSet.is() ) - return; - - // create a query composer - Reference< XSQLQueryComposer > xComposer = xFactory->createQueryComposer(); - OSL_ENSURE( xComposer.is() , "OFilterControl::implInitFilterList: invalid query composer!" ); - if ( !xComposer.is() ) - return; - - // set the statement on the composer, ... - ::rtl::OUString sStatement; - xFormAsSet->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sStatement; - xComposer->setQuery( sStatement ); - - // ... and ask it for the involved tables and queries - Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY ); - Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY ); - - Reference< XNameAccess > xFieldNames; - if ( xSuppColumns.is() ) xFieldNames = xSuppColumns->getColumns(); - Reference< XNameAccess > xTablesNames; - if ( xSuppTables.is() ) xTablesNames = xSuppTables->getTables(); - - if ( !xFieldNames.is() || !xTablesNames.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::implInitFilterList: invalid query composer (no fields or no tables supplied)!" ); - return; - } - - // search the field - Reference< XPropertySet > xComposerFieldAsSet; - if ( xFieldNames->hasByName( sName ) ) - xFieldNames->getByName( sName ) >>= xComposerFieldAsSet; - - if ( xComposerFieldAsSet.is() - && ::comphelper::hasProperty( PROPERTY_TABLENAME, xComposerFieldAsSet ) - && ::comphelper::hasProperty( PROPERTY_REALNAME, xComposerFieldAsSet ) - ) - { - ::rtl::OUString sFieldName, sTableName; - xComposerFieldAsSet->getPropertyValue(PROPERTY_REALNAME) >>= sFieldName; - xComposerFieldAsSet->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName; - - // no possibility to create a select statement - // looking for the complete table name - if (!xTablesNames->hasByName(sTableName)) - return; - - // this is the tablename - Reference< XNamed > xName; - xTablesNames->getByName(sTableName) >>= xName; - OSL_ENSURE(xName.is(),"No XName interface!"); - sTableName = xName->getName(); - - // ein Statement aufbauen und abschicken als query - // Access to the connection - - Reference< XColumn > xDataField; - - Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData(); - ::rtl::OUString aQuote = xMeta->getIdentifierQuoteString(); - ::rtl::OUStringBuffer aStatement; - aStatement.appendAscii( "SELECT DISTINCT " ); - aStatement.append( ::dbtools::quoteName( aQuote, sName ) ); - - if ( sFieldName.getLength() && ( sName != sFieldName ) ) - { - aStatement.appendAscii(" AS "); - aStatement.append( ::dbtools::quoteName(aQuote, sFieldName) ); - } - - aStatement.appendAscii( " FROM " ); + aStatement.appendAscii(" AS "); + aStatement.append( sQuoteChar ); + aStatement.append( sFieldName ); + aStatement.append( sQuoteChar ); + } - ::rtl::OUString sCatalog, sSchema, sTable; - ::dbtools::qualifiedNameComponents( xMeta, sTableName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); - aStatement.append( ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sTable ) ); + aStatement.appendAscii( " FROM " ); - ::rtl::OUString sSelectStatement( aStatement.makeStringAndClear( ) ); - xStatement = xConnection->createStatement(); - xListCursor = xStatement->executeQuery( sSelectStatement ); + ::rtl::OUString sCatalog, sSchema, sTable; + ::dbtools::qualifiedNameComponents( xMeta, sTableName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); + aStatement.append( ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sTable ) ); - Reference< XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY); - Reference< XIndexAccess > xFields; - if (xSupplyCols.is()) - xFields = Reference< XIndexAccess > (xSupplyCols->getColumns(), UNO_QUERY); - if (xFields.is()) - xFields->getByIndex(0) >>= xDataField; - if (!xDataField.is()) - return; + // execute the statement + xStatement.reset( xConnection->createStatement() ); + const ::rtl::OUString sSelectStatement( aStatement.makeStringAndClear( ) ); + xListCursor.reset( xStatement->executeQuery( sSelectStatement ) ); + // retrieve the one column which we take the values from + const Reference< XColumnsSupplier > xSupplyCols( xListCursor, UNO_QUERY_THROW ); + const Reference< XIndexAccess > xFields( xSupplyCols->getColumns(), UNO_QUERY_THROW ); + const Reference< XPropertySet > xDataField( xFields->getByIndex(0), UNO_QUERY_THROW ); - sal_Int16 i = 0; - ::std::vector< ::rtl::OUString> aStringList; - aStringList.reserve(16); - ::rtl::OUString aStr; + // ensure the values will be formatted according to the field format + const ::dbtools::FormattedColumnValue aFormatter( m_xFormatter, xDataField ); - ::com::sun::star::util::Date aNullDate( ::dbtools::DBTypeConversion::getStandardDate() ); - sal_Int32 nFormatKey = 0; - try - { - m_xFormatter->getNumberFormatsSupplier()->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) - >>= aNullDate; - nFormatKey = ::comphelper::getINT32(m_xField->getPropertyValue(PROPERTY_FORMATKEY)); - } - catch(const Exception&) - { - } + ::std::vector< ::rtl::OUString > aProposals; + aProposals.reserve(16); + while ( xListCursor->next() && ( aProposals.size() < size_t( SHRT_MAX ) ) ) + { + const ::rtl::OUString sCurrentValue = aFormatter.getFormattedValue(); + aProposals.push_back( sCurrentValue ); + } - sal_Int16 nKeyType = ::comphelper::getNumberFormatType(m_xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey); - while ( xListCursor->next() && ( i++ < SHRT_MAX) ) - { - aStr = ::dbtools::DBTypeConversion::getValue(xDataField, m_xFormatter, aNullDate, nFormatKey, nKeyType); - aStringList.push_back(aStr); - } + // fill the list items into our peer + Sequence< ::rtl::OUString> aStringSeq( aProposals.size() ); + ::std::copy( aProposals.begin(), aProposals.end(), aStringSeq.getArray() ); - Sequence< ::rtl::OUString> aStringSeq(aStringList.size()); - ::rtl::OUString* pustrStrings = aStringSeq.getArray(); - for (i = 0; i < (sal_Int16)aStringList.size(); ++i) - pustrStrings[i] = aStringList[i]; + const Reference< XComboBox > xComboBox( getPeer(), UNO_QUERY_THROW ); + xComboBox->addItems( aStringSeq, 0 ); - Reference< XComboBox > xComboBox( getPeer(), UNO_QUERY); - if ( xComboBox.is() ) - { - xComboBox->addItems(aStringSeq, 0); - // set the drop down line count - sal_Int16 nLineCount = ::std::min( (sal_Int16)10, (sal_Int16)aStringSeq.getLength() ); - xComboBox->setDropDownLineCount( nLineCount ); - } - } - } + // set the drop down line count to something reasonable + const sal_Int16 nLineCount = ::std::min( sal_Int16( 16 ), sal_Int16( aStringSeq.getLength() ) ); + xComboBox->setDropDownLineCount( nLineCount ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } - - ::comphelper::disposeComponent( xListCursor ); - ::comphelper::disposeComponent( xStatement ); } // XFocusListener @@ -587,7 +531,7 @@ namespace frm aNewText.trim(); if ( aNewText.getLength() ) { - ::dbtools::OPredicateInputController aPredicateInput( m_xORB, m_xConnection, getParseContext() ); + ::dbtools::OPredicateInputController aPredicateInput( m_aContext.getLegacyServiceFactory(), m_xConnection, getParseContext() ); ::rtl::OUString sErrorMessage; if ( !aPredicateInput.normalizePredicateString( aNewText, m_xField, &sErrorMessage ) ) { @@ -780,7 +724,8 @@ namespace frm aArgs[1] <<= PropertyValue(::rtl::OUString::createFromAscii("ParentWindow"), 0, makeAny( m_xMessageParent ), PropertyState_DIRECT_VALUE); static ::rtl::OUString s_sDialogServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.sdb.ErrorMessageDialog" ); - Reference< XExecutableDialog > xErrorDialog( m_xORB->createInstanceWithArguments( s_sDialogServiceName, aArgs ), UNO_QUERY ); + + Reference< XExecutableDialog > xErrorDialog( m_aContext.createComponentWithArguments( s_sDialogServiceName, aArgs ), UNO_QUERY ); if ( xErrorDialog.is() ) xErrorDialog->execute(); else @@ -791,7 +736,7 @@ namespace frm } catch( const Exception& ) { - OSL_ENSURE( sal_False, "displayException: could not display the error message!" ); + DBG_UNHANDLED_EXCEPTION(); } } diff --git a/forms/source/component/Filter.hxx b/forms/source/component/Filter.hxx index f07c8ff883c8..b59b673ac664 100644 --- a/forms/source/component/Filter.hxx +++ b/forms/source/component/Filter.hxx @@ -40,11 +40,10 @@ #include #include -#ifndef _TOOLKIT_AWT_LISTENERMULTIPLEXER_HXX_ #include -#endif #include #include +#include #include #include #include @@ -72,7 +71,7 @@ namespace frm { TextListenerMultiplexer m_aTextListeners; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + ::comphelper::ComponentContext m_aContext; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; -- cgit v1.2.3 From 738f9f2e8577984fa90f1376078e18c1f57bf64b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 17 Dec 2009 11:15:02 +0100 Subject: dba33e: #i107611#: display a text sample for text formats, to better distinguish text formats from non-text formats --- .../source/propctrlr/formcomponenthandler.cxx | 2 +- extensions/source/propctrlr/propres.src | 5 ++ extensions/source/propctrlr/propresid.hrc | 3 +- extensions/source/propctrlr/usercontrol.cxx | 58 ++++++++++++++-------- extensions/source/propctrlr/usercontrol.hxx | 3 ++ 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index f21e70a20f47..6f580ec2422e 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2710,7 +2710,7 @@ namespace pcr SvNumberFormatter* pFormatter = pSupplier->GetNumberFormatter(); double dPreviewVal = OFormatSampleControl::getPreviewValue(pFormatter,nFormatKey); - SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, SID_ATTR_NUMBERFORMAT_INFO ); + SvxNumberInfoItem aFormatter( pFormatter, dPreviewVal, String( PcrRes( RID_STR_TEXT_FORMAT ) ), SID_ATTR_NUMBERFORMAT_INFO ); aCoreSet.Put( aFormatter ); // a tab dialog with a single page diff --git a/extensions/source/propctrlr/propres.src b/extensions/source/propctrlr/propres.src index 7ce673f8136f..6d2729f12625 100644 --- a/extensions/source/propctrlr/propres.src +++ b/extensions/source/propctrlr/propres.src @@ -64,3 +64,8 @@ String RID_EMBED_IMAGE_PLACEHOLDER { Text [ en-US ] = ""; }; + +String RID_STR_TEXT_FORMAT +{ + Text [ en-US ] = "Text"; +}; diff --git a/extensions/source/propctrlr/propresid.hrc b/extensions/source/propctrlr/propresid.hrc index 705638accf98..1f857616905c 100644 --- a/extensions/source/propctrlr/propresid.hrc +++ b/extensions/source/propctrlr/propresid.hrc @@ -45,6 +45,7 @@ #define RID_STR_PROPPAGE_DEFAULT ( RID_PROPCONTROLLER_START + 1 ) #define RID_STR_PROPPAGE_DATA ( RID_PROPCONTROLLER_START + 2 ) #define RID_STR_HELP_SECTION_LABEL ( RID_PROPCONTROLLER_START + 3 ) -#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 5 ) +#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 4 ) +#define RID_STR_TEXT_FORMAT ( RID_PROPCONTROLLER_START + 5 ) #endif // EXTENSIONS_PROPRESID_HRC diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx index 005659f3576a..40dc288f64f4 100644 --- a/extensions/source/propctrlr/usercontrol.cxx +++ b/extensions/source/propctrlr/usercontrol.cxx @@ -44,6 +44,7 @@ #include #include "modulepcr.hxx" #include "propresid.hrc" + //............................................................................ namespace pcr { @@ -118,11 +119,44 @@ namespace pcr getTypedControlWindow()->SetFormatKey( nFormatKey ); SvNumberFormatter* pNF = getTypedControlWindow()->GetFormatter(); - getTypedControlWindow()->SetValue( getPreviewValue(pNF,getTypedControlWindow()->GetFormatKey()) ); + const SvNumberformat* pEntry = pNF->GetEntry( nFormatKey ); + OSL_ENSURE( pEntry, "OFormatSampleControl::setValue: invalid format entry!" ); + + const bool bIsTextFormat = ( pEntry && pEntry->IsTextFormat() ); + if ( bIsTextFormat ) + getTypedControlWindow()->SetText( String( PcrRes( RID_STR_TEXT_FORMAT ) ) ); + else + getTypedControlWindow()->SetValue( pEntry ? getPreviewValue( *pEntry ) : 1234.56789 ); } else getTypedControlWindow()->SetText( String() ); } + //------------------------------------------------------------------ + double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry ) + { + double nValue = 1234.56789; + switch ( i_rEntry.GetType() & ~NUMBERFORMAT_DEFINED ) + { + case NUMBERFORMAT_DATE: + { + Date aCurrentDate; + static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast(aCurrentDate.GetDate())),STANDARD_DB_DATE); + } + break; + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_DATETIME: + { + Time aCurrentTime; + nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); + } + break; + default: + break; + } + return nValue; + } + //------------------------------------------------------------------ double OFormatSampleControl::getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey) { @@ -130,27 +164,7 @@ namespace pcr DBG_ASSERT( pEntry, "OFormattedNumericControl::SetFormatDescription: invalid format key!" ); double nValue = 1234.56789; if ( pEntry ) - { - switch (pEntry->GetType() & ~NUMBERFORMAT_DEFINED) - { - case NUMBERFORMAT_DATE: - { - Date aCurrentDate; - static ::com::sun::star::util::Date STANDARD_DB_DATE(30,12,1899); - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(static_cast(aCurrentDate.GetDate())),STANDARD_DB_DATE); - } - break; - case NUMBERFORMAT_TIME: - case NUMBERFORMAT_DATETIME: - { - Time aCurrentTime; - nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime())); - } - break; - default: - break; - } - } + nValue = getPreviewValue( *pEntry ); return nValue; } //------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/usercontrol.hxx b/extensions/source/propctrlr/usercontrol.hxx index 0d9a0e5a85d7..3fca7e12324f 100644 --- a/extensions/source/propctrlr/usercontrol.hxx +++ b/extensions/source/propctrlr/usercontrol.hxx @@ -90,6 +90,9 @@ namespace pcr * \return current date or time or the value 1234.56789 */ static double getPreviewValue(SvNumberFormatter* _pNF,sal_Int32 _nFormatKey); + + private: + static double getPreviewValue( const SvNumberformat& i_rEntry ); }; //======================================================================== -- cgit v1.2.3 From 1eac49df5c337a5832231514c7e352009f0295fd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 18 Dec 2009 07:02:42 +0100 Subject: dba33e: remove unused header --- dbaccess/source/core/inc/View.hxx | 1 - 1 file changed, 1 deletion(-) diff --git a/dbaccess/source/core/inc/View.hxx b/dbaccess/source/core/inc/View.hxx index 90226d011d84..0cda27afcf82 100644 --- a/dbaccess/source/core/inc/View.hxx +++ b/dbaccess/source/core/inc/View.hxx @@ -35,7 +35,6 @@ /** === begin UNO includes === **/ #include -#include #include /** === end UNO includes === **/ -- cgit v1.2.3 From ade249bf2b4be34133fc9d86939b66e8cdfe6559 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 09:48:23 +0100 Subject: autorecovery: removed a few unused slot IDs --- sw/sdi/_docsh.sdi | 4 ---- sw/source/ui/app/docsh2.cxx | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi index 9154e6ce2578..15ffb44b1399 100644 --- a/sw/sdi/_docsh.sdi +++ b/sw/sdi/_docsh.sdi @@ -78,10 +78,6 @@ interface BaseTextDocument : OfficeDocument ExecMethod = Execute ; ] - SID_MAIL_PREPAREEXPORT - [ - ExecMethod = Execute ; - ] SID_MAIL_EXPORT_FINISHED [ ExecMethod = Execute; diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 2fbdc79653f3..8dfabb7ac969 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1203,18 +1203,6 @@ void SwDocShell::Execute(SfxRequest& rReq) } break; - case SID_MAIL_PREPAREEXPORT: - { - //pWrtShell is not set in page preview - if(pWrtShell) - pWrtShell->StartAllAction(); - pDoc->UpdateFlds( NULL, false ); - pDoc->EmbedAllLinks(); - pDoc->RemoveInvisibleContent(); - if(pWrtShell) - pWrtShell->EndAllAction(); - } - break; case SID_MAIL_EXPORT_FINISHED: { if(pWrtShell) -- cgit v1.2.3 From dc0e0e62c498846357d2881f73b53472b57c1c9b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 12:34:33 +0100 Subject: autorecovery: ensure that unsaved XML forms are properly recovered, by properly respecting the 'Hidden' load parameter --- sw/source/ui/app/apphdl.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index e6a9f33eb730..26299a37fcea 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -959,8 +959,7 @@ void NewXForms( SfxRequest& rReq ) static_cast( &xDocSh )->GetDoc()->initXForms( true ); // load document into frame - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); - SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); + SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); // set return value rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) ); -- cgit v1.2.3 From d46f080c23f69bb729173a23aa12b936b78b8803 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 18 Dec 2009 13:44:13 +0100 Subject: autorecovery: oops, *this* version of LoadDocumentIntoFrame was just removed --- sw/source/ui/app/applab.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index cf62e3954d9a..572236555d50 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -237,8 +237,7 @@ static sal_uInt16 nBCTitleNo = 0; pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); } - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); - SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *xDocSh, pFrameItem ); + SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. -- cgit v1.2.3 From 6f4bc5831ab4bc0be6cd1e01e038b3585770eed6 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 21 Dec 2009 14:42:31 +0100 Subject: dba33e: #i107717# allow the command definition to define the column names which should be shown --- dbaccess/source/core/api/RowSet.cxx | 4 ++++ dbaccess/source/core/api/definitioncolumn.cxx | 11 +++++++++-- dbaccess/source/core/api/query.cxx | 27 +++++++++++++++++++-------- dbaccess/source/core/inc/definitioncolumn.hxx | 3 ++- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1adddab143c1..bb500ac94ad2 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1904,6 +1904,8 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(!xColumn.is()) { // no column found so we could look at the position i + bReFetchName = sal_True; + sColumnLabel = ::rtl::OUString(); Reference xIndexAccess(m_xColumns,UNO_QUERY); if(xIndexAccess.is() && i <= xIndexAccess->getCount()) { @@ -1913,7 +1915,9 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi { Sequence< ::rtl::OUString> aSeq = m_xColumns->getElementNames(); if( i <= aSeq.getLength()) + { m_xColumns->getByName(aSeq.getConstArray()[i-1]) >>= xColumn; + } } } if(bReFetchName && xColumn.is()) diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 9f9e511fc9b4..77a29812b105 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -192,7 +192,7 @@ rtl::OUString OTableColumn::getImplementationName( ) throw (RuntimeException) DBG_NAME( OQueryColumn ); // ------------------------------------------------------------------------- -OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection ) +OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, const Reference< XConnection >& _rxConnection,const ::rtl::OUString& _sNewName ) :OTableColumnDescriptor( false /* do not act as descriptor */ ) { const sal_Int32 nPropAttr = PropertyAttribute::READONLY; @@ -210,7 +210,14 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_TYPE ) >>= m_nType ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISAUTOINCREMENT ) >>= m_bAutoIncrement ); OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_ISCURRENCY ) >>= m_bCurrency ); - OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName ); + if ( _sNewName.getLength() ) + { + m_sName = _sNewName; + } + else + { + OSL_VERIFY( _rxParserColumn->getPropertyValue( PROPERTY_NAME ) >>= m_sName ); + } m_bRowVersion = sal_False; Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW ); diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index 7468e88f4fff..ccd91f2a312e 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -191,9 +191,10 @@ void OQuery::rebuildColumns() m_pColumnMediator = NULL; Reference xColSup(m_xCommandDefinition,UNO_QUERY); + Reference< XNameAccess > xColumnDefinitions; if ( xColSup.is() ) { - Reference< XNameAccess > xColumnDefinitions = xColSup->getColumns(); + xColumnDefinitions = xColSup->getColumns(); if ( xColumnDefinitions.is() ) m_pColumnMediator = new OContainerMediator( m_pColumns, xColumnDefinitions, m_xConnection, OContainerMediator::eColumns ); } @@ -236,19 +237,29 @@ void OQuery::rebuildColumns() } Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); - const ::rtl::OUString* pBegin = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); - for ( ;pBegin != pEnd; ++pBegin) + Sequence< ::rtl::OUString> aDefintionNames; + bool bApplyDefinitionNames = false; + if ( xColumnDefinitions.is() ) { - Reference xSource(xColumns->getByName( *pBegin ),UNO_QUERY); - OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection ); + aDefintionNames = xColumnDefinitions->getElementNames(); + bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength(); + } + + ::rtl::OUString sEmpty; + const ::rtl::OUString* pIter = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pIter + aNames.getLength(); + for ( sal_Int32 i = 0;pIter != pEnd; ++pIter,++i) + { + Reference xSource(xColumns->getByName( *pIter ),UNO_QUERY); + OQueryColumn* pColumn = new OQueryColumn( xSource, m_xConnection, bApplyDefinitionNames ? aDefintionNames[i] : sEmpty); Reference< XChild > xChild( *pColumn, UNO_QUERY_THROW ); xChild->setParent( *this ); - implAppendColumn( *pBegin, pColumn ); + ::rtl::OUString sNewName = bApplyDefinitionNames ? aDefintionNames[i] : *pIter; + implAppendColumn( sNewName, pColumn ); Reference< XPropertySet > xDest( *pColumn, UNO_QUERY_THROW ); if ( m_pColumnMediator.is() ) - m_pColumnMediator->notifyElementCreated( *pBegin, xDest ); + m_pColumnMediator->notifyElementCreated( sNewName, xDest ); } } catch( const SQLContext& e ) diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx index c5151e6bffd5..b67b0de70c59 100644 --- a/dbaccess/source/core/inc/definitioncolumn.hxx +++ b/dbaccess/source/core/inc/definitioncolumn.hxx @@ -167,7 +167,8 @@ namespace dbaccess public: OQueryColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxParserColumn, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, + const ::rtl::OUString& _sNewName ); // XTypeProvider -- cgit v1.2.3 From f013c8cb61251b156ce7d1a166875d39373344d6 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Mon, 28 Dec 2009 13:49:39 +0100 Subject: sw33bf02: #i105535# method - handle unexpected situation for to-frame anchored fly frames - Save determination of content node for to-frame anchored fly frame - If no fly frame for to-frame anchored fly frame is found, fallback to to-paragraph anchored fly frame. --- sw/source/core/layout/atrfrm.cxx | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 5560a5c07309..879710e88f09 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2718,10 +2718,23 @@ void SwFlyFrmFmt::MakeFrms() //die Suche vom StartNode zum FrameFormat sein. SwNodeIndex aIdx( aAnchorAttr.GetCntntAnchor()->nNode ); SwCntntNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - SwClientIter aIter( *pCNd ); - if ( aIter.First( TYPE(SwFrm) ) ) - pModify = pCNd; - else + // --> OD 2009-12-28 #i105535# + if ( pCNd == 0 ) + { + pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode(); + } + if ( pCNd ) + // <-- + { + SwClientIter aIter( *pCNd ); + if ( aIter.First( TYPE(SwFrm) ) ) + { + pModify = pCNd; + } + } + // --> OD 2009-12-28 #i105535# + if ( pModify == 0 ) + // <-- { const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode; SwSpzFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts(); @@ -2793,7 +2806,24 @@ void SwFlyFrmFmt::MakeFrms() !((SwCntntFrm*)pFrm)->IsFollow(); if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() ) - pFrm = pFrm->FindFlyFrm(); + { + // --> OD 2009-12-28 #i105535# + // fallback to anchor type at-paragraph, if no fly frame is found. +// pFrm = pFrm->FindFlyFrm(); + SwFrm* pFlyFrm = pFrm->FindFlyFrm(); + if ( pFlyFrm ) + { + pFrm = pFlyFrm; + } + else + { + aAnchorAttr.SetType( FLY_AT_CNTNT ); + SetFmtAttr( aAnchorAttr ); + MakeFrms(); + return; + } + // <-- + } if( pFrm->GetDrawObjs() ) { -- cgit v1.2.3 From 91928bce2b1cb1bdc9ed7ba31fa843bacb74fff3 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Mon, 28 Dec 2009 13:53:06 +0100 Subject: sw33bf02: #i105535# method - no update of anchor attribute for frame styles. --- sw/source/ui/app/docst.cxx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 953ab1b8b8f7..e4ae8dddb012 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -1019,18 +1019,10 @@ USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* pCurrWrtShell->StartAllAction(); pCurrWrtShell->GetFlyFrmAttr( aSet ); - // JP 10.06.98: nur automatische Orientierungen uebernehmen -/* #61359# jetzt auch wieder alle Orientierungen - * const SfxPoolItem* pItem; - if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT, - FALSE, &pItem ) && - text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient()) - aSet.ClearItem( RES_VERT_ORIENT ); - - if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT, - FALSE, &pItem ) && - text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient()) - aSet.ClearItem( RES_HORI_ORIENT );*/ + // --> OD 2009-12-28 #i105535# + // no update of anchor attribute + aSet.ClearItem( RES_ANCHOR ); + // <-- pFrm->SetFmtAttr( aSet ); -- cgit v1.2.3 From 14e83655b8655251aa30c96e9d33fd7c1b9ffa2e Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Mon, 28 Dec 2009 14:51:02 +0100 Subject: sw33bf02: #i104291# method - adjustments avoid overflow. --- sw/source/core/text/txtfrm.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 7df571159c38..abeb06a579db 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -633,23 +633,34 @@ void SwTxtFrm::HideAndShowObjects() *************************************************************************/ xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt, - const xub_StrLen nStart, const xub_StrLen nEnd ) const + const xub_StrLen nStart, + const xub_StrLen nEnd ) const { - xub_StrLen nFound = nStart; + // --> OD 2009-12-28 #i104291# - applying patch to avoid overflow. + unsigned long nFound = nStart; const xub_StrLen nEndLine = Min( nEnd, rTxt.Len() ); // Wir ueberlesen erst alle Blanks am Anfang der Zeile (vgl. Bug 2235). - while( nFound <= nEndLine && ' ' == rTxt.GetChar( nFound ) ) - ++nFound; + while( nFound <= nEndLine && + ' ' == rTxt.GetChar( static_cast(nFound) ) ) + { + nFound++; + } // Eine knifflige Sache mit den TxtAttr-Dummy-Zeichen (hier "$"): // "Dr.$Meyer" am Anfang der zweiten Zeile. Dahinter ein Blank eingegeben // und das Wort rutscht nicht in die erste Zeile, obwohl es ginge. // Aus diesem Grund nehmen wir das Dummy-Zeichen noch mit. - while( nFound <= nEndLine && ' ' != rTxt.GetChar( nFound ) ) - ++nFound; + while( nFound <= nEndLine && + ' ' != rTxt.GetChar( static_cast(nFound) ) ) + { + nFound++; + } - return nFound; + return nFound <= STRING_LEN + ? static_cast(nFound) + : STRING_LEN; + // <-- } /************************************************************************* -- cgit v1.2.3 From 8e731fdfd5706a2efebee757cfd453c8982ae7dc Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 29 Dec 2009 09:19:13 +0100 Subject: sw33bf02: #i104750 removal of "scrolling instead of painting optimization" --- sw/inc/viewsh.hxx | 7 - sw/source/core/crsr/crsrsh.cxx | 7 - sw/source/core/doc/notxtfrm.cxx | 67 +- sw/source/core/inc/layact.hxx | 6 - sw/source/core/inc/scrrect.hxx | 128 ---- sw/source/core/inc/txtfrm.hxx | 3 - sw/source/core/inc/viewimp.hxx | 63 +- sw/source/core/layout/layact.cxx | 485 +-------------- sw/source/core/layout/paintfrm.cxx | 2 +- sw/source/core/layout/tabfrm.cxx | 3 - sw/source/core/text/frmpaint.cxx | 68 -- sw/source/core/view/makefile.mk | 7 +- sw/source/core/view/scrrect.cxx | 1195 ------------------------------------ sw/source/core/view/viewimp.cxx | 19 +- sw/source/core/view/viewsh.cxx | 58 +- 15 files changed, 64 insertions(+), 2054 deletions(-) delete mode 100644 sw/source/core/inc/scrrect.hxx delete mode 100644 sw/source/core/view/scrrect.cxx diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index f12b3ecbe9bc..33f8fcea94b3 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -183,9 +183,6 @@ class SW_DLLPUBLIC ViewShell : public Ring SW_DLLPRIVATE sal_Bool CheckInvalidForPaint( const SwRect & );//Direkt Paint oder lieber //eine Aktion ausloesen. - SW_DLLPRIVATE void Scroll(); //Scrollen wenn sich aus der LayAction Scrollmoeglichkeiten - //ergaben. - SW_DLLPRIVATE void PrepareForPrint( const SwPrtOptions &rOptions ); SW_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt ); @@ -233,11 +230,7 @@ public: void ChgHyphenation() { Reformat(); } void ChgNumberDigits(); - //Methoden fuer Paint- und Scrollrects, die auf allen Shells im - //Ring arbeiten. sal_Bool AddPaintRect( const SwRect &rRect ); - void AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, long nOffs ); - void SetNoNextScroll(); void InvalidateWindows( const SwRect &rRect ); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 3637cc19354d..3be6f84956fd 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1773,13 +1773,6 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) } } - //Ggf. gescrollten Bereicht korrigieren (Alignment). - //Nur wenn gescrollt wurde, und wenn keine Selektion existiert. - if( pFrm && Imp()->IsScrolled() && - pShellCrsr->GetNext() == pShellCrsr && !pShellCrsr->HasMark() ) - Imp()->RefreshScrolledArea( aCharRect ); - - eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst if( pFrm && Imp()->IsAccessible() ) diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 54139e06c340..d4ad970727a9 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -298,14 +298,6 @@ void SwNoTxtFrm::Paint( const SwRect &rRect ) const // <-- StopAnimation(); - if ( pSh->Imp()->IsPaintInScroll() && pSh->GetWin() && rRect != Frm() && - HasAnimation() ) - { - pSh->GetWin()->Invalidate( Frm().SVRect() ); - return; - } - - SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn) OutputDevice *pOut = pSh->GetOut(); @@ -802,29 +794,30 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut ) { + if(!pOut) return; - Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() ); - Rectangle aNewPxRect( aPxRect ); - while( aNewPxRect.Left() < aPxRect.Left() ) - { - rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 ); - aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); - } - while( aNewPxRect.Top() < aPxRect.Top() ) - { - rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 ); - aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); - } - while( aNewPxRect.Bottom() > aPxRect.Bottom() ) - { - rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 ); - aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); - } - while( aNewPxRect.Right() > aPxRect.Right() ) - { - rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 ); - aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); + Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() ); + Rectangle aNewPxRect( aPxRect ); + while( aNewPxRect.Left() < aPxRect.Left() ) + { + rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 ); + aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); + } + while( aNewPxRect.Top() < aPxRect.Top() ) + { + rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 ); + aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); + } + while( aNewPxRect.Bottom() > aPxRect.Bottom() ) + { + rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 ); + aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); + } + while( aNewPxRect.Right() > aPxRect.Right() ) + { + rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 ); + aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() ); } } @@ -861,14 +854,14 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ::SwAlignGrfRect( &aAlignedGrfArea, *pOut ); } else //if( bIsChart ) - { - //#i78025# charts own borders are not completely visible - //the above pixel correction is not correct - at least not for charts - //so a different pixel correction is choosen here - //this might be a good idea for all other OLE objects also, - //but as I cannot oversee the consequences I fix it only for charts for now - lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut ); - } + { + //#i78025# charts own borders are not completely visible + //the above pixel correction is not correct - at least not for charts + //so a different pixel correction is choosen here + //this might be a good idea for all other OLE objects also, + //but as I cannot oversee the consequences I fix it only for charts for now + lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut ); + } if( pGrfNd ) { diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index ad4c7730d07c..bf111e129de4 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -108,14 +108,8 @@ class SwLayAction // OD 14.04.2003 #106346# - new flag for content formatting on interrupt. sal_Bool mbFormatCntntOnInterrupt; - // --> OD 2004-06-14 #i28701# - new flag, indicating, if scrolling is - // allowed during page format - bool mbScrollingAllowed; - #ifdef _LAYACT_CXX - void _AddScrollRect( const SwCntntFrm *, const SwPageFrm *, - const SwTwips, const SwTwips ); void PaintCntnt( const SwCntntFrm *, const SwPageFrm *, const SwRect &rOldRect, long nOldBottom ); BOOL PaintWithoutFlys( const SwRect &, const SwCntntFrm *, diff --git a/sw/source/core/inc/scrrect.hxx b/sw/source/core/inc/scrrect.hxx deleted file mode 100644 index f5e987617c0b..000000000000 --- a/sw/source/core/inc/scrrect.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: scrrect.hxx,v $ - * $Revision: 1.6 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _SCRRECT_HXX -#define _SCRRECT_HXX - -#include -#include "swrect.hxx" -#include - -class SwStripe -{ - SwTwips nY; - SwTwips nHeight; -public: - inline SwStripe( SwTwips nPos, SwTwips nHght ) - : nY( nPos ), nHeight( nHght ) {} - inline SwTwips GetY() const { return nY; } - inline SwTwips& Y() { return nY; } - inline SwTwips GetHeight() const { return nHeight; } - inline SwTwips& Height() { return nHeight; } - inline SwTwips GetBottom() const { return nHeight ? nY + nHeight - 1 : nY; } - inline BOOL operator<( const SwStripe &rTst ) const - { return nY < rTst.nY || ( nY == rTst.nY && nHeight > rTst.nHeight ); } - inline BOOL operator==( const SwStripe& rTst ) const - { return nY == rTst.nY && nHeight == rTst.nHeight; } -}; - -SV_DECL_VARARR( SwStripeArr, SwStripe, 1, 4 ) - -class SwStripes : public SwStripeArr, public SwStripe -{ - SwTwips nMin; // Left minimum - SwTwips nMax; // Right maximum -public: - SwStripes( SwTwips nPos, SwTwips nSize, SwTwips nMn, SwTwips nMx ) - : SwStripe( nPos, nSize ), nMin( nMn ), nMax( nMx ) {} - SwStripes& Plus( const SwStripes& rOther, BOOL bVert ); - BOOL Recalc( BOOL bVert ); - - inline SwTwips GetMin() const { return nMin; } - inline SwTwips GetMax() const { return nMax; } - inline void SetMin( const SwTwips nNew ) { nMin = nNew; } - inline void SetMax( const SwTwips nNew ) { nMax = nNew; } - inline void ChkMin( const SwTwips nNew ) { if( nNew < nMin ) nMin = nNew; } - inline void ChkMax( const SwTwips nNew ) { if( nNew > nMax ) nMax = nNew; } - inline SwTwips GetRight() const { return nMax > nMin ? nMax - 1 : nMax; } - inline SwTwips GetWidth() const { return nMax - nMin; } -}; - -class SwScrollColumn -{ - SwTwips nX; - SwTwips nWidth; - SwTwips nOffs; - BOOL bVertical; -public: - inline SwScrollColumn( SwTwips nPos, SwTwips nSz, SwTwips nOff, BOOL bVert ) - : nX( nPos ), nWidth( nSz ), nOffs( nOff ), bVertical( bVert ) {} - inline SwScrollColumn( const SwScrollColumn& rCol ) - : nX( rCol.nX ), nWidth( rCol.nWidth ), - nOffs( rCol.nOffs ), bVertical( rCol.bVertical ) {} - BOOL IsVertical() const { return bVertical; } - inline BOOL operator<( const SwScrollColumn &rTst ) const - { return bVertical < rTst.bVertical || ( bVertical == rTst.bVertical && - ( nX < rTst.nX || ( nX == rTst.nX && ( nWidth < rTst.nWidth || - ( nWidth == rTst.nWidth && nOffs < rTst.nOffs ) ) ) ) ); } - inline BOOL operator==( const SwScrollColumn &rTst ) const - { return bVertical == rTst.bVertical && nX == rTst.nX && - nWidth == rTst.nWidth && nOffs == rTst.nOffs;} - inline SwTwips GetX() const { return nX; } - inline SwTwips GetWidth() const { return nWidth; } - inline SwTwips GetOffs() const { return nOffs; } - inline void ClrOffs() { nOffs = 0; } - inline SwTwips GetRight() const { return nWidth ? nX + nWidth - 1 : nX; } -}; - -typedef SwStripes* SwStripesPtr; -SV_DECL_PTRARR_SORT(SwScrollStripes, SwStripesPtr, 1, 4) - -class SwScrollArea : public SwScrollColumn, public SwScrollStripes -{ -public: - void SmartInsert( SwStripes* pStripes ); - void Add( SwScrollArea *pScroll ); - inline SwScrollArea( const SwScrollColumn &rCol, SwStripes* pStripes ) - : SwScrollColumn( rCol ) - { Insert( pStripes ); } - BOOL Compress(); -}; - -typedef SwScrollArea* SwScrollAreaPtr; -SV_DECL_PTRARR_SORT(SScrAreas,SwScrollAreaPtr,1,2) - -class SwScrollAreas : public SScrAreas -{ -public: - void InsertCol( const SwScrollColumn &rCol, SwStripes *pStripes ); -}; - - -#endif //_SCRRECT_HXX diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 79cd2a1a574c..4ce0b66b188d 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -49,7 +49,6 @@ class SwBorderAttrs; class SwFrmFmt; class OutputDevice; class SwTestFormat; -class SwStripes; struct SwCrsrMoveState; struct SwFillData; class SwPortionHandler; @@ -547,8 +546,6 @@ public: // Stoppt Animationen innerhalb von Numerierungen void StopAnimation( OutputDevice *pOut ); - void CriticalLines(const OutputDevice& rOut,SwStripes &rStripes,long nOffs); - // visit all portions for Accessibility void VisitPortions( SwPortionHandler& rPH ) const; diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index eba323bd52a2..7fa7eab22871 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -45,7 +45,6 @@ class ViewShell; class SwFlyFrm; class SwViewOption; class SwRegionRects; -class SwScrollAreas; class SwFrm; class SwLayAction; class SwLayIdle; @@ -88,8 +87,6 @@ class SwViewImp SwPageFrm *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite. SwRegionRects *pRegion; //Sammler fuer Paintrects aus der LayAction. - SwScrollAreas *pScrollRects; //Sammler fuer Scrollrects aus der LayAction. - SwScrollAreas *pScrolledArea;//Sammler der gescrollten Rechtecke. SwLayAction *pLayAct; //Ist gesetzt wenn ein Action-Objekt existiert //Wird vom SwLayAction-CTor ein- und vom DTor @@ -101,17 +98,11 @@ class SwViewImp mutable const SdrObject * pSdrObjCached; mutable String sSdrObjCachedComment; - AutoTimer aScrollTimer; //Fuer das Aufraeumen nach dem Scrollen. - BOOL bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig? - BOOL bNextScroll :1; //Scroll in der folgenden EndAction erlaubt? - BOOL bScroll :1; //Scroll in der aktuellen EndAction erlaubt? - BOOL bScrolled :1; //Wurde gescrolled? Dann im Idle aufraeumen. //BOOL bResetXorVisibility:1; //StartAction/EndAction //HMHBOOL bShowHdlPaint :1; //LockPaint/UnlockPaint BOOL bResetHdlHiddenPaint:1;// -- "" -- - BOOL bPaintInScroll :1; //Paint (Update() im ScrollHdl der ViewShell BOOL bSmoothUpdate :1; //Meber fuer SmoothScroll BOOL bStopSmooth :1; @@ -146,21 +137,6 @@ class SwViewImp void SetFirstVisPage(); //Neue Ermittlung der ersten sichtbaren Seite - void ResetNextScroll() { bNextScroll = FALSE; } - void SetNextScroll() { bNextScroll = TRUE; } - void SetScroll() { bScroll = TRUE; } - void ResetScrolled() { bScrolled = FALSE; } - void SetScrolled() { bScrolled = TRUE; } - - SwScrollAreas *GetScrollRects() { return pScrollRects; } - void FlushScrolledArea(); - BOOL _FlushScrolledArea( SwRect& rRect ); - BOOL FlushScrolledArea( SwRect& rRect ) - { if( !pScrolledArea ) return FALSE; return _FlushScrolledArea( rRect ); } - void _ScrolledRect( const SwRect& rRect, long nOffs ); - void ScrolledRect( const SwRect& rRect, long nOffs ) - { if( pScrolledArea ) _ScrolledRect( rRect, nOffs ); } - void StartAction(); //Henkel Anzeigen und verstecken. void EndAction(); //gerufen von ViewShell::ImplXXXAction void LockPaint(); //dito, gerufen von ViewShell::ImplLockPaint @@ -226,32 +202,9 @@ public: inline SwPageFrm *GetFirstVisPage(); void SetFirstVisPageInvalid() { bFirstPageInvalid = TRUE; } - //SS'en fuer Paint- und Scrollrects. BOOL AddPaintRect( const SwRect &rRect ); - void AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, long nOffs ); - void MoveScrollArea(); SwRegionRects *GetRegion() { return pRegion; } - void DelRegions(); //Loescht Scroll- und PaintRects - - //Handler fuer das Refresh von gescrollten Bereichen (Korrektur des - //Alignments). Ruft das Refresh mit der ScrolledArea. - //RefreshScrolledArea kann z.B. beim Setzen des Crsr genutzt werden, es - //wird nur der Anteil des Rect refreshed, der mit der ScrolledArea - //ueberlappt. Das 'reingereichte Rechteck wird veraendert! - void RestartScrollTimer() { aScrollTimer.Start(); } - DECL_LINK( RefreshScrolledHdl, Timer * ); - void _RefreshScrolledArea( const SwRect &rRect ); - void RefreshScrolledArea( SwRect &rRect ); - - //Wird vom Layout ggf. waehrend einer Action gerufen, wenn der - //Verdacht besteht, dass es etwas drunter und drueber geht. - void ResetScroll() { bScroll = FALSE; } - - BOOL IsNextScroll() const { return bNextScroll; } - BOOL IsScroll() const { return bScroll; } - BOOL IsScrolled() const { return bScrolled; } - - BOOL IsPaintInScroll() const { return bPaintInScroll; } + void DelRegion(); // neues Interface fuer StarView Drawing inline BOOL HasDrawView() const { return 0 != pDrawView; } @@ -365,20 +318,6 @@ public: void FireAccessibleEvents(); }; -//Kann auf dem Stack angelegt werden, wenn etwas ausgegeben oder -//gescrolled wird. Handles und sontiges vom Drawing werden im CTor -//gehidet und im DTor wieder sichtbar gemacht. -//AW 06-Sep99: Hiding of handles is no longer necessary, removed -//class SwSaveHdl -//{ -// SwViewImp *pImp; -// BOOL bXorVis; -//public: -// SwSaveHdl( SwViewImp *pImp ); -// ~SwSaveHdl(); -//}; - - inline SwPageFrm *SwViewImp::GetFirstVisPage() { if ( bFirstPageInvalid ) diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 18d03bb167d0..b187db871eb7 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -372,149 +372,6 @@ void SwLayAction::PaintCntnt( const SwCntntFrm *pCnt, } } -/************************************************************************* -|* -|* SwLayAction::_AddScrollRect() -|* -|* Ersterstellung MA 04. Mar. 94 -|* Letzte Aenderung MA 04. Mar. 94 -|* -|*************************************************************************/ -BOOL MA_FASTCALL lcl_IsOverObj( const SwFrm *pFrm, const SwPageFrm *pPage, - const SwRect &rRect1, const SwRect &rRect2, - const SwLayoutFrm *pLay ) -{ - const SwSortedObjs &rObjs = *pPage->GetSortedObjs(); - const SwFlyFrm *pSelfFly = pFrm->FindFlyFrm(); - const BOOL bInCnt = pSelfFly && pSelfFly->IsFlyInCntFrm() ? TRUE : FALSE; - - for ( sal_uInt32 j = 0; j < rObjs.Count(); ++j ) - { - // --> OD 2004-07-07 #i28701# - consider changed type of entries - const SwAnchoredObject* pAnchoredObj = rObjs[j]; - const SwRect aRect( pAnchoredObj->GetObjRect() ); - if ( !rRect1.IsOver( aRect ) && !rRect2.IsOver( aRect ) ) - continue; //Keine Ueberlappung, der naechste. - - const SwFlyFrm *pFly = pAnchoredObj->ISA(SwFlyFrm) - ? static_cast(pAnchoredObj) : 0; - - //Wenn der Rahmen innerhalb des LayFrm verankert ist, so darf er - //mitgescrollt werden, wenn er nicht seitlich aus dem Rechteck - //herausschaut. - if ( pLay && pFly && pFly->IsLowerOf( pLay ) ) - { - if ( pFly->Frm().Left() < rRect1.Left() || - pFly->Frm().Right()> rRect1.Right() ) - return TRUE; - continue; - } - - if ( !pSelfFly ) //Nur wenn der Frm in einem Fly steht kann - return TRUE; //es Einschraenkungen geben. - - if ( !pFly ) //Keine Einschraenkung fuer Zeichenobjekte. - return TRUE; - - if ( pFly != pSelfFly ) - { - //Flys unter dem eigenen nur dann abziehen, wenn sie innerhalb des - //eigenen stehen. - //Fuer inhaltsgebundene Flys alle Flys abziehen fuer die gilt, dass - //pSelfFly nicht innerhalb von ihnen steht. - if ( bInCnt ) - { - const SwFlyFrm *pTmp = pSelfFly->GetAnchorFrm()->FindFlyFrm(); - while ( pTmp ) - { - if ( pTmp == pFly ) - return FALSE; - else - pTmp = pTmp->GetAnchorFrm()->FindFlyFrm(); - } - } else if ( pAnchoredObj->GetDrawObj()->GetOrdNum() < - pSelfFly->GetVirtDrawObj()->GetOrdNum() ) - { - const SwFlyFrm *pTmp = pFly; - do - { if ( pTmp == pSelfFly ) - return TRUE; - else - pTmp = pTmp->GetAnchorFrm()->FindFlyFrm(); - } while ( pTmp ); - } else - return TRUE; - } - } - return FALSE; -} - -void SwLayAction::_AddScrollRect( const SwCntntFrm *pCntnt, - const SwPageFrm *pPage, - const SwTwips nOfst, - const SwTwips nOldBottom ) -{ - // --> OD 2004-07-01 #i28701# - determine, if scrolling is allowed. - bool bScroll = mbScrollingAllowed; - SwRect aPaintRect( pCntnt->PaintArea() ); - SWRECTFN( pCntnt ) - - // --> OD 2007-11-27 #notes2# - // if sidebar for notes is present, no scrolling is allowed - if ( bScroll ) - { - const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr(); - if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) - { - bScroll = false; - } - } - // <-- - - //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der - //Cntnt nicht selbst steht, so ist nichts mit Scrollen. - if ( bScroll && pPage->GetSortedObjs() ) - { - SwRect aRect( aPaintRect ); - if( bVert ) - aPaintRect.Pos().X() += nOfst; - else - aPaintRect.Pos().Y() -= nOfst; - - if ( ::lcl_IsOverObj( pCntnt, pPage, aPaintRect, aRect, 0 ) ) - bScroll = false; - - if( bVert ) - aPaintRect.Pos().X() -= nOfst; - else - aPaintRect.Pos().Y() += nOfst; - } - if ( bScroll && pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE ) - bScroll = false; - - if ( bScroll ) - { - if( aPaintRect.HasArea() ) - pImp->GetShell()->AddScrollRect( pCntnt, aPaintRect, nOfst ); - if ( pCntnt->IsRetouche() && !pCntnt->GetNext() ) - { - SwRect aRect( pCntnt->GetUpper()->PaintArea() ); - (aRect.*fnRect->fnSetTop)( (pCntnt->*fnRect->fnGetPrtBottom)() ); - if ( !pImp->GetShell()->AddPaintRect( aRect ) ) - pCntnt->ResetRetouche(); - } - pCntnt->ResetCompletePaint(); - } - else if( aPaintRect.HasArea() ) - { - if( bVert ) - aPaintRect.Pos().X() += nOfst; - else - aPaintRect.Pos().Y() -= nOfst; - PaintCntnt( pCntnt, pPage, aPaintRect, nOldBottom ); - } -} - /************************************************************************* |* |* SwLayAction::SwLayAction() @@ -541,8 +398,6 @@ SwLayAction::SwLayAction( SwRootFrm *pRt, SwViewImp *pI ) : bUpdateExpFlds = bBrowseActionStop = bActionInProgress = FALSE; // OD 14.04.2003 #106346# - init new flag . mbFormatCntntOnInterrupt = sal_False; - // --> OD 2004-06-14 #i28701# - mbScrollingAllowed = true; pImp->pLayAct = this; //Anmelden } @@ -657,8 +512,6 @@ void SwLayAction::Action() pRoot->ResetTurboFlag(); pRoot->ResetTurbo(); - if ( IsInput() ) - pImp->GetShell()->SetNoNextScroll(); SetCheckPages( TRUE ); bActionInProgress = FALSE; @@ -738,34 +591,6 @@ class NotifyLayoutOfPageInProgress }; // <-- -// --> OD 2004-06-14 #i28701# - local method to determine, if scrolling during -// the format of the given page is allowed. -// Scrolling isn't allowed, if the wrapping style of floating screen objects -// is considered on object positioning and to-paragraph/to-character anchored -// floating screen objects are registered at the page. -bool lcl_ScrollingAllowed( const SwPageFrm& _rPageFrm ) -{ - bool bRetScrollAllowed = true; - - if ( _rPageFrm.GetSortedObjs() && - _rPageFrm.GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) ) - { - const SwSortedObjs* pObjs = _rPageFrm.GetSortedObjs(); - sal_uInt32 i = 0; - for ( ; i < pObjs->Count(); ++i ) - { - SwAnchoredObject* pObj = (*pObjs)[i]; - if ( pObj->ConsiderObjWrapInfluenceOnObjPos() ) - { - bRetScrollAllowed = false; - break; - } - } - } - - return bRetScrollAllowed; -} - void SwLayAction::InternalAction() { ASSERT( pRoot->Lower()->IsPageFrm(), ":-( Keine Seite unterhalb der Root."); @@ -867,8 +692,6 @@ void SwLayAction::InternalAction() // { NotifyLayoutOfPageInProgress aLayoutOfPageInProgress( *pPage ); - // --> OD 2004-07-01 #i28701# - determine, if scrolling is allowed. - mbScrollingAllowed = lcl_ScrollingAllowed( *pPage ); while ( !IsInterrupt() && !IsNextCycle() && ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) ) @@ -1841,219 +1664,6 @@ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm* pFly ) return bChanged || bTabChanged; } -BOOL MA_FASTCALL lcl_AreLowersScrollable( const SwLayoutFrm *pLay ) -{ - const SwFrm *pLow = pLay->Lower(); - while ( pLow ) - { - if ( pLow->IsCompletePaint() || !pLow->IsValid() || pLow->IsCoveredCell() ) - return FALSE; - if ( pLow->IsLayoutFrm() && !::lcl_AreLowersScrollable( (SwLayoutFrm*)pLow )) - return FALSE; - pLow = pLow->GetNext(); - } - return TRUE; -} - -SwLayoutFrm * MA_FASTCALL lcl_IsTabScrollable( SwTabFrm *pTab ) -{ - //returnt die erste unveraenderte Zeile, oder 0 wenn nicht - //gescrollt werden darf. - if ( !pTab->IsCompletePaint() ) - { - SwLayoutFrm *pUnchgdRow = 0; - SwLayoutFrm *pRow = (SwLayoutFrm*)pTab->Lower(); - while ( pRow ) - { - if ( ::lcl_AreLowersScrollable( pRow ) ) - { - if ( !pUnchgdRow ) - pUnchgdRow = pRow; - } - else - { - pUnchgdRow = 0; - } - - pRow = (SwLayoutFrm*)pRow->GetNext(); - } - return pUnchgdRow; - } - return 0; -} - -// OD 2004-05-11 #i28701# -void lcl_ValidateLowerObjs( SwFrm* pFrm, - const SwTwips nOfst, - SwPageFrm *pPage, - bool bResetOnly ); - -// OD 2004-05-11 #i28701# - correction: floating screen objects, which are -// anchored at-fly, have also been to be considered. -void MA_FASTCALL lcl_ValidateLowers( SwLayoutFrm *pLay, const SwTwips nOfst, - SwLayoutFrm *pRow, SwPageFrm *pPage, - BOOL bResetOnly ) -{ - pLay->ResetCompletePaint(); - - // OD 2004-05-11 #i28701# - consider floating screen objects, which are - // anchored at-fly. - if ( pLay->IsFlyFrm() ) - { - ::lcl_ValidateLowerObjs( pLay, nOfst, pPage, bResetOnly ); - } - - SwFrm *pLow = pRow ? pRow : pLay->Lower(); - SwRootFrm *pRootFrm = 0; - - while ( pLow ) - { - if ( !bResetOnly ) - { - SwRect aOldFrm( pLow->Frm() ); - pLow->Frm().Pos().Y() += nOfst; - if( pLow->IsAccessibleFrm() ) - { - if( !pRootFrm ) - pRootFrm = pPage->FindRootFrm(); - if( pRootFrm && pRootFrm->IsAnyShellAccessible() && - pRootFrm->GetCurrShell() ) - { - pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( pLow, aOldFrm ); - } - } - } - if ( pLow->IsLayoutFrm() ) - { - ::lcl_ValidateLowers( (SwLayoutFrm*)pLow, nOfst, 0, pPage, bResetOnly); - } - else - { - pLow->ResetCompletePaint(); - // OD 2004-05-11 #i28701# - use new local helper method - // - ::lcl_ValidateLowerObjs( pLow, nOfst, pPage, bResetOnly); - } - if ( !bResetOnly ) - pLow->Calc(); //#55435# Stabil halten. - pLow = pLow->GetNext(); - } -} - -// OD 2004-05-11 #i28701# - helper method for to -// 'ValidateLowers' for floating screen objects -void lcl_ValidateLowerObjs( SwFrm* pFrm, - const SwTwips nOfst, - SwPageFrm *pPage, - bool bResetOnly ) -{ - if ( pFrm->GetDrawObjs() ) - { - // --> OD 2004-10-15 #i26945# - consider layout direction - SWRECTFN( pFrm ) - // <-- - for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i ) - { - SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; - // --> OD 2004-10-08 #i26945# - check, if the anchor frame, which - // contains the anchor position, is the given frame - if ( pAnchoredObj->GetAnchorFrmContainingAnchPos() != pFrm ) - { - continue; - } - if ( pAnchoredObj->ISA(SwFlyFrm) ) - { - SwFlyFrm *pFly = static_cast(pAnchoredObj); - if ( !bResetOnly ) - { - // --> OD 2004-10-15 #i26945# - // - consider layout direction - // - consider condition for direct move - const bool bNoDirectMove = - WEIT_WECH == pFly->Frm().Top() || - pFly->ConsiderObjWrapInfluenceOnObjPos(); - if ( !bNoDirectMove ) - { - (pFly->Frm().*fnRect->fnSubTop)( -nOfst ); - (pFly->Frm().*fnRect->fnAddBottom)( nOfst ); - } - // <-- - pFly->GetVirtDrawObj()->SetRectsDirty(); - // --> OD 2004-08-17 - also notify view of - // instance, which represents the Writer fly frame in the - // drawing layer - pFly->GetVirtDrawObj()->SetChanged(); - // <-- - if ( pFly->IsFlyInCntFrm() ) - ((SwFlyInCntFrm*)pFly)->AddRefOfst( nOfst ); - // --> OD 2004-10-15 #i26945# - consider at-character - // anchored Writer fly frames - else if( pFly->IsAutoPos() ) - { - pFly->AddLastCharY( nOfst ); - // OD 2004-05-18 #i28701# - follow-up of #i22341# - // has also been adjusted. - pFly->AddLastTopOfLineY( nOfst ); - } - // <-- - } - ::lcl_ValidateLowers( pFly, nOfst, 0, pPage, bResetOnly); - } - // --> OD 2004-10-15 #i26945# - consider drawing objects - else - { - if ( !bResetOnly ) - { - pAnchoredObj->AddLastCharY( nOfst ); - pAnchoredObj->AddLastTopOfLineY( nOfst ); - } - } - // <-- - pAnchoredObj->InvalidateObjPos(); - } - } -} - -void MA_FASTCALL lcl_AddScrollRectTab( SwTabFrm *pTab, SwLayoutFrm *pRow, - const SwRect &rRect, - const SwTwips nOfst) -{ - // --> OD 2007-11-27 #notes2# - // if sidebar for notes is present, no scrolling is allowed - const SwPageFrm* pPage = pTab->FindPageFrm(); - ASSERT( pPage, " - no page frame found at table frame -> crash" ); - ViewShell* pSh = pPage->GetShell(); - if ( pSh ) - { - const SwPostItMgr* pPostItMgr = pSh->GetPostItMgr(); - if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) - { - return; - } - } - // <-- - //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der - //Frm nicht selbst steht, so ist nichts mit Scrollen. - SwRect aRect( rRect ); - // OD 04.11.2002 #104100# - not needed. - if( pTab->IsVertical() ) - aRect.Pos().X() -= nOfst; - else - aRect.Pos().Y() += nOfst; - if ( pPage->GetSortedObjs() ) - { - if ( ::lcl_IsOverObj( pTab, pPage, rRect, aRect, pTab ) ) - return; - } - if ( pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE ) - return; - - if ( pSh ) - pSh->AddScrollRect( pTab, aRect, nOfst ); - ::lcl_ValidateLowers( pTab, nOfst, pRow, pTab->FindPageFrm(), - pTab->IsLowersFormatted() ); -} - // OD 31.10.2002 #104100# // NOTE: no adjustments for vertical layout support necessary BOOL CheckPos( SwFrm *pFrm ) @@ -2096,76 +1706,27 @@ BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect ) if ( !pTab->IsValid() || pTab->IsCompletePaint() || pTab->IsComplete() ) { if ( pTab->GetPrev() && !pTab->GetPrev()->IsValid() ) - pTab->GetPrev()->SetCompletePaint(); - - //Potenzielles Scrollrect ist die ganze Tabelle. Da bereits ein - //Wachstum innerhalb der Tabelle - und damit der Tabelle selbst - - //stattgefunden haben kann, muss die untere Kante durch die - //Unterkante der letzten Zeile bestimmt werden. - SwLayoutFrm* pRow = 0L; - SwRect aScrollRect( pTab->PaintArea() ); - // --> OD 2004-07-01 #i28701# - check, if scrolling is allowed. - if ( mbScrollingAllowed && - ( IsPaint() || bAddRect ) ) { - pRow = static_cast(pTab->GetLastLower()); - // OD 31.10.2002 #104100# - vertical layout support - (aScrollRect.*fnRect->fnSetBottom)( (pRow->Frm().*fnRect->fnGetBottom)() ); - //Die Oberkante wird ggf. durch die erste unveraenderte Zeile bestimmt. - pRow = ::lcl_IsTabScrollable( pTab ); - if ( pRow && pRow != pTab->Lower() ) - // OD 31.10.2002 #104100# - vertical layout support - (aScrollRect.*fnRect->fnSetTop)( (pRow->Frm().*fnRect->fnGetTop)() ); + pTab->GetPrev()->SetCompletePaint(); } - const SwFrm *pOldUp = pTab->GetUpper(); - - SwRect aOldRect( pTab->Frm() ); + const SwRect aOldRect( pTab->Frm() ); pTab->SetLowersFormatted( FALSE ); pTab->Calc(); if ( aOldRect != pTab->Frm() ) + { bChanged = TRUE; - SwRect aPaintFrm = pTab->PaintArea(); + } + const SwRect aPaintFrm = pTab->PaintArea(); if ( IsPaint() && bAddRect ) { - // --> OD 2004-07-01 #i28701# - check, if scrolling is allowed - if ( mbScrollingAllowed && - pRow && pOldUp == pTab->GetUpper() && - pTab->Frm().SSize() == aOldRect.SSize() && - // OD 31.10.2002 #104100# - vertical layout support - (pTab->Frm().*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() && - pTab->IsAnLower( pRow ) ) - { - SwTwips nOfst; - if ( pRow->GetPrev() ) - { - if ( pRow->GetPrev()->IsValid() || - ::CheckPos( pRow->GetPrev() ) ) - { - // OD 31.10.2002 #104100# - vertical layout support - nOfst = -(pRow->Frm().*fnRect->fnTopDist)( (pRow->GetPrev()->Frm().*fnRect->fnGetBottom)() ); - } - else - nOfst = 0; - } - else - // OD 31.10.2002 #104100# - vertical layout support - nOfst = (pTab->Frm().*fnRect->fnTopDist)( (aOldRect.*fnRect->fnGetTop)() ); - - if ( nOfst ) - { - ::lcl_AddScrollRectTab( pTab, pRow, aScrollRect, nOfst ); - bPainted = TRUE; - } - } - // OD 01.11.2002 #104100# - add condition Frm().HasArea()> - if ( !pTab->IsCompletePaint() && pTab->IsComplete() && + if ( !pTab->IsCompletePaint() && + pTab->IsComplete() && ( pTab->Frm().SSize() != pTab->Prt().SSize() || // OD 31.10.2002 #104100# - vertical layout support - (pTab->*fnRect->fnGetLeftMargin)() - ) && + (pTab->*fnRect->fnGetLeftMargin)() ) && pTab->Frm().HasArea() ) { @@ -2481,13 +2042,6 @@ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt, SWRECTFN( pCntnt ) if ( !bDrawObjsOnly && IsPaint() ) { - const BOOL bPosOnly = !pCntnt->GetValidPosFlag() && - !pCntnt->IsCompletePaint() && - pCntnt->GetValidSizeFlag() && - pCntnt->GetValidPrtAreaFlag() && - ( !pCntnt->IsTxtFrm() || - !((SwTxtFrm*)pCntnt)->HasAnimation() ); - const SwFrm *pOldUp = pCntnt->GetUpper(); const SwRect aOldRect( pCntnt->UnionFrm() ); const long nOldBottom = (pCntnt->*fnRect->fnGetPrtBottom)(); pCntnt->OptCalc(); @@ -2495,23 +2049,10 @@ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt, return; if( (*fnRect->fnYDiff)( (pCntnt->Frm().*fnRect->fnGetBottom)(), (aOldRect.*fnRect->fnGetBottom)() ) < 0 ) - pCntnt->SetRetouche(); - const SwRect aNewRect( pCntnt->UnionFrm() ); - if ( bPosOnly && - (aNewRect.*fnRect->fnGetTop)() != (aOldRect.*fnRect->fnGetTop)() && - !pCntnt->IsInTab() && !pCntnt->IsInSct() && - ( !pCntnt->GetPrev() || !pCntnt->GetPrev()->IsTabFrm() ) && - pOldUp == pCntnt->GetUpper() && - (aNewRect.*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() && - aNewRect.SSize() == aOldRect.SSize() - ) { - _AddScrollRect( pCntnt, pPage, (*fnRect->fnYDiff)( - (pCntnt->Frm().*fnRect->fnGetTop)(), - (aOldRect.*fnRect->fnGetTop)() ), nOldBottom ); + pCntnt->SetRetouche(); } - else - PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom); + PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom); } else { @@ -2910,7 +2451,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : { --pSh->nStartAction; - if ( pSh->Imp()->GetRegion() || pSh->Imp()->GetScrollRects() ) + if ( pSh->Imp()->GetRegion() ) bActions = TRUE; else { @@ -2956,9 +2497,9 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : //fix(18176): SwViewImp *pViewImp = pSh->Imp(); BOOL bUnlock = FALSE; - if ( pViewImp->GetRegion() || pViewImp->GetScrollRects() ) + if ( pViewImp->GetRegion() ) { - pViewImp->DelRegions(); + pViewImp->DelRegion(); //Fuer Repaint mit virtuellem Device sorgen. pSh->LockPaint(); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a52423e24bc1..44d5af0f84b2 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2809,7 +2809,7 @@ void SwRootFrm::Paint( const SwRect& rRect ) const aAction.Action(); ((SwRootFrm*)this)->ResetTurboFlag(); if ( !pSh->ActionPend() ) - pSh->Imp()->DelRegions(); + pSh->Imp()->DelRegion(); } SwRect aRect( rRect ); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 61f08281e5f9..aff6ca369d46 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2795,9 +2795,6 @@ void SwTabFrm::MakeAll() } else if ( GetFollow() == GetNext() ) ((SwTabFrm*)GetFollow())->MoveFwd( TRUE, FALSE ); - ViewShell *pSh; - if ( 0 != (pSh = GetShell()) ) - pSh->Imp()->ResetScroll(); } continue; } diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 05c142e1fd84..0f560d80dc98 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -62,7 +62,6 @@ #include // SwRedlineItr #include // SW_MOD #include // SwTabFrm (Redlining) -#include #include // --> FME 2004-06-08 #i12836# enhanced pdf export @@ -751,70 +750,3 @@ void SwTxtFrm::Paint( const SwRect &rRect ) const } } -void SwTxtFrm::CriticalLines( const OutputDevice& rOut, SwStripes &rStripes, - long nOffs) -{ - ASSERT( ! IsVertical() || ! IsSwapped(), - "SwTxtFrm::CriticalLines with swapped frame" ); - SWRECTFN( this ) - long nFrmHeight; - - GetFormatted(); - if( HasPara() ) - { - const long nTopMargin = (this->*fnRect->fnGetTopMargin)(); - SwStripe aStripe( (Frm().*fnRect->fnGetTop)(), nTopMargin ); - if ( nTopMargin ) - { - rStripes.Insert( aStripe, rStripes.Count() ); - // OD 06.11.2002 #104171#,#103931# - consider vertical layout - if ( bVert ) - aStripe.Y() -= nTopMargin; - else - // OD 06.11.2002 #104171#,#103931# - *add* top margin to Y. - aStripe.Y() += nTopMargin; - } - SwLineLayout* pLay = GetPara(); - do - { - SwTwips nBase = aStripe.GetY() + - ( bVert ? -pLay->GetAscent() : pLay->GetAscent() ); - - long nLogToPixBase, nLogToPixSum, nLogToPixOffs; - - if ( bVert ) - { - nLogToPixBase = rOut.LogicToPixel( Point( nBase, 0 ) ).X(); - nLogToPixSum = rOut.LogicToPixel( Point( nBase + nOffs, 0 ) ).X(); - nLogToPixOffs = -rOut.LogicToPixel( Size( nOffs, 0 ) ).Width(); - } - else - { - nLogToPixBase = rOut.LogicToPixel( Point( 0, nBase ) ).Y(); - nLogToPixSum = rOut.LogicToPixel( Point( 0, nBase - nOffs ) ).Y(); - nLogToPixOffs = rOut.LogicToPixel( Size( 0, nOffs ) ).Height(); - } - - if( nLogToPixBase != nLogToPixSum + nLogToPixOffs ) - { - aStripe.Height() = pLay->GetRealHeight(); - rStripes.Insert( aStripe, rStripes.Count() ); - } - aStripe.Y() += ( bVert ? -pLay->GetRealHeight() : - pLay->GetRealHeight() ); - pLay = pLay->GetNext(); - } while( pLay ); - - const long nBottomMargin = (this->*fnRect->fnGetBottomMargin)(); - if( nBottomMargin ) - { - - aStripe.Height() = nBottomMargin; - rStripes.Insert( aStripe, rStripes.Count() ); - } - } - else if( 0 != (nFrmHeight = (Frm().*fnRect->fnGetHeight)() )) - rStripes.Insert( SwStripe( (Frm().*fnRect->fnGetTop)(), nFrmHeight ), - rStripes.Count() ); -} - diff --git a/sw/source/core/view/makefile.mk b/sw/source/core/view/makefile.mk index 56cfb7d6ed26..86b8871f9641 100644 --- a/sw/source/core/view/makefile.mk +++ b/sw/source/core/view/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -44,7 +44,6 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES = \ - $(SLO)$/scrrect.obj \ $(SLO)$/vdraw.obj \ $(SLO)$/viewimp.obj \ $(SLO)$/viewsh.obj \ @@ -52,10 +51,10 @@ SLOFILES = \ $(SLO)$/vnew.obj \ $(SLO)$/vprint.obj \ $(SLO)$/pagepreviewlayout.obj - + EXCEPTIONSFILES = \ $(SLO)$/pagepreviewlayout.obj - + # --- Targets ------------------------------------------------------- diff --git a/sw/source/core/view/scrrect.cxx b/sw/source/core/view/scrrect.cxx deleted file mode 100644 index f70bb1a52470..000000000000 --- a/sw/source/core/view/scrrect.cxx +++ /dev/null @@ -1,1195 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: scrrect.cxx,v $ - * $Revision: 1.23 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - - -#include -#include -#include -#include -#include // SwScrollRect, SwScrollRects -// OD 18.02.2003 #107562# - for -#include -#ifndef _CURSOR_HXX //autogen -#include -#endif -#include -#ifndef _APP_HXX //autogen -#include -#endif -#include -#include "crsrsh.hxx" -#include "rootfrm.hxx" -#include "pagefrm.hxx" - -// OD 12.11.2002 #96272# - include declaration for -#include "setmapvirtdev.hxx" -#include - -// #i75172# -#include "dview.hxx" - -DBG_NAME(RefreshTimer) - -SV_IMPL_VARARR(SwStripeArr,SwStripe); -SV_IMPL_OP_PTRARR_SORT(SwScrollStripes, SwStripesPtr); -SV_IMPL_OP_PTRARR_SORT(SScrAreas, SwScrollAreaPtr); - -/***************************************************************************** -|* -|* ViewShell::AddScrollRect() -|* -|* Creation MA 07. Mar. 94 -|* Last change AMA 20. July 00 -|* -|* Description -|* ViewShell::AddScrollRect(..) passes a registration from a scrolling frame or -|* rectangle to all ViewShells and SwViewImps respectively. -|* -******************************************************************************/ - -void ViewShell::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, - long nOfs ) -{ - ASSERT( pFrm, "Where is my friend, the frame?" ); - BOOL bScrollOn = TRUE; - -#ifdef NOSCROLL - //Auch im Product per speziellem Compilat abschaltbar. - bScrollOn = FALSE; -#endif - - if( bScrollOn && Imp()->IsScroll() && nOfs <= SHRT_MAX && nOfs >= SHRT_MIN ) - { - ViewShell *pSh = this; - do - { - pSh->Imp()->AddScrollRect( pFrm, rRect, nOfs ); - pSh = (ViewShell*)pSh->GetNext(); - } while ( pSh != this ); - } - else - AddPaintRect( rRect ); -} - -/****************************************************************************** -|* -|* ViewShell::Scroll() -|* -|* Ersterstellung MA 07. Mar. 94 -|* Last change AMA 21. July 00 -|* -|* Description -|* ViewShell::Scroll() scrolls all rectangles in the pScrollRects-list and -|* transfers the critical lines by calling SwViewImp::MoveScrollArea(..). -|* -******************************************************************************/ -#include -#include - -void ViewShell::Scroll() -{ - SwScrollAreas *pScrollRects = Imp()->GetScrollRects(); - if ( pScrollRects ) - { - bPaintWorks = FALSE; - ASSERT( pScrollRects->Count(), "ScrollRects ohne ScrollRects." ); - - //Abgleichen der Region mit den Scroll-Bereichen!!! - //Wenn eines der Scroll-Rechtecke ungueltig wird, so muss - //der PaintMode wahrscheinlich auf PAINT_BACKGROUND umgeschaltet - //werden. - - //Auf die Richtung kommt es an: - //- Bei einem pos. Ofst muss von hinten nach vorn gescrollt werden. - //- Bei einem neg. Ofst muss von vorn nach hinten gescrollt werden. - BOOL bPositive = (*pScrollRects)[0]->GetOffs() > 0; - if( (*pScrollRects)[0]->IsVertical() ) - bPositive = !bPositive; - int i = bPositive ? pScrollRects->Count()-1 : 0; - - for ( ; bPositive ? - i >= 0 : - i < (int)pScrollRects->Count(); - bPositive ? - --i : - ++i ) - { - const SwScrollArea &rScroll = *(*pScrollRects)[ sal::static_int_cast(i) ]; - if( rScroll.Count() ) - { - int j = bPositive ? rScroll.Count()-1 : 0; - for ( ; bPositive ? j >= 0 : j < (int)rScroll.Count(); - bPositive ? --j : ++j ) - { - const SwStripes& rStripes = *rScroll[ sal::static_int_cast(j) ]; - if( rScroll.IsVertical() ) - { - Rectangle aRectangle( rStripes.GetY() - - rStripes.GetHeight() + rScroll.GetOffs(), - rStripes.GetMin(), - rStripes.GetY() + rScroll.GetOffs(), - rStripes.GetMax() ); - // OD 18.02.2003 #107562# - align rectangle for scrolling - SwRect aAlignedScrollRect( aRectangle ); - ::SwAlignRect( aAlignedScrollRect, this ); - - // #i68597# when scrolling, let DrawingLayer know about refreshed areas, - // even when no DL objects are in the area. This is needed to allow - // fully buffered overlay. - const Rectangle aSourceRect(aAlignedScrollRect.SVRect()); - const Rectangle aTargetRect( - aSourceRect.Left() - rScroll.GetOffs(), aSourceRect.Top(), - aSourceRect.Right() - rScroll.GetOffs(), aSourceRect.Bottom()); - - if(GetWin()) - { - // SCROLL_NOWINDOWINVALIDATE okay since AddPaintRect below adds the to-be-invalidated region - GetWin()->Scroll( -rScroll.GetOffs(), 0, aSourceRect, SCROLL_CHILDREN | SCROLL_NOWINDOWINVALIDATE ); - } - - // #i68597# if buffered overlay, the buffered content needs to be scrolled directly - { - SdrPaintWindow* pPaintWindow = GetDrawView()->GetPaintWindow(0); - - if(pPaintWindow) - { - sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager(); - - if(pOverlayManager) - { - pOverlayManager->copyArea(aTargetRect.TopLeft(), aSourceRect.TopLeft(), aSourceRect.GetSize()); - } - } - } - - SwRect aRect( aRectangle ); - Imp()->ScrolledRect( aRect, -rScroll.GetOffs() ); - if ( bPositive ) - aRect.Right( aRect.Left() + rScroll.GetOffs()-1 ); - else - aRect.Left( aRect.Right() - rScroll.GetOffs() ); - Imp()->AddPaintRect( aRect ); - } - else - { - Rectangle aRectangle( rStripes.GetMin(), - rStripes.GetY() - rScroll.GetOffs(), - rStripes.GetRight(), - rStripes.GetBottom() - rScroll.GetOffs() ); - // OD 18.02.2003 #107562# - use aligned rectangle for scrolling - SwRect aAlignedScrollRect( aRectangle ); - ::SwAlignRect( aAlignedScrollRect, this ); - - // #i68597# when scrolling, let DrawingLayer know about refreshed areas, - // even when no DL objects are in the area. This is needed to allow - // fully buffered overlay. - const Rectangle aSourceRect(aAlignedScrollRect.SVRect()); - const Rectangle aTargetRect( - aSourceRect.Left(), aSourceRect.Top() + rScroll.GetOffs(), - aSourceRect.Right(), aSourceRect.Bottom() + rScroll.GetOffs()); - - if(GetWin()) - { - // SCROLL_NOWINDOWINVALIDATE okay since AddPaintRect below adds the to-be-invalidated region - GetWin()->Scroll( 0, rScroll.GetOffs(), aSourceRect, SCROLL_CHILDREN | SCROLL_NOWINDOWINVALIDATE ); - } - - // #i68597# if buffered overlay, the buffered content needs to be scrolled directly - { - SdrPaintWindow* pPaintWindow = GetDrawView()->GetPaintWindow(0); - - if(pPaintWindow) - { - sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager(); - - if(pOverlayManager) - { - pOverlayManager->copyArea(aTargetRect.TopLeft(), aSourceRect.TopLeft(), aSourceRect.GetSize()); - } - } - } - - SwRect aRect( aRectangle ); - Imp()->ScrolledRect( aRect, rScroll.GetOffs() ); - if ( bPositive ) - aRect.Bottom( aRect.Top() + rScroll.GetOffs()-1 ); - else - aRect.Top( aRect.Bottom() + rScroll.GetOffs() ); - Imp()->AddPaintRect( aRect ); - } - } - } - } - if ( !Imp()->IsScrolled() ) - Imp()->SetScrolled(); - - Imp()->MoveScrollArea(); - bPaintWorks = TRUE; - } -} - -/****************************************************************************** -|* -|* ViewShell::SetNoNextScroll() -|* -|* Ersterstellung MA 08. Mar. 94 -|* Letzte Aenderung MA 08. Mar. 94 -|* -******************************************************************************/ - -void ViewShell::SetNoNextScroll() -{ - ViewShell *pSh = this; - do - { pSh->Imp()->ResetNextScroll(); - pSh = (ViewShell*)pSh->GetNext(); - - } while ( pSh != this ); -} - -/****************************************************************************** -|* -|* SwViewImp::AddScrollRect() -|* -|* Ersterstellung MA 07. Mar. 94 -|* Last change AMA 21. July 00 -|* -|* Adds a scrollable rectangle and his critical lines to the list. -|* -******************************************************************************/ - -void SwViewImp::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, - long nOffs ) -{ - ASSERT( nOffs != 0, "Scrollen ohne Ofst." ); - SwRect aRect( rRect ); - BOOL bVert = pFrm->IsVertical(); - if( bVert ) - aRect.Pos().X() += nOffs; - else - aRect.Pos().Y() -= nOffs; - if( aRect.IsOver( pSh->VisArea() ) ) - { - ASSERT( pSh->GetWin(), "Scrolling without outputdevice" ); - aRect._Intersection( pSh->VisArea() ); - SwStripes *pStr; - if ( !pScrollRects ) - pScrollRects = new SwScrollAreas; - if( bVert ) - { - aRect.Pos().X() -= nOffs; - pStr = new SwStripes( aRect.Right(), aRect.Width(), - aRect.Top(), aRect.Bottom() ); - if( pFrm->IsTxtFrm() ) - ((SwTxtFrm*)pFrm)->CriticalLines(*pSh->GetWin(), *pStr, nOffs ); - else - pStr->Insert( SwStripe( aRect.Right(), aRect.Width() ), 0 ); - pScrollRects->InsertCol( SwScrollColumn( pFrm->Frm().Top(), - pFrm->Frm().Height(), nOffs, bVert ), pStr); - } - else - { - aRect.Pos().Y() += nOffs; - pStr = new SwStripes( aRect.Top(), aRect.Height(), - aRect.Left(), aRect.Right() ); - if( pFrm->IsTxtFrm() ) - ((SwTxtFrm*)pFrm)->CriticalLines(*pSh->GetWin(), *pStr, nOffs ); - else - pStr->Insert( SwStripe( aRect.Top(), aRect.Height() ), 0 ); - pScrollRects->InsertCol( SwScrollColumn( pFrm->Frm().Left(), - pFrm->Frm().Width(), nOffs, bVert ), pStr ); - } - } - else - AddPaintRect( rRect ); -} - -/****************************************************************************** -|* -|* SwViewImp::MoveScrollArea() -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* Transfers the areas after scrolling to the scrolled list, but only those -|* parts with critical lines. -|* -******************************************************************************/ - -void SwViewImp::MoveScrollArea() -{ - if( !pScrolledArea ) - pScrolledArea = new SwScrollAreas; - for( USHORT nIdx = 0; nIdx < pScrollRects->Count(); ++nIdx ) - { - SwScrollArea *pScr = (*pScrollRects)[ nIdx ]; - if( pScr->Compress() ) - delete pScr; - else - { - USHORT nIndx; - if( pScrolledArea->Seek_Entry( pScr, &nIndx ) ) - pScrolledArea->GetObject(nIndx)->Add( pScr ); - else - pScrolledArea->Insert( pScr ); - } - } - delete pScrollRects; - pScrollRects = NULL; -} - -/****************************************************************************** -|* -|* SwViewImp::FlushScrolledArea() -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* Flushes the scrolled critical lines, that is transfer them to AddPaintRect() -|* and remove them from the list. -|* -******************************************************************************/ - -void SwViewImp::FlushScrolledArea() -{ - USHORT nCount = pScrolledArea->Count(); - while( nCount ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--nCount]; - USHORT nCnt = pScroll->Count(); - while( nCnt ) - { - SwStripes* pStripes = (*pScroll)[--nCnt]; - if( pScroll->IsVertical() ) - { - SwRect aRect( 0, pStripes->GetMin(), 0, pStripes->GetWidth() ); - for( USHORT i = 0; i < pStripes->Count(); ++i ) - { - long nWidth = (*pStripes)[i].GetHeight(); - aRect.Left( (*pStripes)[i].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - AddPaintRect( aRect ); - } - } - { - SwRect aRect( pStripes->GetMin(), 0, pStripes->GetWidth(), 0 ); - for( USHORT i = 0; i < pStripes->Count(); ++i ) - { - aRect.Top( (*pStripes)[i].GetY() ); - aRect.Height( (*pStripes)[i].GetHeight() ); - AddPaintRect( aRect ); - } - } - pScroll->Remove( nCnt ); - delete pStripes; - } - pScrolledArea->Remove( nCount ); - delete pScroll; - } - delete pScrolledArea; - pScrolledArea = NULL; -} - -/****************************************************************************** -|* -|* SwViewImp::_FlushScrolledArea(..) -|* -|* Creation AMA 10. July 00 -|* Last change AMA 21. July 00 -|* -|* The critical lines, which overlaps with the given rectangle, will be united -|* with the rectangle and removed from the list. -|* -******************************************************************************/ - -BOOL SwViewImp::_FlushScrolledArea( SwRect& rRect ) -{ - BOOL bRet = FALSE; - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - for( USHORT j = pScroll->Count(); j; ) - { - SwStripes* pStripes = (*pScroll)[--j]; - if( pStripes->Count() ) - { - if( pScroll->IsVertical() ) - { - SwRect aRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - if( rRect.IsOver( aRect ) ) - { - rRect.Union( aRect ); - bRet = TRUE; - pStripes->Remove( nI ); - nI = pStripes->Count(); - } - } - } - } - else - { - SwRect aRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - rRect.Union( aRect ); - bRet = TRUE; - pStripes->Remove( nI ); - nI = pStripes->Count(); - } - } - } - } - } - if( !pStripes->Count() ) - { - pScroll->Remove( j ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - } - if( !pScrolledArea->Count() ) - { - DELETEZ( pScrolledArea ); - SetNextScroll(); - } - return bRet; -} - -/****************************************************************************** -|* -|* SwViewImp::RefreshScrolledHdl(..) -|* -|* Creation MA 06. Oct. 94 -|* Last change AMA 21. July 00 -|* -|* Every timerstop one of the critical lines will be painted. -|* -******************************************************************************/ - -IMPL_LINK( SwViewImp, RefreshScrolledHdl, Timer *, EMPTYARG ) -{ - DBG_PROFSTART( RefreshTimer ); - - if ( !IsScrolled() ) - { DBG_PROFSTOP( RefreshTimer ); - return 0; - } - - SET_CURR_SHELL( GetShell() ); - - //Kein Refresh wenn eine Selektion besteht. - if ( GetShell()->IsA( TYPE(SwCrsrShell) ) && - (((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1)) - { - DBG_PROFSTOP( RefreshTimer ); - return 0; - } - - if( pScrolledArea ) - { - const SwRect aRect( GetShell()->VisArea() ); - BOOL bNoRefresh = GetShell()->IsA( TYPE(SwCrsrShell) ) && - ( ((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1 ); - if( pScrolledArea->Count() ) - { - SwScrollArea* pScroll = pScrolledArea->GetObject(0); - ASSERT( pScroll->Count(), "Empty scrollarea" ); - // OD 21.10.2003 #112616# - for savety reason: - // react, if precondition named in assertion isn't hold - if ( pScroll->Count() ) - { - SwStripes* pStripes = pScroll->GetObject(0); - // OD 20.10.2003 #112616# - consider also first stripe - ASSERT( pStripes->Count(), "Empty scrollstripes" ); - // OD 21.10.2003 #112616# - for savety reason: - // react, if precondition named in assertion isn't hold - if ( pStripes->Count() ) - { - const SwStripe &rStripe = pStripes->GetObject(0); - SwRect aTmpRect = pScroll->IsVertical() ? - SwRect( rStripe.GetY() - rStripe.GetHeight(), pScroll->GetX(), - rStripe.GetHeight(), pScroll->GetWidth() ) : - SwRect( pScroll->GetX(), rStripe.GetY(), - pScroll->GetWidth(), rStripe.GetHeight() ); - if( aTmpRect.IsOver( aRect ) ) - { - // SwSaveHdl aSaveHdl( this ); - if( !bNoRefresh ) - _RefreshScrolledArea( aTmpRect ); - } - // OD 20.10.2003 #112616# - consider also first stripe - pStripes->Remove( 0 ); - } - if( pStripes->Count() < 1 ) - { - pScroll->Remove( USHORT(0) ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - } - if( !pScrolledArea->Count() ) - { - delete pScrolledArea; - pScrolledArea = 0; - } - } - - //All done? - if( !pScrolledArea || !pScrolledArea->Count() - ) - { - ResetScrolled(); - SetNextScroll(); - aScrollTimer.Stop(); - } - - DBG_PROFSTOP( RefreshTimer ); - return 0; -} - -/****************************************************************************** -|* -|* SwViewImp::_ScrolledRect(..) -|* -|* Creation AMA 20. July 00 -|* Last change AMA 21. July 00 -|* -|* handles the problem of scrolled criticals lines, when they are a part of -|* a scrolling area again. In this case, their rectangle has to move to the -|* right position. -|* -******************************************************************************/ - -void SwViewImp::_ScrolledRect( const SwRect& rRect, long nOffs ) -{ - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - ASSERT( pScroll->Count() == 1, "Missing scrollarea compression 1" ); - SwStripes* pStripes = (*pScroll)[0]; - if( pStripes->Count() ) - { - SwRect aRect = pScroll->IsVertical() ? - SwRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ) : - SwRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - - if( rRect.IsOver( aRect ) ) - { - BOOL bRecalc = FALSE; - for( USHORT nI = pStripes->Count(); nI; ) - { - if( pScroll->IsVertical() ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() - nWidth + 1 ); - aRect.Width( nWidth ); - } - else - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - } - if( rRect.IsInside( aRect ) ) - { - (*pStripes)[nI].Y() += nOffs; - bRecalc = TRUE; - } - } - if( bRecalc ) - pStripes->Recalc( pScroll->IsVertical() ); - } - } - } -} - -/****************************************************************************** -|* -|* SwViewImp::_RefreshScrolledArea() -|* -******************************************************************************/ - -//Berechnen der Hoehe fuer das virtuelle Device, Breite und maximaler -//Speicherbedarf sind vorgegeben. -#define MAXKB 180L - -static void lcl_CalcVirtHeight( OutputDevice *pOut, Size &rSz ) -{ - char nBytes; - const ULONG nColorCount = pOut->GetColorCount(); - if( 256 >= nColorCount ) // 2^8 - nBytes = 1; - else - if( USHRT_MAX >= nColorCount ) // 2^16 - nBytes = 2; - else - if( 16777216 >= nColorCount ) // 2^24 - nBytes = 3; - else - nBytes = 4; // 2^n - - rSz = pOut->LogicToPixel( rSz ); - - long nKB = MAXKB * 1000; - nKB /= nBytes; - if ( rSz.Width() > 0 ) - rSz.Height() = nKB / rSz.Width(); - else - rSz.Height() = nKB; - - rSz = pOut->PixelToLogic( rSz ); -} - -void SwViewImp::_RefreshScrolledArea( const SwRect &rRect ) -{ - SwRect aScRect( rRect ); - aScRect.Intersection( GetShell()->VisArea() ); - - if( aScRect.IsEmpty() ) - return; - - BOOL bShowCrsr = FALSE; - Window *pWin = GetShell()->GetWin(); - if ( pWin && pWin->GetCursor() && pWin->GetCursor()->IsVisible() ) - { - bShowCrsr = TRUE; - pWin->GetCursor()->Hide(); - } - - //Virtuelles Device erzeugen und einstellen. - // --> OD 2007-08-16 #i80720# - // rename variable to - OutputDevice* pCurrentOut = GetShell()->GetOut(); - VirtualDevice *pVout = new VirtualDevice( *pCurrentOut ); - MapMode aMapMode( pCurrentOut->GetMapMode() ); - pVout->SetMapMode( aMapMode ); - Size aSize( aScRect.Width(), 0 ); - lcl_CalcVirtHeight( pCurrentOut, aSize ); - if ( aSize.Height() > aScRect.Height() ) - aSize.Height() = aScRect.Height() + 50; - - //unten in der Schleife lassen wir die Rechtecke ein wenig ueberlappen, - //das muss auch bei der Groesse beruecksichtigt werden. - aSize = pCurrentOut->LogicToPixel( aSize ); - aSize.Width() += 4; aSize.Height() += 4; - aSize = pCurrentOut->PixelToLogic( aSize ); - // <-- - - const SwRootFrm* pLayout = GetShell()->GetLayout(); - - // #i75172# Avoid VDev if PreRendering is active - static bool bDoNotUseVDev(GetDrawView()->IsBufferedOutputAllowed()); - - // --> OD 2007-08-16 #i80720# - // Enlarge paint rectangle also in case that "own" virtual device - // isn't used. Refactor code a little bit to achieve this. - const bool bApplyVDev = !bDoNotUseVDev && pVout->SetOutputSize( aSize ); - - { - if ( bApplyVDev ) - { - // --> OD 2007-08-16 #i80720# - // rename variable to - pVout->SetLineColor( pCurrentOut->GetLineColor() ); - pVout->SetFillColor( pCurrentOut->GetFillColor() ); - // <-- - } - - // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev - const Region aRepaintRegion(aScRect.SVRect()); - GetShell()->DLPrePaint2(aRepaintRegion); - - //Virtuelles Device in die ViewShell 'selektieren' - // --> OD 2007-08-16 #i80720# - // remember current output device at this place - OutputDevice* pOldOut = GetShell()->GetOut(); - // <-- - if ( bApplyVDev ) - { - GetShell()->pOut = pVout; - } - - const SwFrm *pPg = GetFirstVisPage(); - do - { - SwRect aRect( pPg->Frm() ); - if ( aRect.IsOver( aScRect ) ) - { - aRect._Intersection( aScRect ); - do - { - Rectangle aTmp( aRect.SVRect() ); - long nTmp = aTmp.Top() + aSize.Height(); - if ( aTmp.Bottom() > nTmp ) - aTmp.Bottom() = nTmp; - - aTmp = pOldOut->LogicToPixel( aTmp ); - if( aRect.Top() > pPg->Frm().Top() ) - aTmp.Top() -= 2; - if( aRect.Top() + aRect.Height() < pPg->Frm().Top() - + pPg->Frm().Height() ) - aTmp.Bottom() += 2; - if( aRect.Left() > pPg->Frm().Left() ) - aTmp.Left() -= 2; - if( aRect.Left() + aRect.Width() < pPg->Frm().Left() - + pPg->Frm().Width() ) - aTmp.Right() += 2; - aTmp = pOldOut->PixelToLogic( aTmp ); - SwRect aTmp2( aTmp ); - - if ( bApplyVDev ) - { - // OD 12.11.2002 #96272# - use method to set mapping - //Point aOrigin( aTmp2.Pos() ); - //aOrigin.X() = -aOrigin.X(); aOrigin.Y() = -aOrigin.Y(); - //aMapMode.SetOrigin( aOrigin ); - ::SetMappingForVirtDev( aTmp2.Pos(), &aMapMode, pOldOut, pVout ); - pVout->SetMapMode( aMapMode ); - } - - pLayout->Paint( aTmp2 ); - if ( bApplyVDev ) - { - pOldOut->DrawOutDev( aTmp2.Pos(), aTmp2.SSize(), - aTmp2.Pos(), aTmp2.SSize(), *pVout ); - } - - aRect.Top( aRect.Top() + aSize.Height() ); - aScRect.Top( aRect.Top() ); - - } while ( aRect.Height() > 0 ); - } - pPg = pPg->GetNext(); - - } while ( pPg && pPg->Frm().IsOver( GetShell()->VisArea() ) ); - - if ( bApplyVDev ) - { - GetShell()->pOut = pOldOut; - } - delete pVout; - - // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted - GetShell()->DLPostPaint2(true); - } - // <-- - - if ( bShowCrsr ) - pWin->GetCursor()->Show(); -} - -/****************************************************************************** -|* -|* SwViewImp::RefreshScrolledArea() -|* -|* Ersterstellung MA 06. Oct. 94 -|* Letzte Aenderung MA 19. Apr. 95 -|* -******************************************************************************/ - -void SwViewImp::RefreshScrolledArea( SwRect &rRect ) -{ - // --> OD 2007-07-24 #123003# - make code robust - // avoid recursive call - static bool bRunning( false ); - - if ( bRunning ) - { - ASSERT( false, " - recursive method call - please inform OD" ); - return; - } - // <-- - - //1. Wird auch von der CrsrShell gerufen, um ggf. den Bereich, in den der - //Crsr gesetzt wird (Absatz, ganze Zeile bei einer Tabelle) aufzufrischen. - //Allerdings kann es dann natuerlich sein, dass das Rechteck ueberhaupt - //nicht mit aufzufrischenden Bereichen ueberlappt. - //2. Kein Refresh wenn eine Selektion besteht. - if( (GetShell()->IsA( TYPE(SwCrsrShell) ) && - (((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1))) - { - return; - } - - // --> OD 2007-07-27 #123003# - bRunning = true; - // <-- - - if( pScrolledArea && pScrolledArea->Count() && - !( ( GetShell()->IsA( TYPE(SwCrsrShell) ) && - ( ((SwCrsrShell*)GetShell())->HasSelection() || - ((SwCrsrShell*)GetShell())->GetCrsrCnt() > 1) ) ) ) - { - for( USHORT i = pScrolledArea->Count(); i; ) - { - SwScrollArea* pScroll = (*pScrolledArea)[--i]; - for( USHORT j = pScroll->Count(); j; ) - { - SwStripes* pStripes = (*pScroll)[--j]; - if( pStripes->Count() ) - { - SwRect aRect = pScroll->IsVertical() ? - SwRect( pStripes->GetY() - pStripes->GetHeight(), - pStripes->GetMin(), pStripes->GetHeight(), - pStripes->GetWidth() ) : - SwRect( pStripes->GetMin(), pStripes->GetY(), - pStripes->GetWidth(), pStripes->GetHeight() ); - if( rRect.IsOver( aRect ) ) - { - for( USHORT nI = pStripes->Count(); nI; ) - { - if( pScroll->IsVertical() ) - { - long nWidth = (*pStripes)[--nI].GetHeight(); - aRect.Left( (*pStripes)[nI].GetY() -nWidth +1 ); - aRect.Width( nWidth ); - } - else - { - aRect.Top( (*pStripes)[--nI].GetY() ); - aRect.Height( (*pStripes)[nI].GetHeight() ); - } - if( rRect.IsOver( aRect ) ) - { - pStripes->Remove( nI ); - _RefreshScrolledArea( aRect ); - } - } - } - } - if( !pStripes->Count() ) - { - pScroll->Remove( j ); - delete pStripes; - } - } - if( !pScroll->Count() ) - { - pScrolledArea->Remove( pScroll ); - delete pScroll; - } - //Ist da jemand ungeduldig? - //Nur Mouse und Keyboard, weil wir sonst von jeder billigen - //Uhr unterbrochen werden. - if( GetpApp()->AnyInput( INPUT_MOUSEANDKEYBOARD ) ) - break; - } - } - - //All done? - if( !pScrolledArea || !pScrolledArea->Count() ) - { - ResetScrolled(); - SetNextScroll(); - aScrollTimer.Stop(); - } - - // --> OD 2007-07-24 #123003# - bRunning = false; - // <-- -} - -SwStripes& SwStripes::Plus( const SwStripes& rOther, BOOL bVert ) -{ - if( !Count() ) - { - Insert( &rOther, 0 ); - SetMin( rOther.GetMin() ); - SetMax( rOther.GetMax() ); - return *this; - } - - long nCnt = rOther.Count(); - if( nCnt ) - { - ChkMin( rOther.GetMin() ); - ChkMax( rOther.GetMax() ); - USHORT nStart = 0; - if( bVert ) - for( USHORT nIdx = 0; nIdx < nCnt; ++nIdx ) - { - const SwStripe& rAdd = rOther[ nIdx ]; - long nBottom = rAdd.GetY() - rAdd.GetHeight(); - USHORT nCount = Count(); - USHORT nTmpY = nStart; - while( nTmpY < nCount ) - { - SwStripe& rChk = GetObject( nTmpY ); - if( rChk.GetY() - rChk.GetHeight() < rAdd.GetY() ) - break; - else - ++nTmpY; - } - USHORT nB = nTmpY; - while( nB < nCount ) - { - const SwStripe& rChk = GetObject( nB ); - if( rChk.GetY() <= nBottom ) - break; - else - ++nB; - } - nStart = nTmpY; - if( nTmpY == nB ) - Insert( rAdd, nTmpY ); - else - { - long nChkBottom = rAdd.GetY() - rAdd.GetHeight();; - const SwStripe& rChkB = GetObject( nB - 1 ); - long nTmp = rChkB.GetY() - rChkB.GetHeight(); - if( nTmp < nChkBottom ) - nChkBottom = nTmp; - SwStripe& rChk = GetObject( nTmpY ); - if( rAdd.GetY() > rChk.GetY() ) - rChk.Y() = rAdd.GetY(); - rChk.Height() = rChk.GetY() - nChkBottom; - nChkBottom = nB - nTmpY - 1; - if( nChkBottom ) - Remove( nTmpY + 1, (USHORT)nChkBottom ); - } - } - else - { - for( USHORT nIdx = 0; nIdx < nCnt; ++nIdx ) - { - const SwStripe& rAdd = rOther[ nIdx ]; - long nBottom = rAdd.GetY() + rAdd.GetHeight(); - USHORT nCount = Count(); - USHORT nTmpY = nStart; - while( nTmpY < nCount ) - { - SwStripe& rChk = GetObject( nTmpY ); - if( rChk.GetY() + rChk.GetHeight() > rAdd.GetY() ) - break; - else - ++nTmpY; - } - USHORT nB = nTmpY; - while( nB < nCount ) - { - const SwStripe& rChk = GetObject( nB ); - if( rChk.GetY() >= nBottom ) - break; - else - ++nB; - } - nStart = nTmpY; - if( nTmpY == nB ) - Insert( rAdd, nTmpY ); - else - { - long nChkBottom = rAdd.GetY() + rAdd.GetHeight();; - const SwStripe& rChkB = GetObject( nB - 1 ); - long nTmp = rChkB.GetY() + rChkB.GetHeight(); - if( nTmp > nChkBottom ) - nChkBottom = nTmp; - SwStripe& rChk = GetObject( nTmpY ); - if( rAdd.GetY() < rChk.GetY() ) - rChk.Y() = rAdd.GetY(); - rChk.Height() = nChkBottom - rChk.GetY(); - nChkBottom = nB - nTmpY - 1; - if( nChkBottom ) - Remove( nTmpY + 1, (USHORT)nChkBottom ); - } - } - } - } - return *this; -} - -BOOL SwStripes::Recalc( BOOL bVert ) -{ - if( !Count() ) - return TRUE; - Y() = GetObject(0).GetY(); - if( bVert ) - { - long nTmpMin = GetObject(0).GetY() - GetObject(0).Height(); - for( USHORT nIdx = 1; nIdx < Count(); ) - { - const SwStripe& rStr = GetObject(nIdx++); - if( GetY() < rStr.GetY() ) - Y() = rStr.GetY(); - if( nTmpMin > rStr.GetY() - rStr.GetHeight() ) - nTmpMin = rStr.GetY() - rStr.GetHeight(); - } - Height() = GetY() - nTmpMin; - } - else - { - long nTmpMax = GetObject(0).GetY() + GetObject(0).Height(); - for( USHORT nIdx = 1; nIdx < Count(); ) - { - const SwStripe& rStr = GetObject(nIdx++); - if( GetY() > rStr.GetY() ) - Y() = rStr.GetY(); - if( nTmpMax < rStr.GetY() + rStr.GetHeight() ) - nTmpMax = rStr.GetY() + rStr.GetHeight(); - } - Height() = nTmpMax - GetY(); - } - return FALSE; -} - -BOOL SwScrollArea::Compress() -{ - if( !Count() ) - return TRUE; - for( USHORT nIdx = Count() - 1; nIdx > 0; --nIdx ) - { - GetObject(0)->Plus( *GetObject(nIdx), IsVertical() ); - delete GetObject( nIdx ); - Remove( nIdx, 1 ); - } - ClrOffs(); - return GetObject(0)->Recalc( IsVertical() ); -} - -void SwScrollArea::Add( SwScrollArea *pScroll ) -{ - ASSERT( pScroll->Count() == 1, "Missing scrollarea compression 2" ); - ASSERT( Count() == 1, "Missing scrollarea compression 3" ); - GetObject(0)->Plus( *pScroll->GetObject(0), IsVertical() ); - GetObject(0)->Recalc( IsVertical() ); - delete pScroll->GetObject( 0 ); - pScroll->Remove( (USHORT)0, 1 ); - delete pScroll; -} - -/****************************************************************************** -|* -|* SwScrollAreas::Insert(..) -|* -******************************************************************************/ - -void SwScrollAreas::InsertCol( const SwScrollColumn &rCol, - SwStripes *pStripes ) -{ - SwScrollArea *pTmp = new SwScrollArea( rCol, pStripes ); - USHORT nIdx; - if( Seek_Entry( pTmp, &nIdx ) ) - { - GetObject( nIdx )->SmartInsert( pStripes ); - delete pTmp; - } - else - Insert( pTmp ); -} - - -void SwScrollArea::SmartInsert( SwStripes* pStripes ) -{ - ASSERT( pStripes, "Insert empty scrollstripe?" ); - BOOL bNotInserted = TRUE; - if( IsVertical() ) - for( USHORT nIdx = 0; nIdx < Count() && bNotInserted; ) - { - SwStripes* pTmp = GetObject( nIdx++ ); - if( pTmp->GetY() - pTmp->GetHeight() == pStripes->GetY() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, pTmp->Count(), 0 ); - bNotInserted = FALSE; - } - else if( pTmp->GetY() == pStripes->GetY() - pStripes->GetHeight() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->Y() = pStripes->GetY(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, 0, 0 ); - bNotInserted = FALSE; - } - } - else - for( USHORT nIdx = 0; nIdx < Count() && bNotInserted; ) - { - SwStripes* pTmp = GetObject( nIdx++ ); - if( pTmp->GetY() + pTmp->GetHeight() == pStripes->GetY() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, pTmp->Count(), 0 ); - bNotInserted = FALSE; - } - else if( pTmp->GetY() == pStripes->GetY() + pStripes->GetHeight() ) - { - pTmp->Height() += pStripes->GetHeight(); - pTmp->Y() = pStripes->GetY(); - pTmp->ChkMin( pStripes->GetMin() ); - pTmp->ChkMax( pStripes->GetMax() ); - if( pStripes->Count() ) - pTmp->Insert( (SwStripeArr*)pStripes, 0, 0 ); - bNotInserted = FALSE; - } - } - if( !bNotInserted || !Insert( pStripes ) ) - delete pStripes; -} diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 7bb1aabe07c8..3e80e663f15e 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -32,7 +32,6 @@ #include "precompiled_sw.hxx" -#include "scrrect.hxx" #include "crsrsh.hxx" #include "rootfrm.hxx" #include "pagefrm.hxx" @@ -129,8 +128,6 @@ SwViewImp::SwViewImp( ViewShell *pParent ) : pSdrPageView( 0 ), pFirstVisPage( 0 ), pRegion( 0 ), - pScrollRects( 0 ), - pScrolledArea( 0 ), pLayAct( 0 ), pIdleAct( 0 ), pAccMap( 0 ), @@ -141,13 +138,9 @@ SwViewImp::SwViewImp( ViewShell *pParent ) : { //bResetXorVisibility = //HMHbShowHdlPaint = - bResetHdlHiddenPaint = bScrolled = - bPaintInScroll = bSmoothUpdate = bStopSmooth = bStopPrt = FALSE; - bFirstPageInvalid = bScroll = bNextScroll = TRUE; - - aScrollTimer.SetTimeout( 1500 ); - aScrollTimer.SetTimeoutHdl( LINK( this, SwViewImp, RefreshScrolledHdl)); - aScrollTimer.Stop(); + bResetHdlHiddenPaint = + bSmoothUpdate = bStopSmooth = bStopPrt = FALSE; + bFirstPageInvalid = TRUE; } /****************************************************************************** @@ -172,8 +165,7 @@ SwViewImp::~SwViewImp() delete pDrawView; - DelRegions(); - delete pScrolledArea; + DelRegion(); ASSERT( !pLayAct, "Have action for the rest of your life." ); ASSERT( !pIdleAct,"Be idle for the rest of your life." ); @@ -188,10 +180,9 @@ SwViewImp::~SwViewImp() |* ******************************************************************************/ -void SwViewImp::DelRegions() +void SwViewImp::DelRegion() { DELETEZ(pRegion); - DELETEZ(pScrollRects); } /****************************************************************************** diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index cd80439877f6..bad21186ac42 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -219,28 +219,18 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) Imp()->StartAction(); if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() ) - Imp()->DelRegions(); + Imp()->DelRegion(); const BOOL bExtraData = ::IsExtraData( GetDoc() ); if ( !bIdleEnd ) { - if ( Imp()->IsNextScroll() && !bExtraData ) - Imp()->SetScroll(); - else - { - if ( bExtraData ) - Imp()->bScroll = FALSE; - Imp()->SetNextScroll(); - Imp()->ResetScroll(); - } SwLayAction aAction( GetLayout(), Imp() ); aAction.SetComplete( FALSE ); if ( nLockPaint ) aAction.SetPaint( FALSE ); aAction.SetInputType( INPUT_KEYBOARD ); aAction.Action(); - Imp()->SetScroll(); } if ( bIsShellForCheckViewLayout ) @@ -249,8 +239,9 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) //Wenn wir selbst keine Paints erzeugen, so warten wir auf das Paint //vom System. Dann ist das Clipping korrekt gesetzt; Beispiel: verschieben //eines DrawObjektes. - if ( Imp()->GetRegion() || Imp()->GetScrollRects() || - aInvalidRect.HasArea() || bExtraData ) + if ( Imp()->GetRegion() || + aInvalidRect.HasArea() || + bExtraData ) { if ( !nLockPaint ) { @@ -274,15 +265,10 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) // Mitte eine Selektion und mit einem anderen Cursor an linken // rechten Rand springen. Ohne ShowCrsr verschwindet die // Selektion - BOOL bShowCrsr = (pRegion || Imp()->GetScrollRects()) && - IsA( TYPE(SwCrsrShell) ); + BOOL bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) ); if( bShowCrsr ) ((SwCrsrShell*)this)->HideCrsrs(); - Scroll(); - if ( bPaintsFromSystem && Imp()->pScrolledArea ) - Imp()->FlushScrolledArea(); - if ( pRegion ) { SwRootFrm* pLayout = GetLayout(); @@ -411,14 +397,14 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) delete pVout; delete pRegion; - Imp()->DelRegions(); + Imp()->DelRegion(); } if( bShowCrsr ) ((SwCrsrShell*)this)->ShowCrsrs( TRUE ); } else { - Imp()->DelRegions(); + Imp()->DelRegion(); bPaintWorks = TRUE; } } @@ -438,13 +424,6 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) UISizeNotify(); ++nStartAction; -#ifdef DBG_UTIL - // test option 'No Scroll' suppresses the automatic repair of the scrolled area - if ( !GetViewOptions()->IsTest8() ) -#endif - if ( Imp()->IsScrolled() ) - Imp()->RestartScrollTimer(); - if( Imp()->IsAccessible() ) Imp()->FireAccessibleEvents(); } @@ -1199,12 +1178,10 @@ void ViewShell::VisPortChgd( const SwRect &rRect) //vom RootFrm::Paint erzeugt worden sein. if ( !bInEndAction && Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() ) - Imp()->DelRegions(); + Imp()->DelRegion(); SET_CURR_SHELL( this ); - //SwSaveHdl aSaveHdl( Imp() ); - bool bScrolled = false; SwPostItMgr* pPostItMgr = GetPostItMgr(); @@ -1334,9 +1311,7 @@ void ViewShell::VisPortChgd( const SwRect &rRect) Imp()->GetDrawView()->VisAreaChanged( GetWin() ); Imp()->GetDrawView()->SetActualWin( GetWin() ); } - Imp()->bPaintInScroll = TRUE; GetWin()->Update(); - Imp()->bPaintInScroll = FALSE; if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ) pPostItMgr->CorrectPositions(); @@ -1836,9 +1811,8 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) //nicht ankommen. //Ergo: Alles selbst machen (siehe ImplEndAction()) if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea()) - Imp()->DelRegions(); + Imp()->DelRegion(); - Imp()->ResetScroll(); SwLayAction aAction( GetLayout(), Imp() ); aAction.SetComplete( FALSE ); // We increment the action counter to avoid a recursive call of actions @@ -1864,7 +1838,7 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) } if ( bStop ) { - Imp()->DelRegions(); + Imp()->DelRegion(); pRegion = 0; } } @@ -1909,7 +1883,7 @@ BOOL ViewShell::CheckInvalidForPaint( const SwRect &rRect ) } else bRet = FALSE; - Imp()->DelRegions(); + Imp()->DelRegion(); } else bRet = FALSE; @@ -1960,17 +1934,7 @@ void ViewShell::Paint(const Rectangle &rRect) { if( GetWin() && GetWin()->IsVisible() ) { - //Wenn mit dem Paint ein Bereich betroffen ist, der vorher gescrolled - //wurde, so wiederholen wir das Paint mit dem Gesamtbereich. Nur so - //koennen wir sicherstellen, das (nicht mal kurzfristig) durch das Paint - //keine Alignmentfehler sichtbar werden. SwRect aRect( rRect ); - if ( Imp()->IsScrolled() && Imp()->FlushScrolledArea( aRect ) ) - { - GetWin()->Invalidate( aRect.SVRect() ); - return; - } - if ( bPaintInProgress ) //Schutz gegen doppelte Paints! { GetWin()->Invalidate( rRect ); -- cgit v1.2.3 From d7d854b1c4f70f57f29261d6a942bdb29ebcee8c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 29 Dec 2009 11:44:13 +0100 Subject: sw33bf02: #i105901# method - skip character cells for all script types --- sw/source/core/txtnode/fntcache.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 7aec6d4e9884..f99b745b9c14 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2420,21 +2420,18 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf ) sal_uInt16 nItrMode = i18n::CharacterIteratorMode::SKIPCELL; sal_Int32 nDone = 0; LanguageType aLang = LANGUAGE_NONE; - sal_Bool bSkipCell = sal_False; + bool bSkipCharacterCells = false; xub_StrLen nIdx = rInf.GetIdx(); xub_StrLen nLastIdx = nIdx; const xub_StrLen nEnd = rInf.GetIdx() + rInf.GetLen(); - // skip character cells for complex scripts - // --> OD 2009-10-14 #i105571# - skip also character cells for CJK - if ( rInf.GetFont() && - ( SW_CTL == rInf.GetFont()->GetActual() || - SW_CJK == rInf.GetFont()->GetActual() ) && - pBreakIt->GetBreakIter().is() ) + // --> OD 2009-12-29 #i105901# + // skip character cells for all script types + if ( pBreakIt->GetBreakIter().is() ) // <-- { aLang = rInf.GetFont()->GetLanguage(); - bSkipCell = sal_True; + bSkipCharacterCells = true; } while ( ( nRight < long( rInf.GetOfst() ) ) && ( nIdx < nEnd ) ) @@ -2445,7 +2442,7 @@ xub_StrLen SwFntObj::GetCrsrOfst( SwDrawTextInfo &rInf ) // go to next character (cell). nLastIdx = nIdx; - if ( bSkipCell ) + if ( bSkipCharacterCells ) { nIdx = (xub_StrLen)pBreakIt->GetBreakIter()->nextCharacters( rInf.GetText(), nIdx, pBreakIt->GetLocale( aLang ), nItrMode, 1, nDone ); -- cgit v1.2.3 From 5d57f18e6f0b14a1bf2c0f418a9cd6f64e06781b Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 30 Dec 2009 15:04:27 +0100 Subject: sw33bf02: #i89920# Improvement of selection of objects in background --- sw/source/core/draw/dflyobj.cxx | 5 +++ sw/source/core/frmedt/feshview.cxx | 86 +++++++++++++++++++++++++++----------- sw/source/core/inc/dflyobj.hxx | 1 + sw/source/ui/docvw/edtwin.cxx | 23 +++++----- 4 files changed, 80 insertions(+), 35 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 15ca46ca2456..c97c0a079745 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -566,6 +566,11 @@ const Rectangle& __EXPORT SwVirtFlyDrawObj::GetCurrentBoundRect() const return aOutRect; } +const Rectangle& __EXPORT SwVirtFlyDrawObj::GetLastBoundRect() const +{ + return GetCurrentBoundRect(); +} + void __EXPORT SwVirtFlyDrawObj::RecalcBoundRect() { diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index d465abc4403e..80e150248c75 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1185,9 +1185,7 @@ bool SwFEShell::IsObjSelectable( const Point& rPt ) } // #107513# -// Test if there is a draw object at that position and if it should be selected. -// The 'should' is aimed at Writer text fly frames which may be in front of -// the draw object. +// Test if there is a object at that position and if it should be selected. sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) { SET_CURR_SHELL(this); @@ -1204,39 +1202,79 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) bRet = pDrawView->PickObj(rPt, pDrawView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMARKABLE); pDrawView->SetHitTolerancePixel(nOld); - if(bRet && pObj) + if ( bRet && pObj ) { const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess(); - if( pObj->GetLayer() == pIDDMA->GetHellId() ) + // --> OD 2009-12-30 #i89920# + // Do not select object in background which is overlapping this text + // at the given position. + bool bObjInBackground( false ); { - const SwFrm *pPageFrm = GetLayout()->Lower(); - while( pPageFrm && !pPageFrm->Frm().IsInside( rPt ) ) + if ( pObj->GetLayer() == pIDDMA->GetHellId() ) { - if ( rPt.Y() < pPageFrm->Frm().Top() ) - pPageFrm = 0; - else - pPageFrm = pPageFrm->GetNext(); + const SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj ); + const SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt(); + const SwFmtSurround& rSurround = rFmt.GetSurround(); + if ( rSurround.GetSurround() == SURROUND_THROUGHT ) + { + bObjInBackground = true; + } } + } + if ( bObjInBackground ) + { + const SwPageFrm* pPageFrm = GetLayout()->GetPageAtPos( rPt ); if( pPageFrm ) { - SwRect aTmp( pPageFrm->Prt() ); - aTmp += pPageFrm->Frm().Pos(); - if( aTmp.IsInside( rPt ) ) - return sal_False; + const SwCntntFrm* pCntntFrm( pPageFrm->ContainsCntnt() ); + while ( pCntntFrm ) + { + if ( pCntntFrm->UnionFrm().IsInside( rPt ) ) + { + const SwTxtFrm* pTxtFrm = + dynamic_cast(pCntntFrm); + if ( pTxtFrm ) + { + SwPosition* pPos = + new SwPosition( *(pTxtFrm->GetTxtNode()) ); + Point aTmpPt( rPt ); + if ( pTxtFrm->GetKeyCrsrOfst( pPos, aTmpPt ) ) + { + SwRect aCharRect; + if ( pTxtFrm->GetCharRect( aCharRect, *pPos ) ) + { + if ( aCharRect.IsOver( SwRect( pObj->GetLastBoundRect() ) ) ) + { + bRet = sal_False; + } + } + } + } + else + { + bRet = sal_False; + } + break; + } + + pCntntFrm = pCntntFrm->GetNextCntntFrm(); + } } } - - const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); - // --> FME 2005-04-18 #i20965# Use GetOrdNum() instead of GetOrdNumDirect() - // because ordnums might be wrong - for(sal_uInt32 a(pObj->GetOrdNum() + 1); bRet && a < pPage->GetObjCount(); a++) - { // <-- - SdrObject *pCandidate = pPage->GetObj(a); - if(pCandidate->ISA(SwVirtFlyDrawObj) && ((SwVirtFlyDrawObj*)pCandidate)->GetCurrentBoundRect().IsInside(rPt)) + if ( bRet ) + { + const SdrPage* pPage = pIDDMA->GetDrawModel()->GetPage(0); + for(sal_uInt32 a(pObj->GetOrdNum() + 1); bRet && a < pPage->GetObjCount(); a++) { - bRet = sal_False; + SdrObject *pCandidate = pPage->GetObj(a); + + if (pCandidate->ISA(SwVirtFlyDrawObj) && + ( (SwVirtFlyDrawObj*)pCandidate)->GetCurrentBoundRect().IsInside(rPt) ) + { + bRet = sal_False; + } } } } diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 292be49df7b4..2d5f8299a229 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -100,6 +100,7 @@ public: //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand. virtual const Rectangle& GetCurrentBoundRect() const; + virtual const Rectangle& GetLastBoundRect() const; virtual void RecalcBoundRect(); virtual void RecalcSnapRect(); virtual const Rectangle& GetSnapRect() const; diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 5bef2edb398f..6e7c393d8c6a 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -2882,7 +2882,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) !bExecDrawTextLink) { // #107513# - // Test if there is a draw object at that position and if it should be selected. + // Test if there is a object at that position and if it should be selected. sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos); if(bShould) @@ -3153,7 +3153,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if ( rSh.IsSelFrmMode() ) rSh.SelectObj(aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP); else - { if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) ) + { + if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) ) { rSh.EnterSelFrmMode( &aDocPos ); SwEditWin::nDDStartPosY = aDocPos.Y(); @@ -3366,11 +3367,16 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bNoInterrupt = bTmpNoInterrupt; } - if( !bOverURLGrf && !bOnlyText ) + if ( !bOverURLGrf && !bOnlyText ) { - const int nSelType = rSh.GetSelectionType(); - if( nSelType == nsSelectionType::SEL_OLE || - nSelType == nsSelectionType::SEL_GRF ) + const SelectionType nSelType = rSh.GetSelectionType(); + // --> OD 2009-12-30 #i89920# + // Check in general, if an object is selectable at given position. + // Thus, also text fly frames in background become selectable via Ctrl-Click. + if ( nSelType & nsSelectionType::SEL_OLE || + nSelType & nsSelectionType::SEL_GRF || + rSh.IsObjSelectable( aDocPos ) ) + // <-- { MV_KONTEXT( &rSh ); if( !rSh.IsFrmSelected() ) @@ -3379,11 +3385,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bCallBase = FALSE; } } - // nicht mehr hier zuruecksetzen, damit -- falls durch MouseMove - // bei gedrueckter Ctrl-Taste eine Mehrfachselektion erfolgen soll, - // im Drag nicht die vorherige Selektion aufgehoben wird. -// if(bModePushed) -// rSh.PopMode(FALSE); break; } } -- cgit v1.2.3 From ace587b93a77488eba22fea1fc90ab576a4dde6c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 30 Dec 2009 15:07:06 +0100 Subject: sw33bf02: #i89920# method - adjustment of object's attributes - renaming of method. - setting object's wrapping style to WRAP_THROUGH. - bringing object into foreground. --- sw/inc/fesh.hxx | 8 ++--- sw/source/core/crsr/crstrvl.cxx | 6 ++-- sw/source/core/frmedt/fefly1.cxx | 73 ++++++++++++++++------------------------ sw/source/ui/dochdl/swdtflvr.cxx | 6 ++-- sw/source/ui/shells/grfshex.cxx | 2 +- sw/source/ui/uiview/viewdraw.cxx | 4 +-- 6 files changed, 43 insertions(+), 56 deletions(-) diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index e75d4baec8d0..0146b91d0571 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -539,10 +539,10 @@ public: const SfxItemSet* pFlyAttrSet = 0, const SfxItemSet* pGrfAttrSet = 0, SwFrmFmt* = 0 ); - //Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel - // angemeldet sein. - void Insert( SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet = 0, - SwFrmFmt* = 0, const Point* = 0 ); + + // Insertion of a drawing object which have to be already inserted in the DrawModel + void InsertDrawObj( SdrObject& rDrawObj, + const Point& rInsertPosition ); BOOL ReplaceSdrObj( const String& rGrfName, const String& rFltName, const Graphic* pGrf = 0 ); diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index b315e31bae48..39f041c66b66 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1008,9 +1008,9 @@ BOOL SwCrsrShell::IsPageAtPos( const Point &rPt ) const } BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, - SwContentAtPos& rCntntAtPos, - BOOL bSetCrsr, - SwRect* pFldRect ) + SwContentAtPos& rCntntAtPos, + BOOL bSetCrsr, + SwRect* pFldRect ) { SET_CURR_SHELL( this ); BOOL bRet = FALSE; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index a8a19c95f5ab..29b2fe64f30b 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -75,9 +75,11 @@ // --> OD 2006-03-06 #125892# #include // <-- - #include - +// --> OD 2009-12-29 #i89920# +#include +#include +// <-- using ::rtl::OUString; using namespace ::com::sun::star; @@ -899,67 +901,50 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, } -void SwFEShell::Insert( SdrObject& rDrawObj, - const SfxItemSet* pFlyAttrSet, - SwFrmFmt* pFrmFmt, const Point* pPt ) +void SwFEShell::InsertDrawObj( SdrObject& rDrawObj, + const Point& rInsertPosition ) { - SwDrawFrmFmt* pFmt = 0; SET_CURR_SHELL( this ); - if( pPt ) - { - SfxItemSet* pSet = 0; - const SfxPoolItem* pItem; - if( !pFlyAttrSet || - !pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False, &pItem ) || - FLY_PAGE != ((SwFmtAnchor*)pItem)->GetAnchorId() ) - { - pSet = new SfxItemSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange ); - pSet->Put( SwFmtAnchor( FLY_AT_CNTNT )); - pFlyAttrSet = pSet; - } + SfxItemSet rFlyAttrSet( GetDoc()->GetAttrPool(), aFrmFmtSetRange ); + rFlyAttrSet.Put( SwFmtAnchor( FLY_AT_CNTNT )); + // --> OD 2009-12-29 #i89920# + rFlyAttrSet.Put( SwFmtSurround( SURROUND_THROUGHT ) ); + rDrawObj.SetLayer( getIDocumentDrawModelAccess()->GetHeavenId() ); + // <-- + // find anchor position + SwPaM aPam( pDoc->GetNodes() ); + { SwCrsrMoveState aState( MV_SETONLYTEXT ); - SwPaM aPam( pDoc->GetNodes() ); - Point aTmpPt( *pPt ); + Point aTmpPt( rInsertPosition ); getIDocumentLayoutAccess()->GetRootFrm()->GetCrsrOfst( aPam.GetPoint(), aTmpPt, &aState ); - SwFrm* pFrm = aPam.GetCntntNode()->GetFrm( 0, 0, sal_False ); - const Point aRelPos( pPt->X() - pFrm->Frm().Left(), - pPt->Y() - pFrm->Frm().Top() ); - // OD 2004-04-05 #i26791# - direct object positioning for + const SwFrm* pFrm = aPam.GetCntntNode()->GetFrm( 0, 0, sal_False ); + const Point aRelPos( rInsertPosition.X() - pFrm->Frm().Left(), + rInsertPosition.Y() - pFrm->Frm().Top() ); rDrawObj.SetRelativePos( aRelPos ); - ::lcl_FindAnchorPos( *GetDoc(), *pPt, *pFrm, *(SfxItemSet*)pFlyAttrSet ); - pFmt = GetDoc()->Insert( aPam, rDrawObj, pFlyAttrSet, pFrmFmt ); - if( pSet ) - delete pSet; - } - else - { - StartAllAction(); - FOREACHPAM_START( this ) - pFmt = GetDoc()->Insert(*PCURCRSR, rDrawObj, - pFlyAttrSet, pFrmFmt ); - ASSERT( pFmt, "Doc->Insert(sdrobj) failed." ); - - FOREACHPAM_END() - EndAllAction(); + ::lcl_FindAnchorPos( *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet ); } + // insert drawing object into the document creating a new instance + SwDrawFrmFmt* pFmt = GetDoc()->Insert( aPam, rDrawObj, &rFlyAttrSet, 0 ); - // --> OD 2005-01-07 #i40085# - follow-up of #i35635# // move object to visible layer SwContact* pContact = static_cast(rDrawObj.GetUserCall()); if ( pContact ) { pContact->MoveObjToVisibleLayer( &rDrawObj ); } - // <-- - if( pFmt ) - // das DrawObject selektieren + if ( pFmt ) + { + // select drawing object Imp()->GetDrawView()->MarkObj( &rDrawObj, Imp()->GetPageView(), - sal_False, sal_False ); + sal_False, sal_False ); + } else + { GetLayout()->SetAssertFlyPages(); + } } /*********************************************************************** diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 64d894acfdb2..493c1c067426 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -2658,7 +2658,9 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData, if(pFmView) { const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData); if(0 != (pObj = pFmView->CreateXFormsControl(rDesc))) - rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt ); + { + rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); + } } } else if( nWh ) @@ -2719,7 +2721,7 @@ int SwTransferable::_PasteDBData( TransferableDataHelper& rData, if (pFmView && bHaveColumnDescriptor) { if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) ) - rSh.SwFEShell::Insert( *pObj, 0, 0, pDragPt ); + rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt ); } } nRet = 1; diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index 9ee02b74e591..8d9ab4f27943 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -161,7 +161,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest& rReq ) pObj->setURL( aURL ); rSh.EnterStdMode(); - rSh.SwFEShell::Insert( *pObj, 0, 0, &aPos ); + rSh.SwFEShell::InsertDrawObj( *pObj, aPos ); bRet = true; if( pWindow ) diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx index 328b5a3d06ca..a12beb994d61 100644 --- a/sw/source/ui/uiview/viewdraw.cxx +++ b/sw/source/ui/uiview/viewdraw.cxx @@ -174,7 +174,7 @@ void SwView::ExecDraw(SfxRequest& rReq) // TODO: unmark all other pWrtShell->EnterStdMode(); - pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aStartPos ); + pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos ); } } } @@ -221,7 +221,7 @@ void SwView::ExecDraw(SfxRequest& rReq) aSize = Size( 2835, 2835 ); pWrtShell->EnterStdMode(); - pWrtShell->SwFEShell::Insert( *pObj, 0, 0, &aPos ); + pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos ); rReq.Ignore (); } } -- cgit v1.2.3 From 4944c8c648b9d2b914d57fa83a47d57076c0473c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 30 Dec 2009 17:20:32 +0100 Subject: sw33bf02: #i107447# method - do not reflect reset of flag in return value on normal cursor move. --- sw/source/core/crsr/crsrsh.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 3be6f84956fd..6c121a890ef3 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -395,10 +395,18 @@ BOOL SwCrsrShell::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode, else { const BOOL bSkipHidden = !GetViewOptions()->IsShowHiddenChar(); - bRet = SetInFrontOfLabel( FALSE ); + // --> OD 2009-12-30 #i107447# + // To avoid loop the reset of flag is no longer + // reflected in the return value . + const bool bResetOfInFrontOfLabel = SetInFrontOfLabel( FALSE ); bRet = pShellCrsr->LeftRight( bLeft, nCnt, nMode, bVisualAllowed, - bSkipHidden, - !IsOverwriteCrsr() ) || bRet; + bSkipHidden, !IsOverwriteCrsr() ); + if ( !bRet && bLeft && bResetOfInFrontOfLabel ) + { + // undo reset of flag + SetInFrontOfLabel( TRUE ); + } + // <-- } if( bRet ) -- cgit v1.2.3 From 19dee7433c8d36f0632fab2e6ed6ed88834e6df7 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 31 Dec 2009 09:33:47 +0100 Subject: sw33bf02: #i89920# adjustment of fix due to compiler warning --- sw/source/core/frmedt/feshview.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 80e150248c75..9983eb80642d 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1240,10 +1240,10 @@ sal_Bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) Point aTmpPt( rPt ); if ( pTxtFrm->GetKeyCrsrOfst( pPos, aTmpPt ) ) { - SwRect aCharRect; - if ( pTxtFrm->GetCharRect( aCharRect, *pPos ) ) + SwRect aCursorCharRect; + if ( pTxtFrm->GetCharRect( aCursorCharRect, *pPos ) ) { - if ( aCharRect.IsOver( SwRect( pObj->GetLastBoundRect() ) ) ) + if ( aCursorCharRect.IsOver( SwRect( pObj->GetLastBoundRect() ) ) ) { bRet = sal_False; } -- cgit v1.2.3 From 62ee0f6d9597990fa9f29912a045573b72c59f1c Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 31 Dec 2009 10:05:48 +0100 Subject: sw33bf02: #i106906# method - lock view during action to avoid jump to cursor --- sw/source/ui/app/docsh.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 8a119ddd5140..f69a891a7d4b 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -767,6 +767,10 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) if ( pWrtShell ) { SwWait aWait( *this, TRUE ); + // --> OD 2009-12-31 #i106906# + const sal_Bool bFormerLockView = pWrtShell->IsViewLocked(); + pWrtShell->LockView( sal_True ); + // <-- pWrtShell->StartAllAction(); pWrtShell->Push(); SwWriter aWrt( rMedium, *pWrtShell, TRUE ); @@ -777,6 +781,9 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) { pWrtShell->Pop(FALSE); pWrtShell->EndAllAction(); + // --> OD 2009-12-31 #i106906# + pWrtShell->LockView( bFormerLockView ); + // <-- } } else -- cgit v1.2.3 From 3ec21c0b69dc696e108163d09d34d770c3f21d14 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 31 Dec 2009 10:59:35 +0100 Subject: sw33bf02: #i106452# method - check page description not only in situations with sections --- sw/source/core/layout/flowfrm.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 108dadf23ec8..84411f30d5eb 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -513,10 +513,10 @@ BOOL SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, pParent->pLower = pStart; else //Modified for #i100782#,04/03/2009 - //If the pParent has more than 1 child nodes, former design will - //ignore them directly without any collection work. It will make some - //dangling pointers. This lead the crash... - //The new design will find the last child of pParent in loop way, and + //If the pParent has more than 1 child nodes, former design will + //ignore them directly without any collection work. It will make some + //dangling pointers. This lead the crash... + //The new design will find the last child of pParent in loop way, and //add the pStart after the last child. // pParent->Lower()->pNext = pStart; { @@ -2130,13 +2130,15 @@ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways ) // OD 30.10.2002 #97265# - no in online layout if ( !pNewPage->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ) { - //Bei Sections kann es passieren, das wir gleich in den Follow geflutscht - //sind. Dadurch wird nicht vom GetLeaf fuer die richtige Seite gesorgt. - //Das muessen wir fuer diesen Fall pruefen. - if ( !bSamePage && pNewUpper->IsInSct() && + // --> OD 2009-12-31 #i106452# + // check page description not only in situation with sections. + if ( !bSamePage && ( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() || pOldPage->GetPageDesc()->GetFollow() != pNewPage->GetPageDesc() ) ) + { SwFrm::CheckPageDescs( pNewPage, FALSE ); + } + // <-- } } return bSamePage; -- cgit v1.2.3 From 7b9039d7fef05044cc1f51485e8845a2a3f76089 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Mon, 4 Jan 2010 13:30:37 +0100 Subject: sw33bf02: #i105243# Output of graphic in Writer with corresponding PDF handling --- sw/source/core/doc/notxtfrm.cxx | 10 ++++++---- sw/source/core/layout/paintfrm.cxx | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index d4ad970727a9..6c37169902df 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -909,8 +909,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr )) { - rGrfObj.Draw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), - &aGrfAttr ); + rGrfObj.DrawWithPDFHandling( *pOut, + aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), + &aGrfAttr ); bContinue = FALSE; } } @@ -949,8 +950,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons 0, GRFMGR_DRAW_STANDARD, pVout ); } else - rGrfObj.Draw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), - &aGrfAttr ); + rGrfObj.DrawWithPDFHandling( *pOut, + aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), + &aGrfAttr ); } else { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 44d5af0f84b2..7597c880a0e1 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1649,7 +1649,7 @@ void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, /// Because for drawing a graphic left-top-corner and size coordinations are /// used, these coordinations have to be determined on pixel level. ::SwAlignGrfRect( &aAlignedGrfRect, *pOut ); - pGrf->Draw( pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() ); + pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() ); if ( bNotInside ) pOut->Pop(); -- cgit v1.2.3 From a1c9cd02be2ed42c77eb959f234c01804704b1d5 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 5 Jan 2010 14:19:09 +0100 Subject: sw33bf02: #b6884103# correct consideration of actual indent when starting new list. --- sw/inc/ndtxt.hxx | 4 ++++ sw/source/core/txtnode/ndtxt.cxx | 45 ++++++++++++++++++++++++++++++++++++++++ sw/source/ui/wrtsh/wrtsh1.cxx | 11 ++++++---- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index d4d59afa3d9c..3cd195724670 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -484,6 +484,10 @@ public: */ BOOL GetFirstLineOfsWithNum( short& rFirstOffset ) const; + // --> OD 2010-01-05 #b6884103# + SwTwips GetAdditionalIndentForStartingNewList() const; + // <-- + // --> OD 2008-12-02 #i96772# void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const; // <-- diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a779898d4aaa..81971372ee10 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2889,6 +2889,51 @@ BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const return bRet; } +// --> OD 2010-01-05 #b6884103# +SwTwips SwTxtNode::GetAdditionalIndentForStartingNewList() const +{ + SwTwips nAdditionalIndent = 0; + + const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; + if ( pRule ) + { + const SwNumFmt& rFmt = pRule->Get(static_cast(GetActualListLevel())); + if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + + if (getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)) + { + nAdditionalIndent = nAdditionalIndent - + GetSwAttrSet().GetLRSpace().GetTxtFirstLineOfst(); + } + } + else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + if ( AreListLevelIndentsApplicable() ) + { + nAdditionalIndent = rFmt.GetIndentAt() + rFmt.GetFirstLineIndent(); + } + else + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + if (getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)) + { + nAdditionalIndent = nAdditionalIndent - + GetSwAttrSet().GetLRSpace().GetTxtFirstLineOfst(); + } + } + } + } + else + { + nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); + } + + return nAdditionalIndent; +} +// <-- + // --> OD 2008-12-02 #i96772# void SwTxtNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const { diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 2b924933f1cc..7b0268cc57a2 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1379,10 +1379,13 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum) if ( pTxtNode && ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) { - short nTxtNodeFirstLineOffset( 0 ); - pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset ); - const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() + - nTxtNodeFirstLineOffset; + // --> OD 2010-01-05 #b6884103# +// short nTxtNodeFirstLineOffset( 0 ); +// pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset ); +// const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() + +// nTxtNodeFirstLineOffset; + const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList(); + // <-- if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 ) { const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; -- cgit v1.2.3 From 1ab97e6cbe7357c51c485be667aa23c191ccda47 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Tue, 5 Jan 2010 14:44:36 +0100 Subject: autorecovery: method - no call of method for window of zero size. --- sw/source/ui/uiview/pview.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 1632a0745ea6..5725ec4ed7cf 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -2090,8 +2090,11 @@ void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize ) //Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen //Scrollrange immer die halbe Hoehe der VisArea abgezogen wird. - if ( pVScrollbar ) - ScrollDocSzChg(); + if ( pVScrollbar && + aTmpSize.Width() > 0 && aTmpSize.Height() > 0 ) + { + ScrollDocSzChg(); + } } /*-------------------------------------------------------------------- -- cgit v1.2.3 From 845b04c98a87700e7443e5a16e66098103d43d46 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 5 Jan 2010 22:32:38 +0100 Subject: autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change, the LoadDispatchListener became superfluous, and was removed. Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility of the loader, and must not happen inside the XController::attachModel call anymore. This change made the ModelControllerConnector class superfluous, so it has been removed, too. --- dbaccess/inc/documentcontroller.hxx | 133 ------------------ dbaccess/inc/singledoccontroller.hxx | 1 - .../source/core/dataaccess/databasedocument.cxx | 30 +++++ .../source/core/dataaccess/databasedocument.hxx | 14 +- dbaccess/source/filter/xml/dbloader2.cxx | 18 ++- dbaccess/source/ui/app/AppController.cxx | 27 ++-- dbaccess/source/ui/app/AppController.hxx | 8 +- dbaccess/source/ui/browser/dataview.cxx | 23 ++++ dbaccess/source/ui/misc/documentcontroller.cxx | 150 --------------------- dbaccess/source/ui/misc/makefile.mk | 1 - 10 files changed, 93 insertions(+), 312 deletions(-) delete mode 100644 dbaccess/inc/documentcontroller.hxx delete mode 100644 dbaccess/source/ui/misc/documentcontroller.cxx diff --git a/dbaccess/inc/documentcontroller.hxx b/dbaccess/inc/documentcontroller.hxx deleted file mode 100644 index a16e4c645b06..000000000000 --- a/dbaccess/inc/documentcontroller.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: documentcontroller.hxx,v $ - * $Revision: 1.3.2.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef DBACCESS_SOURCE_UI_INC_DOCUMENTCONTROLLER_HXX -#define DBACCESS_SOURCE_UI_INC_DOCUMENTCONTROLLER_HXX - -/** === begin UNO includes === **/ -#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ -#include -#endif -#include -/** === end UNO includes === **/ - -#ifndef INCLUDED_DBACCESSDLLAPI_H -#include "dbaccessdllapi.h" -#endif -//........................................................................ -namespace dbaui -{ -//........................................................................ - - //==================================================================== - //= ModelControllerConnector - //==================================================================== - /** a helper class for controllers associated with an ->XModel - - Instances of this class take an ->XModel, which they connect to at - construction time (->XModel::connectController), and disconnect from - at destruction time (->XModel::disconnectController). - - Additionally, they keep the controller alive (by being a CloseVetoListener) - as long as they themself are alive. - */ - class DBACCESS_DLLPUBLIC ModelControllerConnector - { - private: - typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > Model; - typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > Controller; - - Model m_xModel; - Controller m_xController; - - public: - /** constructs the object, and connects the controller to the model - - @param _rxModel - the model to which the controller should be connected - @param _rxController - the controller which should be connected to the model - */ - ModelControllerConnector( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController - ); - - /** connects the controller to the model - - @param _rxModel - the model to which the controller should be connected - @param _rxController - the controller which should be connected to the model - */ - void connect( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController - ); - - /** destroys the object, and disconnects the controller from the model - */ - ~ModelControllerConnector(); - - /** determines whether the object is empty - */ - inline bool empty() const { return !m_xController.is(); } - - /** clears the object - - The controller is disconnected from the model, and references to the model and the controller - are released. - */ - inline void clear() - { - connect( NULL, NULL ); - } - - public: - ModelControllerConnector(); - ModelControllerConnector( const ModelControllerConnector& _rSource ); - ModelControllerConnector& operator=( const ModelControllerConnector& _rSource ); - - private: - void impl_connect(); - void impl_disconnect(); - void impl_copyFrom( const ModelControllerConnector& _rSource ); - }; - -//........................................................................ -} // namespace dbaui -//........................................................................ - -#endif // DBACCESS_SOURCE_UI_INC_DOCUMENTCONTROLLER_HXX - diff --git a/dbaccess/inc/singledoccontroller.hxx b/dbaccess/inc/singledoccontroller.hxx index f63d1c02fdf2..1c5017ff2013 100644 --- a/dbaccess/inc/singledoccontroller.hxx +++ b/dbaccess/inc/singledoccontroller.hxx @@ -31,7 +31,6 @@ #ifndef DBAUI_SINGLEDOCCONTROLLER_HXX #define DBAUI_SINGLEDOCCONTROLLER_HXX -#include "documentcontroller.hxx" #include "genericcontroller.hxx" #include "IEnvironment.hxx" diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 00dca6ea51c0..f6f25b4adde1 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -538,6 +538,26 @@ void SAL_CALL ODatabaseDocument::load( const Sequence< PropertyValue >& _Argumen // <- SYNCHRONIZED } +// ----------------------------------------------------------------------------- +void SAL_CALL ODatabaseDocument::doEmergencySave( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + // for the moment, just delegate this to our "storeToURL" method + storeToURL( i_TargetLocation, i_MediaDescriptor ); +} + +// ----------------------------------------------------------------------------- +void SAL_CALL ODatabaseDocument::recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + // for the moment, just delegate this to our "load" method + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + + // our load implementation expects the SalvagedFile and URL to be in the media descriptor + aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); + aMediaDescriptor.put( "URL", i_SourceLocation ); + + load( aMediaDescriptor.getPropertyValues() ); +} + // ----------------------------------------------------------------------------- // XModel sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException) @@ -594,6 +614,16 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController { DocumentGuard aGuard( *this ); +#if OSL_DEBUG_LEVEL > 0 + for ( Controllers::const_iterator controller = m_aControllers.begin(); + controller != m_aControllers.end(); + ++controller + ) + { + OSL_ENSURE( *controller != _xController, "ODatabaseDocument::connectController: this controller is already connected!" ); + } +#endif + m_aControllers.push_back( _xController ); m_aEventNotifier.notifyDocumentEventAsync( "OnViewCreated", Reference< XController2 >( _xController, UNO_QUERY ) ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 3430a60e037d..8cdccc3561f7 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -60,11 +60,12 @@ #include #include #include +#include /** === end UNO includes === **/ -#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_16) -#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_16 -#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 16 +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 17 #include #endif @@ -143,7 +144,7 @@ private: //============================================================ //= ODatabaseDocument //============================================================ -typedef ::comphelper::WeakComponentImplHelper16 < ::com::sun::star::frame::XModel2 +typedef ::comphelper::WeakComponentImplHelper17 < ::com::sun::star::frame::XModel2 , ::com::sun::star::util::XModifiable , ::com::sun::star::frame::XStorable , ::com::sun::star::document::XEventBroadcaster @@ -159,6 +160,7 @@ typedef ::comphelper::WeakComponentImplHelper16 < ::com::sun::star::frame::XMo , ::com::sun::star::script::provider::XScriptProviderSupplier , ::com::sun::star::document::XEventsSupplier , ::com::sun::star::frame::XLoadable + , ::com::sun::star::document::XDocumentRecovery > ODatabaseDocument_OfficeDocument; typedef ::cppu::ImplHelper3< ::com::sun::star::frame::XTitle @@ -425,6 +427,10 @@ public: virtual void SAL_CALL initNew( ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + // css.document.XDocumentRecovery + virtual void SAL_CALL doEmergencySave( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); + virtual void SAL_CALL recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); + // XTitle virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 7310c2ca10ec..7f6b8286f03d 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -547,22 +547,20 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: } } - Reference< XController2 > xController; if ( bSuccess ) { try { Reference< XModel2 > xModel2( xModel, UNO_QUERY_THROW ); - xController = xModel2->createViewController( sViewName, Sequence< PropertyValue >(), rFrame ); + Reference< XController2 > xController( xModel2->createViewController( sViewName, Sequence< PropertyValue >(), rFrame ), UNO_QUERY_THROW ); - bSuccess = xController.is(); - if ( bSuccess ) - { - xController->attachModel( xModel ); - rFrame->setComponent( xController->getComponentWindow(), xController.get() ); - xController->attachFrame( rFrame ); - xModel->setCurrentController( xController.get() ); - } + xController->attachModel( xModel ); + xModel->connectController( xController.get() ); + rFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( rFrame ); + xModel->setCurrentController( xController.get() ); + + bSuccess = sal_True; } catch( const Exception& ) { diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index b87b7706d87f..91efd04e5daa 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -534,7 +534,8 @@ void SAL_CALL OApplicationController::disposing() } } - m_aModelConnector.clear(); + m_xModel->disconnectController( this ); + m_xModel.clear(); } } @@ -614,7 +615,6 @@ void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) thr else if ( _rSource.Source == m_xModel ) { m_xModel.clear(); - m_aModelConnector.clear(); } else if ( _rSource.Source == m_xDataSource ) { @@ -2675,7 +2675,7 @@ Reference< XModel > SAL_CALL OApplicationController::getModel(void) throw( Runt } // ----------------------------------------------------------------------------- -void OApplicationController::onConnectedModel() +void OApplicationController::onAttachedFrame() { sal_Int32 nConnectedControllers( 0 ); try @@ -2704,9 +2704,15 @@ void OApplicationController::onConnectedModel() // ----------------------------------------------------------------------------- IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ ) { + ::osl::MutexGuard aGuard( getMutex() ); + + if ( !m_xModel.is() ) + { + OSL_ENSURE( false, "OApplicationController::OnFirstControllerConnected: too late!" ); + } + // if we have forms or reports which contain macros/scripts, then show a warning // which suggests the user to migrate them to the database document - Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY ); if ( xDocumentScripts.is() ) { @@ -2751,6 +2757,14 @@ IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ ) return 1L; } +// ----------------------------------------------------------------------------- +void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i_rxFrame ) throw( RuntimeException ) +{ + OApplicationController_CBASE::attachFrame( i_rxFrame ); + if ( getFrame().is() ) + onAttachedFrame(); +} + // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException ) { @@ -2767,16 +2781,13 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > // at least: remove as property change listener from the old model/data source m_xModel = _rxModel; - if ( _rxModel.is() ) + if ( m_xModel.is() ) { m_xDocumentModify.set( m_xModel, UNO_QUERY_THROW ); - m_aModelConnector.connect( _rxModel, this ); - onConnectedModel(); } else { m_xDocumentModify.clear(); - m_aModelConnector.clear(); } m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference(),UNO_QUERY); diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 96ca58d6f428..669eb181d3e3 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -35,7 +35,6 @@ #include "AppElementType.hxx" #include "callbacks.hxx" #include "commontypes.hxx" -#include "documentcontroller.hxx" #include "dsntypes.hxx" #include "genericcontroller.hxx" #include "linkeddocuments.hxx" @@ -123,8 +122,6 @@ namespace dbaui ::cppu::OInterfaceContainerHelper m_aContextMenuInterceptors; - ModelControllerConnector - m_aModelConnector; TContainerVector m_aCurrentContainers; // the containers where we are listener on ::rtl::Reference< SubComponentManager > m_pSubComponentManager; @@ -396,12 +393,12 @@ namespace dbaui */ void showPreviewFor( const ElementType _eType,const ::rtl::OUString& _sName ); - /** called when we just connected to a new, non-NULL model + /** called we were attached to a frame In particular, this is called *after* the controller has been announced to the model (XModel::connectController) */ - void onConnectedModel(); + void onAttachedFrame(); /// determines whether the given table name denotes a view which can be altered bool impl_isAlterableView_nothrow( const ::rtl::OUString& _rTableOrViewName ) const; @@ -455,6 +452,7 @@ namespace dbaui SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); // ::com::sun::star::frame::XController + virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index 538925125425..a66f6ec6d11a 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -40,6 +40,7 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include #endif +#include #ifndef _SFXAPP_HXX //autogen wg. SFX_APP #include #endif @@ -61,6 +62,7 @@ #ifndef _SVTOOLS_IMGDEF_HXX #include #endif +#include //......................................................................... namespace dbaui @@ -221,6 +223,27 @@ namespace dbaui // Check if we need to get new images for normal/high contrast mode m_rController.notifyHiContrastChanged(); } + + if ( nType == STATE_CHANGE_INITSHOW ) + { + // now that there's a view which is finally visible, remove the "Hidden" value from the + // model's arguments. + try + { + Reference< XController > xController( m_rController.getXController(), UNO_SET_THROW ); + Reference< XModel > xModel( xController->getModel(), UNO_QUERY ); + if ( xModel.is() ) + { + ::comphelper::NamedValueCollection aArgs( xModel->getArgs() ); + aArgs.remove( "Hidden" ); + xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } } // ----------------------------------------------------------------------------- void ODataView::DataChanged( const DataChangedEvent& rDCEvt ) diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx deleted file mode 100644 index 523307d55013..000000000000 --- a/dbaccess/source/ui/misc/documentcontroller.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: documentcontroller.cxx,v $ - * $Revision: 1.5.178.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_dbaccess.hxx" - -#include "documentcontroller.hxx" - -/** === begin UNO includes === **/ -/** === end UNO includes === **/ - -#include -#include - -//........................................................................ -namespace dbaui -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::frame; - - //==================================================================== - //= ModelControllerConnector - //==================================================================== - DBG_NAME( ModelControllerConnector ) - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector() - { - DBG_CTOR( ModelControllerConnector, NULL ); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController ) - :m_xModel( _rxModel ) - ,m_xController( _rxController ) - { - DBG_CTOR( ModelControllerConnector, NULL ); - DBG_ASSERT( _rxModel.is() && m_xController.is(), "ModelControllerConnector::ModelControllerConnector: invalid model or controller!" ); - impl_connect(); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::ModelControllerConnector( const ModelControllerConnector& _rSource ) - { - DBG_CTOR( ModelControllerConnector, NULL ); - impl_copyFrom( _rSource ); - } - - //-------------------------------------------------------------------- - ModelControllerConnector& ModelControllerConnector::operator=( const ModelControllerConnector& _rSource ) - { - if ( this != &_rSource ) - impl_copyFrom( _rSource ); - return *this; - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::connect( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController ) - { - impl_disconnect(); - - m_xModel = _rxModel; - m_xController = _rxController; - - impl_connect(); - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_copyFrom( const ModelControllerConnector& _rSource ) - { - Model aNewModel( _rSource.m_xModel ); - Controller aNewController( _rSource.m_xController ); - - impl_disconnect(); - - m_xModel = aNewModel; - m_xController = aNewController; - - impl_connect(); - } - - //-------------------------------------------------------------------- - ModelControllerConnector::~ModelControllerConnector() - { - impl_disconnect(); - DBG_DTOR( ModelControllerConnector, NULL ); - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_connect() - { - try - { - Reference< XModel > xModel = m_xModel; - if ( xModel.is() && m_xController.is() ) - xModel->connectController( m_xController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - //-------------------------------------------------------------------- - void ModelControllerConnector::impl_disconnect() - { - try - { - Reference< XModel > xModel = m_xModel; - if ( xModel.is() && m_xController.is() ) - xModel->disconnectController( m_xController ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - -//........................................................................ -} // namespace dbaui -//........................................................................ - diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk index e5db6954ea4d..f0d2ad133fff 100644 --- a/dbaccess/source/ui/misc/makefile.mk +++ b/dbaccess/source/ui/misc/makefile.mk @@ -76,7 +76,6 @@ SLOFILES= \ $(SLO)$/WColumnSelect.obj \ $(SLO)$/WExtendPages.obj \ $(SLO)$/WNameMatch.obj \ - $(SLO)$/documentcontroller.obj \ $(SLO)$/ToolBoxHelper.obj \ $(SLO)$/stringlistitem.obj \ $(SLO)$/charsets.obj \ -- cgit v1.2.3 From 1c6413338a0d520833b2d6e8347f83083601088c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 5 Jan 2010 22:32:38 +0100 Subject: autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change, the LoadDispatchListener became superfluous, and was removed. Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility of the loader, and must not happen inside the XController::attachModel call anymore. This change made the ModelControllerConnector class superfluous, so it has been removed, too. --- offapi/com/sun/star/document/XDocumentRecovery.idl | 95 ++++++++++++++++++++++ offapi/com/sun/star/document/makefile.mk | 1 + 2 files changed, 96 insertions(+) create mode 100644 offapi/com/sun/star/document/XDocumentRecovery.idl diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl new file mode 100644 index 000000000000..49d6766bdea0 --- /dev/null +++ b/offapi/com/sun/star/document/XDocumentRecovery.idl @@ -0,0 +1,95 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef __offapcom_sun_star_document_XDocumentRecovery_idl__ +#define __offapcom_sun_star_document_XDocumentRecovery_idl__ + +#include +#include +#include + +//============================================================================= + +module com { module sun { module star { module document { + +//============================================================================= + +/** is the interface to be implemented by documents who wish to participate in + the document emergency-save / recovery process. + */ +interface XDocumentRecovery +{ + /** does an emergency save of the document + + @param TargetLocation + specifies the URL of the location to which the document should be emergency-saved. + + @param MediaDescriptor + contains additional arguments for the save process, for instance an StatusIndicator. + + @see MediaDescriptor + */ + void doEmergencySave( + [in] string TargetLocation, + [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor + ) + raises ( ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException + ); + + /** recovers the document after a previous emergency save. + + The document itself has previously been created, but not loaded + (via XLoadable::load) or initialized (via + XLoadable::initNew). + + @param SourceLocation + specifies the URL of the location to which the document was previously emergency-saved. + + @param SalvagedFile + specifies the original URL of the file which had been emergency-saved. + + @param MediaDescriptor + contains additional arguments for the load process, for instance an StatusIndicator. + + @see MediaDescriptor + */ + void recoverDocument( + [in] string SourceLocation, + [in] string SalvagedFile, + [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor + ) + raises ( ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException + ); +}; + +//============================================================================= + +}; }; }; }; + +//============================================================================= + +#endif diff --git a/offapi/com/sun/star/document/makefile.mk b/offapi/com/sun/star/document/makefile.mk index 3bc2db2f9e46..55542e45fea6 100644 --- a/offapi/com/sun/star/document/makefile.mk +++ b/offapi/com/sun/star/document/makefile.mk @@ -87,6 +87,7 @@ IDLFILES=\ XDocumentInsertable.idl\ XDocumentProperties.idl\ XDocumentPropertiesSupplier.idl\ + XDocumentRecovery.idl\ XDocumentSubStorageSupplier.idl\ XEmbeddedObjectResolver.idl\ XEmbeddedObjectSupplier.idl\ -- cgit v1.2.3 From 77bc1109eee784c6338145506bdf7455c4385e9d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- basctl/source/basicide/basdoc.cxx | 5 +++-- basctl/source/basicide/basdoc.hxx | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index 4dd0dbd2aeca..ac7af7de25a4 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -38,6 +38,7 @@ #define GLOBALOVERFLOW2 #include +#include #include #include @@ -60,11 +61,11 @@ SFX_IMPL_INTERFACE( BasicDocShell, SfxObjectShell, IDEResId( 0 ) ) SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR ) ); } -BasicDocShell::BasicDocShell( SfxObjectCreateMode eMode ) : SfxObjectShell( eMode ) +BasicDocShell::BasicDocShell() + :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) { pPrinter = 0; SetPool( &SFX_APP()->GetPool() ); - SetHasNoBasic(); SetModel( new SIDEModel(this) ); } diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx index a589ef700b33..120c083cfb46 100644 --- a/basctl/source/basicide/basdoc.hxx +++ b/basctl/source/basicide/basdoc.hxx @@ -59,7 +59,7 @@ public: using SotObject::GetInterface; SFX_DECL_OBJECTFACTORY(); SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_DOCSH ) - BasicDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); + BasicDocShell(); ~BasicDocShell(); SfxPrinter* GetPrinter( BOOL bCreate ); -- cgit v1.2.3 From d1233ab8290a14cea18cf78f6712767a02291456 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- starmath/inc/document.hxx | 2 +- starmath/source/document.cxx | 7 ++----- starmath/source/unodoc.cxx | 5 +---- sw/inc/docsh.hxx | 3 ++- sw/source/ui/app/docshini.cxx | 24 +++++++++++++++++++++--- sw/source/ui/uno/unodoc.cxx | 4 +--- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index fac4f1b0faa4..c842a78c6a1a 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -170,7 +170,7 @@ public: using SotObject::GetInterface; SFX_DECL_OBJECTFACTORY(); - SmDocShell(SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, const sal_Bool _bScriptSupport = sal_True); + SmDocShell( const sal_uInt64 i_nSfxCreationFlags ); virtual ~SmDocShell(); void LoadSymbols(); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 03beb26f7bb2..1cf65eab1678 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -684,8 +684,8 @@ void SmDocShell::Repaint() } -SmDocShell::SmDocShell(SfxObjectCreateMode eMode,const sal_Bool _bScriptSupport) : - SfxObjectShell(eMode), +SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : + SfxObjectShell( i_nSfxCreationFlags ), pTree ( 0 ), pEditEngineItemPool ( 0 ), pEditEngine ( 0 ), @@ -704,9 +704,6 @@ SmDocShell::SmDocShell(SfxObjectCreateMode eMode,const sal_Bool _bScriptSupport) StartListening(aFormat); StartListening(*pp->GetConfig()); - if ( !_bScriptSupport ) - SetHasNoBasic(); - SetModel( new SmModel(this) ); //! das hier mit new erzeugte Model brauch //! im Destruktor nicht explizit geloescht werden. //! Dies erledigt das Sfx. diff --git a/starmath/source/unodoc.cxx b/starmath/source/unodoc.cxx index 3f213c0ee256..e2ca1a655e9d 100644 --- a/starmath/source/unodoc.cxx +++ b/starmath/source/unodoc.cxx @@ -64,10 +64,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmDocument_createInstance( if ( !SM_MOD() ) SmDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - - SfxObjectShell* pShell = new SmDocShell( eCreateMode, bScriptSupport ); + SfxObjectShell* pShell = new SmDocShell( _nCreationFlags ); if( pShell ) return uno::Reference< uno::XInterface >( pShell->GetModel() ); diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 6ed3f6d652bd..6d54542c1075 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -154,7 +154,8 @@ public: static rtl::OUString GetEventName( sal_Int32 nId ); //Das Doc wird fuer SO-Datenaustausch benoetigt! - SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, sal_Bool _bScriptingSupport = sal_True ); + SwDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED ); + SwDocShell( const sal_uInt64 i_nSfxCreationFlags ); SwDocShell( SwDoc *pDoc, SfxObjectCreateMode eMode = SFX_CREATE_MODE_STANDARD ); ~SwDocShell(); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 630d836c785b..9ec18607a71e 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #ifndef _OFA_MISCCFG_HXX //autogen #include #endif @@ -400,7 +401,7 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) --------------------------------------------------------------------*/ -SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport ) : +SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) : SfxObjectShell ( eMode ), pDoc(0), pFontList(0), @@ -411,8 +412,25 @@ SwDocShell::SwDocShell( SfxObjectCreateMode eMode, sal_Bool _bScriptingSupport ) bInUpdateFontList(false) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); - if ( !_bScriptingSupport ) - SetHasNoBasic(); + Init_Impl(); +} + +/*-------------------------------------------------------------------- + Beschreibung: Ctor / Dtor + --------------------------------------------------------------------*/ + + +SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) : + SfxObjectShell ( i_nSfxCreationFlags ), + pDoc(0), + pFontList(0), + pView( 0 ), + pWrtShell( 0 ), + pOLEChildList( 0 ), + nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG), + bInUpdateFontList(false) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" ); Init_Impl(); } diff --git a/sw/source/ui/uno/unodoc.cxx b/sw/source/ui/uno/unodoc.cxx index dc801a8abee5..65cdecc0ca7a 100644 --- a/sw/source/ui/uno/unodoc.cxx +++ b/sw/source/ui/uno/unodoc.cxx @@ -69,9 +69,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance( { ::vos::OGuard aGuard( Application::GetSolarMutex() ); SwDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - SfxObjectShell* pShell = new SwDocShell( eCreateMode, bScriptSupport ); + SfxObjectShell* pShell = new SwDocShell( _nCreationFlags ); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } -- cgit v1.2.3 From 276272a1de68f11a533fa4e2a7821426cd5727da Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- sc/source/ui/docshell/docsh.cxx | 11 ++++------- sc/source/ui/inc/docsh.hxx | 6 ++---- sc/source/ui/unoobj/unodoc.cxx | 4 +--- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 3e6931184048..64fdcf5bc80d 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2243,22 +2243,19 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) //------------------------------------------------------------------ -ScDocShell::ScDocShell( SfxObjectCreateMode eMode, const bool _bScriptSupport ) - : SfxObjectShell( eMode ), - __SCDOCSHELL_INIT +ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) + : SfxObjectShell( i_nSfxCreationFlags ) + , __SCDOCSHELL_INIT { RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ScDocShell" ); SetPool( &SC_MOD()->GetPool() ); - bIsInplace = (eMode == SFX_CREATE_MODE_EMBEDDED); + bIsInplace = (GetCreateMode() == SFX_CREATE_MODE_EMBEDDED); // wird zurueckgesetzt, wenn nicht inplace pDocFunc = new ScDocFunc(*this); - if ( !_bScriptSupport ) - SetHasNoBasic(); - // SetBaseModel needs exception handling ScModelObj::CreateAndSet( this ); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 9556b4ad8138..b9ba3a2e11da 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -34,10 +34,8 @@ #include -//REMOVE #ifndef _SFX_INTERNO_HXX //autogen -//REMOVE #include -//REMOVE #endif #include +#include #include #include "scdllapi.h" @@ -182,7 +180,7 @@ public: SFX_DECL_OBJECTFACTORY(); ScDocShell( const ScDocShell& rDocShell ); - ScDocShell( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, const bool _bScriptSupport = true ); + ScDocShell( const sal_uInt64 i_nSfxCreationFlags = SFXMODEL_EMBEDDED_OBJECT ); ~ScDocShell(); using SotObject::GetInterface; diff --git a/sc/source/ui/unoobj/unodoc.cxx b/sc/source/ui/unoobj/unodoc.cxx index e79cb113e496..740d69352055 100644 --- a/sc/source/ui/unoobj/unodoc.cxx +++ b/sc/source/ui/unoobj/unodoc.cxx @@ -63,9 +63,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScDocument_createInstance( { ::vos::OGuard aGuard( Application::GetSolarMutex() ); ScDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - SfxObjectShell* pShell = new ScDocShell( eCreateMode, bScriptSupport ); + SfxObjectShell* pShell = new ScDocShell( _nCreationFlags ); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } -- cgit v1.2.3 From 1f680bfe9c50b03c7623bf34755d84ec0796ea32 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- sd/source/ui/docshell/docshell.cxx | 27 ++++++++++++++++++++++++--- sd/source/ui/docshell/grdocsh.cxx | 12 ++++++++++-- sd/source/ui/inc/DrawDocShell.hxx | 8 ++++++-- sd/source/ui/inc/GraphicDocShell.hxx | 8 ++++++-- sd/source/ui/unoidl/unodoc.cxx | 10 ++-------- 5 files changed, 48 insertions(+), 17 deletions(-) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 8b7ce2e12045..b05e9158a873 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -166,7 +166,7 @@ void DrawDocShell::Construct( bool bClipboard ) DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, BOOL bDataObject, - DocumentType eDocumentType,BOOL bScriptSupport) : + DocumentType eDocumentType) : SfxObjectShell( eMode == SFX_CREATE_MODE_INTERNAL ? SFX_CREATE_MODE_EMBEDDED : eMode), mpFormatClipboard(new SdFormatClipboard()), mpDoc(NULL), @@ -180,8 +180,6 @@ DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, mbOwnPrinter(FALSE), mbNewDocument( sal_True ) { - if ( !bScriptSupport ) - SetHasNoBasic(); Construct( eMode == SFX_CREATE_MODE_INTERNAL ); } @@ -191,6 +189,29 @@ DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, |* \************************************************************************/ +DrawDocShell::DrawDocShell( const sal_uInt64 nModelCreationFlags, BOOL bDataObject, DocumentType eDocumentType ) : + SfxObjectShell( nModelCreationFlags ), + mpFormatClipboard(new SdFormatClipboard()), + mpDoc(NULL), + mpUndoManager(NULL), + mpPrinter(NULL), + mpViewShell(NULL), + mpFontList(NULL), + meDocType(eDocumentType), + mpFilterSIDs(0), + mbSdDataObj(bDataObject), + mbOwnPrinter(FALSE), + mbNewDocument( sal_True ) +{ + Construct( FALSE ); +} + +/************************************************************************* +|* +|* Konstruktor 3 +|* +\************************************************************************/ + DrawDocShell::DrawDocShell(SdDrawDocument* pDoc, SfxObjectCreateMode eMode, BOOL bDataObject, DocumentType eDocumentType) : diff --git a/sd/source/ui/docshell/grdocsh.cxx b/sd/source/ui/docshell/grdocsh.cxx index 990922111089..07c6f203e3a2 100644 --- a/sd/source/ui/docshell/grdocsh.cxx +++ b/sd/source/ui/docshell/grdocsh.cxx @@ -71,8 +71,16 @@ SFX_IMPL_OBJECTFACTORY( GraphicDocShell, SvGlobalName(SO3_SDRAW_CLASSID_60), SFX GraphicDocShell::GraphicDocShell(SfxObjectCreateMode eMode, BOOL bDataObject, - DocumentType eDocType,BOOL bScriptSupport) : - DrawDocShell(eMode, bDataObject, eDocType, bScriptSupport) + DocumentType eDocType) : + DrawDocShell(eMode, bDataObject, eDocType) +{ + SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS ); +} + +GraphicDocShell::GraphicDocShell(const sal_uInt64 nModelCreationFlags, + BOOL bDataObject, + DocumentType eDocType) : + DrawDocShell(nModelCreationFlags, bDataObject, eDocType) { SetStyleFamily( SD_STYLE_FAMILY_GRAPHICS ); } diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index fb2d83ba4be9..01706cb6ab93 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -74,8 +74,12 @@ public: DrawDocShell ( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, BOOL bSdDataObj=FALSE, - DocumentType=DOCUMENT_TYPE_IMPRESS, - BOOL bScriptSupport=TRUE); + DocumentType=DOCUMENT_TYPE_IMPRESS); + + DrawDocShell ( + const sal_uInt64 nModelCreationFlags, + BOOL bSdDataObj=FALSE, + DocumentType=DOCUMENT_TYPE_IMPRESS); DrawDocShell ( SdDrawDocument* pDoc, diff --git a/sd/source/ui/inc/GraphicDocShell.hxx b/sd/source/ui/inc/GraphicDocShell.hxx index 9171dbefb801..08df27c9cb1c 100644 --- a/sd/source/ui/inc/GraphicDocShell.hxx +++ b/sd/source/ui/inc/GraphicDocShell.hxx @@ -60,8 +60,12 @@ public: GraphicDocShell ( SfxObjectCreateMode eMode = SFX_CREATE_MODE_EMBEDDED, BOOL bSdDataObj=FALSE, - DocumentType=DOCUMENT_TYPE_DRAW, - BOOL bScriptSupport=TRUE); + DocumentType=DOCUMENT_TYPE_DRAW); + + GraphicDocShell ( + const sal_uInt64 nModelCreationFlags, + BOOL bSdDataObj=FALSE, + DocumentType=DOCUMENT_TYPE_DRAW); virtual ~GraphicDocShell (void); }; diff --git a/sd/source/ui/unoidl/unodoc.cxx b/sd/source/ui/unoidl/unodoc.cxx index 55b7a59fa56f..0efd5128cfc1 100644 --- a/sd/source/ui/unoidl/unodoc.cxx +++ b/sd/source/ui/unoidl/unodoc.cxx @@ -69,12 +69,9 @@ uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance( SdDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - SfxObjectShell* pShell = new ::sd::GraphicDocShell( - eCreateMode, FALSE, DOCUMENT_TYPE_DRAW, bScriptSupport ); + _nCreationFlags, FALSE, DOCUMENT_TYPE_DRAW ); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } @@ -101,12 +98,9 @@ uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance SdDLL::Init(); - const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD; - const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; - SfxObjectShell* pShell = new ::sd::DrawDocShell( - eCreateMode, FALSE, DOCUMENT_TYPE_IMPRESS, bScriptSupport ); + _nCreationFlags, FALSE, DOCUMENT_TYPE_IMPRESS ); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } -- cgit v1.2.3 From dabdaa680073a58380c02ababcbb2c1464b51ab5 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 6 Jan 2010 21:34:53 +0100 Subject: autorecovery: allow creating SFX-based documents which do not support the XDocumentRecovery interface For this purpose, the SFX document factory methods got an additional parameter respectively flag ("DocumentRecoverySupport" resp. SFXMODEL_DISABLE_DOCUMENT_RECOVERY). This flag is used by database documents to remove the interface from sub documents (aka forms/reports). In this course, some of the functionality around those SFXMODELL_* flags, previously duplicated in all applications, has been consolidated into a new SfxObjectShell constructor. --- dbaccess/source/core/dataaccess/documentdefinition.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 8a4cff9624ae..4ed7a5130dc2 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1630,6 +1630,10 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC // tell the embedded object to have (or not have) script support aEmbeddedDescriptor.put( "EmbeddedScriptSupport", (sal_Bool)objectSupportsEmbeddedScripts() ); + // ......................................................................... + // tell the embedded object to not participate in the document recovery game - the DB doc will handle it + aEmbeddedDescriptor.put( "DocumentRecoverySupport", (sal_Bool)sal_False ); + // ......................................................................... // pass the descriptor of the embedded object to the caller aEmbeddedDescriptor >>= _out_rEmbeddedObjectDescriptor; -- cgit v1.2.3 From 79958d9c6f51986ff07248d91106d929720ce625 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:06:53 +0100 Subject: enable hierachical queries --- dbaccess/source/core/api/RowSet.cxx | 4 ++-- dbaccess/source/core/api/query.cxx | 10 ++++---- dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 8 ++++++- dbaccess/source/ui/browser/unodatbr.cxx | 34 +++++++++++++++++++++++++-- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index bb500ac94ad2..937bcbe82f37 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1904,8 +1904,8 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi if(!xColumn.is()) { // no column found so we could look at the position i - bReFetchName = sal_True; - sColumnLabel = ::rtl::OUString(); + //bReFetchName = sal_True; + //sColumnLabel = ::rtl::OUString(); Reference xIndexAccess(m_xColumns,UNO_QUERY); if(xIndexAccess.is() && i <= xIndexAccess->getCount()) { diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index ccd91f2a312e..3f3ccc57db2e 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -239,11 +239,11 @@ void OQuery::rebuildColumns() Sequence< ::rtl::OUString> aNames = xColumns->getElementNames(); Sequence< ::rtl::OUString> aDefintionNames; bool bApplyDefinitionNames = false; - if ( xColumnDefinitions.is() ) - { - aDefintionNames = xColumnDefinitions->getElementNames(); - bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength(); - } + //if ( xColumnDefinitions.is() ) + //{ + // aDefintionNames = xColumnDefinitions->getElementNames(); + // bApplyDefinitionNames = aDefintionNames.getLength() == aNames.getLength(); + //} ::rtl::OUString sEmpty; const ::rtl::OUString* pIter = aNames.getConstArray(); diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx index 2af41d70cc13..6e522dd293f0 100644 --- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx +++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx @@ -126,8 +126,14 @@ SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType( SvLBoxEntry* return etQuery; } + while( pEntryParent != pQueries ) + { + pEntryParent = m_pTreeView->getListBox().GetParent(pEntryParent); + if ( !pEntryParent ) + return etUnknown; + } - return etUnknown; + return etQueryContainer; } //------------------------------------------------------------------------------ void SbaTableQueryBrowser::select(SvLBoxEntry* _pEntry, sal_Bool _bSelect) diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 8377edda3017..5b32eff98d25 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -1109,8 +1109,38 @@ SvLBoxEntry* SbaTableQueryBrowser::getObjectEntry(const ::rtl::OUString& _rDataS ::rtl::OUString sPath = sCommand.getToken( 0, '/', nIndex ); pObject = m_pTreeView->getListBox().GetEntryPosByName(sPath, pCommandType); pCommandType = pObject; - if (_bExpandAncestors && nIndex >= 0 ) - m_pTreeView->getListBox().Expand(pCommandType); + if ( nIndex >= 0 ) + { + if (ensureEntryObject(pObject)) + { + DBTreeListUserData* pParentData = static_cast< DBTreeListUserData* >( pObject->GetUserData() ); + Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY ); + sal_Int32 nIndex2 = nIndex; + sPath = sCommand.getToken( 0, '/', nIndex2 ); + try + { + if ( xCollection->hasByName(sPath) ) + { + if(!m_pTreeView->getListBox().GetEntryPosByName(sPath,pObject)) + { + Reference xChild(xCollection->getByName(sPath),UNO_QUERY); + DBTreeListUserData* pEntryData = new DBTreeListUserData; + pEntryData->eType = etQuery; + if ( xChild.is() ) + { + pEntryData->eType = etQueryContainer; + } + implAppendEntry( pObject, sPath, pEntryData, pEntryData->eType ); + } + } + } + catch(Exception&) + { + DBG_ERROR("SbaTableQueryBrowser::populateTree: could not fill the tree"); + } + } + } + // m_pTreeView->getListBox().Expand(pCommandType); } while ( nIndex >= 0 ); } -- cgit v1.2.3 From c2e5ecc21502279bc009185ecb17dfb3c9df65f6 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:10:59 +0100 Subject: haschanged now quotes --- reportdesign/source/filter/xml/xmlExport.cxx | 7 +++++++ reportdesign/source/filter/xml/xmlGroup.cxx | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index aff63a9eb6f8..3cb44abcc17a 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1117,6 +1117,13 @@ sal_Bool ORptExport::exportGroup(const Reference& _xReportDef ::rtl::OUString sExpression = xGroup->getExpression(); if ( sExpression.getLength() ) { + static ::rtl::OUString s_sQuote(RTL_CONSTASCII_USTRINGPARAM("\"\"")); + sal_Int32 nIndex = sExpression.indexOf('"'); + while ( nIndex > -1 ) + { + sExpression = sExpression.replaceAt(nIndex,1,s_sQuote); + nIndex = sExpression.indexOf('"',nIndex+2);SELECT "D4 Product"."P10 Color" || ',' || "D2 Market"."M04 Region" , "F1 Revenue"."1-01 Revenue (Sum All)" FROM "Sample Sales" + } ::rtl::OUString sFormula(RTL_CONSTASCII_USTRINGPARAM("rpt:HASCHANGED(\"")); TGroupFunctionMap::iterator aGroupFind = m_aGroupFunctionMap.find(xGroup); diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index 195b41aaa3c0..b49f6b0e7b9c 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -105,6 +105,7 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport sal_Int32 nLen = sValue.getLength(); if ( nLen ) { + const static ::rtl::OUString s_sChanged(RTL_CONSTASCII_USTRINGPARAM("rpt:HASCHANGED(\"")); sal_Int32 nPos = sValue.indexOf(s_sChanged); if ( nPos == -1 ) @@ -112,7 +113,15 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport else { nPos = s_sChanged.getLength(); - --nLen; + static ::rtl::OUString s_sQuote(RTL_CONSTASCII_USTRINGPARAM("\"\"")); + static ::rtl::OUString s_sSingleQuote(RTL_CONSTASCII_USTRINGPARAM("\"")); + sal_Int32 nIndex = sValue.indexOf(s_sQuote,nPos); + while ( nIndex > -1 ) + { + sValue = sValue.replaceAt(nIndex,2,s_sSingleQuote); + nIndex = sValue.indexOf(s_sQuote,nIndex+2); + } + nLen = sValue.getLength() - 1; } sValue = sValue.copy(nPos,nLen-nPos-1); const ORptFilter::TGroupFunctionMap& aFunctions = _rImport.getFunctions(); -- cgit v1.2.3 From f1b864563766e1ab78c1242711b0e8906bcaa345 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:15:49 +0100 Subject: enable hierachical queries --- .../source/propctrlr/formcomponenthandler.cxx | 30 +++++++++++++++++++--- .../source/propctrlr/formcomponenthandler.hxx | 9 +++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 6f580ec2422e..78fa5db34561 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -33,6 +33,7 @@ #include "controltype.hxx" #include "propctrlr.hrc" +#include "extensio.hrc" #include "fontdialog.hxx" #include "formcomponenthandler.hxx" #include "formlinkdialog.hxx" @@ -2538,17 +2539,38 @@ namespace pcr Reference< XQueriesSupplier > xSupplyQueries( m_xRowSetConnection, UNO_QUERY ); Reference< XNameAccess > xQueryNames; if ( xSupplyQueries.is() ) + { xQueryNames = xSupplyQueries->getQueries(); - DBG_ASSERT( xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); - if ( !xQueryNames.is() ) + impl_fillQueryNames_throw(xQueryNames,_out_rNames); + } + } + //------------------------------------------------------------------------ + void FormComponentPropertyHandler::impl_fillQueryNames_throw( const Reference< XNameAccess >& _xQueryNames,::std::vector< ::rtl::OUString >& _out_rNames,const ::rtl::OUString& _sName ) const + { + DBG_ASSERT( _xQueryNames.is(), "FormComponentPropertyHandler::impl_fillQueryNames_throw: no way to obtain the queries of the connection!" ); + if ( !_xQueryNames.is() ) return; - Sequence< ::rtl::OUString> aQueryNames = xQueryNames->getElementNames(); + Sequence< ::rtl::OUString> aQueryNames = _xQueryNames->getElementNames(); sal_uInt32 nCount = aQueryNames.getLength(); const ::rtl::OUString* pQueryNames = aQueryNames.getConstArray(); + sal_Bool bAdd = _sName.getLength(); for ( sal_uInt32 i=0; i xSubQueries(_xQueryNames->getByName(*pQueryNames),UNO_QUERY); + if ( xSubQueries.is() ) + impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); + else + _out_rNames.push_back( sTemp.makeStringAndClear() ); + } } //------------------------------------------------------------------------ diff --git a/extensions/source/propctrlr/formcomponenthandler.hxx b/extensions/source/propctrlr/formcomponenthandler.hxx index 9b972896e856..d02a05c8e650 100644 --- a/extensions/source/propctrlr/formcomponenthandler.hxx +++ b/extensions/source/propctrlr/formcomponenthandler.hxx @@ -238,6 +238,15 @@ namespace pcr */ void impl_fillQueryNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const; + /** describes the UI for selecting a query name + + @precond + m_xRowSetConnection is not + */ + void impl_fillQueryNames_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xQueryNames + ,::std::vector< ::rtl::OUString >& _out_rNames + ,const ::rtl::OUString& _sName = ::rtl::OUString() ) const; + /** describes the UI for selecting a ListSource (for list-like form controls) @precond ->m_xRowSetConnection is not -- cgit v1.2.3 From 8aa99f59a4ab4fba762c072b210620aa9f6a8ddd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 09:16:59 +0100 Subject: check already quoted expression --- reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java | 4 ++-- reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index 5c3032e3a7f9..cbd215220bc9 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -210,7 +210,7 @@ public class SDBCReportDataFactory implements DataSourceFactory final Boolean escapeProcessing = (Boolean) parameters.get(ESCAPE_PROCESSING); final String filter = (String) parameters.get(UNO_FILTER); final Integer maxRows = (Integer) parameters.get("MaxRows"); - RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows); + final RowSetProperties rowSetProps = new RowSetProperties(escapeProcessing, commandType, command, filter, maxRows); final Object[] p = createRowSet(rowSetProps, parameters); final XRowSet rowSet = (XRowSet) p[0]; @@ -260,7 +260,7 @@ public class SDBCReportDataFactory implements DataSourceFactory final Object[] pair = (Object[]) groupExpressions.get(i); String expression = (String) pair[0]; - if (columns.hasByName(expression)) + if (!expression.startsWith(quote) && columns.hasByName(expression)) { expression = quote + expression + quote; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 23f959e05943..6641092ca6ee 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -257,6 +257,11 @@ public class PentahoReportJob implements ReportJob if (parameters.length > 0) { String name = parameters[0].toString(); + if (parameters[0] instanceof ContextLookup) + { + final ContextLookup context = (ContextLookup) parameters[0]; + name = context.getName(); + } for (int j = 0; j < reportFunctions.length; j++) { if (reportFunctions[j] instanceof FormulaExpression) -- cgit v1.2.3 From 8b6c7d5ba4409eabb39cd56e6e2f3db019f90b34 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 7 Jan 2010 09:46:58 +0100 Subject: sw33bf02: #i107834# [patch from CMC] - method keep "faked" font properties at font metric --- sw/source/core/txtnode/fntcache.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index f99b745b9c14..919c8091b700 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -484,6 +484,11 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; pScrFont = pPrtFont; FontMetric aMet = pPrt->GetFontMetric( ); + //Don't loose "faked" properties of the logical font that don't truly + //exist in the physical font metrics which vcl which fake up for us + aMet.SetWeight(pScrFont->GetWeight()); + aMet.SetItalic(pScrFont->GetItalic()); + bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); if ( USHRT_MAX == nGuessedLeading ) @@ -523,6 +528,11 @@ static sal_Char __READONLY_DATA sStandardString[] = "Dies ist der Teststring"; pPrt->SetFont( aFnt2 ); aMet = pPrt->GetFontMetric( ); + //Don't loose "faked" properties of the logical font that don't + //truly exist in the physical font metrics which vcl which fake + //up for us + aMet.SetWeight(aFnt2.GetWeight()); + aMet.SetItalic(aFnt2.GetItalic()); } const XubString aStandardStr( sStandardString, -- cgit v1.2.3 From 8921236168eb7468d55b0961ac0a43c0e1b420ca Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 13:00:10 +0100 Subject: dba33e: #i108037# disable column control when more than 1 is selected --- dbaccess/source/ui/misc/WTypeSelect.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index a964b0e13d38..2d2d6e5ed241 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -323,6 +323,8 @@ IMPL_LINK( OWizTypeSelect, ColumnSelectHdl, MultiListBox *, /*pListBox*/ ) OFieldDescription* pField = static_cast(m_lbColumnNames.GetEntryData(m_lbColumnNames.GetEntryPos(aColumnName))); if(pField) m_aTypeControl.DisplayData(pField); + + m_aTypeControl.Enable(m_lbColumnNames.GetSelectEntryCount() == 1 ); return 0; } // ----------------------------------------------------------------------- -- cgit v1.2.3 From c3436b84cde501fee0f8ddde012f5c81d20a1760 Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Thu, 7 Jan 2010 14:40:30 +0100 Subject: sw33bf02: #i107811# method - Assure that at-page anchored fly frames have a page num or a content anchor set. --- sw/source/core/doc/doclay.cxx | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index b97d1fbcd642..889037daadca 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -659,14 +659,14 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, // Anker noch nicht gesetzt ? RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId() : pFmt->GetAnchor().GetAnchorId(); - if( !pAnchor || - (FLY_PAGE != pAnchor->GetAnchorId() && - //Nur Page und nicht: -// FLY_AT_CNTNT == pAnchor->GetAnchorId() || -// FLY_IN_CNTNT == pAnchor->GetAnchorId() || -// FLY_AT_FLY == pAnchor->GetAnchorId() || -// FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ) && - !pAnchor->GetCntntAnchor() )) + // --> OD 2010-01-07 #i107811# + // Assure that at-page anchored fly frames have a page num or a content anchor set. + if ( !pAnchor || + ( FLY_PAGE != pAnchor->GetAnchorId() && + !pAnchor->GetCntntAnchor() ) || + ( FLY_PAGE == pAnchor->GetAnchorId() && + !pAnchor->GetCntntAnchor() && + pAnchor->GetPageNum() == 0 ) ) { // dann setze ihn, wird im Undo gebraucht SwFmtAnchor aAnch( pFmt->GetAnchor() ); @@ -680,15 +680,20 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, { if( eRequestId != aAnch.GetAnchorId() && SFX_ITEM_SET != pFmt->GetItemState( RES_ANCHOR, sal_True ) ) + { aAnch.SetType( eRequestId ); + } eAnchorId = aAnch.GetAnchorId(); - if ( FLY_PAGE != eAnchorId ) - //Nur Page und nicht: -// if( FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId || -// FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId ) + if ( FLY_PAGE != eAnchorId || + ( FLY_PAGE == eAnchorId && + ( !pAnchor || + aAnch.GetPageNum() == 0 ) ) ) + { aAnch.SetAnchor( &rAnchPos ); + } } + // <-- pFmt->SetFmtAttr( aAnch ); } else -- cgit v1.2.3 From f0ac9ba83791cfd168dbb0c87ac72098fad98b57 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 7 Jan 2010 15:12:22 +0100 Subject: dba33e: #i107782# erase leading spaces --- dbaccess/source/ui/misc/HtmlReader.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index b95423b77c24..b5733d0bebe5 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -509,6 +509,8 @@ sal_Bool OHTMLReader::CreateTable(int nToken) else if ( m_sCurrent.Len() ) aColumnName = m_sCurrent; + aColumnName.EraseLeadingChars(); + aColumnName.EraseTrailingChars(); CreateDefaultColumn(aColumnName); aColumnName.Erase(); m_sCurrent.Erase(); @@ -553,6 +555,8 @@ sal_Bool OHTMLReader::CreateTable(int nToken) if ( m_sCurrent.Len() ) aColumnName = m_sCurrent; + aColumnName.EraseLeadingChars(); + aColumnName.EraseTrailingChars(); if(aColumnName.Len()) CreateDefaultColumn(aColumnName); -- cgit v1.2.3 From b524974211771183870534e03302d9e4be9f813d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 7 Jan 2010 21:47:03 +0100 Subject: autorecovery: basdoc.cxx needs exceptions by now (well, really, it always needed them, but now the compiler complains) --- basctl/source/basicide/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basctl/source/basicide/makefile.mk b/basctl/source/basicide/makefile.mk index 8766473d8157..0487da0ea2c3 100644 --- a/basctl/source/basicide/makefile.mk +++ b/basctl/source/basicide/makefile.mk @@ -69,6 +69,7 @@ EXCEPTIONSFILES=$(SLO)$/scriptdocument.obj \ $(SLO)$/moduldl2.obj \ $(SLO)$/unomodel.obj \ $(SLO)$/register.obj \ + $(SLO)$/basdoc.obj \ $(SLO)$/tbxctl.obj \ $(SLO)$/basidectrlr.obj \ $(SLO)$/localizationmgr.obj \ @@ -77,7 +78,6 @@ EXCEPTIONSFILES=$(SLO)$/scriptdocument.obj \ $(SLO)$/documentenumeration.obj SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/basdoc.obj \ $(SLO)$/basicbox.obj \ $(SLO)$/baside2b.obj \ $(SLO)$/brkdlg.obj \ -- cgit v1.2.3 From 993a031df19361ae07b8aaec112b9b863b70a2bd Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 07:13:22 +0100 Subject: dba33e: compile error --- reportdesign/source/filter/xml/xmlExport.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 3cb44abcc17a..33da532c99c6 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -1122,7 +1122,7 @@ sal_Bool ORptExport::exportGroup(const Reference& _xReportDef while ( nIndex > -1 ) { sExpression = sExpression.replaceAt(nIndex,1,s_sQuote); - nIndex = sExpression.indexOf('"',nIndex+2);SELECT "D4 Product"."P10 Color" || ',' || "D2 Market"."M04 Region" , "F1 Revenue"."1-01 Revenue (Sum All)" FROM "Sample Sales" + nIndex = sExpression.indexOf('"',nIndex+2); } ::rtl::OUString sFormula(RTL_CONSTASCII_USTRINGPARAM("rpt:HASCHANGED(\"")); -- cgit v1.2.3 From b2cb11ec544a9441234cbc5424dc4f36a9e84048 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 08:41:34 +0100 Subject: dba33e: #i107654# handle functionname as well --- dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 1b468b2a69c9..16fd0a9211ef 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -757,11 +757,22 @@ sal_Bool OSelectionBrowseBox::saveField(const String& _sFieldName,OTableFieldDes bool bInternational = ( nPass % 2 ) == 0; ::rtl::OUString sSql; - sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT ")); if ( bQuote ) sSql += ::dbtools::quoteName( xMetaData->getIdentifierQuoteString(), _sFieldName ); else sSql += _sFieldName; + + if ( _pEntry->isAggreateFunction() ) + { + DBG_ASSERT(_pEntry->GetFunction().getLength(),"Functionname darf hier nicht leer sein! ;-("); + ::rtl::OUStringBuffer aTmpStr2( _pEntry->GetFunction()); + aTmpStr2.appendAscii("("); + aTmpStr2.append(sSql); + aTmpStr2.appendAscii(")"); + sSql = aTmpStr2.makeStringAndClear(); + } + + sSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT ")) + sSql; if ( sFieldAlias.getLength() ) { // always quote the alias name there canbe no function in it sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); -- cgit v1.2.3 From 1ddcd1caed5fa7b63df12385839f6f4c15b883ed Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 09:23:27 +0100 Subject: dba33e: #i107472# correct class param for ConnectionTools --- .../com/sun/star/report/SDBCReportDataFactory.java | 268 ++------------------- .../sun/star/report/pentaho/PentahoReportJob.java | 2 +- 2 files changed, 27 insertions(+), 243 deletions(-) diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index cbd215220bc9..8653d0ba6e3d 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -254,33 +254,35 @@ public class SDBCReportDataFactory implements DataSourceFactory final String quote = connection.getMetaData().getIdentifierQuoteString(); final XComponent[] hold = new XComponent[1]; final XNameAccess columns = getFieldsByCommandDescriptor(commandType, command, hold); - - for (int i = 0; i < count; i++) + if (columns != null) { - final Object[] pair = (Object[]) groupExpressions.get(i); - String expression = (String) pair[0]; - - if (!expression.startsWith(quote) && columns.hasByName(expression)) + for (int i = 0; i < count; i++) { - expression = quote + expression + quote; - } - expression = expression.trim(); // Trim away white spaces + final Object[] pair = (Object[]) groupExpressions.get(i); + String expression = (String) pair[0]; - if (expression.length() > 0) - { - order.append(expression); - if (order.length() > 0) + if (!expression.startsWith(quote) && columns.hasByName(expression)) { - order.append(' '); + expression = quote + expression + quote; } - final String sorting = (String) pair[1]; - if (sorting == null || sorting.equals(OfficeToken.FALSE)) - { - order.append("DESC"); - } - if ((i + 1) < count) + expression = expression.trim(); // Trim away white spaces + + if (expression.length() > 0) { - order.append(", "); + order.append(expression); + if (order.length() > 0) + { + order.append(' '); + } + final String sorting = (String) pair[1]; + if (sorting == null || sorting.equals(OfficeToken.FALSE)) + { + order.append("DESC"); + } + if ((i + 1) < count) + { + order.append(", "); + } } } } @@ -296,7 +298,7 @@ public class SDBCReportDataFactory implements DataSourceFactory private XNameAccess getFieldsByCommandDescriptor(final int commandType, final String command, final XComponent[] out) throws SQLException { final Class[] parameter = new Class[3]; - parameter[0] = Integer.class; + parameter[0] = int.class; parameter[1] = String.class; parameter[2] = out.getClass(); final XConnectionTools tools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, connection); @@ -309,171 +311,7 @@ public class SDBCReportDataFactory implements DataSourceFactory { } - XNameAccess xFields = null; - // some kind of state machine to ease the sharing of code - int eState = FAILED; - switch (commandType) - { - case CommandType.TABLE: - eState = HANDLE_TABLE; - break; - case CommandType.QUERY: - eState = HANDLE_QUERY; - break; - case CommandType.COMMAND: - eState = HANDLE_SQL; - break; - } - - // needed in various states: - XNameAccess xObjectCollection = null; - XColumnsSupplier xSupplyColumns = null; - - try - { - // go! - while ((DONE != eState) && (FAILED != eState)) - { - switch (eState) - { - case HANDLE_TABLE: - { - // initial state for handling the tables - - // get the table objects - final XTablesSupplier xSupplyTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, connection); - if (xSupplyTables != null) - { - xObjectCollection = xSupplyTables.getTables(); - // if something went wrong 'til here, then this will be handled in the next state - - // next state: get the object - } - eState = RETRIEVE_OBJECT; - } - break; - - case HANDLE_QUERY: - { - // initial state for handling the tables - - // get the table objects - final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection); - if (xSupplyQueries != null) - { - xObjectCollection = xSupplyQueries.getQueries(); - // if something went wrong 'til here, then this will be handled in the next state - - // next state: get the object - } - eState = RETRIEVE_OBJECT; - } - break; - - case RETRIEVE_OBJECT: - // here we should have an object (aka query or table) collection, and are going - // to retrieve the desired object - - // next state: default to FAILED - eState = FAILED; - - if (xObjectCollection != null && xObjectCollection.hasByName(command)) - { - xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xObjectCollection.getByName(command)); - - // next: go for the columns - eState = RETRIEVE_COLUMNS; - } - break; - - case RETRIEVE_COLUMNS: - // next state: default to FAILED - eState = FAILED; - - if (xSupplyColumns != null) - { - xFields = xSupplyColumns.getColumns(); - // that's it - eState = DONE; - } - break; - - case HANDLE_SQL: - { - String sStatementToExecute = command; - - // well, the main problem here is to handle statements which contain a parameter - // If we would simply execute a parametrized statement, then this will fail because - // we cannot supply any parameter values. - // Thus, we try to analyze the statement, and to append a WHERE 0=1 filter criterion - // This should cause every driver to not really execute the statement, but to return - // an empty result set with the proper structure. We then can use this result set - // to retrieve the columns. - - try - { - final XMultiServiceFactory xComposerFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); - - if (xComposerFac != null) - { - final XSingleSelectQueryComposer xComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xComposerFac.createInstance("com.sun.star.sdb.SingleSelectQueryComposer")); - if (xComposer != null) - { - xComposer.setQuery(sStatementToExecute); - - // Now set the filter to a dummy restriction which will result in an empty - // result set. - xComposer.setFilter("0=1"); - - sStatementToExecute = xComposer.getQuery(); - } - } - } - catch (com.sun.star.uno.Exception ex) - { - // silent this error, this was just a try. If we're here, we did not change sStatementToExecute, - // so it will still be _rCommand, which then will be executed without being touched - } - - // now execute - final XPreparedStatement xStatement = connection.prepareStatement(sStatementToExecute); - // transfer ownership of this temporary object to the caller - out[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xStatement); - - // set the "MaxRows" to 0. This is just in case our attempt to append a 0=1 filter - // failed - in this case, the MaxRows restriction should at least ensure that there - // is no data returned (which would be potentially expensive) - final XPropertySet xStatementProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xStatement); - try - { - if (xStatementProps != null) - { - xStatementProps.setPropertyValue("MaxRows", Integer.valueOf(0)); - } - } - catch (com.sun.star.uno.Exception ex) - { - // oh damn. Not much of a chance to recover, we will no retrieve the complete - // full blown result set - } - - xSupplyColumns = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xStatement.executeQuery()); - // this should have given us a result set which does not contain any data, but - // the structural information we need - - // so the next state is to get the columns - eState = RETRIEVE_COLUMNS; - } - break; - default: - eState = FAILED; - } - } - } - catch (com.sun.star.uno.Exception ex) - { - } - return xFields; + throw new SQLException(); } private XSingleSelectQueryComposer getComposer(final XConnectionTools tools, @@ -504,61 +342,7 @@ public class SDBCReportDataFactory implements DataSourceFactory // should not happen // assert False } - try - { - final XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, connection); - final XSingleSelectQueryComposer out = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, factory.createInstance("com.sun.star.sdb.SingleSelectQueryAnalyzer")); - final String quote = connection.getMetaData().getIdentifierQuoteString(); - String statement = command; - switch (commandType) - { - case CommandType.TABLE: - statement = "SELECT * FROM " + quote + command + quote; - break; - case CommandType.QUERY: - { - final XQueriesSupplier xSupplyQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, connection); - final XNameAccess queries = xSupplyQueries.getQueries(); - if (queries.hasByName(command)) - { - final XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, queries.getByName(command)); - final Boolean escape = (Boolean) prop.getPropertyValue(ESCAPEPROCESSING); - if (escape) - { - statement = (String) prop.getPropertyValue(UNO_COMMAND); - final XSingleSelectQueryComposer composer = getComposer(tools, statement, CommandType.COMMAND); - if (composer != null) - { - final String order = (String) prop.getPropertyValue(UNO_ORDER); - if (order != null && order.length() != 0) - { - composer.setOrder(order); - } - final Boolean applyFilter = (Boolean) prop.getPropertyValue(UNO_APPLY_FILTER); - if (applyFilter) - { - final String filter = (String) prop.getPropertyValue(UNO_FILTER); - if (filter != null && filter.length() != 0) - { - composer.setFilter(filter); - } - } - statement = composer.getQuery(); - } - } - } - break; - } - case CommandType.COMMAND: - statement = command; - break; - } - out.setElementaryQuery(statement); - return out; - } - catch (Exception e) - { - } + return null; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java index 6641092ca6ee..6889e3100f92 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/PentahoReportJob.java @@ -375,7 +375,7 @@ public class PentahoReportJob implements ReportJob catch (final Exception e) { String message = e.getMessage(); - if (message.length() == 0) + if (message == null || message.length() == 0) { message = "Failed to process the report"; } -- cgit v1.2.3 From 9d43ce3490eb06668cd7fa6e7d29b7a7ced18957 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 8 Jan 2010 09:39:22 +0100 Subject: autorecovery: need to compile some files (which indirectly include sfxbasemodel.hxx) with exception support --- starmath/source/makefile.mk | 1 + sw/source/ui/app/makefile.mk | 1 + sw/source/ui/shells/makefile.mk | 1 + 3 files changed, 3 insertions(+) diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index 53f6569dcf9c..af775dc5df40 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -89,6 +89,7 @@ SLOFILES = \ $(SLO2FILES) EXCEPTIONSFILES = \ + $(SLO)$/register.obj \ $(SLO)$/accessibility.obj \ $(SLO)$/cfgitem.obj \ $(SLO)$/document.obj \ diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk index d3a4cd242d30..80af904aa731 100644 --- a/sw/source/ui/app/makefile.mk +++ b/sw/source/ui/app/makefile.mk @@ -73,6 +73,7 @@ SLOFILES = \ EXCEPTIONSFILES= \ $(SLO)$/docsh.obj \ $(SLO)$/docst.obj \ + $(SLO)$/docshini.obj \ $(SLO)$/swmodule.obj \ $(SLO)$/swmodul1.obj \ $(SLO)$/apphdl.obj \ diff --git a/sw/source/ui/shells/makefile.mk b/sw/source/ui/shells/makefile.mk index 2e4a96c990bf..a3317235b746 100644 --- a/sw/source/ui/shells/makefile.mk +++ b/sw/source/ui/shells/makefile.mk @@ -77,6 +77,7 @@ SLOFILES = \ $(SLO)$/txtnum.obj EXCEPTIONSFILES = \ + $(SLO)$/basesh.obj \ $(SLO)$/annotsh.obj \ $(SLO)$/drwtxtsh.obj \ $(SLO)$/textsh.obj \ -- cgit v1.2.3 From 54a73a80c48c7ec987331aa038f5ad3c9e72a582 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 8 Jan 2010 09:39:22 +0100 Subject: autorecovery: need to compile some files (which indirectly include sfxbasemodel.hxx) with exception support --- sc/source/filter/excel/makefile.mk | 1 + sc/source/ui/undo/makefile.mk | 2 ++ sc/source/ui/view/makefile.mk | 3 +++ 3 files changed, 6 insertions(+) diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk index 4c94b0712d89..abf672144dca 100644 --- a/sc/source/filter/excel/makefile.mk +++ b/sc/source/filter/excel/makefile.mk @@ -155,6 +155,7 @@ EXCEPTIONSFILES = \ $(SLO)$/xlpivot.obj \ $(SLO)$/xlroot.obj \ $(SLO)$/xlstyle.obj \ + $(SLO)$/xltools.obj \ $(SLO)$/xlview.obj # --- Targets ------------------------------------------------------- diff --git a/sc/source/ui/undo/makefile.mk b/sc/source/ui/undo/makefile.mk index b25c2919a332..559cb1a5fd76 100644 --- a/sc/source/ui/undo/makefile.mk +++ b/sc/source/ui/undo/makefile.mk @@ -78,6 +78,8 @@ SLOFILES = \ $(SLO)$/undotab.obj EXCEPTIONSFILES= \ + $(SLO)$/undoblk3.obj \ + $(SLO)$/undocell.obj \ $(SLO)$/undostyl.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/view/makefile.mk b/sc/source/ui/view/makefile.mk index 466ab5dc8627..8d12a5b86e9f 100644 --- a/sc/source/ui/view/makefile.mk +++ b/sc/source/ui/view/makefile.mk @@ -160,6 +160,9 @@ EXCEPTIONSFILES= \ $(SLO)$/scextopt.obj \ $(SLO)$/tabvwshb.obj \ $(SLO)$/viewdata.obj \ + $(SLO)$/viewfunc.obj \ + $(SLO)$/viewfun2.obj \ + $(SLO)$/viewfun3.obj \ $(SLO)$/viewfun5.obj \ $(SLO)$/viewfun7.obj -- cgit v1.2.3 From 8382cc3375051a093ba21dfb1faaf219b54741d2 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Fri, 8 Jan 2010 10:03:35 +0100 Subject: chart43: #i108122# data label from categories crash without categories --- chart2/source/view/charttypes/VSeriesPlotter.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index c8f473d226d0..864a9f8accfa 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -537,6 +537,9 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re createText( xTarget_, aText.makeStringAndClear() , *pPropNames, *pPropValues, ShapeFactory::makeTransformation( aScreenPosition2D ) ); + if( !xTextShape.is() ) + return xTextShape; + const awt::Point aUnrotatedTextPos( xTextShape->getPosition() ); if( fRotationDegrees != 0.0 ) { @@ -547,7 +550,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re LabelPositionHelper::correctPositionForRotation( xTextShape, eAlignment, fRotationDegrees, true /*bRotateAroundCenter*/ ); } - if( xSymbol.is() && xTextShape.is() ) + if( xSymbol.is() ) { const awt::Point aOldTextPos( xTextShape->getPosition() ); awt::Point aNewTextPos( aOldTextPos ); -- cgit v1.2.3 From 58519fbb7255ca48701d3850f4038ca549e29b27 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 10:16:37 +0100 Subject: dba33e: #i108092# when value is null set NAN --- dbaccess/source/core/misc/DatabaseDataProvider.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index b6aff3db3240..2cb2b29f8e87 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -633,7 +634,14 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(sal_Bool _bHasCat for (sal_Int32 j = _bHasCategories ? 2 : 1,i = 0; j <= nCount; ++j,++i) { aValue.fill(j,aColumnTypes[j-1],xRow); - aRow.push_back(aValue.getDouble()); + if ( aValue.isNull() ) + { + double nValue; + ::rtl::math::setNan( &nValue ); + aRow.push_back(nValue); + } + else + aRow.push_back(aValue.getDouble()); } // for (sal_Int32 j = 2,i = 0; j <= nCount; ++j,++i) aDataValues.push_back(aRow); } // while( xRes->next() && (!m_RowLimit || nRowCount < m_RowLimit) ) -- cgit v1.2.3 From ed6a92553b678c64d7c6c0f8b3259e014a4851b3 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 10:16:56 +0100 Subject: dba33e: #i108092# set NAN when double value is NULL --- .../sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java | 2 +- .../report/pentaho/layoutprocessor/TableCellLayoutController.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java index 405fe4a2815b..79c946c9643d 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -57,7 +57,7 @@ public class FormatValueUtility private static final String BOOLEAN_VALUE = "boolean-value"; private static final String STRING_VALUE = "string-value"; public static final String VALUE_TYPE = "value-type"; - private static final String VALUE = "value"; + public static final String VALUE = "value"; private static SimpleDateFormat dateFormat; private static SimpleDateFormat timeFormat; diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java index 5393a5e13a15..baba6c9aafe5 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -80,6 +80,10 @@ public class TableCellLayoutController extends SectionLayoutController { FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); } + else if ( "float".equals(valueType)) + { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE, "1.#NAN"); + } } catch (Exception e) { -- cgit v1.2.3 From d3a4501c36c893751070c20e5a6462261269668b Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 8 Jan 2010 11:02:32 +0100 Subject: dba33e: #i108128# check if default driver is available --- dbaccess/source/ui/dlg/DbAdminImpl.cxx | 9 +++++++-- dbaccess/source/ui/dlg/DbAdminImpl.hxx | 1 + dbaccess/source/ui/dlg/dbwizsetup.cxx | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index dd7e736240ec..fd62eba4ff5f 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -355,6 +355,11 @@ void ODbDataSourceAdministrationHelper::clearPassword() } // ----------------------------------------------------------------------------- Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver() +{ + return getDriver(getConnectionURL()); +} +// ----------------------------------------------------------------------------- +Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const ::rtl::OUString& _sURL) { // get the global DriverManager Reference< XDriverAccess > xDriverManager; @@ -376,11 +381,11 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver() throw SQLException(sCurrentActionError, getORB(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")), 0, Any()); - Reference< XDriver > xDriver = xDriverManager->getDriverByURL(getConnectionURL()); + Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL); if (!xDriver.is()) { sCurrentActionError = String(ModuleRes(STR_NOREGISTEREDDRIVER)); - sCurrentActionError.SearchAndReplaceAscii("#connurl#", getConnectionURL()); + sCurrentActionError.SearchAndReplaceAscii("#connurl#", _sURL); // will be caught and translated into an SQLContext exception throw SQLException(sCurrentActionError, getORB(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")), 0, Any()); } diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx index a194ebc7b23c..6c64363a1623 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx @@ -140,6 +140,7 @@ namespace dbaui /** return the corresponding driver for the selected URL */ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver(); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > getDriver(const ::rtl::OUString& _sURL); /** returns the data source the dialog is currently working with */ diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index bab1dcca3694..ced0640b928c 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -945,7 +945,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { ::rtl::OUString sEmbeddedURL = m_pCollection->getEmbeddedDatabase(); ::connectivity::DriversConfig aDriverConfig(getORB()); - if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() ) + if ( !aDriverConfig.getDriverFactoryName(sEmbeddedURL).getLength() || m_pImpl->getDriver(sEmbeddedURL).is() ) sEmbeddedURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:")); return sEmbeddedURL; -- cgit v1.2.3 From 726b8b3030ef97d55b2cb3601afd627fc8bffbb4 Mon Sep 17 00:00:00 2001 From: Mikhail Voitenko Date: Fri, 8 Jan 2010 15:15:59 +0000 Subject: #i108159# new ODF- and nonODF-Icons --- default_images/res/lx03123.png | Bin 330 -> 982 bytes default_images/res/lx03126.png | Bin 315 -> 692 bytes default_images/res/lx03127.png | Bin 323 -> 919 bytes default_images/res/lx03128.png | Bin 314 -> 749 bytes default_images/res/lx03129.png | Bin 440 -> 1319 bytes default_images/res/lx03130.png | Bin 337 -> 1166 bytes default_images/res/lx03131.png | Bin 551 -> 919 bytes default_images/res/lx03132.png | Bin 547 -> 919 bytes default_images/res/lx03139.png | Bin 2908 -> 755 bytes default_images/res/lx03144.png | Bin 332 -> 1172 bytes default_images/res/lx03156.png | Bin 401 -> 903 bytes default_images/res/lx03161.png | Bin 448 -> 903 bytes default_images/res/lx03162.png | Bin 349 -> 903 bytes default_images/res/lx03163.png | Bin 353 -> 941 bytes default_images/res/lx03188.png | Bin 315 -> 692 bytes default_images/res/lx03217.png | Bin 1315 -> 1363 bytes default_images/res/lx03218.png | Bin 1315 -> 1363 bytes default_images/res/lx03220.png | Bin 1315 -> 1363 bytes default_images/res/lx03221.png | Bin 1315 -> 1363 bytes default_images/res/lx03222.png | Bin 1315 -> 1363 bytes default_images/res/lx03226.png | Bin 350 -> 909 bytes default_images/res/lx03227.png | Bin 360 -> 1363 bytes default_images/res/lx03228.png | Bin 364 -> 1307 bytes default_images/res/lx03241.png | Bin 315 -> 749 bytes default_images/res/lx03242.png | Bin 2510 -> 966 bytes default_images/res/lx03243.png | Bin 403 -> 982 bytes default_images/res/lx03244.png | Bin 381 -> 1166 bytes default_images/res/lx03245.png | Bin 2922 -> 1497 bytes default_images/res/lx03246.png | Bin 2828 -> 1548 bytes default_images/res/lx03247.png | Bin 2622 -> 1346 bytes default_images/res/lx03248.png | Bin 2338 -> 1110 bytes default_images/res/lx03249.png | Bin 2623 -> 1180 bytes default_images/res/lx03250.png | Bin 2618 -> 917 bytes default_images/res/lx03251.png | Bin 2311 -> 1106 bytes default_images/res/lx03252.png | Bin 2957 -> 1506 bytes default_images/res/lx03253.png | Bin 2812 -> 1370 bytes default_images/res/lx03254.png | Bin 2856 -> 1130 bytes default_images/res/lx03255.png | Bin 2575 -> 1153 bytes default_images/res/lxh03123.png | Bin 355 -> 3742 bytes default_images/res/lxh03126.png | Bin 313 -> 3706 bytes default_images/res/lxh03127.png | Bin 205 -> 3780 bytes default_images/res/lxh03128.png | Bin 392 -> 126 bytes default_images/res/lxh03129.png | Bin 374 -> 3807 bytes default_images/res/lxh03130.png | Bin 243 -> 3798 bytes default_images/res/lxh03131.png | Bin 244 -> 3780 bytes default_images/res/lxh03132.png | Bin 255 -> 3780 bytes default_images/res/lxh03139.png | Bin 239 -> 3735 bytes default_images/res/lxh03144.png | Bin 333 -> 3822 bytes default_images/res/lxh03156.png | Bin 146 -> 3771 bytes default_images/res/lxh03161.png | Bin 221 -> 3771 bytes default_images/res/lxh03162.png | Bin 306 -> 3771 bytes default_images/res/lxh03163.png | Bin 192 -> 3774 bytes default_images/res/lxh03188.png | Bin 170 -> 3706 bytes default_images/res/lxh03217.png | Bin 220 -> 3892 bytes default_images/res/lxh03218.png | Bin 220 -> 3892 bytes default_images/res/lxh03220.png | Bin 220 -> 3892 bytes default_images/res/lxh03221.png | Bin 220 -> 3892 bytes default_images/res/lxh03222.png | Bin 220 -> 3892 bytes default_images/res/lxh03226.png | Bin 371 -> 3763 bytes default_images/res/lxh03227.png | Bin 427 -> 3892 bytes default_images/res/lxh03228.png | Bin 303 -> 3886 bytes default_images/res/lxh03241.png | Bin 170 -> 126 bytes default_images/res/lxh03242.png | Bin 223 -> 3784 bytes default_images/res/lxh03243.png | Bin 200 -> 3742 bytes default_images/res/lxh03244.png | Bin 225 -> 3798 bytes default_images/res/lxh03245.png | Bin 246 -> 3867 bytes default_images/res/lxh03246.png | Bin 254 -> 3955 bytes default_images/res/lxh03247.png | Bin 227 -> 3880 bytes default_images/res/lxh03248.png | Bin 219 -> 3816 bytes default_images/res/lxh03249.png | Bin 238 -> 3805 bytes default_images/res/lxh03250.png | Bin 219 -> 3778 bytes default_images/res/lxh03251.png | Bin 219 -> 3831 bytes default_images/res/lxh03252.png | Bin 263 -> 3945 bytes default_images/res/lxh03253.png | Bin 260 -> 3856 bytes default_images/res/lxh03254.png | Bin 244 -> 3850 bytes default_images/res/lxh03255.png | Bin 249 -> 3835 bytes default_images/res/odb_16_8.png | Bin 1026 -> 574 bytes default_images/res/odb_32.png | Bin 2922 -> 1497 bytes default_images/res/odb_32_8.png | Bin 2950 -> 1497 bytes default_images/res/odb_48_8.png | Bin 4949 -> 2430 bytes default_images/res/odf_16_8.png | Bin 1012 -> 580 bytes default_images/res/odf_32.png | Bin 2622 -> 1346 bytes default_images/res/odf_32_8.png | Bin 2450 -> 1346 bytes default_images/res/odf_48_8.png | Bin 4247 -> 2171 bytes default_images/res/odg_16_8.png | Bin 1042 -> 572 bytes default_images/res/odg_32.png | Bin 2828 -> 1548 bytes default_images/res/odg_32_8.png | Bin 2682 -> 1548 bytes default_images/res/odg_48_8.png | Bin 4744 -> 2518 bytes default_images/res/odm_16_8.png | Bin 943 -> 472 bytes default_images/res/odm_32_8.png | Bin 2241 -> 1110 bytes default_images/res/odm_48_8.png | Bin 3846 -> 1741 bytes default_images/res/odp_16_8.png | Bin 1001 -> 441 bytes default_images/res/odp_32.png | Bin 2623 -> 1180 bytes default_images/res/odp_32_8.png | Bin 2674 -> 1180 bytes default_images/res/odp_48_8.png | Bin 4515 -> 2125 bytes default_images/res/ods_16_8.png | Bin 992 -> 436 bytes default_images/res/ods_32.png | Bin 2618 -> 917 bytes default_images/res/ods_32_8.png | Bin 2531 -> 917 bytes default_images/res/ods_48_8.png | Bin 4305 -> 2079 bytes default_images/res/odt_16_8.png | Bin 954 -> 420 bytes default_images/res/odt_32.png | Bin 2311 -> 1106 bytes default_images/res/odt_32_8.png | Bin 2222 -> 1106 bytes default_images/res/odt_48_8.png | Bin 3770 -> 2094 bytes default_images/res/otg_16_8.png | Bin 1011 -> 554 bytes default_images/res/otg_32_8.png | Bin 2415 -> 1506 bytes default_images/res/otg_48_8.png | Bin 4222 -> 2482 bytes default_images/res/oth_16_8.png | Bin 1020 -> 436 bytes default_images/res/oth_32_8.png | Bin 2771 -> 966 bytes default_images/res/oth_48_8.png | Bin 4709 -> 1537 bytes default_images/res/otp_16_8.png | Bin 984 -> 532 bytes default_images/res/otp_32_8.png | Bin 2405 -> 1370 bytes default_images/res/otp_48_8.png | Bin 4027 -> 2376 bytes default_images/res/ots_16_8.png | Bin 968 -> 538 bytes default_images/res/ots_32_8.png | Bin 2302 -> 1130 bytes default_images/res/ots_48_8.png | Bin 3835 -> 2400 bytes default_images/res/ott_16_8.png | Bin 923 -> 444 bytes default_images/res/ott_32_8.png | Bin 1988 -> 1153 bytes default_images/res/ott_48_8.png | Bin 3320 -> 2125 bytes default_images/res/sx03123.png | Bin 227 -> 425 bytes default_images/res/sx03126.png | Bin 200 -> 412 bytes default_images/res/sx03127.png | Bin 213 -> 513 bytes default_images/res/sx03128.png | Bin 228 -> 525 bytes default_images/res/sx03129.png | Bin 228 -> 555 bytes default_images/res/sx03130.png | Bin 233 -> 515 bytes default_images/res/sx03131.png | Bin 314 -> 513 bytes default_images/res/sx03132.png | Bin 280 -> 513 bytes default_images/res/sx03139.png | Bin 1023 -> 366 bytes default_images/res/sx03144.png | Bin 195 -> 562 bytes default_images/res/sx03156.png | Bin 286 -> 392 bytes default_images/res/sx03161.png | Bin 317 -> 392 bytes default_images/res/sx03162.png | Bin 192 -> 392 bytes default_images/res/sx03163.png | Bin 198 -> 413 bytes default_images/res/sx03188.png | Bin 468 -> 412 bytes default_images/res/sx03217.png | Bin 701 -> 555 bytes default_images/res/sx03218.png | Bin 701 -> 555 bytes default_images/res/sx03220.png | Bin 701 -> 555 bytes default_images/res/sx03221.png | Bin 701 -> 555 bytes default_images/res/sx03222.png | Bin 701 -> 555 bytes default_images/res/sx03226.png | Bin 235 -> 450 bytes default_images/res/sx03227.png | Bin 238 -> 555 bytes default_images/res/sx03228.png | Bin 243 -> 522 bytes default_images/res/sx03241.png | Bin 202 -> 525 bytes default_images/res/sx03242.png | Bin 947 -> 436 bytes default_images/res/sx03243.png | Bin 272 -> 425 bytes default_images/res/sx03244.png | Bin 254 -> 515 bytes default_images/res/sx03245.png | Bin 1009 -> 574 bytes default_images/res/sx03246.png | Bin 1082 -> 572 bytes default_images/res/sx03247.png | Bin 1014 -> 580 bytes default_images/res/sx03248.png | Bin 929 -> 472 bytes default_images/res/sx03249.png | Bin 960 -> 441 bytes default_images/res/sx03250.png | Bin 961 -> 436 bytes default_images/res/sx03251.png | Bin 923 -> 420 bytes default_images/res/sx03252.png | Bin 1094 -> 554 bytes default_images/res/sx03253.png | Bin 1025 -> 532 bytes default_images/res/sx03254.png | Bin 1018 -> 538 bytes default_images/res/sx03255.png | Bin 986 -> 444 bytes default_images/res/sxh03123.png | Bin 236 -> 3679 bytes default_images/res/sxh03126.png | Bin 217 -> 3662 bytes default_images/res/sxh03127.png | Bin 224 -> 3704 bytes default_images/res/sxh03128.png | Bin 261 -> 109 bytes default_images/res/sxh03129.png | Bin 285 -> 3681 bytes default_images/res/sxh03130.png | Bin 244 -> 3701 bytes default_images/res/sxh03131.png | Bin 175 -> 3704 bytes default_images/res/sxh03132.png | Bin 177 -> 3704 bytes default_images/res/sxh03139.png | Bin 140 -> 3655 bytes default_images/res/sxh03144.png | Bin 231 -> 3682 bytes default_images/res/sxh03156.png | Bin 127 -> 3664 bytes default_images/res/sxh03161.png | Bin 162 -> 3664 bytes default_images/res/sxh03162.png | Bin 216 -> 3664 bytes default_images/res/sxh03163.png | Bin 224 -> 3660 bytes default_images/res/sxh03188.png | Bin 108 -> 3662 bytes default_images/res/sxh03217.png | Bin 140 -> 3705 bytes default_images/res/sxh03218.png | Bin 140 -> 3705 bytes default_images/res/sxh03220.png | Bin 140 -> 3705 bytes default_images/res/sxh03221.png | Bin 140 -> 3705 bytes default_images/res/sxh03222.png | Bin 140 -> 3705 bytes default_images/res/sxh03226.png | Bin 259 -> 3668 bytes default_images/res/sxh03227.png | Bin 276 -> 3705 bytes default_images/res/sxh03228.png | Bin 274 -> 3678 bytes default_images/res/sxh03241.png | Bin 122 -> 109 bytes default_images/res/sxh03242.png | Bin 163 -> 3648 bytes default_images/res/sxh03243.png | Bin 160 -> 3679 bytes default_images/res/sxh03244.png | Bin 161 -> 3701 bytes default_images/res/sxh03245.png | Bin 151 -> 3687 bytes default_images/res/sxh03246.png | Bin 144 -> 3706 bytes default_images/res/sxh03247.png | Bin 146 -> 3695 bytes default_images/res/sxh03248.png | Bin 143 -> 3666 bytes default_images/res/sxh03249.png | Bin 141 -> 3679 bytes default_images/res/sxh03250.png | Bin 139 -> 3666 bytes default_images/res/sxh03251.png | Bin 138 -> 3667 bytes default_images/res/sxh03252.png | Bin 150 -> 3694 bytes default_images/res/sxh03253.png | Bin 146 -> 3698 bytes default_images/res/sxh03254.png | Bin 150 -> 3709 bytes default_images/res/sxh03255.png | Bin 143 -> 3662 bytes default_images/svtools/res/new_doc.png | Bin 2215 -> 950 bytes default_images/svtools/res/new_doc_h.png | Bin 241 -> 3785 bytes default_images/svtools/res/template.png | Bin 2510 -> 966 bytes default_images/svtools/res/template_h.png | Bin 236 -> 3784 bytes default_images/svx/res/tr10437.png | Bin 2440 -> 950 bytes default_images/svx/res/trh10437.png | Bin 212 -> 3785 bytes 200 files changed, 0 insertions(+), 0 deletions(-) diff --git a/default_images/res/lx03123.png b/default_images/res/lx03123.png index 7f5eb7f28b0e..730f86f0ba63 100644 Binary files a/default_images/res/lx03123.png and b/default_images/res/lx03123.png differ diff --git a/default_images/res/lx03126.png b/default_images/res/lx03126.png index c83c48e35588..dc9bd083c218 100644 Binary files a/default_images/res/lx03126.png and b/default_images/res/lx03126.png differ diff --git a/default_images/res/lx03127.png b/default_images/res/lx03127.png index fcff205083ba..d81cd27dd93f 100644 Binary files a/default_images/res/lx03127.png and b/default_images/res/lx03127.png differ diff --git a/default_images/res/lx03128.png b/default_images/res/lx03128.png index 9e9eee40bc03..4da4372213f3 100644 Binary files a/default_images/res/lx03128.png and b/default_images/res/lx03128.png differ diff --git a/default_images/res/lx03129.png b/default_images/res/lx03129.png index 383e9da46ad6..6e0a4b8f60ba 100644 Binary files a/default_images/res/lx03129.png and b/default_images/res/lx03129.png differ diff --git a/default_images/res/lx03130.png b/default_images/res/lx03130.png index d04a453d589f..5163f441039a 100644 Binary files a/default_images/res/lx03130.png and b/default_images/res/lx03130.png differ diff --git a/default_images/res/lx03131.png b/default_images/res/lx03131.png index e0b7d5522c3f..d81cd27dd93f 100644 Binary files a/default_images/res/lx03131.png and b/default_images/res/lx03131.png differ diff --git a/default_images/res/lx03132.png b/default_images/res/lx03132.png index 336cdc24b666..d81cd27dd93f 100644 Binary files a/default_images/res/lx03132.png and b/default_images/res/lx03132.png differ diff --git a/default_images/res/lx03139.png b/default_images/res/lx03139.png index e3bd788ea1dc..f48b979c072c 100644 Binary files a/default_images/res/lx03139.png and b/default_images/res/lx03139.png differ diff --git a/default_images/res/lx03144.png b/default_images/res/lx03144.png index 00887a107848..d989593924c2 100644 Binary files a/default_images/res/lx03144.png and b/default_images/res/lx03144.png differ diff --git a/default_images/res/lx03156.png b/default_images/res/lx03156.png index 0af99cb8d9b3..1454b20fd5db 100644 Binary files a/default_images/res/lx03156.png and b/default_images/res/lx03156.png differ diff --git a/default_images/res/lx03161.png b/default_images/res/lx03161.png index de855b86145d..1454b20fd5db 100644 Binary files a/default_images/res/lx03161.png and b/default_images/res/lx03161.png differ diff --git a/default_images/res/lx03162.png b/default_images/res/lx03162.png index c81ea954cbff..1454b20fd5db 100644 Binary files a/default_images/res/lx03162.png and b/default_images/res/lx03162.png differ diff --git a/default_images/res/lx03163.png b/default_images/res/lx03163.png index 49056145eafd..7c738c21eb59 100644 Binary files a/default_images/res/lx03163.png and b/default_images/res/lx03163.png differ diff --git a/default_images/res/lx03188.png b/default_images/res/lx03188.png index 6ffc58a70172..dc9bd083c218 100644 Binary files a/default_images/res/lx03188.png and b/default_images/res/lx03188.png differ diff --git a/default_images/res/lx03217.png b/default_images/res/lx03217.png index e98b72c1e50b..4abe5c0f80af 100644 Binary files a/default_images/res/lx03217.png and b/default_images/res/lx03217.png differ diff --git a/default_images/res/lx03218.png b/default_images/res/lx03218.png index e98b72c1e50b..4abe5c0f80af 100644 Binary files a/default_images/res/lx03218.png and b/default_images/res/lx03218.png differ diff --git a/default_images/res/lx03220.png b/default_images/res/lx03220.png index e98b72c1e50b..4abe5c0f80af 100644 Binary files a/default_images/res/lx03220.png and b/default_images/res/lx03220.png differ diff --git a/default_images/res/lx03221.png b/default_images/res/lx03221.png index e98b72c1e50b..4abe5c0f80af 100644 Binary files a/default_images/res/lx03221.png and b/default_images/res/lx03221.png differ diff --git a/default_images/res/lx03222.png b/default_images/res/lx03222.png index e98b72c1e50b..4abe5c0f80af 100644 Binary files a/default_images/res/lx03222.png and b/default_images/res/lx03222.png differ diff --git a/default_images/res/lx03226.png b/default_images/res/lx03226.png index 5cb5deb2f058..d4b033f4aab8 100644 Binary files a/default_images/res/lx03226.png and b/default_images/res/lx03226.png differ diff --git a/default_images/res/lx03227.png b/default_images/res/lx03227.png index aa7a17d342a4..4abe5c0f80af 100644 Binary files a/default_images/res/lx03227.png and b/default_images/res/lx03227.png differ diff --git a/default_images/res/lx03228.png b/default_images/res/lx03228.png index 4accce9a8967..a341632dabb7 100644 Binary files a/default_images/res/lx03228.png and b/default_images/res/lx03228.png differ diff --git a/default_images/res/lx03241.png b/default_images/res/lx03241.png index 6ffc58a70172..4da4372213f3 100644 Binary files a/default_images/res/lx03241.png and b/default_images/res/lx03241.png differ diff --git a/default_images/res/lx03242.png b/default_images/res/lx03242.png index 92ba5ecc15b7..8e906f8be1df 100644 Binary files a/default_images/res/lx03242.png and b/default_images/res/lx03242.png differ diff --git a/default_images/res/lx03243.png b/default_images/res/lx03243.png index 5a947356ee92..730f86f0ba63 100644 Binary files a/default_images/res/lx03243.png and b/default_images/res/lx03243.png differ diff --git a/default_images/res/lx03244.png b/default_images/res/lx03244.png index 57b52ae0e128..5163f441039a 100644 Binary files a/default_images/res/lx03244.png and b/default_images/res/lx03244.png differ diff --git a/default_images/res/lx03245.png b/default_images/res/lx03245.png index ddfcd7d19588..461bdf37b774 100644 Binary files a/default_images/res/lx03245.png and b/default_images/res/lx03245.png differ diff --git a/default_images/res/lx03246.png b/default_images/res/lx03246.png index 8d78d91c1866..55dda2143e57 100644 Binary files a/default_images/res/lx03246.png and b/default_images/res/lx03246.png differ diff --git a/default_images/res/lx03247.png b/default_images/res/lx03247.png index 302c7ab633f4..6b8f2f732201 100644 Binary files a/default_images/res/lx03247.png and b/default_images/res/lx03247.png differ diff --git a/default_images/res/lx03248.png b/default_images/res/lx03248.png index fc032402b756..234bac461e74 100644 Binary files a/default_images/res/lx03248.png and b/default_images/res/lx03248.png differ diff --git a/default_images/res/lx03249.png b/default_images/res/lx03249.png index 465583b9b06b..fedeb0620a75 100644 Binary files a/default_images/res/lx03249.png and b/default_images/res/lx03249.png differ diff --git a/default_images/res/lx03250.png b/default_images/res/lx03250.png index 67da85c10bf1..020d95bef310 100644 Binary files a/default_images/res/lx03250.png and b/default_images/res/lx03250.png differ diff --git a/default_images/res/lx03251.png b/default_images/res/lx03251.png index 571e6a0e4a48..ac350cb409d1 100644 Binary files a/default_images/res/lx03251.png and b/default_images/res/lx03251.png differ diff --git a/default_images/res/lx03252.png b/default_images/res/lx03252.png index e742adc40258..cdc2f2df0fc8 100644 Binary files a/default_images/res/lx03252.png and b/default_images/res/lx03252.png differ diff --git a/default_images/res/lx03253.png b/default_images/res/lx03253.png index 03c96f8dd867..012516065215 100644 Binary files a/default_images/res/lx03253.png and b/default_images/res/lx03253.png differ diff --git a/default_images/res/lx03254.png b/default_images/res/lx03254.png index 383906a70a2e..9d63063e67d0 100644 Binary files a/default_images/res/lx03254.png and b/default_images/res/lx03254.png differ diff --git a/default_images/res/lx03255.png b/default_images/res/lx03255.png index feb935cc1df4..983b39e611ae 100644 Binary files a/default_images/res/lx03255.png and b/default_images/res/lx03255.png differ diff --git a/default_images/res/lxh03123.png b/default_images/res/lxh03123.png index 587bbf4ccb69..392d54db47cb 100644 Binary files a/default_images/res/lxh03123.png and b/default_images/res/lxh03123.png differ diff --git a/default_images/res/lxh03126.png b/default_images/res/lxh03126.png index 0e4c7c800747..556b86926671 100644 Binary files a/default_images/res/lxh03126.png and b/default_images/res/lxh03126.png differ diff --git a/default_images/res/lxh03127.png b/default_images/res/lxh03127.png index 3b1af95476af..05e9947e398f 100644 Binary files a/default_images/res/lxh03127.png and b/default_images/res/lxh03127.png differ diff --git a/default_images/res/lxh03128.png b/default_images/res/lxh03128.png index d454ef1159ba..68e8add815c9 100644 Binary files a/default_images/res/lxh03128.png and b/default_images/res/lxh03128.png differ diff --git a/default_images/res/lxh03129.png b/default_images/res/lxh03129.png index 454c6342d764..97f918d99fbe 100644 Binary files a/default_images/res/lxh03129.png and b/default_images/res/lxh03129.png differ diff --git a/default_images/res/lxh03130.png b/default_images/res/lxh03130.png index 6695e9e6715d..6ed4402580fd 100644 Binary files a/default_images/res/lxh03130.png and b/default_images/res/lxh03130.png differ diff --git a/default_images/res/lxh03131.png b/default_images/res/lxh03131.png index 3735adb276cc..05e9947e398f 100644 Binary files a/default_images/res/lxh03131.png and b/default_images/res/lxh03131.png differ diff --git a/default_images/res/lxh03132.png b/default_images/res/lxh03132.png index fe5bb926d82f..05e9947e398f 100644 Binary files a/default_images/res/lxh03132.png and b/default_images/res/lxh03132.png differ diff --git a/default_images/res/lxh03139.png b/default_images/res/lxh03139.png index e0d4fc8c3dfb..b6bafe2f52c6 100644 Binary files a/default_images/res/lxh03139.png and b/default_images/res/lxh03139.png differ diff --git a/default_images/res/lxh03144.png b/default_images/res/lxh03144.png index 57600ed86d96..fbefd3d96fae 100644 Binary files a/default_images/res/lxh03144.png and b/default_images/res/lxh03144.png differ diff --git a/default_images/res/lxh03156.png b/default_images/res/lxh03156.png index 66f1db29dba2..788b6ef9743e 100644 Binary files a/default_images/res/lxh03156.png and b/default_images/res/lxh03156.png differ diff --git a/default_images/res/lxh03161.png b/default_images/res/lxh03161.png index bc8e5448286b..788b6ef9743e 100644 Binary files a/default_images/res/lxh03161.png and b/default_images/res/lxh03161.png differ diff --git a/default_images/res/lxh03162.png b/default_images/res/lxh03162.png index fc735ad454bd..788b6ef9743e 100644 Binary files a/default_images/res/lxh03162.png and b/default_images/res/lxh03162.png differ diff --git a/default_images/res/lxh03163.png b/default_images/res/lxh03163.png index aa2a45f8bc1b..7d099a0250f6 100644 Binary files a/default_images/res/lxh03163.png and b/default_images/res/lxh03163.png differ diff --git a/default_images/res/lxh03188.png b/default_images/res/lxh03188.png index e96e85722c37..556b86926671 100644 Binary files a/default_images/res/lxh03188.png and b/default_images/res/lxh03188.png differ diff --git a/default_images/res/lxh03217.png b/default_images/res/lxh03217.png index 13802eb01070..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03217.png and b/default_images/res/lxh03217.png differ diff --git a/default_images/res/lxh03218.png b/default_images/res/lxh03218.png index 13802eb01070..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03218.png and b/default_images/res/lxh03218.png differ diff --git a/default_images/res/lxh03220.png b/default_images/res/lxh03220.png index 13802eb01070..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03220.png and b/default_images/res/lxh03220.png differ diff --git a/default_images/res/lxh03221.png b/default_images/res/lxh03221.png index 13802eb01070..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03221.png and b/default_images/res/lxh03221.png differ diff --git a/default_images/res/lxh03222.png b/default_images/res/lxh03222.png index 13802eb01070..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03222.png and b/default_images/res/lxh03222.png differ diff --git a/default_images/res/lxh03226.png b/default_images/res/lxh03226.png index a08d3eb3286a..6ae32eae1551 100644 Binary files a/default_images/res/lxh03226.png and b/default_images/res/lxh03226.png differ diff --git a/default_images/res/lxh03227.png b/default_images/res/lxh03227.png index 1e19be936002..4ba9c53ebd72 100644 Binary files a/default_images/res/lxh03227.png and b/default_images/res/lxh03227.png differ diff --git a/default_images/res/lxh03228.png b/default_images/res/lxh03228.png index 2606b6d18c74..90cfc94e6f90 100644 Binary files a/default_images/res/lxh03228.png and b/default_images/res/lxh03228.png differ diff --git a/default_images/res/lxh03241.png b/default_images/res/lxh03241.png index e96e85722c37..68e8add815c9 100644 Binary files a/default_images/res/lxh03241.png and b/default_images/res/lxh03241.png differ diff --git a/default_images/res/lxh03242.png b/default_images/res/lxh03242.png index 144b1b4c8c7b..53b65603557d 100644 Binary files a/default_images/res/lxh03242.png and b/default_images/res/lxh03242.png differ diff --git a/default_images/res/lxh03243.png b/default_images/res/lxh03243.png index 43abff2ffccc..392d54db47cb 100644 Binary files a/default_images/res/lxh03243.png and b/default_images/res/lxh03243.png differ diff --git a/default_images/res/lxh03244.png b/default_images/res/lxh03244.png index f1a51bd2db8c..6ed4402580fd 100644 Binary files a/default_images/res/lxh03244.png and b/default_images/res/lxh03244.png differ diff --git a/default_images/res/lxh03245.png b/default_images/res/lxh03245.png index d9a3d12c5c93..70068a091c9c 100644 Binary files a/default_images/res/lxh03245.png and b/default_images/res/lxh03245.png differ diff --git a/default_images/res/lxh03246.png b/default_images/res/lxh03246.png index 1523565591bf..ee8a0d1cf52a 100644 Binary files a/default_images/res/lxh03246.png and b/default_images/res/lxh03246.png differ diff --git a/default_images/res/lxh03247.png b/default_images/res/lxh03247.png index ba5a1fa6b52c..b63b9d7450cb 100644 Binary files a/default_images/res/lxh03247.png and b/default_images/res/lxh03247.png differ diff --git a/default_images/res/lxh03248.png b/default_images/res/lxh03248.png index ac10bb5aeacb..4d925976528e 100644 Binary files a/default_images/res/lxh03248.png and b/default_images/res/lxh03248.png differ diff --git a/default_images/res/lxh03249.png b/default_images/res/lxh03249.png index 4d88440e7601..7372ba53e266 100644 Binary files a/default_images/res/lxh03249.png and b/default_images/res/lxh03249.png differ diff --git a/default_images/res/lxh03250.png b/default_images/res/lxh03250.png index 0bd920a9e9cb..fde5d70e18de 100644 Binary files a/default_images/res/lxh03250.png and b/default_images/res/lxh03250.png differ diff --git a/default_images/res/lxh03251.png b/default_images/res/lxh03251.png index 1545fab570e4..e9487262f8a5 100644 Binary files a/default_images/res/lxh03251.png and b/default_images/res/lxh03251.png differ diff --git a/default_images/res/lxh03252.png b/default_images/res/lxh03252.png index dca0e84df741..aa4262efdcc8 100644 Binary files a/default_images/res/lxh03252.png and b/default_images/res/lxh03252.png differ diff --git a/default_images/res/lxh03253.png b/default_images/res/lxh03253.png index 47bc68870c7b..17c241ac3890 100644 Binary files a/default_images/res/lxh03253.png and b/default_images/res/lxh03253.png differ diff --git a/default_images/res/lxh03254.png b/default_images/res/lxh03254.png index 860bc02acc93..1600247d9b31 100644 Binary files a/default_images/res/lxh03254.png and b/default_images/res/lxh03254.png differ diff --git a/default_images/res/lxh03255.png b/default_images/res/lxh03255.png index d207df9b63ca..d63520ac31e0 100644 Binary files a/default_images/res/lxh03255.png and b/default_images/res/lxh03255.png differ diff --git a/default_images/res/odb_16_8.png b/default_images/res/odb_16_8.png index 351a55e52690..e4ae28570f08 100644 Binary files a/default_images/res/odb_16_8.png and b/default_images/res/odb_16_8.png differ diff --git a/default_images/res/odb_32.png b/default_images/res/odb_32.png index ddfcd7d19588..461bdf37b774 100644 Binary files a/default_images/res/odb_32.png and b/default_images/res/odb_32.png differ diff --git a/default_images/res/odb_32_8.png b/default_images/res/odb_32_8.png index 3770632c3439..461bdf37b774 100644 Binary files a/default_images/res/odb_32_8.png and b/default_images/res/odb_32_8.png differ diff --git a/default_images/res/odb_48_8.png b/default_images/res/odb_48_8.png index 28f19ffa5de3..77e684960ec2 100644 Binary files a/default_images/res/odb_48_8.png and b/default_images/res/odb_48_8.png differ diff --git a/default_images/res/odf_16_8.png b/default_images/res/odf_16_8.png index d11ef96675ff..4cefbb690d10 100644 Binary files a/default_images/res/odf_16_8.png and b/default_images/res/odf_16_8.png differ diff --git a/default_images/res/odf_32.png b/default_images/res/odf_32.png index 302c7ab633f4..6b8f2f732201 100644 Binary files a/default_images/res/odf_32.png and b/default_images/res/odf_32.png differ diff --git a/default_images/res/odf_32_8.png b/default_images/res/odf_32_8.png index 53dd60d124a5..6b8f2f732201 100644 Binary files a/default_images/res/odf_32_8.png and b/default_images/res/odf_32_8.png differ diff --git a/default_images/res/odf_48_8.png b/default_images/res/odf_48_8.png index d925818a3ca9..f6508de45379 100644 Binary files a/default_images/res/odf_48_8.png and b/default_images/res/odf_48_8.png differ diff --git a/default_images/res/odg_16_8.png b/default_images/res/odg_16_8.png index a27669332554..3d66cc97eb5e 100644 Binary files a/default_images/res/odg_16_8.png and b/default_images/res/odg_16_8.png differ diff --git a/default_images/res/odg_32.png b/default_images/res/odg_32.png index 8d78d91c1866..55dda2143e57 100644 Binary files a/default_images/res/odg_32.png and b/default_images/res/odg_32.png differ diff --git a/default_images/res/odg_32_8.png b/default_images/res/odg_32_8.png index b5b256758200..55dda2143e57 100644 Binary files a/default_images/res/odg_32_8.png and b/default_images/res/odg_32_8.png differ diff --git a/default_images/res/odg_48_8.png b/default_images/res/odg_48_8.png index 05f91680c27b..258b3b2fc1e2 100644 Binary files a/default_images/res/odg_48_8.png and b/default_images/res/odg_48_8.png differ diff --git a/default_images/res/odm_16_8.png b/default_images/res/odm_16_8.png index 7d0c238cf9fb..12aab4a27c32 100644 Binary files a/default_images/res/odm_16_8.png and b/default_images/res/odm_16_8.png differ diff --git a/default_images/res/odm_32_8.png b/default_images/res/odm_32_8.png index 70883869170d..234bac461e74 100644 Binary files a/default_images/res/odm_32_8.png and b/default_images/res/odm_32_8.png differ diff --git a/default_images/res/odm_48_8.png b/default_images/res/odm_48_8.png index baf96e3abc1f..1923fc9b9ff4 100644 Binary files a/default_images/res/odm_48_8.png and b/default_images/res/odm_48_8.png differ diff --git a/default_images/res/odp_16_8.png b/default_images/res/odp_16_8.png index 03d420878a03..46942cba2852 100644 Binary files a/default_images/res/odp_16_8.png and b/default_images/res/odp_16_8.png differ diff --git a/default_images/res/odp_32.png b/default_images/res/odp_32.png index 465583b9b06b..fedeb0620a75 100644 Binary files a/default_images/res/odp_32.png and b/default_images/res/odp_32.png differ diff --git a/default_images/res/odp_32_8.png b/default_images/res/odp_32_8.png index c098b3c9851d..fedeb0620a75 100644 Binary files a/default_images/res/odp_32_8.png and b/default_images/res/odp_32_8.png differ diff --git a/default_images/res/odp_48_8.png b/default_images/res/odp_48_8.png index 76a9549507f0..635953e1c714 100644 Binary files a/default_images/res/odp_48_8.png and b/default_images/res/odp_48_8.png differ diff --git a/default_images/res/ods_16_8.png b/default_images/res/ods_16_8.png index 901349acc190..abc38d4310c9 100644 Binary files a/default_images/res/ods_16_8.png and b/default_images/res/ods_16_8.png differ diff --git a/default_images/res/ods_32.png b/default_images/res/ods_32.png index 67da85c10bf1..020d95bef310 100644 Binary files a/default_images/res/ods_32.png and b/default_images/res/ods_32.png differ diff --git a/default_images/res/ods_32_8.png b/default_images/res/ods_32_8.png index 1e550aac2739..020d95bef310 100644 Binary files a/default_images/res/ods_32_8.png and b/default_images/res/ods_32_8.png differ diff --git a/default_images/res/ods_48_8.png b/default_images/res/ods_48_8.png index 82c6fdc5e72c..4c407a0f5fc1 100644 Binary files a/default_images/res/ods_48_8.png and b/default_images/res/ods_48_8.png differ diff --git a/default_images/res/odt_16_8.png b/default_images/res/odt_16_8.png index 6a552f38a3d3..06c1f30c8fa2 100644 Binary files a/default_images/res/odt_16_8.png and b/default_images/res/odt_16_8.png differ diff --git a/default_images/res/odt_32.png b/default_images/res/odt_32.png index 571e6a0e4a48..ac350cb409d1 100644 Binary files a/default_images/res/odt_32.png and b/default_images/res/odt_32.png differ diff --git a/default_images/res/odt_32_8.png b/default_images/res/odt_32_8.png index 2857d98fc955..ac350cb409d1 100644 Binary files a/default_images/res/odt_32_8.png and b/default_images/res/odt_32_8.png differ diff --git a/default_images/res/odt_48_8.png b/default_images/res/odt_48_8.png index 6fec7d5354ae..0c04210a0c9a 100644 Binary files a/default_images/res/odt_48_8.png and b/default_images/res/odt_48_8.png differ diff --git a/default_images/res/otg_16_8.png b/default_images/res/otg_16_8.png index 0f14ed067884..eaad54fcdf7e 100644 Binary files a/default_images/res/otg_16_8.png and b/default_images/res/otg_16_8.png differ diff --git a/default_images/res/otg_32_8.png b/default_images/res/otg_32_8.png index dd4d72b88ef5..cdc2f2df0fc8 100644 Binary files a/default_images/res/otg_32_8.png and b/default_images/res/otg_32_8.png differ diff --git a/default_images/res/otg_48_8.png b/default_images/res/otg_48_8.png index 773d52cc7aca..8cb4dd3fa7d0 100644 Binary files a/default_images/res/otg_48_8.png and b/default_images/res/otg_48_8.png differ diff --git a/default_images/res/oth_16_8.png b/default_images/res/oth_16_8.png index 432c2db57f05..01c04a0ea697 100644 Binary files a/default_images/res/oth_16_8.png and b/default_images/res/oth_16_8.png differ diff --git a/default_images/res/oth_32_8.png b/default_images/res/oth_32_8.png index 9bae937388c5..8e906f8be1df 100644 Binary files a/default_images/res/oth_32_8.png and b/default_images/res/oth_32_8.png differ diff --git a/default_images/res/oth_48_8.png b/default_images/res/oth_48_8.png index 55d78c9f8f99..0ff92ec7a267 100644 Binary files a/default_images/res/oth_48_8.png and b/default_images/res/oth_48_8.png differ diff --git a/default_images/res/otp_16_8.png b/default_images/res/otp_16_8.png index 3fd5e22c9534..9f281836d793 100644 Binary files a/default_images/res/otp_16_8.png and b/default_images/res/otp_16_8.png differ diff --git a/default_images/res/otp_32_8.png b/default_images/res/otp_32_8.png index c4d7d8ccad46..012516065215 100644 Binary files a/default_images/res/otp_32_8.png and b/default_images/res/otp_32_8.png differ diff --git a/default_images/res/otp_48_8.png b/default_images/res/otp_48_8.png index f3a0e9968235..00d311317566 100644 Binary files a/default_images/res/otp_48_8.png and b/default_images/res/otp_48_8.png differ diff --git a/default_images/res/ots_16_8.png b/default_images/res/ots_16_8.png index 214c3f8e9f03..4781bfc3a6fc 100644 Binary files a/default_images/res/ots_16_8.png and b/default_images/res/ots_16_8.png differ diff --git a/default_images/res/ots_32_8.png b/default_images/res/ots_32_8.png index 5ccdf68dc50f..9d63063e67d0 100644 Binary files a/default_images/res/ots_32_8.png and b/default_images/res/ots_32_8.png differ diff --git a/default_images/res/ots_48_8.png b/default_images/res/ots_48_8.png index 9485e9056e1b..7c4beda53d60 100644 Binary files a/default_images/res/ots_48_8.png and b/default_images/res/ots_48_8.png differ diff --git a/default_images/res/ott_16_8.png b/default_images/res/ott_16_8.png index 21987b33dc68..9836814c6c2c 100644 Binary files a/default_images/res/ott_16_8.png and b/default_images/res/ott_16_8.png differ diff --git a/default_images/res/ott_32_8.png b/default_images/res/ott_32_8.png index b3df7899677c..983b39e611ae 100644 Binary files a/default_images/res/ott_32_8.png and b/default_images/res/ott_32_8.png differ diff --git a/default_images/res/ott_48_8.png b/default_images/res/ott_48_8.png index 4ea3cec8f4c8..64b86940885a 100644 Binary files a/default_images/res/ott_48_8.png and b/default_images/res/ott_48_8.png differ diff --git a/default_images/res/sx03123.png b/default_images/res/sx03123.png index 2f3e12976a6f..6803ae4c7492 100644 Binary files a/default_images/res/sx03123.png and b/default_images/res/sx03123.png differ diff --git a/default_images/res/sx03126.png b/default_images/res/sx03126.png index 529024450f76..46c72242a02a 100644 Binary files a/default_images/res/sx03126.png and b/default_images/res/sx03126.png differ diff --git a/default_images/res/sx03127.png b/default_images/res/sx03127.png index 4cc3cae586cd..5be785e40f64 100644 Binary files a/default_images/res/sx03127.png and b/default_images/res/sx03127.png differ diff --git a/default_images/res/sx03128.png b/default_images/res/sx03128.png index 756a7a91891e..90a61222f2a2 100644 Binary files a/default_images/res/sx03128.png and b/default_images/res/sx03128.png differ diff --git a/default_images/res/sx03129.png b/default_images/res/sx03129.png index 6baaffd00c9f..fb32e00a1ba6 100644 Binary files a/default_images/res/sx03129.png and b/default_images/res/sx03129.png differ diff --git a/default_images/res/sx03130.png b/default_images/res/sx03130.png index 6806d797daf6..df1d5293a83d 100644 Binary files a/default_images/res/sx03130.png and b/default_images/res/sx03130.png differ diff --git a/default_images/res/sx03131.png b/default_images/res/sx03131.png index 1250b3f107df..5be785e40f64 100644 Binary files a/default_images/res/sx03131.png and b/default_images/res/sx03131.png differ diff --git a/default_images/res/sx03132.png b/default_images/res/sx03132.png index 6e9ef356499a..5be785e40f64 100644 Binary files a/default_images/res/sx03132.png and b/default_images/res/sx03132.png differ diff --git a/default_images/res/sx03139.png b/default_images/res/sx03139.png index 795d92615e4f..f2cc46690231 100644 Binary files a/default_images/res/sx03139.png and b/default_images/res/sx03139.png differ diff --git a/default_images/res/sx03144.png b/default_images/res/sx03144.png index fd2f0e28bca4..e7e95875efed 100644 Binary files a/default_images/res/sx03144.png and b/default_images/res/sx03144.png differ diff --git a/default_images/res/sx03156.png b/default_images/res/sx03156.png index 1371aa50d7e5..c0d1cd3dcc7a 100644 Binary files a/default_images/res/sx03156.png and b/default_images/res/sx03156.png differ diff --git a/default_images/res/sx03161.png b/default_images/res/sx03161.png index b6f03643cf99..c0d1cd3dcc7a 100644 Binary files a/default_images/res/sx03161.png and b/default_images/res/sx03161.png differ diff --git a/default_images/res/sx03162.png b/default_images/res/sx03162.png index 8b70e8967434..c0d1cd3dcc7a 100644 Binary files a/default_images/res/sx03162.png and b/default_images/res/sx03162.png differ diff --git a/default_images/res/sx03163.png b/default_images/res/sx03163.png index 78ddd4575d2c..2827f29f3a4e 100644 Binary files a/default_images/res/sx03163.png and b/default_images/res/sx03163.png differ diff --git a/default_images/res/sx03188.png b/default_images/res/sx03188.png index 0289f219fc68..46c72242a02a 100644 Binary files a/default_images/res/sx03188.png and b/default_images/res/sx03188.png differ diff --git a/default_images/res/sx03217.png b/default_images/res/sx03217.png index 23f957fc3bbd..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03217.png and b/default_images/res/sx03217.png differ diff --git a/default_images/res/sx03218.png b/default_images/res/sx03218.png index 23f957fc3bbd..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03218.png and b/default_images/res/sx03218.png differ diff --git a/default_images/res/sx03220.png b/default_images/res/sx03220.png index 23f957fc3bbd..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03220.png and b/default_images/res/sx03220.png differ diff --git a/default_images/res/sx03221.png b/default_images/res/sx03221.png index 23f957fc3bbd..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03221.png and b/default_images/res/sx03221.png differ diff --git a/default_images/res/sx03222.png b/default_images/res/sx03222.png index 23f957fc3bbd..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03222.png and b/default_images/res/sx03222.png differ diff --git a/default_images/res/sx03226.png b/default_images/res/sx03226.png index 8406ecacd012..e442a0c0985d 100644 Binary files a/default_images/res/sx03226.png and b/default_images/res/sx03226.png differ diff --git a/default_images/res/sx03227.png b/default_images/res/sx03227.png index c3674de2d3e2..3bd7b7d29cb1 100644 Binary files a/default_images/res/sx03227.png and b/default_images/res/sx03227.png differ diff --git a/default_images/res/sx03228.png b/default_images/res/sx03228.png index f35df1462376..f045190f395a 100644 Binary files a/default_images/res/sx03228.png and b/default_images/res/sx03228.png differ diff --git a/default_images/res/sx03241.png b/default_images/res/sx03241.png index 2438714af8a6..90a61222f2a2 100644 Binary files a/default_images/res/sx03241.png and b/default_images/res/sx03241.png differ diff --git a/default_images/res/sx03242.png b/default_images/res/sx03242.png index 824c34efbf70..01c04a0ea697 100644 Binary files a/default_images/res/sx03242.png and b/default_images/res/sx03242.png differ diff --git a/default_images/res/sx03243.png b/default_images/res/sx03243.png index 4be5e87bfc52..6803ae4c7492 100644 Binary files a/default_images/res/sx03243.png and b/default_images/res/sx03243.png differ diff --git a/default_images/res/sx03244.png b/default_images/res/sx03244.png index b97ada0b6fa0..df1d5293a83d 100644 Binary files a/default_images/res/sx03244.png and b/default_images/res/sx03244.png differ diff --git a/default_images/res/sx03245.png b/default_images/res/sx03245.png index 2f2d56dd0daa..e4ae28570f08 100644 Binary files a/default_images/res/sx03245.png and b/default_images/res/sx03245.png differ diff --git a/default_images/res/sx03246.png b/default_images/res/sx03246.png index d65439afbc6c..3d66cc97eb5e 100644 Binary files a/default_images/res/sx03246.png and b/default_images/res/sx03246.png differ diff --git a/default_images/res/sx03247.png b/default_images/res/sx03247.png index 9c628ce789f9..4cefbb690d10 100644 Binary files a/default_images/res/sx03247.png and b/default_images/res/sx03247.png differ diff --git a/default_images/res/sx03248.png b/default_images/res/sx03248.png index 137778d11fa2..12aab4a27c32 100644 Binary files a/default_images/res/sx03248.png and b/default_images/res/sx03248.png differ diff --git a/default_images/res/sx03249.png b/default_images/res/sx03249.png index c642127abc1e..46942cba2852 100644 Binary files a/default_images/res/sx03249.png and b/default_images/res/sx03249.png differ diff --git a/default_images/res/sx03250.png b/default_images/res/sx03250.png index f51a29a85492..abc38d4310c9 100644 Binary files a/default_images/res/sx03250.png and b/default_images/res/sx03250.png differ diff --git a/default_images/res/sx03251.png b/default_images/res/sx03251.png index 8b095bfcbafb..06c1f30c8fa2 100644 Binary files a/default_images/res/sx03251.png and b/default_images/res/sx03251.png differ diff --git a/default_images/res/sx03252.png b/default_images/res/sx03252.png index 94f4ac9ec58e..eaad54fcdf7e 100644 Binary files a/default_images/res/sx03252.png and b/default_images/res/sx03252.png differ diff --git a/default_images/res/sx03253.png b/default_images/res/sx03253.png index 3153d8e3c705..9f281836d793 100644 Binary files a/default_images/res/sx03253.png and b/default_images/res/sx03253.png differ diff --git a/default_images/res/sx03254.png b/default_images/res/sx03254.png index 689bb5aef425..4781bfc3a6fc 100644 Binary files a/default_images/res/sx03254.png and b/default_images/res/sx03254.png differ diff --git a/default_images/res/sx03255.png b/default_images/res/sx03255.png index 1c20ed072ba8..9836814c6c2c 100644 Binary files a/default_images/res/sx03255.png and b/default_images/res/sx03255.png differ diff --git a/default_images/res/sxh03123.png b/default_images/res/sxh03123.png index 23fea101dfad..fad06d7e8778 100644 Binary files a/default_images/res/sxh03123.png and b/default_images/res/sxh03123.png differ diff --git a/default_images/res/sxh03126.png b/default_images/res/sxh03126.png index 45f3e1eec848..f05874b9b0af 100644 Binary files a/default_images/res/sxh03126.png and b/default_images/res/sxh03126.png differ diff --git a/default_images/res/sxh03127.png b/default_images/res/sxh03127.png index e1aee76d680e..46b8887cece7 100644 Binary files a/default_images/res/sxh03127.png and b/default_images/res/sxh03127.png differ diff --git a/default_images/res/sxh03128.png b/default_images/res/sxh03128.png index cc0377f7cbb3..5bfbfbab68a5 100644 Binary files a/default_images/res/sxh03128.png and b/default_images/res/sxh03128.png differ diff --git a/default_images/res/sxh03129.png b/default_images/res/sxh03129.png index 1fc2c076d5d0..c64c42dee425 100644 Binary files a/default_images/res/sxh03129.png and b/default_images/res/sxh03129.png differ diff --git a/default_images/res/sxh03130.png b/default_images/res/sxh03130.png index b5b8052ae58a..8242e47385cf 100644 Binary files a/default_images/res/sxh03130.png and b/default_images/res/sxh03130.png differ diff --git a/default_images/res/sxh03131.png b/default_images/res/sxh03131.png index edb3d79180e5..46b8887cece7 100644 Binary files a/default_images/res/sxh03131.png and b/default_images/res/sxh03131.png differ diff --git a/default_images/res/sxh03132.png b/default_images/res/sxh03132.png index e78be65f0a47..46b8887cece7 100644 Binary files a/default_images/res/sxh03132.png and b/default_images/res/sxh03132.png differ diff --git a/default_images/res/sxh03139.png b/default_images/res/sxh03139.png index d190d13270e8..92f7853cedfb 100644 Binary files a/default_images/res/sxh03139.png and b/default_images/res/sxh03139.png differ diff --git a/default_images/res/sxh03144.png b/default_images/res/sxh03144.png index d7fed7bdbaaf..f5a07bf58397 100644 Binary files a/default_images/res/sxh03144.png and b/default_images/res/sxh03144.png differ diff --git a/default_images/res/sxh03156.png b/default_images/res/sxh03156.png index 3788d1e3d92f..2363f6f8ea86 100644 Binary files a/default_images/res/sxh03156.png and b/default_images/res/sxh03156.png differ diff --git a/default_images/res/sxh03161.png b/default_images/res/sxh03161.png index 64dc83c5cead..2363f6f8ea86 100644 Binary files a/default_images/res/sxh03161.png and b/default_images/res/sxh03161.png differ diff --git a/default_images/res/sxh03162.png b/default_images/res/sxh03162.png index c4d0cf82a09f..2363f6f8ea86 100644 Binary files a/default_images/res/sxh03162.png and b/default_images/res/sxh03162.png differ diff --git a/default_images/res/sxh03163.png b/default_images/res/sxh03163.png index 2c0a37c6dbd6..1f123ff38895 100644 Binary files a/default_images/res/sxh03163.png and b/default_images/res/sxh03163.png differ diff --git a/default_images/res/sxh03188.png b/default_images/res/sxh03188.png index 94f961ae3b20..f05874b9b0af 100644 Binary files a/default_images/res/sxh03188.png and b/default_images/res/sxh03188.png differ diff --git a/default_images/res/sxh03217.png b/default_images/res/sxh03217.png index 47ca56a399f0..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03217.png and b/default_images/res/sxh03217.png differ diff --git a/default_images/res/sxh03218.png b/default_images/res/sxh03218.png index 47ca56a399f0..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03218.png and b/default_images/res/sxh03218.png differ diff --git a/default_images/res/sxh03220.png b/default_images/res/sxh03220.png index 47ca56a399f0..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03220.png and b/default_images/res/sxh03220.png differ diff --git a/default_images/res/sxh03221.png b/default_images/res/sxh03221.png index 47ca56a399f0..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03221.png and b/default_images/res/sxh03221.png differ diff --git a/default_images/res/sxh03222.png b/default_images/res/sxh03222.png index 47ca56a399f0..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03222.png and b/default_images/res/sxh03222.png differ diff --git a/default_images/res/sxh03226.png b/default_images/res/sxh03226.png index cb78abdb0d15..943cbe25a297 100644 Binary files a/default_images/res/sxh03226.png and b/default_images/res/sxh03226.png differ diff --git a/default_images/res/sxh03227.png b/default_images/res/sxh03227.png index cec2802b9664..7c2c0a88f5d2 100644 Binary files a/default_images/res/sxh03227.png and b/default_images/res/sxh03227.png differ diff --git a/default_images/res/sxh03228.png b/default_images/res/sxh03228.png index 06bb7b3efe6d..44dc7810e783 100644 Binary files a/default_images/res/sxh03228.png and b/default_images/res/sxh03228.png differ diff --git a/default_images/res/sxh03241.png b/default_images/res/sxh03241.png index 82c928be5251..5bfbfbab68a5 100644 Binary files a/default_images/res/sxh03241.png and b/default_images/res/sxh03241.png differ diff --git a/default_images/res/sxh03242.png b/default_images/res/sxh03242.png index 04580b702d61..5e81b6ba4c40 100644 Binary files a/default_images/res/sxh03242.png and b/default_images/res/sxh03242.png differ diff --git a/default_images/res/sxh03243.png b/default_images/res/sxh03243.png index db921e65e063..fad06d7e8778 100644 Binary files a/default_images/res/sxh03243.png and b/default_images/res/sxh03243.png differ diff --git a/default_images/res/sxh03244.png b/default_images/res/sxh03244.png index 3e33ded9ed7d..8242e47385cf 100644 Binary files a/default_images/res/sxh03244.png and b/default_images/res/sxh03244.png differ diff --git a/default_images/res/sxh03245.png b/default_images/res/sxh03245.png index 68092f35d79c..41bc635ddc8b 100644 Binary files a/default_images/res/sxh03245.png and b/default_images/res/sxh03245.png differ diff --git a/default_images/res/sxh03246.png b/default_images/res/sxh03246.png index 951e1df7b213..ec5e1e7b6f5d 100644 Binary files a/default_images/res/sxh03246.png and b/default_images/res/sxh03246.png differ diff --git a/default_images/res/sxh03247.png b/default_images/res/sxh03247.png index 0c27972133bc..4dc4c0a669ce 100644 Binary files a/default_images/res/sxh03247.png and b/default_images/res/sxh03247.png differ diff --git a/default_images/res/sxh03248.png b/default_images/res/sxh03248.png index e5477e1d019d..8d9a6f547ccb 100644 Binary files a/default_images/res/sxh03248.png and b/default_images/res/sxh03248.png differ diff --git a/default_images/res/sxh03249.png b/default_images/res/sxh03249.png index 3ddc856e18b6..bb52df1cb8fe 100644 Binary files a/default_images/res/sxh03249.png and b/default_images/res/sxh03249.png differ diff --git a/default_images/res/sxh03250.png b/default_images/res/sxh03250.png index 7c78936ce2d6..ec04c898302d 100644 Binary files a/default_images/res/sxh03250.png and b/default_images/res/sxh03250.png differ diff --git a/default_images/res/sxh03251.png b/default_images/res/sxh03251.png index 73a8ffb2af79..320f2476a175 100644 Binary files a/default_images/res/sxh03251.png and b/default_images/res/sxh03251.png differ diff --git a/default_images/res/sxh03252.png b/default_images/res/sxh03252.png index 0683f07a5b65..714cff67ac8b 100644 Binary files a/default_images/res/sxh03252.png and b/default_images/res/sxh03252.png differ diff --git a/default_images/res/sxh03253.png b/default_images/res/sxh03253.png index 26fa1e92566c..963642284b4f 100644 Binary files a/default_images/res/sxh03253.png and b/default_images/res/sxh03253.png differ diff --git a/default_images/res/sxh03254.png b/default_images/res/sxh03254.png index a93e071d327e..bf3c9033dafd 100644 Binary files a/default_images/res/sxh03254.png and b/default_images/res/sxh03254.png differ diff --git a/default_images/res/sxh03255.png b/default_images/res/sxh03255.png index 28272fedbf21..99332030f903 100644 Binary files a/default_images/res/sxh03255.png and b/default_images/res/sxh03255.png differ diff --git a/default_images/svtools/res/new_doc.png b/default_images/svtools/res/new_doc.png index 46f8c33d580f..309392b7a62c 100644 Binary files a/default_images/svtools/res/new_doc.png and b/default_images/svtools/res/new_doc.png differ diff --git a/default_images/svtools/res/new_doc_h.png b/default_images/svtools/res/new_doc_h.png index 77a37a3998b1..02b668d4f6f4 100644 Binary files a/default_images/svtools/res/new_doc_h.png and b/default_images/svtools/res/new_doc_h.png differ diff --git a/default_images/svtools/res/template.png b/default_images/svtools/res/template.png index 92ba5ecc15b7..8e906f8be1df 100644 Binary files a/default_images/svtools/res/template.png and b/default_images/svtools/res/template.png differ diff --git a/default_images/svtools/res/template_h.png b/default_images/svtools/res/template_h.png index 3a162545518f..53b65603557d 100644 Binary files a/default_images/svtools/res/template_h.png and b/default_images/svtools/res/template_h.png differ diff --git a/default_images/svx/res/tr10437.png b/default_images/svx/res/tr10437.png index f30ba415bed0..309392b7a62c 100644 Binary files a/default_images/svx/res/tr10437.png and b/default_images/svx/res/tr10437.png differ diff --git a/default_images/svx/res/trh10437.png b/default_images/svx/res/trh10437.png index 7b8f3c2ffd1c..02b668d4f6f4 100644 Binary files a/default_images/svx/res/trh10437.png and b/default_images/svx/res/trh10437.png differ -- cgit v1.2.3 From c66e59ccbfb5f71be553718fb80891d710e14eff Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 11 Jan 2010 09:53:12 +0100 Subject: autorecovery: fix post-rebase build problems --- sd/source/ui/docshell/docshell.cxx | 1 - sd/source/ui/view/ViewShellBase.cxx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 3298c28bbb53..2153da7eab41 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -189,7 +189,6 @@ DrawDocShell::DrawDocShell(SfxObjectCreateMode eMode, DrawDocShell::DrawDocShell( const sal_uInt64 nModelCreationFlags, BOOL bDataObject, DocumentType eDocumentType ) : SfxObjectShell( nModelCreationFlags ), - mpFormatClipboard(new SdFormatClipboard()), mpDoc(NULL), mpUndoManager(NULL), mpPrinter(NULL), diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 5a92c726c9c7..e8f89676604a 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -1227,7 +1227,7 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager") ) ), UNO_QUERY_THROW ); - Reference< XInterface > xIfac( GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW ); + Reference< XInterface > xIfac( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY_THROW ); ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); -- cgit v1.2.3 From a4c445a0eac44be7900591265c4d627561792a2c Mon Sep 17 00:00:00 2001 From: tb121644 Date: Tue, 12 Jan 2010 16:56:37 +0100 Subject: #106268# patch & license upgrade --- testautomation/tools/run_tests/run_tests.vbs | 68 ++++++++++++++++++---------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/testautomation/tools/run_tests/run_tests.vbs b/testautomation/tools/run_tests/run_tests.vbs index 10e69c976f41..836f094d56a1 100755 --- a/testautomation/tools/run_tests/run_tests.vbs +++ b/testautomation/tools/run_tests/run_tests.vbs @@ -1,35 +1,32 @@ -'************************************************************************* +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. '* -'* OpenOffice.org - a multi-platform office productivity suite +'* Copyright 2008 by Sun Microsystems, Inc. '* -'* $RCSfile: run_tests.vbs,v $ +'* OpenOffice.org - a multi-platform office productivity suite '* -'* $Revision: 1.1 $ +'* $RCSfile: master.inc,v $ '* -'* last change: $Author: andreschnabel $ $Date: 2008/04/05 09:02:23 $ +'* $Revision: 1.5 $ '* -'* The Contents of this file are made available subject to -'* the terms of GNU Lesser General Public License Version 2.1. +'* last change: $Author: vg $ $Date: 2008-08-19 12:49:51 $ '* +'* This file is part of OpenOffice.org. '* -'* GNU Lesser General Public License Version 2.1 -'* ============================================= -'* Copyright 2005 by Sun Microsystems, Inc. -'* 901 San Antonio Road, Palo Alto, CA 94303, USA +'* OpenOffice.org is free software: you can redistribute it and/or modify +'* it under the terms of the GNU Lesser General Public License version 3 +'* only, as published by the Free Software Foundation. '* -'* This library is free software; you can redistribute it and/or -'* modify it under the terms of the GNU Lesser General Public -'* License version 2.1, as published by the Free Software Foundation. +'* OpenOffice.org is distributed in the hope that it will be useful, +'* but WITHOUT ANY WARRANTY; without even the implied warranty of +'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +'* GNU Lesser General Public License version 3 for more details +'* (a copy is included in the LICENSE file that accompanied this code). '* -'* This library is distributed in the hope that it will be useful, -'* but WITHOUT ANY WARRANTY; without even the implied warranty of -'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -'* Lesser General Public License for more details. -'* -'* You should have received a copy of the GNU Lesser General Public -'* License along with this library; if not, write to the Free Software -'* Foundation, Inc., 59 Temple Place, Suite 330, Boston, -'* MA 02111-1307 USA +'* You should have received a copy of the GNU Lesser General Public License +'* version 3 along with OpenOffice.org. If not, see +'* +'* for a copy of the LGPLv3 License. '* '######################################################################## ' @@ -63,6 +60,7 @@ Dim oFSO ' AS FileSystemObject Dim oStdIn ' As TextStream Dim WshShell ' as WScript.Shell Dim oExec ' as WshExec +Dim sKill ' as Killcommand for soffic.* process '06.11.2009 Florian Bircher (fbircher@openoffice.org) ' get Objects for Scripting Set oFSO = CreateObject ("Scripting.FileSystemObject") @@ -74,6 +72,26 @@ Set WshShell = CreateObject("WScript.Shell") ' Read Environment and do Windows Version specific stuff ' nothing done yet +' Begin 06.11.2009 Florian Bircher (fbircher@openoffice.org): +' Change due Windows 7 does not have tskill +' Selecting Terminatig Process +sTaskKill = oFSO.GetSpecialFolder(SystemFolder) & "\system32\taskkill.exe" +sTsKill = oFSO.GetSpecialFolder(SystemFolder) & "\system32\tskill.exe" + +If oFSO.FileExists(sTaskKill) Then + sKill = sTaskKill & " /IM soffice* /T /F" + WScript.Echo "Using taskkill to kill soffice" +Else + If oFSO.FileExists(sTsKill) Then + sKill = sTsKill & " soffice*" + WScript.Echo "Using tskill to kill soffice" + Else + WScript.Echo "taskkill.exe or tskill.exe not found." + WScript.Echo "Check if they exist in %Windows%\system32\" + WScript.Quit 1 + End If +End If +' End 06.11.2009 Florian Bircher (fbircher@openoffice.org) '--- if sLocation is not set manuall try to get the location form testtoolrc If not oFSO.FolderExists(sLocation) Then @@ -128,7 +146,7 @@ While Not oStdIn.AtEndOfStream ' *************-> killed in resetoffice.bas) ' *************-> 2009/07/06 ' *************-> wolfgang pechlaner (wope@openoffice.org) - WshShell.Run "tskill soffice", 1, true + WshShell.Run sKill, 1, true '06.11.2009 Florian Bircher (fbircher@openoffice.org) WScript.Sleep 1000 sTestCase = oStdIn.ReadLine @@ -144,7 +162,7 @@ While Not oStdIn.AtEndOfStream WScript.Echo " File not found" Else ' first run is the real test ... - Set oExec = WshShell.Exec("""" & sTestTool & """ & -run & """ & sTest & """" ) + Set oExec = WshShell.Exec("""" & sTestTool & """ -run """ & sTest & """" ) WScript.Sleep 1000 If oExec.Status = 0 Then -- cgit v1.2.3 From e0d43c1493e7a36086df622247ad45c04c502929 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:30:34 +0100 Subject: autorecovery: remove SID_VIEW, it is used only once, and mapped to SID_HIDDEN, anyway --- sd/source/ui/dlg/dlgass.cxx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index ea89fba79500..5fdb08e112b1 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -304,8 +304,8 @@ public: OKButton maFinishButton; SdDocPreviewWin maPreview; - String maCreateStr; - String maOpenStr; + String maCreateStr; + String maOpenStr; // Seite 1 FixedBitmap* mpPage1FB; @@ -385,8 +385,8 @@ AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, maLastPageButton(pWindow,SdResId(BUT_LAST)), maNextPageButton(pWindow,SdResId(BUT_NEXT)), maFinishButton(pWindow,SdResId(BUT_FINISH)), - maPreview(pWindow,SdResId(CT_PREVIEW)), - maCreateStr(SdResId(STR_CREATE)), + maPreview(pWindow,SdResId(CT_PREVIEW)), + maCreateStr(SdResId(STR_CREATE)), maOpenStr(SdResId(STR_OPEN)) { maPageListFile += sal_Unicode('?'), @@ -974,9 +974,9 @@ void AssistentDlgImpl::SetStartType( StartType eType ) mpPage1OpenLB->Show(eType == ST_OPEN); mpPage1OpenPB->Show(eType == ST_OPEN); - if (eType == ST_OPEN) - maFinishButton.SetText(maOpenStr); - else + if (eType == ST_OPEN) + maFinishButton.SetText(maOpenStr); + else maFinishButton.SetText(maCreateStr); } @@ -1594,14 +1594,13 @@ void AssistentDlgImpl::UpdatePreview( BOOL bDocPreview ) aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aDocFile )); aReq.AppendItem( SfxStringItem( SID_REFERER, aEmptyStr ) ); aReq.AppendItem( SfxStringItem( SID_TARGETNAME, aTargetStr ) ); - aReq.AppendItem( SfxBoolItem( SID_VIEW, FALSE ) ); + aReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); aReq.AppendItem( SfxBoolItem( SID_PREVIEW, bDocPreview ) ); - const SfxObjectShellItem* pRet = (SfxObjectShellItem*) - SFX_APP()->ExecuteSlot( aReq ); + const SfxViewFrameItem* pRet = PTR_CAST( SfxViewFrameItem, SFX_APP()->ExecuteSlot( aReq ) ); - if( pRet && pRet->GetObjectShell() ) - xDocShell = pRet->GetObjectShell(); + if ( pRet && pRet->GetFrame() && pRet->GetFrame()->GetObjectShell() ) + xDocShell = pRet->GetFrame()->GetObjectShell(); } -- cgit v1.2.3 From ff9e369da43eaa1c89f846122943ab2c46b13c25 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- .../source/core/dataaccess/databasedocument.cxx | 132 ++++++++++++++++++++- .../source/core/dataaccess/databasedocument.hxx | 5 +- 2 files changed, 129 insertions(+), 8 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index eacc009d9bb5..36c5fbe2eb80 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -60,6 +60,8 @@ #include #include #include +#include +#include /** === end UNO includes === **/ #include @@ -110,6 +112,8 @@ using namespace ::cppu; using namespace ::osl; using ::com::sun::star::awt::XWindow; +using ::com::sun::star::ucb::XContent; +using ::com::sun::star::sdb::application::XDatabaseDocumentUI; //........................................................................ namespace dbaccess @@ -537,23 +541,139 @@ void SAL_CALL ODatabaseDocument::load( const Sequence< PropertyValue >& _Argumen } // ----------------------------------------------------------------------------- -void SAL_CALL ODatabaseDocument::doEmergencySave( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +namespace { - // for the moment, just delegate this to our "storeToURL" method - storeToURL( i_TargetLocation, i_MediaDescriptor ); + // ......................................................................... + const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() + { + static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); + return s_sRecDataStorName; + } + + // ......................................................................... + bool lcl_hasAnyModifiedSubComponent_throw( const Reference< XController >& i_rController ) + { + Reference< XDatabaseDocumentUI > xDatabaseUI( i_rController, UNO_QUERY_THROW ); + Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); + + typedef ::std::vector< Reference< XComponent > > Components; + Components aSubComponents( aComponents.getLength() ); + ::std::copy( aComponents.getConstArray(), aComponents.getConstArray() + aComponents.getLength(), aSubComponents.begin() ); + + bool isAnyModified = false; + for ( Components::const_iterator comp = aSubComponents.begin(); + !isAnyModified && ( comp != aSubComponents.end() ); + ++comp + ) + { + Reference< XModifiable > xModify( *comp, UNO_QUERY ); + if ( xModify.is() ) + { + isAnyModified = xModify->isModified(); + continue; + } + + // TODO: clarify: anything else to care for? Both the sub componbents with and without model + // should support the XModifiable interface, so I think nothing more is needed here. + OSL_ENSURE( false, "lcl_hasAnyModifiedSubComponent_throw: anything left to do here?" ); + } + + return isAnyModified; + } } // ----------------------------------------------------------------------------- -void SAL_CALL ODatabaseDocument::recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +::sal_Bool SAL_CALL ODatabaseDocument::wasModifiedSinceLastSave() throw ( RuntimeException ) { - // for the moment, just delegate this to our "load" method - ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + DocumentGuard aGuard( *this ); + + // The implementation here is somewhat sloppy, in that it returns whether *any* part of the whole + // database document, including opened sub components, is modified. This is more that what is requested: + // We need to return if the doc itself, or any of the opened sub components, has been modified + // since the last call to any of the save* methods, or since the document has been loaded/created. + // However, the API definition explicitly allows to be that sloppy ... + + if ( isModified() ) + return sal_True; + + // auto recovery is an "UI feature", it is to restore the UI the user knows. Thus, + // we ask our connected controllers, not simply our existing form/report definitions. + // (There is some information which even cannot be obtained without asking the controller. + // For instance, newly created, but not yet saved, forms/reports are acessible via the + // controller only, but not via the model.) + + try + { + for ( Controllers::const_iterator ctrl = m_aControllers.begin(); + ctrl != m_aControllers.end(); + ++ctrl + ) + { + if ( lcl_hasAnyModifiedSubComponent_throw( *ctrl ) ) + return sal_True; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return sal_False; +} + +// ----------------------------------------------------------------------------- +void SAL_CALL ODatabaseDocument::saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + DocumentGuard aGuard( *this ); + ModifyLock aLock( *this ); + + try + { + // create a storage for the target location + Reference< XStorage > xTargetStorage( impl_createStorageFor_throw( i_TargetLocation ) ); + + // first store the document as a whole into this storage + impl_storeToStorage_throw( xTargetStorage, i_MediaDescriptor, aGuard ); + + // create a sub storage for recovery data + if ( xTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + xTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); + Reference< XStorage > xRecoveryStorage = xTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); + + // store recovery data for open sub components of our controller(s) + // TODO + + // commit the root storage + ODatabaseModelImpl::commitStorageIfWriteable( xTargetStorage ); + } + catch( const Exception& ) + { + Any aError = ::cppu::getCaughtException(); + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + ) + { + // allowed to leave + throw; + } + + throw WrappedTargetException( ::rtl::OUString(), *this, aError ); + } +} + +// ----------------------------------------------------------------------------- +void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + // delegate this to our "load" method, to load the database document itself // our load implementation expects the SalvagedFile and URL to be in the media descriptor + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); aMediaDescriptor.put( "URL", i_SourceLocation ); load( aMediaDescriptor.getPropertyValues() ); + + // TODO: recover any things in the "recovery" sub folder of the storage } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 8cdccc3561f7..db6c71114c18 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -428,8 +428,9 @@ public: virtual void SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); // css.document.XDocumentRecovery - virtual void SAL_CALL doEmergencySave( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); - virtual void SAL_CALL recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); + virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); + virtual void SAL_CALL recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); // XTitle virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException); -- cgit v1.2.3 From 3bb1f9069d1973908175269564992a2b568ebbfe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- offapi/com/sun/star/document/XDocumentRecovery.idl | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl index 49d6766bdea0..1e9113201476 100644 --- a/offapi/com/sun/star/document/XDocumentRecovery.idl +++ b/offapi/com/sun/star/document/XDocumentRecovery.idl @@ -41,8 +41,31 @@ module com { module sun { module star { module document { */ interface XDocumentRecovery { + /** determines whether the document has been modified since the last call to saveToRecoveryFile. + +

If saveToRecoveryFile has not been called before, this method returns whether the document + has been modified since it has been loaded respectively created.

+ +

When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a + periodic session save as configured by the user, saveToRecoveryFile is called for every + document where wasModifiedSinceLastSave returns .

+ +

It's allowed to implement this method sloppy, by returning in cases where it is not sure whether + the document actually has been modified. So, the most simple implementation could simply delegate this call + to XModifiable::isModified. (Well, actually that's the + second simple implementation, the most simple one would, still egitimately, always return .)

+ +

However, in such a case, the document might be saved more often than needed. In particular during the + periodic session save, this might become a problem when saving is expensive, for a single document + or the sum of all open documents.

+ */ + boolean wasModifiedSinceLastSave(); + /** does an emergency save of the document +

A default implementation of this method could simply delegate this call to + XStorable::storeToURL.

+ @param TargetLocation specifies the URL of the location to which the document should be emergency-saved. @@ -51,7 +74,7 @@ interface XDocumentRecovery @see MediaDescriptor */ - void doEmergencySave( + void saveToRecoveryFile( [in] string TargetLocation, [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor ) @@ -61,22 +84,26 @@ interface XDocumentRecovery /** recovers the document after a previous emergency save. - The document itself has previously been created, but not loaded +

The document itself has previously been created, but not loaded (via XLoadable::load) or initialized (via - XLoadable::initNew). + XLoadable::initNew).

+ +

A default implementation of this method could simply delegate this call to + XLodable::load.

@param SourceLocation specifies the URL of the location to which the document was previously emergency-saved. @param SalvagedFile - specifies the original URL of the file which had been emergency-saved. + specifies the original URL of the file which had been emergency-saved. If this is empty, + then the file should be recovered from its original location. @param MediaDescriptor contains additional arguments for the load process, for instance an StatusIndicator. @see MediaDescriptor */ - void recoverDocument( + void recoverFromFile( [in] string SourceLocation, [in] string SalvagedFile, [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor -- cgit v1.2.3 From 923e15dd7d61770613e0d7c5c2a15695c95b606c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- basctl/source/basicide/basdoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index ac7af7de25a4..5de3dd712bd7 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -66,7 +66,7 @@ BasicDocShell::BasicDocShell() { pPrinter = 0; SetPool( &SFX_APP()->GetPool() ); - SetModel( new SIDEModel(this) ); + SetBaseModel( new SIDEModel(this) ); } __EXPORT BasicDocShell::~BasicDocShell() -- cgit v1.2.3 From 45e6e337a385be0798d3d8a9d8c90b170fd64d58 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- sd/source/ui/docshell/docshell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 2153da7eab41..fab53be9ec30 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -148,7 +148,7 @@ void DrawDocShell::Construct( bool bClipboard ) // the document's ref device. UpdateRefDevice(); - SetModel( new SdXImpressDocument( this, bClipboard ) ); + SetBaseModel( new SdXImpressDocument( this, bClipboard ) ); SetPool( &mpDoc->GetItemPool() ); mpUndoManager = new sd::UndoManager; mpDoc->SetSdrUndoManager( mpUndoManager ); -- cgit v1.2.3 From 5f2428d39fcb746c8aee3ca0b06dcfae8849fa3b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 12 Jan 2010 23:32:12 +0100 Subject: autorecovery: initial implementation of a new save/recovery for database documents For the moment, the document only stores and loads itself, as before. In this course, the AutoRecovery service now delegates the decision whether or not a document needs to be stored (to the "salvage location") to the document itself, using the new method XDocumentRecovery::wasModifiedSinceLastSave, superseded the previous E_MODIFIED_SINCE_LAST_AUTOSAVE flag. XDocumentRecovery::wasModifiedSinceLastSave has been implemented for SfxBaseModel, yielding the same behavior as before. It has also been implemented for database documents, where the implementation is somewhat "sloppy", in that it returns always when any of the opened sub components of the document is modified. --- starmath/source/document.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 519c53984e86..caf58f3cae69 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -704,9 +704,7 @@ SmDocShell::SmDocShell( const sal_uInt64 i_nSfxCreationFlags ) : StartListening(aFormat); StartListening(*pp->GetConfig()); - SetModel( new SmModel(this) ); //! das hier mit new erzeugte Model brauch - //! im Destruktor nicht explizit geloescht werden. - //! Dies erledigt das Sfx. + SetBaseModel( new SmModel(this) ); } -- cgit v1.2.3 From b7ecc322a4e36a8882cbf107186ac46c55a4950b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 13 Jan 2010 13:03:53 +0100 Subject: #i107826#: apply patch from cmc --- sw/source/core/doc/doccomp.cxx | 52 ++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 047b5b2dc582..6b32eebc35ce 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -969,6 +969,29 @@ BOOL SwCompareLine::Compare( const CompareLine& rLine ) const return CompareNode( rNode, ((SwCompareLine&)rLine).rNode ); } +namespace +{ + static String SimpleTableToText(const SwNode &rNode) + { + String sRet; + const SwNode* pEndNd = rNode.EndOfSectionNode(); + SwNodeIndex aIdx( rNode ); + while (&aIdx.GetNode() != pEndNd) + { + if (aIdx.GetNode().IsTxtNode()) + { + if (sRet.Len()) + { + sRet.Append( '\n' ); + } + sRet.Append( aIdx.GetNode().GetTxtNode()->GetExpandTxt() ); + } + aIdx++; + } + return sRet; + } +} + BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) { if( rSrcNd.GetNodeType() != rDstNd.GetNodeType() ) @@ -989,6 +1012,13 @@ BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) bRet = ( rTSrcNd.EndOfSectionIndex() - rTSrcNd.GetIndex() ) == ( rTDstNd.EndOfSectionIndex() - rTDstNd.GetIndex() ); + + // --> #i107826#: compare actual table content + if (bRet) + { + bRet = (SimpleTableToText(rSrcNd) == SimpleTableToText(rDstNd)); + } + // <-- } break; @@ -1043,6 +1073,15 @@ BOOL SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd ) case ND_ENDNODE: bRet = rSrcNd.StartOfSectionNode()->GetNodeType() == rDstNd.StartOfSectionNode()->GetNodeType(); + + // --> #i107826#: compare actual table content + if (bRet && rSrcNd.StartOfSectionNode()->GetNodeType() == ND_TABLENODE) + { + bRet = CompareNode( + *rSrcNd.StartOfSectionNode(), *rDstNd.StartOfSectionNode()); + } + // <-- + break; } return bRet; @@ -1059,18 +1098,7 @@ String SwCompareLine::GetText() const case ND_TABLENODE: { - const SwNode* pEndNd = rNode.EndOfSectionNode(); - SwNodeIndex aIdx( rNode ); - while( &aIdx.GetNode() != pEndNd ) - { - if( aIdx.GetNode().IsTxtNode() ) - { - if( sRet.Len() ) - sRet.Append( '\n' ); - sRet.Append( ((SwTxtNode&)rNode).GetExpandTxt() ); - } - aIdx++; - } + sRet = SimpleTableToText(rNode); sRet.InsertAscii( "Tabelle: ", 0 ); } break; -- cgit v1.2.3 From 3e8eb23621c5ee4ed9c2d7052f6682d0fbc1e0e0 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 13 Jan 2010 15:46:51 +0100 Subject: autorecovery: save open/modified (Writer-based) reports and forms, when doing a session/emergency save Still, the documents are stored only, and not loaded. For storing, there's at least one known issue: The controller is unable to deliver the proper object name for a form which has been newly created, and then saved. In this case, an empty name (from the time where the form was created) will be returned, and used in the save process. --- dbaccess/source/core/dataaccess/ModelImpl.cxx | 45 +-- dbaccess/source/core/dataaccess/ModelImpl.hxx | 10 - .../source/core/dataaccess/databasedocument.cxx | 37 +- dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 374 +++++++++++++++++++++ dbaccess/source/core/dataaccess/dbdocrecovery.hxx | 75 +++++ dbaccess/source/core/dataaccess/makefile.mk | 3 +- dbaccess/source/core/inc/sdbcoretools.hxx | 26 ++ dbaccess/source/core/misc/sdbcoretools.cxx | 43 ++- dbaccess/source/ui/app/AppController.hxx | 1 + dbaccess/source/ui/app/AppControllerGen.cxx | 24 ++ dbaccess/source/ui/app/subcomponentmanager.cxx | 28 ++ dbaccess/source/ui/app/subcomponentmanager.hxx | 18 + 12 files changed, 607 insertions(+), 77 deletions(-) create mode 100644 dbaccess/source/core/dataaccess/dbdocrecovery.cxx create mode 100644 dbaccess/source/core/dataaccess/dbdocrecovery.hxx diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 755f8f717d25..ed071e0b01a7 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -41,6 +41,7 @@ #include "dbastrings.hrc" #include "ModelImpl.hxx" #include "userinformation.hxx" +#include "sdbcoretools.hxx" /** === begin UNO includes === **/ #include @@ -299,7 +300,7 @@ void DocumentStorageAccess::commitStorages() SAL_THROW(( IOException, RuntimeExc ++aIter ) { - m_pModelImplementation->commitStorageIfWriteable( aIter->second ); + tools::stor::commitStorageIfWriteable( aIter->second ); } } catch(const WrappedTargetException&) @@ -320,7 +321,7 @@ bool DocumentStorageAccess::commitEmbeddedStorage( bool _bPreventRootCommits ) { NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) ); if ( pos != m_aExposedStorages.end() ) - bSuccess = m_pModelImplementation->commitStorageIfWriteable( pos->second ); + bSuccess = tools::stor::commitStorageIfWriteable( pos->second ); } catch( Exception& ) { @@ -952,49 +953,13 @@ bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits ) return getDocumentStorageAccess()->commitEmbeddedStorage( _bPreventRootCommits ); } -// ----------------------------------------------------------------------------- -namespace -{ - bool lcl_storageIsWritable_nothrow( const Reference< XStorage >& _rxStorage ) - { - if ( !_rxStorage.is() ) - return false; - - sal_Int32 nMode = ElementModes::READ; - try - { - Reference< XPropertySet > xStorageProps( _rxStorage, UNO_QUERY_THROW ); - xStorageProps->getPropertyValue( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) ) ) >>= nMode; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return ( nMode & ElementModes::WRITE ) != 0; - } -} - -// ----------------------------------------------------------------------------- -bool ODatabaseModelImpl::commitStorageIfWriteable( const Reference< XStorage >& _rxStorage ) SAL_THROW(( IOException, WrappedTargetException, RuntimeException )) -{ - bool bSuccess = false; - Reference xTrans( _rxStorage, UNO_QUERY ); - if ( xTrans.is() ) - { - if ( lcl_storageIsWritable_nothrow( _rxStorage ) ) - xTrans->commit(); - bSuccess = true; - } - return bSuccess; -} // ----------------------------------------------------------------------------- bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference< XStorage >& _rxStorage ) SAL_THROW(()) { bool bSuccess = false; try { - bSuccess = commitStorageIfWriteable( _rxStorage ); + bSuccess = tools::stor::commitStorageIfWriteable( _rxStorage ); } catch( const Exception& ) { @@ -1346,7 +1311,7 @@ Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const Refe lcl_rebaseScriptStorage_throw( m_xBasicLibraries, m_xDocumentStorage.getTyped() ); lcl_rebaseScriptStorage_throw( m_xDialogLibraries, m_xDocumentStorage.getTyped() ); - m_bReadOnly = !lcl_storageIsWritable_nothrow( m_xDocumentStorage.getTyped() ); + m_bReadOnly = !tools::stor::storageIsWritable_nothrow( m_xDocumentStorage.getTyped() ); // TODO: our data source, if it exists, must broadcast the change of its ReadOnly property return m_xDocumentStorage.getTyped(); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index f9b38be569af..8697bf1abdc3 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -325,16 +325,6 @@ public: /// commits our storage void commitRootStorage(); - /// commits a given storage if it's not readonly - static bool commitStorageIfWriteable( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage - ) - SAL_THROW(( - ::com::sun::star::io::IOException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException - )); - /// commits a given storage if it's not readonly, ignoring (but asserting) all errors static bool commitStorageIfWriteable_ignoreErrors( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 36c5fbe2eb80..46921a583c98 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -41,6 +41,7 @@ #include "databasecontext.hxx" #include "documentcontainer.hxx" #include "sdbcoretools.hxx" +#include "dbdocrecovery.hxx" /** === begin UNO includes === **/ #include @@ -543,30 +544,19 @@ void SAL_CALL ODatabaseDocument::load( const Sequence< PropertyValue >& _Argumen // ----------------------------------------------------------------------------- namespace { - // ......................................................................... - const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() - { - static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); - return s_sRecDataStorName; - } - // ......................................................................... bool lcl_hasAnyModifiedSubComponent_throw( const Reference< XController >& i_rController ) { Reference< XDatabaseDocumentUI > xDatabaseUI( i_rController, UNO_QUERY_THROW ); - Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); - typedef ::std::vector< Reference< XComponent > > Components; - Components aSubComponents( aComponents.getLength() ); - ::std::copy( aComponents.getConstArray(), aComponents.getConstArray() + aComponents.getLength(), aSubComponents.begin() ); + Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); + const Reference< XComponent >* component = aComponents.getConstArray(); + const Reference< XComponent >* componentsEnd = aComponents.getConstArray() + aComponents.getLength(); bool isAnyModified = false; - for ( Components::const_iterator comp = aSubComponents.begin(); - !isAnyModified && ( comp != aSubComponents.end() ); - ++comp - ) + for ( ; component != componentsEnd; ++component ) { - Reference< XModifiable > xModify( *comp, UNO_QUERY ); + Reference< XModifiable > xModify( *component, UNO_QUERY ); if ( xModify.is() ) { isAnyModified = xModify->isModified(); @@ -635,22 +625,19 @@ void SAL_CALL ODatabaseDocument::saveToRecoveryFile( const ::rtl::OUString& i_Ta // first store the document as a whole into this storage impl_storeToStorage_throw( xTargetStorage, i_MediaDescriptor, aGuard ); - // create a sub storage for recovery data - if ( xTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) - xTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); - Reference< XStorage > xRecoveryStorage = xTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); - - // store recovery data for open sub components of our controller(s) - // TODO + // save the sub components which need saving + DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext, xTargetStorage ); + aDocRecovery.saveModifiedSubComponents( m_aControllers ); // commit the root storage - ODatabaseModelImpl::commitStorageIfWriteable( xTargetStorage ); + tools::stor::commitStorageIfWriteable( xTargetStorage ); } catch( const Exception& ) { Any aError = ::cppu::getCaughtException(); if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< WrappedTargetException >::get() ) ) { // allowed to leave @@ -1076,7 +1063,7 @@ void ODatabaseDocument::impl_storeToStorage_throw( const Reference< XStorage >& lcl_triggerStatusIndicator_throw( aWriteArgs, _rDocGuard, false ); // commit target storage - OSL_VERIFY( ODatabaseModelImpl::commitStorageIfWriteable( _rxTargetStorage ) ); + OSL_VERIFY( tools::stor::commitStorageIfWriteable( _rxTargetStorage ) ); } catch( const IOException& ) { throw; } catch( const RuntimeException& ) { throw; } diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx new file mode 100644 index 000000000000..890998486424 --- /dev/null +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx @@ -0,0 +1,374 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "precompiled_dbaccess.hxx" + +#include "dbdocrecovery.hxx" +#include "sdbcoretools.hxx" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include + +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::embed::XStorage; + using ::com::sun::star::frame::XController; + using ::com::sun::star::sdb::application::XDatabaseDocumentUI; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::document::XStorageBasedDocument; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::beans::Pair; + using ::com::sun::star::io::XStream; + using ::com::sun::star::io::XOutputStream; + using ::com::sun::star::io::XTextOutputStream; + using ::com::sun::star::io::XActiveDataSource; + /** === end UNO using === **/ + + namespace ElementModes = ::com::sun::star::embed::ElementModes; + + //==================================================================== + //= MapStringToString + //==================================================================== + typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > MapStringToString; + + //==================================================================== + //= helpers + //==================================================================== + namespace + { + // ......................................................................... + const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() + { + static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); + return s_sRecDataStorName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getFormsStorageName() + { + static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); + return s_sFormsStorageName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getReportsStorageName() + { + static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); + return s_sReportsStorageName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getObjectMapStreamName() + { + static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); + return s_sObjectMapStreamName; + } + + // ......................................................................... + enum SubComponentType + { + WRITER_FORM, + WRITER_REPORT, + SRB_REPORT, + TABLE_DESIGN, + QUERY_DESIGN, + TABLE_DATA_VIEW, + RELATION_DESIGN, + + UNKNOWN + }; + + // ......................................................................... + SubComponentType lcl_identifyComponent_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XComponent >& i_rComponent ) + { + Reference< XModuleManager > xModuleManager( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( i_rComponent ); + + struct ComponentTypeMapping + { + const sal_Char* pAsciiModuleName; + SubComponentType eComponentType; + }; + const ComponentTypeMapping aKnownCompTypes[] = + { + { "com.sun.star.sdb.FormDesign", WRITER_FORM }, + { "com.sun.star.sdb.TextReportDesign", WRITER_REPORT }, + { "com.sun.star.report.ReportDefinition", WRITER_REPORT }, + { "com.sun.star.sdb.TableDesign", TABLE_DESIGN }, + { "com.sun.star.sdb.QueryDesign", QUERY_DESIGN }, + { "com.sun.star.sdb.TableDataView", TABLE_DATA_VIEW }, + { "com.sun.star.sdb.RelationDesign", RELATION_DESIGN } + }; + + for ( size_t i=0; i < sizeof( aKnownCompTypes ) / sizeof( aKnownCompTypes[0] ); ++i ) + { + if ( sModuleIdentifier.equalsAscii( aKnownCompTypes[i].pAsciiModuleName ) ) + return aKnownCompTypes[i].eComponentType; + } + + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer message; + message.append( "lcl_identifyComponent_throw: unknown module identifier: '" ); + message.append( ::rtl::OUStringToOString( sModuleIdentifier, RTL_TEXTENCODING_ASCII_US ) ); + message.append( "'" ); + OSL_ENSURE( false, message.makeStringAndClear().getStr() ); + #endif + return UNKNOWN; + } + + // ......................................................................... + void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + const MapStringToString& i_mapStorageToObjectName ) + { + if ( i_mapStorageToObjectName.empty() ) + // nothing to do + return; + + ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); + Reference< XStream > xIniStream( i_rStorage->openStreamElement( + lcl_getObjectMapStreamName(), ElementModes::WRITE | ElementModes::TRUNCATE ), UNO_SET_THROW ); + + Reference< XTextOutputStream > xTextOutput( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW ); + xTextOutput->setEncoding( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-8" ) ) ); + + Reference< XActiveDataSource > xDataSource( xTextOutput, UNO_QUERY_THROW ); + xDataSource->setOutputStream( xIniStream->getOutputStream() ); + + const ::rtl::OUString sLineFeed( sal_Unicode( '\n' ) ); + xTextOutput->writeString( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) ); + xTextOutput->writeString( sLineFeed ); + + for ( MapStringToString::const_iterator stor = i_mapStorageToObjectName.begin(); + stor != i_mapStorageToObjectName.end(); + ++stor + ) + { + ::rtl::OUStringBuffer aLine; + aLine.append( stor->first ); + aLine.append( sal_Unicode( '=' ) ); + aLine.append( stor->second ); + aLine.append( sLineFeed ); + xTextOutput->writeString( aLine.makeStringAndClear() ); + } + + xTextOutput->writeString( sLineFeed ); + } + } + + //==================================================================== + //= DatabaseDocumentRecovery_Data + //==================================================================== + struct DatabaseDocumentRecovery_Data + { + const ::comphelper::ComponentContext aContext; + const Reference< XStorage > xDocSalvageStorage; + + DatabaseDocumentRecovery_Data( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rDocumentSalvageStorage ) + :aContext( i_rContext ) + ,xDocSalvageStorage( i_rDocumentSalvageStorage ) + { + } + }; + + //==================================================================== + //= SubComponentRecovery + //==================================================================== + class SubComponentRecovery + { + public: + SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XDatabaseDocumentUI >& i_rController, + const Reference< XComponent >& i_rComponent ) + :m_rContext( i_rContext ) + ,m_xComponent( i_rComponent ) + { + ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); + + // retrieve the name of the object to which the component belongs to + Pair< sal_Int32, ::rtl::OUString > aComponentIdentity = i_rController->identifySubComponent( i_rComponent ); + m_sObjectName = aComponentIdentity.Second; + } + + void saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapStringToString& io_mapStorageToObjectName ); + + private: + void impl_saveWriterSubComponent_throw( + const SubComponentType i_eType, + const Reference< XStorage >& i_rRecoveryStorage, + MapStringToString& io_mapStorageToObjectName + ); + + private: + const ::comphelper::ComponentContext& m_rContext; + const Reference< XComponent > m_xComponent; + ::rtl::OUString m_sObjectName; + }; + + //-------------------------------------------------------------------- + void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapStringToString& io_mapStorageToObjectName ) + { + SubComponentType eComponentType = lcl_identifyComponent_throw( m_rContext, m_xComponent ); + if ( eComponentType == UNKNOWN ) + // quite fatal, but has already been reported as assertion in lcl_identifyComponent_throw + return; + + switch ( eComponentType ) + { + case WRITER_FORM: + case WRITER_REPORT: + impl_saveWriterSubComponent_throw( eComponentType, i_rRecoveryStorage, io_mapStorageToObjectName ); + break; + + default: + // TODO + OSL_ENSURE( false, "SubComponentRecoverys::saveToRecoveryStorage: unimplemented case!" ); + break; + } + } + + //-------------------------------------------------------------------- + void SubComponentRecovery::impl_saveWriterSubComponent_throw( const SubComponentType i_eType, const Reference< XStorage >& i_rRecoveryStorage, + MapStringToString& io_mapStorageToObjectName ) + { + ENSURE_OR_THROW( ( i_eType == WRITER_FORM ) || ( i_eType == WRITER_REPORT ), "illegal sub component type" ); + ENSURE_OR_THROW( i_rRecoveryStorage.is(), "illegal storage" ); + + // open the sub storage for the given kind of documents + const ::rtl::OUString& rStorageName( i_eType == WRITER_FORM ? lcl_getFormsStorageName() : lcl_getReportsStorageName() ); + const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement( rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + + // find a free sub storage name, and create Yet Another Sub Storage + const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( i_eType == WRITER_FORM ? "form" : "report" ) ); + const ::rtl::OUString sCompStorName = ::dbtools::createUniqueName( xDocsStor.get(), sBaseName, true ); + const Reference< XStorage > xCompStor( xDocsStor->openStorageElement( sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + + // store the document into the storage + Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW ); + xStorageDocument->storeToStorage( xCompStor, Sequence< PropertyValue >() ); + + // remember the map from the component name to the storage name + ::rtl::OUStringBuffer aSubStoragePath; + aSubStoragePath.append( rStorageName ); + aSubStoragePath.append( sal_Unicode( '/' ) ); + aSubStoragePath.append( sCompStorName ); + const ::rtl::OUString sSubStoragePath = aSubStoragePath.makeStringAndClear(); + + OSL_ENSURE( io_mapStorageToObjectName.find( sSubStoragePath ) == io_mapStorageToObjectName.end(), + "SubComponentRecoverys::impl_saveWriterSubComponent_throw: object name already used!" ); + io_mapStorageToObjectName[ sSubStoragePath ] = m_sObjectName; + + // commit the storage for the documents collection + tools::stor::commitStorageIfWriteable( xDocsStor ); + } + + //==================================================================== + //= DatabaseDocumentRecovery + //==================================================================== + //-------------------------------------------------------------------- + DatabaseDocumentRecovery::DatabaseDocumentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rDocumentSalvageStorage ) + :m_pData( new DatabaseDocumentRecovery_Data( i_rContext, i_rDocumentSalvageStorage ) ) + { + ENSURE_OR_THROW( m_pData->xDocSalvageStorage.is(), "invalid document storage" ); + } + + //-------------------------------------------------------------------- + DatabaseDocumentRecovery::~DatabaseDocumentRecovery() + { + } + + //-------------------------------------------------------------------- + void DatabaseDocumentRecovery::saveModifiedSubComponents( const ::std::vector< Reference< XController > >& i_rControllers ) + { + // create a sub storage for recovery data + if ( m_pData->xDocSalvageStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + m_pData->xDocSalvageStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); + Reference< XStorage > xRecoveryStorage = m_pData->xDocSalvageStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); + + // store recovery data for open sub components of the given controller(s) + if ( !i_rControllers.empty() ) + { + ENSURE_OR_THROW( i_rControllers.size() == 1, "can't handle more than one controller" ); + // At the moment, there can be only one view to a database document. If we ever allow for more than this, + // then we need a concept for sub documents opened from different controllers (i.e. two document views, + // and the user opens the very same form in both views). And depending on this, we need a concept for + // how those are saved to the recovery file. + + MapStringToString aMapStorageToObjectName; + + for ( ::std::vector< Reference< XController > >::const_iterator ctrl = i_rControllers.begin(); + ctrl != i_rControllers.end(); + ++ctrl + ) + { + Reference< XDatabaseDocumentUI > xDatabaseUI( *ctrl, UNO_QUERY_THROW ); + Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); + + const Reference< XComponent >* component = aComponents.getConstArray(); + const Reference< XComponent >* componentEnd = aComponents.getConstArray() + aComponents.getLength(); + for ( ; component != componentEnd; ++component ) + { + SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, *component ); + aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapStorageToObjectName ); + } + } + + lcl_writeObjectMap_throw( m_pData->aContext, xRecoveryStorage, aMapStorageToObjectName ); + } + + // commit the recovery storage + tools::stor::commitStorageIfWriteable( xRecoveryStorage ); + } + +//........................................................................ +} // namespace dbaccess +//........................................................................ diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.hxx b/dbaccess/source/core/dataaccess/dbdocrecovery.hxx new file mode 100644 index 000000000000..0fa4fb62758e --- /dev/null +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.hxx @@ -0,0 +1,75 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef DBACCESS_DBDOCRECOVERY_HXX +#define DBACCESS_DBDOCRECOVERY_HXX + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include +#include + +namespace comphelper +{ + class ComponentContext; +} + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + //==================================================================== + //= DatabaseDocumentRecovery + //==================================================================== + struct DatabaseDocumentRecovery_Data; + class DatabaseDocumentRecovery + { + public: + DatabaseDocumentRecovery( + const ::comphelper::ComponentContext& i_rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentSalvageStorage + ); + ~DatabaseDocumentRecovery(); + + /** saves the modified sub components of the given controller(s) to the "recovery" sub storage of the document + storage. + */ + void saveModifiedSubComponents( + const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >& i_rControllers + ); + + private: + const ::std::auto_ptr< DatabaseDocumentRecovery_Data > m_pData; + }; + +//........................................................................ +} // namespace dbaccess +//........................................................................ + +#endif // DBACCESS_DBDOCRECOVERY_HXX diff --git a/dbaccess/source/core/dataaccess/makefile.mk b/dbaccess/source/core/dataaccess/makefile.mk index 580d62c08e55..f74188527c6f 100644 --- a/dbaccess/source/core/dataaccess/makefile.mk +++ b/dbaccess/source/core/dataaccess/makefile.mk @@ -64,7 +64,8 @@ SLOFILES= \ $(SLO)$/ModelImpl.obj \ $(SLO)$/documentevents.obj \ $(SLO)$/documenteventexecutor.obj \ - $(SLO)$/documenteventnotifier.obj + $(SLO)$/documenteventnotifier.obj \ + $(SLO)$/dbdocrecovery.obj # --- Targets ---------------------------------- diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx index 92a163b3d24e..5e5315d128e0 100644 --- a/dbaccess/source/core/inc/sdbcoretools.hxx +++ b/dbaccess/source/core/inc/sdbcoretools.hxx @@ -31,8 +31,14 @@ #ifndef DBACORE_SDBCORETOOLS_HXX #define DBACORE_SDBCORETOOLS_HXX +/** === begin UNO includes === **/ #include #include +#include +#include +#include +#include +/** === end UNO includes === **/ namespace comphelper { @@ -77,6 +83,26 @@ namespace dbaccess */ ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Any& _rError ); + namespace tools + { + namespace stor + { + bool storageIsWritable_nothrow( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage + ); + + /// commits a given storage if it's not readonly + bool commitStorageIfWriteable( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage + ) + SAL_THROW(( + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException + )); + } + + } + //......................................................................... } // namespace dbaccess //......................................................................... diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx index 48e08b7ff7e4..1854aa9efc9a 100644 --- a/dbaccess/source/core/misc/sdbcoretools.cxx +++ b/dbaccess/source/core/misc/sdbcoretools.cxx @@ -41,6 +41,8 @@ #include #include #include +#include +#include /** === end UNO includes === **/ #include @@ -58,10 +60,12 @@ namespace dbaccess using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; + using namespace ::com::sun::star::io; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::task; + using namespace ::com::sun::star::embed; using namespace ::com::sun::star::container; // ========================================================================= @@ -163,7 +167,44 @@ namespace dbaccess return sDisplayMessage; } -// ----------------------------------------------------------------------------- + namespace tools { namespace stor { + + // ----------------------------------------------------------------------------- + bool storageIsWritable_nothrow( const Reference< XStorage >& _rxStorage ) + { + if ( !_rxStorage.is() ) + return false; + + sal_Int32 nMode = ElementModes::READ; + try + { + Reference< XPropertySet > xStorageProps( _rxStorage, UNO_QUERY_THROW ); + xStorageProps->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenMode" ) ) ) >>= nMode; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return ( nMode & ElementModes::WRITE ) != 0; + } + + // ----------------------------------------------------------------------------- + bool commitStorageIfWriteable( const Reference< XStorage >& _rxStorage ) SAL_THROW(( IOException, WrappedTargetException, RuntimeException )) + { + bool bSuccess = false; + Reference< XTransactedObject > xTrans( _rxStorage, UNO_QUERY ); + if ( xTrans.is() ) + { + if ( storageIsWritable_nothrow( _rxStorage ) ) + xTrans->commit(); + bSuccess = true; + } + return bSuccess; + } + + } } // tools::stor + //......................................................................... } // namespace dbaccess //......................................................................... diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 97cc490411fd..27c6f3827adf 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -463,6 +463,7 @@ namespace dbaui virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > SAL_CALL getSubComponents() throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL connect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL identifySubComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& SubComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL closeSubComponents( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index a0f61642dbf0..5c9f66bd724b 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -90,6 +90,7 @@ namespace dbaui using namespace ::dbtools; using namespace ::connectivity; using namespace ::svx; +using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::util; @@ -107,6 +108,7 @@ using namespace ::com::sun::star::ucb; using ::com::sun::star::util::XCloseable; using ::com::sun::star::ui::XContextMenuInterceptor; /** === end UNO using === **/ + namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; @@ -385,6 +387,8 @@ Reference< XConnection > SAL_CALL OApplicationController::getActiveConnection() // ----------------------------------------------------------------------------- void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeException) { + ::osl::MutexGuard aGuard( getMutex() ); + SQLExceptionInfo aError; SharedConnection xConnection = ensureConnection( &aError ); if ( !xConnection.is() ) @@ -399,9 +403,29 @@ void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeEx } } +// ----------------------------------------------------------------------------- +beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL OApplicationController::identifySubComponent( const Reference< XComponent >& i_rSubComponent ) throw (IllegalArgumentException, RuntimeException) +{ + ::osl::MutexGuard aGuard( getMutex() ); + + sal_Int32 nType = -1; + ::rtl::OUString sName; + + if ( !m_pSubComponentManager->lookupSubComponent( i_rSubComponent, sName, nType ) ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + if ( nType == SID_DB_APP_DSRELDESIGN ) + // this is somewhat hacky ... we're expected to return a DatabaseObject value. However, there is no such + // value for the relation design. /me thinks we should change the API definition here ... + nType = -1; + + return beans::Pair< ::sal_Int32, ::rtl::OUString >( nType, sName ); +} + // ----------------------------------------------------------------------------- ::sal_Bool SAL_CALL OApplicationController::closeSubComponents( ) throw (RuntimeException) { + ::osl::MutexGuard aGuard( getMutex() ); return m_pSubComponentManager->closeSubComponents(); } diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index a24fe29b5974..b2f7dab42958 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -525,6 +525,34 @@ namespace dbaui return true; } + // ----------------------------------------------------------------------------- + bool SubComponentManager::lookupSubComponent( const Reference< XComponent >& i_rComponent, + ::rtl::OUString& o_rName, sal_Int32& o_rComponentType ) + { + for ( SubComponentMap::const_iterator comp = m_pData->m_aComponents.begin(); + comp != m_pData->m_aComponents.end(); + ++comp + ) + { + if ( ( comp->second.xModel.is() + && ( comp->second.xModel == i_rComponent ) + ) + || ( comp->second.xController.is() + && ( comp->second.xController == i_rComponent ) + ) + || ( comp->second.xFrame.is() + && ( comp->second.xFrame == i_rComponent ) + ) + ) + { + o_rName = comp->first.sName; + o_rComponentType = comp->first.nComponentType; + return true; + } + } + return false; + } + //........................................................................ } // namespace dbaui //........................................................................ diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx index fbcdf92d4bd9..85984c8e0d14 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.hxx +++ b/dbaccess/source/ui/app/subcomponentmanager.hxx @@ -106,6 +106,24 @@ namespace dbaui const ::rtl::OUString& _rName, const sal_Int32 _nComponentType ); + + /** searches for the given sub component + + @param i_rComponent + the sub component to look up + @param o_rName + contains, upon successful return, the name of the sub component + @param o_nComponentType + contains, upon successful return, the type of the sub component + @return + if and only if the component was found + */ + bool lookupSubComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent, + ::rtl::OUString& o_rName, + sal_Int32& o_rComponentType + ); + private: ::std::auto_ptr< SubComponentManager_Data > m_pData; }; -- cgit v1.2.3 From 8b866362e44be39da31a4de962ff5090e2b19cd9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 13 Jan 2010 15:46:51 +0100 Subject: autorecovery: save open/modified (Writer-based) reports and forms, when doing a session/emergency save Still, the documents are stored only, and not loaded. For storing, there's at least one known issue: The controller is unable to deliver the proper object name for a form which has been newly created, and then saved. In this case, an empty name (from the time where the form was created) will be returned, and used in the save process. --- .../star/sdb/application/XDatabaseDocumentUI.idl | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl index 91e84aafc1b3..60bed3306c66 100644 --- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -31,30 +31,15 @@ #ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ #define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__ -#ifndef __com_sun_star_sdbc_XDataSource_idl__ #include -#endif -#ifndef __com_sun_star_sdbc_SQLException_idl__ #include -#endif -#ifndef __com_sun_star_sdbc_XConnection_idl__ #include -#endif -#ifndef __com_sun_star_awt_XWindow_idl__ #include -#endif -#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ #include -#endif -#ifndef __com_sun_star_container_NoSuchElementException_idl__ #include -#endif -#ifndef __com_sun_star_lang_XComponent_idl__ #include -#endif -#ifndef __com_sun_star_beans_PropertyValue_idl__ #include -#endif +#include //============================================================================= @@ -136,6 +121,29 @@ interface XDatabaseDocumentUI [attribute, readonly] sequence< ::com::sun::star::lang::XComponent > SubComponents; + /** identifies the given sub component + + @param SubComponent + the component to identify. Must be one of the components in SubComponents. + + @return + a record describing the sub component. The first element of the returned pair is the type + of the component, denoted by one of the DatabaseObject constants. The second + element is the name of the component. For object types which support nested structures (forms + and reports, actually), this might be a hierachical name. If the sub component has been newly created, + and not yet saved, this name is empty. + + @throws ::com::sun::star::lang::IllegalArgumentException + if the given component is not one of the controller's sub components + */ + ::com::sun::star::beans::Pair< long, string > + identifySubComponent( + [in] ::com::sun::star::lang::XComponent SubComponent + ) + raises ( + ::com::sun::star::lang::IllegalArgumentException + ); + /** closes all sub components of the database document.

During working with the database, the user might open different sub components: -- cgit v1.2.3 From bed6ae689e836a3c2494dec840bb7946a409619b Mon Sep 17 00:00:00 2001 From: Oliver-Rainer Wittmann Date: Wed, 13 Jan 2010 15:57:11 +0100 Subject: sw33bf02: #b6912256# - assure consistent Writer core attributes if list styles are deleted via UNO-API --- sw/source/core/SwNumberTree/SwNodeNum.cxx | 19 ++++++++++++++++++- sw/source/core/unocore/unocrsrhelper.cxx | 10 ++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx index 171c4de9208d..c13b396e76f4 100644 --- a/sw/source/core/SwNumberTree/SwNodeNum.cxx +++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx @@ -40,6 +40,10 @@ // --> OD 2007-10-31 #i83479# #include // <-- +// --> OD 2010-01-13 #b6912256# +#include +#include +// <-- // --> OD 2008-02-19 #refactorlists# SwNodeNum::SwNodeNum( SwTxtNode* pTxtNode ) @@ -492,8 +496,21 @@ void SwNodeNum::_UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum ) SwTxtNode* pTxtNode( rNodeNum.GetTxtNode() ); if ( pTxtNode ) { - // --> OD 2008-03-13 #refactorlists# pTxtNode->RemoveFromList(); + // --> OD 2010-01-13 #b6912256# + // clear all list attributes and the list style + SvUShortsSort aResetAttrsArray; + aResetAttrsArray.Insert( RES_PARATR_LIST_ID ); + aResetAttrsArray.Insert( RES_PARATR_LIST_LEVEL ); + aResetAttrsArray.Insert( RES_PARATR_LIST_ISRESTART ); + aResetAttrsArray.Insert( RES_PARATR_LIST_RESTARTVALUE ); + aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED ); + aResetAttrsArray.Insert( RES_PARATR_NUMRULE ); + SwPaM aPam( *pTxtNode ); + pTxtNode->GetDoc()->ResetAttrs( aPam, sal_False, + &aResetAttrsArray, + false ); + // <-- } } } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 4f4c7c2658b5..d64281038bb3 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -231,13 +231,11 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry // <-- case FN_NUMBER_NEWSTART: { + // a multi selection is not considered const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode(); - // --> OD 2006-10-19 #134160# - make code robust: - // consider case that PaM doesn't denote a text node - const SwNumRule* pRule = pTxtNd ? pTxtNd->GetNumRule() : 0; + // --> OD 2010-01-13 #b6912256# + if ( pTxtNd && pTxtNd->IsInList() ) // <-- - // hier wird Multiselektion nicht beruecksichtigt - if( pRule ) { if( pAny ) { @@ -518,7 +516,7 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry } eNewState = aCharStyles.getLength() ? - PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;; + PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;; if(pAny) (*pAny) <<= aCharStyles; } -- cgit v1.2.3 From 9eba5bf7b80bd791ef9a7c0af69d6c3c9bebec80 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 14 Jan 2010 12:14:15 +0100 Subject: dba33d: #i108312# check for other function type and pasre only the first child of the condition --- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index f8f2170da555..f85928cb6805 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -712,7 +712,7 @@ namespace // if we have a none numeric field, the table alias could be in the name // otherwise we are not allowed to do this (e.g. 0.1 * PRICE ) - if ( !pEntryField->isNumeric() ) + if ( !pEntryField->isOtherFunction() ) { // we have to look if we have alias.* here but before we have to check if the column doesn't already exist String sTemp = rFieldName; @@ -1226,7 +1226,7 @@ namespace if (pParseNode.get()) { ::rtl::OUString sGroupBy; - pParseNode->parseNodeToStr( sGroupBy, + pParseNode->getChild(0)->parseNodeToStr( sGroupBy, xConnection, &rController.getParser().getContext(), sal_False, -- cgit v1.2.3 From eb1045fea7009f055f4ff2e97f89968d1c075193 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 14 Jan 2010 13:37:07 +0100 Subject: dba33d: #i104612# wrong string test --- reportdesign/source/filter/xml/xmlGroup.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reportdesign/source/filter/xml/xmlGroup.cxx b/reportdesign/source/filter/xml/xmlGroup.cxx index 195b41aaa3c0..fb1ab7ff4299 100644 --- a/reportdesign/source/filter/xml/xmlGroup.cxx +++ b/reportdesign/source/filter/xml/xmlGroup.cxx @@ -142,8 +142,8 @@ OXMLGroup::OXMLGroup( ORptFilter& _rImport { nGroupOn = report::GroupOn::MONTH; } - else if ( sCompleteFormula.matchAsciiL("rpt:INT((MONTH",sizeof("rpt:INT((MONTH"),0) - && sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("-1)/3)+1",sizeof("-1)/3)+1")) ) + else if ( sCompleteFormula.matchIgnoreAsciiCase(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("rpt:INT((MONTH")),0) + && sCompleteFormula.endsWithIgnoreAsciiCaseAsciiL("-1)/3)+1",8) ) { nGroupOn = report::GroupOn::QUARTAL; } -- cgit v1.2.3 From f620348c7bf0c66d0247009cc17214b703ef7a10 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 14 Jan 2010 15:10:17 +0100 Subject: autorecovery: initial glue code for recovering forms/reports --- .../source/core/dataaccess/databasedocument.cxx | 54 ++- .../source/core/dataaccess/databasedocument.hxx | 1 + dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 493 ++++++++++++++++----- dbaccess/source/core/dataaccess/dbdocrecovery.hxx | 19 +- .../source/core/dataaccess/documentcontainer.cxx | 26 +- .../source/core/dataaccess/documentdefinition.cxx | 2 +- 6 files changed, 446 insertions(+), 149 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 46921a583c98..7a234d2ce646 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -173,6 +173,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference& ,m_eInitState( NotInitialized ) ,m_bClosing( false ) ,m_bAllowDocumentScripting( false ) + ,m_bHasBeenRecovered( false ) { DBG_CTOR(ODatabaseDocument,NULL); OSL_TRACE( "DD: ctor: %p: %p", this, m_pImpl.get() ); @@ -626,8 +627,8 @@ void SAL_CALL ODatabaseDocument::saveToRecoveryFile( const ::rtl::OUString& i_Ta impl_storeToStorage_throw( xTargetStorage, i_MediaDescriptor, aGuard ); // save the sub components which need saving - DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext, xTargetStorage ); - aDocRecovery.saveModifiedSubComponents( m_aControllers ); + DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext); + aDocRecovery.saveModifiedSubComponents( xTargetStorage, m_aControllers ); // commit the root storage tools::stor::commitStorageIfWriteable( xTargetStorage ); @@ -651,16 +652,37 @@ void SAL_CALL ODatabaseDocument::saveToRecoveryFile( const ::rtl::OUString& i_Ta // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) { - // delegate this to our "load" method, to load the database document itself + DocumentGuard aGuard( *this, DocumentGuard::InitMethod ); + try + { + // load the document itself, by simply delegating to our "load" method + + // our load implementation expects the SalvagedFile and URL to be in the media descriptor + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); + aMediaDescriptor.put( "URL", i_SourceLocation ); - // our load implementation expects the SalvagedFile and URL to be in the media descriptor - ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); - aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); - aMediaDescriptor.put( "URL", i_SourceLocation ); + aGuard.clear(); // (load has an own guarding scheme) + load( aMediaDescriptor.getPropertyValues() ); - load( aMediaDescriptor.getPropertyValues() ); + // Without a controller, we are unable to recover the sub components, as they're always tied to a controller. + // So, everything else is done when the first controller is connected. + m_bHasBeenRecovered = true; + } + catch( const Exception& ) + { + Any aError = ::cppu::getCaughtException(); + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< WrappedTargetException >::get() ) + ) + { + // allowed to leave + throw; + } - // TODO: recover any things in the "recovery" sub folder of the storage + throw WrappedTargetException( ::rtl::OUString(), *this, aError ); + } } // ----------------------------------------------------------------------------- @@ -739,6 +761,20 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController // check/adjust our macro mode. m_pImpl->checkMacrosOnLoading(); + + // check if there are sub components to recover from our document storage + if ( !m_bHasBeenRecovered ) + return; + + try + { + DatabaseDocumentRecovery aDocRecovery( m_pImpl->m_aContext ); + aDocRecovery.recoverSubDocuments( m_pImpl->getRootStorage(), _xController ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index db6c71114c18..446a344dfebc 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -209,6 +209,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe InitState m_eInitState; bool m_bClosing; bool m_bAllowDocumentScripting; + bool m_bHasBeenRecovered; enum StoreType { SAVE, SAVE_AS }; /** stores the document to the given URL, rebases it to the respective new storage, if necessary, resets diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx index 890998486424..6ab664d7600d 100644 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx @@ -34,7 +34,10 @@ #include #include #include +#include #include +#include +#include /** === end UNO includes === **/ #include @@ -73,14 +76,12 @@ namespace dbaccess using ::com::sun::star::io::XOutputStream; using ::com::sun::star::io::XTextOutputStream; using ::com::sun::star::io::XActiveDataSource; + using ::com::sun::star::io::XTextInputStream; + using ::com::sun::star::io::XActiveDataSink; /** === end UNO using === **/ namespace ElementModes = ::com::sun::star::embed::ElementModes; - - //==================================================================== - //= MapStringToString - //==================================================================== - typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > MapStringToString; + namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; //==================================================================== //= helpers @@ -88,90 +89,143 @@ namespace dbaccess namespace { // ......................................................................... - const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() + enum SubComponentType { - static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); - return s_sRecDataStorName; - } + TABLE = DatabaseObject::TABLE, + QUERY = DatabaseObject::QUERY, + FORM = DatabaseObject::FORM, + REPORT = DatabaseObject::REPORT, + + RELATION_DESIGN = 1000, + + UNKNOWN = 10001 + }; + + struct SubComponentDescriptor + { + ::rtl::OUString sName; + bool bForEditing; + + SubComponentDescriptor() + :sName() + ,bForEditing( false ) + { + } + + SubComponentDescriptor( const ::rtl::OUString& i_rName, const bool i_bForEditing ) + :sName( i_rName ) + ,bForEditing( i_bForEditing ) + { + } + }; + + // ......................................................................... + typedef ::std::hash_map< ::rtl::OUString, SubComponentDescriptor, ::rtl::OUStringHash > MapStringToCompDesc; + typedef ::std::map< SubComponentType, MapStringToCompDesc > MapCompTypeToCompDescs; // ......................................................................... - const ::rtl::OUString& lcl_getFormsStorageName() + void lcl_getPersistentRepresentation( const MapStringToCompDesc::value_type& i_rComponentDesc, ::rtl::OUStringBuffer& o_rBuffer ) { - static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); - return s_sFormsStorageName; + o_rBuffer.append( i_rComponentDesc.first ); + o_rBuffer.append( sal_Unicode( '=' ) ); + o_rBuffer.append( i_rComponentDesc.second.sName ); + o_rBuffer.append( sal_Unicode( ',' ) ); + o_rBuffer.append( sal_Unicode( i_rComponentDesc.second.bForEditing ? '1' : '0' ) ); } // ......................................................................... - const ::rtl::OUString& lcl_getReportsStorageName() + bool lcl_extractCompDesc( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc ) { - static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); - return s_sReportsStorageName; + const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( sal_Unicode( '=' ) ); + if ( nEqualSignPos < 1 ) + { + OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of '='" ); + return false; + } + o_rStorName = i_rIniLine.copy( 0, nEqualSignPos ); + + const sal_Int32 nCommaPos = i_rIniLine.lastIndexOf( sal_Unicode( ',' ) ); + if ( nCommaPos != i_rIniLine.getLength() - 2 ) + { + OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of ','" ); + return false; + } + o_rCompDesc.sName = i_rIniLine.copy( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 ); + o_rCompDesc.bForEditing = ( i_rIniLine.getStr()[ nCommaPos + 1 ] == '1' ); + return true; } // ......................................................................... - const ::rtl::OUString& lcl_getObjectMapStreamName() + SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) { - static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); - return s_sObjectMapStreamName; + switch ( i_nObjectType ) + { + case DatabaseObject::TABLE: return TABLE; + case DatabaseObject::QUERY: return QUERY; + case DatabaseObject::FORM: return FORM; + case DatabaseObject::REPORT:return REPORT; + default: + break; + } + return UNKNOWN; } // ......................................................................... - enum SubComponentType + const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() { - WRITER_FORM, - WRITER_REPORT, - SRB_REPORT, - TABLE_DESIGN, - QUERY_DESIGN, - TABLE_DATA_VIEW, - RELATION_DESIGN, - - UNKNOWN - }; + static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); + return s_sRecDataStorName; + } // ......................................................................... - SubComponentType lcl_identifyComponent_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XComponent >& i_rComponent ) + const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType ) { - Reference< XModuleManager > xModuleManager( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); - const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( i_rComponent ); + static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); + static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); + static const ::rtl::OUString s_sTablesStorageName( RTL_CONSTASCII_USTRINGPARAM( "tables" ) ); + static const ::rtl::OUString s_sQueriesStorageName( RTL_CONSTASCII_USTRINGPARAM( "queries" ) ); + static const ::rtl::OUString s_sRelationsStorageName( RTL_CONSTASCII_USTRINGPARAM( "relations" ) ); - struct ComponentTypeMapping - { - const sal_Char* pAsciiModuleName; - SubComponentType eComponentType; - }; - const ComponentTypeMapping aKnownCompTypes[] = + switch ( i_eType ) { - { "com.sun.star.sdb.FormDesign", WRITER_FORM }, - { "com.sun.star.sdb.TextReportDesign", WRITER_REPORT }, - { "com.sun.star.report.ReportDefinition", WRITER_REPORT }, - { "com.sun.star.sdb.TableDesign", TABLE_DESIGN }, - { "com.sun.star.sdb.QueryDesign", QUERY_DESIGN }, - { "com.sun.star.sdb.TableDataView", TABLE_DATA_VIEW }, - { "com.sun.star.sdb.RelationDesign", RELATION_DESIGN } - }; - - for ( size_t i=0; i < sizeof( aKnownCompTypes ) / sizeof( aKnownCompTypes[0] ); ++i ) - { - if ( sModuleIdentifier.equalsAscii( aKnownCompTypes[i].pAsciiModuleName ) ) - return aKnownCompTypes[i].eComponentType; + case FORM: + return s_sFormsStorageName; + case REPORT: + return s_sReportsStorageName; + case TABLE: + return s_sTablesStorageName; + case QUERY: + return s_sQueriesStorageName; + case RELATION_DESIGN: + return s_sRelationsStorageName; + default: + break; } - #if OSL_DEBUG_LEVEL > 0 - ::rtl::OStringBuffer message; - message.append( "lcl_identifyComponent_throw: unknown module identifier: '" ); - message.append( ::rtl::OUStringToOString( sModuleIdentifier, RTL_TEXTENCODING_ASCII_US ) ); - message.append( "'" ); - OSL_ENSURE( false, message.makeStringAndClear().getStr() ); - #endif - return UNKNOWN; + OSL_ENSURE( false, "lcl_getComponentsStorageName: unimplemented case!" ); + static const ::rtl::OUString s_sFallback; + return s_sFallback; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getObjectMapStreamName() + { + static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); + return s_sObjectMapStreamName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getMapStreamEncodingName() + { + static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) ); + return s_sMapStreamEncodingName; } // ......................................................................... void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, - const MapStringToString& i_mapStorageToObjectName ) + const MapStringToCompDesc& i_mapStorageToCompDesc ) { - if ( i_mapStorageToObjectName.empty() ) + if ( i_mapStorageToCompDesc.empty() ) // nothing to do return; @@ -180,7 +234,7 @@ namespace dbaccess lcl_getObjectMapStreamName(), ElementModes::WRITE | ElementModes::TRUNCATE ), UNO_SET_THROW ); Reference< XTextOutputStream > xTextOutput( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW ); - xTextOutput->setEncoding( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "utf-8" ) ) ); + xTextOutput->setEncoding( lcl_getMapStreamEncodingName() ); Reference< XActiveDataSource > xDataSource( xTextOutput, UNO_QUERY_THROW ); xDataSource->setOutputStream( xIniStream->getOutputStream() ); @@ -189,21 +243,94 @@ namespace dbaccess xTextOutput->writeString( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) ); xTextOutput->writeString( sLineFeed ); - for ( MapStringToString::const_iterator stor = i_mapStorageToObjectName.begin(); - stor != i_mapStorageToObjectName.end(); + for ( MapStringToCompDesc::const_iterator stor = i_mapStorageToCompDesc.begin(); + stor != i_mapStorageToCompDesc.end(); ++stor ) { ::rtl::OUStringBuffer aLine; - aLine.append( stor->first ); - aLine.append( sal_Unicode( '=' ) ); - aLine.append( stor->second ); + lcl_getPersistentRepresentation( *stor, aLine ); aLine.append( sLineFeed ); + xTextOutput->writeString( aLine.makeStringAndClear() ); } xTextOutput->writeString( sLineFeed ); } + + // ......................................................................... + bool lcl_isSectionStart( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rSectionName ) + { + const sal_Int32 nLen = i_rIniLine.getLength(); + if ( ( nLen > 0 ) && ( i_rIniLine.getStr()[0] == '[' ) && ( i_rIniLine.getStr()[ nLen - 1 ] == ']' ) ) + { + o_rSectionName = i_rIniLine.copy( 1, nLen -2 ); + return true; + } + return false; + } + + // ......................................................................... + void lcl_stripTrailingLineFeed( ::rtl::OUString& io_rLine ) + { + const sal_Int32 nLen = io_rLine.getLength(); + if ( ( nLen > 0 ) && ( io_rLine.getStr()[ nLen - 1 ] == '\n' ) ) + io_rLine = io_rLine.copy( 0, nLen - 1 ); + } + + // ......................................................................... + void lcl_readObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + MapStringToCompDesc& o_mapStorageToObjectName ) + { + ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); + if ( !i_rStorage->hasByName( lcl_getObjectMapStreamName() ) ) + { // nothing to do, though suspicious + OSL_ENSURE( false, "lcl_readObjectMap_throw: if there's no map file, then there's expected to be no storage, too!" ); + return; + } + + Reference< XStream > xIniStream( i_rStorage->openStreamElement( + lcl_getObjectMapStreamName(), ElementModes::READ ), UNO_SET_THROW ); + + Reference< XTextInputStream > xTextInput( i_rContext.createComponent( "com.sun.star.io.TextInputStream" ), UNO_QUERY_THROW ); + xTextInput->setEncoding( lcl_getMapStreamEncodingName() ); + + Reference< XActiveDataSink > xDataSink( xTextInput, UNO_QUERY_THROW ); + xDataSink->setInputStream( xIniStream->getInputStream() ); + + ::rtl::OUString sCurrentSection; + bool bCurrentSectionIsKnownToBeUnsupported = true; + while ( !xTextInput->isEOF() ) + { + ::rtl::OUString sLine = xTextInput->readLine(); + lcl_stripTrailingLineFeed( sLine ); + + if ( sLine.getLength() == 0 ) + continue; + + if ( lcl_isSectionStart( sLine, sCurrentSection ) ) + { + bCurrentSectionIsKnownToBeUnsupported = false; + continue; + } + + if ( bCurrentSectionIsKnownToBeUnsupported ) + continue; + + // the only section we support so far is "storages" + if ( !sCurrentSection.equalsAscii( "storages" ) ) + { + bCurrentSectionIsKnownToBeUnsupported = true; + continue; + } + + ::rtl::OUString sStorageName; + SubComponentDescriptor aCompDesc; + if ( !lcl_extractCompDesc( sLine, sStorageName, aCompDesc ) ) + continue; + o_mapStorageToObjectName[ sStorageName ] = aCompDesc; + } + } } //==================================================================== @@ -211,12 +338,10 @@ namespace dbaccess //==================================================================== struct DatabaseDocumentRecovery_Data { - const ::comphelper::ComponentContext aContext; - const Reference< XStorage > xDocSalvageStorage; + const ::comphelper::ComponentContext aContext; - DatabaseDocumentRecovery_Data( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rDocumentSalvageStorage ) + DatabaseDocumentRecovery_Data( const ::comphelper::ComponentContext& i_rContext ) :aContext( i_rContext ) - ,xDocSalvageStorage( i_rDocumentSalvageStorage ) { } }; @@ -231,42 +356,45 @@ namespace dbaccess const Reference< XComponent >& i_rComponent ) :m_rContext( i_rContext ) ,m_xComponent( i_rComponent ) + ,m_eType( UNKNOWN ) + ,m_aCompDesc() { - ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); - - // retrieve the name of the object to which the component belongs to - Pair< sal_Int32, ::rtl::OUString > aComponentIdentity = i_rController->identifySubComponent( i_rComponent ); - m_sObjectName = aComponentIdentity.Second; + impl_identifyComponent_throw( i_rController ); } - void saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapStringToString& io_mapStorageToObjectName ); + void saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapCompTypeToCompDescs& io_mapCompDescs ); private: - void impl_saveWriterSubComponent_throw( - const SubComponentType i_eType, - const Reference< XStorage >& i_rRecoveryStorage, - MapStringToString& io_mapStorageToObjectName - ); + void impl_saveSubDocument_throw( + const Reference< XStorage >& i_rRecoveryStorage, + MapStringToCompDesc& io_mapStorageToCompDesc + ); + + void impl_identifyComponent_throw( + const Reference< XDatabaseDocumentUI >& i_rController + ); private: const ::comphelper::ComponentContext& m_rContext; const Reference< XComponent > m_xComponent; - ::rtl::OUString m_sObjectName; + SubComponentType m_eType; + SubComponentDescriptor m_aCompDesc; }; //-------------------------------------------------------------------- - void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapStringToString& io_mapStorageToObjectName ) + void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, + MapCompTypeToCompDescs& io_mapCompDescs ) { - SubComponentType eComponentType = lcl_identifyComponent_throw( m_rContext, m_xComponent ); - if ( eComponentType == UNKNOWN ) - // quite fatal, but has already been reported as assertion in lcl_identifyComponent_throw + + if ( m_eType == UNKNOWN ) + // quite fatal, but has already been reported (as assertion) before return; - switch ( eComponentType ) + switch ( m_eType ) { - case WRITER_FORM: - case WRITER_REPORT: - impl_saveWriterSubComponent_throw( eComponentType, i_rRecoveryStorage, io_mapStorageToObjectName ); + case FORM: + case REPORT: + impl_saveSubDocument_throw( i_rRecoveryStorage, io_mapCompDescs[ m_eType ] ); break; default: @@ -276,36 +404,86 @@ namespace dbaccess } } + // ......................................................................... + void SubComponentRecovery::impl_identifyComponent_throw( const Reference< XDatabaseDocumentUI >& i_rController ) + { + ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); + + // ask the controller + Pair< sal_Int32, ::rtl::OUString > aComponentIdentity = i_rController->identifySubComponent( m_xComponent ); + m_eType = lcl_databaseObjectToSubComponentType( aComponentIdentity.First ); + m_aCompDesc.sName = aComponentIdentity.Second; + + // what the controller didn't give us is the information whether this is in edit mode or not ... + Reference< XModuleManager > xModuleManager( m_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( m_xComponent ); + + switch ( m_eType ) + { + case TABLE: + m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.TableDesign" ); + break; + + case QUERY: + m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.QueryDesign" ); + break; + + case REPORT: + if ( sModuleIdentifier.equalsAscii( "com.sun.star.report.ReportDefinition" ) ) + { + // it's an SRB report desginer + m_aCompDesc.bForEditing = true; + break; + } + // fall through + + case FORM: + // TODO: how to know whether the thing is opened for editing? + break; + + default: + if ( sModuleIdentifier.equalsAscii( "com.sun.star.sdb.RelationDesign" ) ) + { + m_eType = RELATION_DESIGN; + m_aCompDesc.bForEditing = true; + } + else + { + OSL_ENSURE( false, "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the given sub component!" ); + } + break; + } + + OSL_POSTCOND( m_eType != UNKNOWN, + "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the component!" ); + } + //-------------------------------------------------------------------- - void SubComponentRecovery::impl_saveWriterSubComponent_throw( const SubComponentType i_eType, const Reference< XStorage >& i_rRecoveryStorage, - MapStringToString& io_mapStorageToObjectName ) + void SubComponentRecovery::impl_saveSubDocument_throw( const Reference< XStorage >& i_rRecoveryStorage, + MapStringToCompDesc& io_mapStorageToCompDesc ) { - ENSURE_OR_THROW( ( i_eType == WRITER_FORM ) || ( i_eType == WRITER_REPORT ), "illegal sub component type" ); + ENSURE_OR_THROW( ( m_eType == FORM ) || ( m_eType == REPORT ), "illegal sub component type" ); ENSURE_OR_THROW( i_rRecoveryStorage.is(), "illegal storage" ); // open the sub storage for the given kind of documents - const ::rtl::OUString& rStorageName( i_eType == WRITER_FORM ? lcl_getFormsStorageName() : lcl_getReportsStorageName() ); - const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement( rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + const ::rtl::OUString& rStorageName( lcl_getComponentsStorageName( m_eType ) ); + const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement( + rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); // find a free sub storage name, and create Yet Another Sub Storage - const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( i_eType == WRITER_FORM ? "form" : "report" ) ); + const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( m_eType == FORM ? "form" : "report" ) ); const ::rtl::OUString sCompStorName = ::dbtools::createUniqueName( xDocsStor.get(), sBaseName, true ); - const Reference< XStorage > xCompStor( xDocsStor->openStorageElement( sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + const Reference< XStorage > xCompStor( xDocsStor->openStorageElement( + sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW ); // store the document into the storage Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW ); xStorageDocument->storeToStorage( xCompStor, Sequence< PropertyValue >() ); - // remember the map from the component name to the storage name - ::rtl::OUStringBuffer aSubStoragePath; - aSubStoragePath.append( rStorageName ); - aSubStoragePath.append( sal_Unicode( '/' ) ); - aSubStoragePath.append( sCompStorName ); - const ::rtl::OUString sSubStoragePath = aSubStoragePath.makeStringAndClear(); - - OSL_ENSURE( io_mapStorageToObjectName.find( sSubStoragePath ) == io_mapStorageToObjectName.end(), - "SubComponentRecoverys::impl_saveWriterSubComponent_throw: object name already used!" ); - io_mapStorageToObjectName[ sSubStoragePath ] = m_sObjectName; + // remember the relationship between the component name to the storage name + OSL_ENSURE( io_mapStorageToCompDesc.find( sCompStorName ) == io_mapStorageToCompDesc.end(), + "SubComponentRecoverys::impl_saveSubDocument_throw: object name already used!" ); + io_mapStorageToCompDesc[ sCompStorName ] = m_aCompDesc; // commit the storage for the documents collection tools::stor::commitStorageIfWriteable( xDocsStor ); @@ -315,10 +493,9 @@ namespace dbaccess //= DatabaseDocumentRecovery //==================================================================== //-------------------------------------------------------------------- - DatabaseDocumentRecovery::DatabaseDocumentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rDocumentSalvageStorage ) - :m_pData( new DatabaseDocumentRecovery_Data( i_rContext, i_rDocumentSalvageStorage ) ) + DatabaseDocumentRecovery::DatabaseDocumentRecovery( const ::comphelper::ComponentContext& i_rContext ) + :m_pData( new DatabaseDocumentRecovery_Data( i_rContext ) ) { - ENSURE_OR_THROW( m_pData->xDocSalvageStorage.is(), "invalid document storage" ); } //-------------------------------------------------------------------- @@ -327,12 +504,15 @@ namespace dbaccess } //-------------------------------------------------------------------- - void DatabaseDocumentRecovery::saveModifiedSubComponents( const ::std::vector< Reference< XController > >& i_rControllers ) + void DatabaseDocumentRecovery::saveModifiedSubComponents( const Reference< XStorage >& i_rTargetStorage, + const ::std::vector< Reference< XController > >& i_rControllers ) { + ENSURE_OR_THROW( i_rTargetStorage.is(), "invalid document storage" ); + // create a sub storage for recovery data - if ( m_pData->xDocSalvageStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) - m_pData->xDocSalvageStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); - Reference< XStorage > xRecoveryStorage = m_pData->xDocSalvageStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); + if ( i_rTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + i_rTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); + Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); // store recovery data for open sub components of the given controller(s) if ( !i_rControllers.empty() ) @@ -343,7 +523,7 @@ namespace dbaccess // and the user opens the very same form in both views). And depending on this, we need a concept for // how those are saved to the recovery file. - MapStringToString aMapStorageToObjectName; + MapCompTypeToCompDescs aMapCompDescs; for ( ::std::vector< Reference< XController > >::const_iterator ctrl = i_rControllers.begin(); ctrl != i_rControllers.end(); @@ -358,17 +538,94 @@ namespace dbaccess for ( ; component != componentEnd; ++component ) { SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, *component ); - aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapStorageToObjectName ); + aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapCompDescs ); } } - lcl_writeObjectMap_throw( m_pData->aContext, xRecoveryStorage, aMapStorageToObjectName ); + for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); + map != aMapCompDescs.end(); + ++map + ) + { + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( map->first ), ElementModes::WRITE | ElementModes::NOCREATE ) ); + lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, map->second ); + tools::stor::commitStorageIfWriteable( xComponentsStor ); + } } // commit the recovery storage tools::stor::commitStorageIfWriteable( xRecoveryStorage ); } + //-------------------------------------------------------------------- + void DatabaseDocumentRecovery::recoverSubDocuments( const Reference< XStorage >& i_rDocumentStorage, + const Reference< XController >& i_rTargetController ) + { + ENSURE_OR_THROW( i_rDocumentStorage.is(), "illegal document storage" ); + ENSURE_OR_THROW( i_rTargetController.is(), "illegal controller" ); + + if ( !i_rDocumentStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + // that's allowed + return; + + // the "recovery" sub storage + Reference< XStorage > xRecoveryStorage = i_rDocumentStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READ ); + + // read the map from sub storages to object names + MapCompTypeToCompDescs aMapCompDescs; + SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; + for ( size_t i = 0; i < sizeof( aKnownTypes ) / sizeof( aKnownTypes[0] ); ++i ) + { + if ( !xRecoveryStorage->hasByName( lcl_getComponentsStorageName( aKnownTypes[i] ) ) ) + continue; + + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( aKnownTypes[i] ), ElementModes::READ ) ); + lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownTypes[i] ] ); + xComponentsStor->dispose(); + } + + // recover all sub components as indicated by the map + for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); + map != aMapCompDescs.end(); + ++map + ) + { + // the storage for all components of the current type + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( map->first ), ElementModes::READ ), UNO_QUERY_THROW ); + + // loop thru all components of this type + for ( MapStringToCompDesc::const_iterator stor = map->second.begin(); + stor != map->second.end(); + ++stor + ) + { + if ( !xComponentsStor->hasByName( stor->first ) ) + { + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer message; + message.append( "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" ); + message.append( ::rtl::OUStringToOString( stor->first, RTL_TEXTENCODING_ASCII_US ) ); + message.append( "' not found in '" ); + message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( map->first ), RTL_TEXTENCODING_ASCII_US ) ); + message.append( "', but required per map file!" ); + OSL_ENSURE( false, message.makeStringAndClear() ); + #endif + continue; + } + + // recover the single component + Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) ); + // TODO + xCompStor->dispose(); + } + + xComponentsStor->dispose(); + } + } + //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.hxx b/dbaccess/source/core/dataaccess/dbdocrecovery.hxx index 0fa4fb62758e..0bf44e2bf3e8 100644 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.hxx +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.hxx @@ -52,18 +52,33 @@ namespace dbaccess { public: DatabaseDocumentRecovery( - const ::comphelper::ComponentContext& i_rContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentSalvageStorage + const ::comphelper::ComponentContext& i_rContext ); ~DatabaseDocumentRecovery(); /** saves the modified sub components of the given controller(s) to the "recovery" sub storage of the document storage. + + @throws ::com::sun::star::uno::Exception + in case of an error. */ void saveModifiedSubComponents( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rTargetStorage, const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >& i_rControllers ); + /** recovery sub components from the given document storage, if applicable + + If the given document storage does not contain a recovery folder, the method silently returns. + + @throws ::com::sun::star::uno::Exception + in case of an error. + */ + void recoverSubDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentStorage, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& i_rTargetController + ); + private: const ::std::auto_ptr< DatabaseDocumentRecovery_Data > m_pData; }; diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 9ba06976e555..806168ae5da3 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -85,6 +85,7 @@ #endif #include "core_resource.hxx" #include "core_resource.hrc" +#include #include #include @@ -570,28 +571,15 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const { Command aCommand; - static const ::rtl::OUString s_sOpenMode = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode")); - const PropertyValue* pIter = Arguments.getConstArray(); - const PropertyValue* pEnd = pIter + Arguments.getLength(); - for( ; pIter != pEnd ; ++pIter) - { - if ( pIter->Name == s_sOpenMode ) - { - pIter->Value >>= aCommand.Name; - break; - } - } - if ( !aCommand.Name.getLength() ) // default mode - aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("open")); + ::comphelper::NamedValueCollection aArgs( Arguments ); + aCommand.Name = aArgs.getOrDefault( "OpenMode", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "open" ) ) ); + aArgs.remove( "OpenMode" ); + OpenCommandArgument2 aOpenCommand; aOpenCommand.Mode = OpenMode::DOCUMENT; + aArgs.put( "OpenCommandArgument", aOpenCommand ); - Sequence< PropertyValue > aArguments(Arguments); - sal_Int32 nLen = aArguments.getLength(); - aArguments.realloc(nLen + 1); - - aArguments[nLen].Value <<= aOpenCommand; - aCommand.Argument <<= aArguments; + aCommand.Argument <<= aArgs.getPropertyValues(); xComp.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); } } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 8643a455ce23..49b35a05e6af 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1689,7 +1689,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x // the com.sun.star.report.pentaho.SOReportJobFactory is not present. if ( !m_bForm && !sDocumentService.equalsAscii("com.sun.star.text.TextDocument")) { - // we seems to be a new report, check if report extension is present. + // we seem to be a "new style" report, check if report extension is present. Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); const ::rtl::OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_aContext.getLegacyServiceFactory()); Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName); -- cgit v1.2.3 From 5d0d44c20399add14eb574e9b068dceaf081f686 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 15 Jan 2010 15:21:15 +0100 Subject: autorecovery: save/recover forms and reports Still some lose ends. Most notably, the current code contains cases for other sub component types, but has no real implementation - attempting to save/recover those other types will yield multiple assertions only. Also, recovery of SRB-reports has not been tested, yet, chances are good there's some work ahead here. Other known open issues: - recovering sub components immediately shows them, instead of initially hiding them, and showing only when the main document window is shown - the implementation currently is no real session save, which would require saving information about *unmodified* open sub components (though not their actual content), and restoring them upon recovery. - doing an implicit "connect" at the controller of the to-be-recovered database document is a requirement to actually load the sub components, but might yield problems in case this requires interaction (e.g. a login). Need to investigate - the "recovery" storage is not removed from the database document storage after un/successful recovery - cancelling the recovery of a "modified" database document always suggests to store this doc somewhere --- dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 62 +++++++++++++++++++-- .../source/core/dataaccess/documentdefinition.cxx | 65 +++++++++++++--------- .../source/core/dataaccess/documentdefinition.hxx | 27 ++++++++- 3 files changed, 121 insertions(+), 33 deletions(-) diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx index 6ab664d7600d..9770808b98e5 100644 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx @@ -38,9 +38,11 @@ #include #include #include +#include /** === end UNO includes === **/ #include +#include #include #include #include @@ -78,6 +80,8 @@ namespace dbaccess using ::com::sun::star::io::XActiveDataSource; using ::com::sun::star::io::XTextInputStream; using ::com::sun::star::io::XActiveDataSink; + using ::com::sun::star::frame::XModel; + using ::com::sun::star::util::XModifiable; /** === end UNO using === **/ namespace ElementModes = ::com::sun::star::embed::ElementModes; @@ -331,6 +335,36 @@ namespace dbaccess o_mapStorageToObjectName[ sStorageName ] = aCompDesc; } } + + // ......................................................................... + bool lcl_determineReadOnly( const Reference< XComponent >& i_rComponent ) + { + Reference< XModel > xDocument( i_rComponent, UNO_QUERY ); + if ( !xDocument.is() ) + { + Reference< XController > xController( i_rComponent, UNO_QUERY_THROW ); + xDocument = xController->getModel(); + } + + if ( !xDocument.is() ) + return false; + + ::comphelper::NamedValueCollection aDocArgs( xDocument->getArgs() ); + return aDocArgs.getOrDefault( "ReadOnly", false ); + } + + // ......................................................................... + void lcl_markModified( const Reference< XComponent >& i_rSubComponent ) + { + const Reference< XModifiable > xModify( i_rSubComponent, UNO_QUERY ); + if ( !xModify.is() ) + { + OSL_ENSURE( false, "lcl_markModified: unhandled case!" ); + return; + } + + xModify->setModified( sal_True ); + } } //==================================================================== @@ -404,7 +438,7 @@ namespace dbaccess } } - // ......................................................................... + //-------------------------------------------------------------------- void SubComponentRecovery::impl_identifyComponent_throw( const Reference< XDatabaseDocumentUI >& i_rController ) { ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); @@ -438,7 +472,7 @@ namespace dbaccess // fall through case FORM: - // TODO: how to know whether the thing is opened for editing? + m_aCompDesc.bForEditing = !lcl_determineReadOnly( m_xComponent ); break; default: @@ -563,7 +597,7 @@ namespace dbaccess const Reference< XController >& i_rTargetController ) { ENSURE_OR_THROW( i_rDocumentStorage.is(), "illegal document storage" ); - ENSURE_OR_THROW( i_rTargetController.is(), "illegal controller" ); + Reference< XDatabaseDocumentUI > xDocumentUI( i_rTargetController, UNO_QUERY_THROW ); if ( !i_rDocumentStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) // that's allowed @@ -616,10 +650,28 @@ namespace dbaccess continue; } + // the controller needs to have a connection to be able to open sub components + if ( !xDocumentUI->isConnected() ) + xDocumentUI->connect(); + // recover the single component Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) ); - // TODO - xCompStor->dispose(); + + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "RecoverFromStorage", xCompStor ); + try + { + Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( map->first, stor->second.sName, stor->second.bForEditing, + aLoadArgs.getPropertyValues() ); + + // at the moment, we only store, during session save, sub components which are modified. So, set this + // recovered sub component to "modified", too. + lcl_markModified( xSubComponent ); + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } xComponentsStor->dispose(); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 49b35a05e6af..d2fb5b15c405 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1117,16 +1117,6 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co Reference< XStorage> xStorage = getContainerStorage(); // ----------------------------------------------------------------------------- xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xDest,sPersistentName); - /*loadEmbeddedObject( true ); - Reference xPersist(m_xEmbeddedObject,UNO_QUERY); - if ( xPersist.is() ) - { - xPersist->storeToEntry(xStorage,sPersistentName,Sequence(),Sequence()); - xPersist->storeOwn(); - m_xEmbeddedObject->changeState(EmbedStates::LOADED); - } - else - throw CommandAbortedException();*/ } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preview" ) ) ) { @@ -1577,9 +1567,25 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const return lcl_determineContentType_nothrow( getContainerStorage(), m_pImpl->m_aProps.sPersistentName ); } +// ----------------------------------------------------------------------------- +void ODocumentDefinition::separateOpenCommandArguments( const Sequence< PropertyValue >& i_rOpenCommandArguments, + ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor ) +{ + ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); + o_rDocumentLoadArgs.merge( aOpenCommandArguments, false ); + + // the only OpenCommandArgument so far, which belongs into the EmbeddedObjectDescriptor, and not the document's + // media descriptor, is RecoverFromStorage + if ( aOpenCommandArguments.has( "RecoverFromStorage" ) ) + { + o_rEmbeddedObjectDescriptor.put( "RecoverFromStorage", aOpenCommandArguments.get( "RecoverFromStorage" ) ); + o_rDocumentLoadArgs.remove( "RecoverFromStorage" ); + } +} + // ----------------------------------------------------------------------------- Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XConnection>& _xConnection, const bool _bSuppressMacros, const bool _bReadOnly, - const Sequence< PropertyValue >& _rAdditionalArgs, Sequence< PropertyValue >& _out_rEmbeddedObjectDescriptor ) + const Sequence< PropertyValue >& i_rOpenCommandArguments, Sequence< PropertyValue >& _out_rEmbeddedObjectDescriptor ) { // ......................................................................... // (re-)create interceptor, and put it into the descriptor of the embedded object @@ -1597,6 +1603,10 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC ::comphelper::NamedValueCollection aEmbeddedDescriptor; aEmbeddedDescriptor.put( "OutplaceDispatchInterceptor", xInterceptor ); + // ......................................................................... + ::comphelper::NamedValueCollection aMediaDesc; + separateOpenCommandArguments( i_rOpenCommandArguments, aMediaDesc, aEmbeddedDescriptor ); + // ......................................................................... // create the OutplaceFrameProperties, and put them into the descriptor of the embedded object ::comphelper::NamedValueCollection OutplaceFrameProperties; @@ -1638,9 +1648,6 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC // pass the descriptor of the embedded object to the caller aEmbeddedDescriptor >>= _out_rEmbeddedObjectDescriptor; - // ......................................................................... - ::comphelper::NamedValueCollection aMediaDesc( _rAdditionalArgs ); - // ......................................................................... // create the ComponentData, and put it into the document's media descriptor { @@ -1663,7 +1670,7 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC } // ----------------------------------------------------------------------------- void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _xConnection, const Sequence< sal_Int8 >& _aClassID, - const Sequence< PropertyValue >& _rAdditionalArgs, const bool _bSuppressMacros, const bool _bReadOnly ) + const Sequence< PropertyValue >& i_rOpenCommandArguments, const bool _bSuppressMacros, const bool _bReadOnly ) { if ( !m_xEmbeddedObject.is() ) { @@ -1716,7 +1723,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x Sequence< PropertyValue > aEmbeddedObjectDescriptor; Sequence< PropertyValue > aLoadArgs( fillLoadArgs( - _xConnection, _bSuppressMacros, _bReadOnly, _rAdditionalArgs, aEmbeddedObjectDescriptor ) ); + _xConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) ); m_xEmbeddedObject.set(xEmbedFactory->createInstanceUserInit(aClassID ,sDocumentService @@ -1761,7 +1768,7 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x Sequence< PropertyValue > aEmbeddedObjectDescriptor; Sequence< PropertyValue > aLoadArgs( fillLoadArgs( - _xConnection, _bSuppressMacros, _bReadOnly, _rAdditionalArgs, aEmbeddedObjectDescriptor ) ); + _xConnection, _bSuppressMacros, _bReadOnly, i_rOpenCommandArguments, aEmbeddedObjectDescriptor ) ); Reference xCommon(m_xEmbeddedObject,UNO_QUERY); OSL_ENSURE(xCommon.is(),"unsupported interface!"); @@ -1778,21 +1785,25 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x // then just re-set some model parameters try { - Reference< XModel > xModel( getComponent(), UNO_QUERY_THROW ); - Sequence< PropertyValue > aArgs = xModel->getArgs(); - - ::comphelper::NamedValueCollection aMediaDesc( aArgs ); - ::comphelper::NamedValueCollection aArguments( _rAdditionalArgs ); - aMediaDesc.merge( aArguments, sal_False ); - - lcl_putLoadArgs( aMediaDesc, optional_bool(), optional_bool() ); + // ensure the media descriptor doesn't contain any values which are intended for the + // EmbeddedObjectDescriptor only + ::comphelper::NamedValueCollection aEmbeddedObjectDescriptor; + ::comphelper::NamedValueCollection aNewMediaDesc; + separateOpenCommandArguments( i_rOpenCommandArguments, aNewMediaDesc, aEmbeddedObjectDescriptor ); + + // merge the new media descriptor into the existing media descriptor + const Reference< XModel > xModel( getComponent(), UNO_QUERY_THROW ); + const Sequence< PropertyValue > aArgs = xModel->getArgs(); + ::comphelper::NamedValueCollection aExistentMediaDesc( aArgs ); + aExistentMediaDesc.merge( aNewMediaDesc, sal_False ); + + lcl_putLoadArgs( aExistentMediaDesc, optional_bool(), optional_bool() ); // don't put _bSuppressMacros and _bReadOnly here - if the document was already // loaded, we should not tamper with its settings. // #i88977# / 2008-05-05 / frank.schoenheit@sun.com // #i86872# / 2008-03-13 / frank.schoenheit@sun.com - aMediaDesc >>= aArgs; - xModel->attachResource( xModel->getURL(), aArgs ); + xModel->attachResource( xModel->getURL(), aExistentMediaDesc.getPropertyValues() ); } catch( const Exception& ) { diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 2d8d5f6df343..5b2c43521f6b 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -67,6 +67,11 @@ #include #include +namespace comphelper +{ + class NamedValueCollection; +} + //........................................................................ namespace dbaccess { @@ -247,10 +252,30 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, const bool _bSuppressMacros, const bool _bReadOnly, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rAdditionalArgs, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rOpenCommandArguments, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rEmbeddedObjectDescriptor ); + /** splits the given arguments to an "open*" command into arguments for loading the document, and arguments to be + put into the EmbeddedObjectDescriptor + + Any values already present in o_rDocumentLoadArgs and o_rEmbeddedObjectDescriptor + will be overwritten by values from i_rOpenCommandArguments, if applicable, otherwise they will + be preserved. + + @param i_rOpenCommandArguments + the arguments passed to the "open*" command at the content + @param o_rDocumentLoadArgs + the arguments to be passed when actually loading the embedded document. + @param o_rEmbeddedObjectDescriptor + the EmbeddedObjectDescriptor to be passed when initializing the embedded object + */ + void separateOpenCommandArguments( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rOpenCommandArguments, + ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, + ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor + ); + /** loads the EmbeddedObject if not already loaded @param _aClassID If set, it will be used to create the embedded object. -- cgit v1.2.3 From 5fa3246b0dca2bf3cf7767695436152e142ddf80 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 15 Jan 2010 15:26:50 +0100 Subject: autorecovery: throw an exception when no storage can be created, otherwise we end up with a broken document --- dbaccess/source/filter/xml/xmlfilter.cxx | 114 +++++++++++++++---------------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 4fa30ee6885d..9c0aec576b67 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -117,6 +117,7 @@ #endif #include #include +#include #ifndef _SV_SVAPP_HXX //autogen #include #endif @@ -133,6 +134,7 @@ #include #include #include +#include #include #include #include @@ -514,72 +516,64 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) SfxMediumRef pMedium = new SfxMedium( sFileName, ( STREAM_READ | STREAM_NOCREATE ), FALSE, 0 ); uno::Reference< embed::XStorage > xStorage; - if( pMedium ) + try { - try - { - xStorage = pMedium->GetStorage( sal_False ); - // nError = pMedium->GetError(); - } - catch(const Exception&) - { - } + xStorage.set( pMedium->GetStorage( sal_False ), UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + Any aError = ::cppu::getCaughtException(); + if ( aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) ) + throw; + throw lang::WrappedTargetRuntimeException( ::rtl::OUString(), *this, aError ); } - OSL_ENSURE(xStorage.is(),"No Storage for read!"); - if ( xStorage.is() ) + uno::Reference xOfficeDoc(GetModel(),UNO_QUERY_THROW); + m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW); + uno::Reference xListener = new DatasourceURLListener(getServiceFactory()); + m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener); + uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY); + SetNumberFormatsSupplier(xNum); + + uno::Reference xModel(GetModel(),UNO_QUERY); + sal_Int32 nRet = ReadThroughComponent( xStorage + ,xModel + ,"settings.xml" + ,"Settings.xml" + ,getServiceFactory() + ,this + ); + + if ( nRet == 0 ) + nRet = ReadThroughComponent( xStorage + ,xModel + ,"content.xml" + ,"Content.xml" + ,getServiceFactory() + ,this + ); + + bRet = nRet == 0; + + if ( bRet ) { - uno::Reference xOfficeDoc(GetModel(),UNO_QUERY_THROW); - m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW); - uno::Reference xListener = new DatasourceURLListener(getServiceFactory()); - m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener); - uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY); - SetNumberFormatsSupplier(xNum); - - uno::Reference xModel(GetModel(),UNO_QUERY); - sal_Int32 nRet = ReadThroughComponent( xStorage - ,xModel - ,"settings.xml" - ,"Settings.xml" - ,getServiceFactory() - ,this - ); - - if ( nRet == 0 ) - nRet = ReadThroughComponent( xStorage - ,xModel - ,"content.xml" - ,"Content.xml" - ,getServiceFactory() - ,this - ); - - bRet = nRet == 0; - - if ( bRet ) - { - uno::Reference< XModifiable > xModi(GetModel(),UNO_QUERY); - if ( xModi.is() ) - xModi->setModified(sal_False); - } - else + uno::Reference< XModifiable > xModi(GetModel(),UNO_QUERY); + if ( xModi.is() ) + xModi->setModified(sal_False); + } + else + { + switch( nRet ) { - switch( nRet ) + case ERRCODE_IO_BROKENPACKAGE: + // TODO/LATER: no way to transport the error outside from the filter! + break; + default: { - case ERRCODE_IO_BROKENPACKAGE: - if( xStorage.is() ) - { - // TODO/LATER: no way to transport the error outside from the filter! - break; - } - // fall through intented - default: - { - // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! - ErrorHandler::HandleError( nRet ); - if( nRet & ERRCODE_WARNING_MASK ) - bRet = sal_True; - } + // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! + ErrorHandler::HandleError( nRet ); + if( nRet & ERRCODE_WARNING_MASK ) + bRet = sal_True; } } } -- cgit v1.2.3 From ea4181104caff5b7ad745faa5139a871439e3a35 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 15 Jan 2010 15:27:52 +0100 Subject: autorecovery: notifyEvent: care for multiple invocations, which are possible in some edge cases --- filter/source/config/cache/lateinitlistener.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/filter/source/config/cache/lateinitlistener.cxx b/filter/source/config/cache/lateinitlistener.cxx index c1999cb4a72e..ba32a5f0c738 100644 --- a/filter/source/config/cache/lateinitlistener.cxx +++ b/filter/source/config/cache/lateinitlistener.cxx @@ -59,7 +59,7 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiS // important to do so ... // Otherwhise the temp. reference to ourselves // will kill us at realeasing time! - ++m_refCount; + osl_incrementInterlockedCount( &m_refCount ); m_xBroadcaster = css::uno::Reference< css::document::XEventBroadcaster >( m_xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster")), @@ -67,7 +67,7 @@ LateInitListener::LateInitListener(const css::uno::Reference< css::lang::XMultiS m_xBroadcaster->addEventListener(static_cast< css::document::XEventListener* >(this)); - --m_refCount; + osl_decrementInterlockedCount( &m_refCount ); } /*----------------------------------------------- @@ -95,6 +95,16 @@ void SAL_CALL LateInitListener::notifyEvent(const css::document::EventObject& aE // SAFE -> ::osl::ResettableMutexGuard aLock(m_aLock); + if ( !m_xBroadcaster.is() ) + // the beauty of multi-threading ... OnLoad can be notified synchronously or asynchronously. In particular, + // SFX-based documents notify it synchronously, database documents do it asynchronously. + // Now if multiple documents are opened "at the same time", it is well possible that we get two events from + // different threads, where upon the first event, we already remove ourself from m_xBroadcaster, and start + // the thread, nonetheless there's also a second notification "in the queue", which will arrive short + // thereafter. + // In such a case, simply ignore this second event. + return; + m_xBroadcaster->removeEventListener(static_cast< css::document::XEventListener* >(this)); m_xBroadcaster.clear(); -- cgit v1.2.3 From eb4c085971f315ab5168522e80f8095af2778349 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Mon, 18 Jan 2010 16:09:06 +0100 Subject: #i108349# Added missing statement (compiler warning). --- store/source/storbios.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 9e01c0489d94..955c59f0acc8 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -1104,6 +1104,7 @@ storeError OStorePageBIOS::scanNext ( // Verify PageHead. eErrCode = aPageHead.verify (nAddr); + if (eErrCode != store_E_None) continue; // Check PageHead Magic number. -- cgit v1.2.3 From e5e9c6b22981d9ae35c8e16c0120f1bd94e6c011 Mon Sep 17 00:00:00 2001 From: tb121644 Date: Tue, 19 Jan 2010 15:46:03 +0100 Subject: #i106811# new global variable: gAutoUpdate --- .../framework/required/includes/wizard_firsttime.inc | 18 +++++++++++------- testautomation/global/system/includes/gvariabl.inc | 1 + testautomation/global/system/includes/master.inc | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/testautomation/framework/required/includes/wizard_firsttime.inc b/testautomation/framework/required/includes/wizard_firsttime.inc index 104f683b8442..9efcca098624 100755 --- a/testautomation/framework/required/includes/wizard_firsttime.inc +++ b/testautomation/framework/required/includes/wizard_firsttime.inc @@ -141,14 +141,18 @@ testcase tUpdtWizardFirsttime warnlog( "Could not access TabFirstStartUser" ) endif - kontext "TabFirstStartOnlineUpdate" - if ( TabFirstStartOnlineUpdate.exists( 2 ) ) then - call dialogtest( TabFirstStartOnlineUpdate ) - CheckForUpdates.unCheck() - kontext "WelcomeDialog" - NextBtn.click() + if (gAutoUpdate) then + kontext "TabFirstStartOnlineUpdate" + if ( TabFirstStartOnlineUpdate.exists( 2 ) ) then + call dialogtest( TabFirstStartOnlineUpdate ) + CheckForUpdates.unCheck() + kontext "WelcomeDialog" + NextBtn.click() + else + warnlog( "Online Update Page is missing" ) + endif else - warnlog( "Online Update Page is missing" ) + qaErrorlog( "Online Update Page is missing" ) endif diff --git a/testautomation/global/system/includes/gvariabl.inc b/testautomation/global/system/includes/gvariabl.inc index 52c9f9f54dd0..aef5a2dfb126 100755 --- a/testautomation/global/system/includes/gvariabl.inc +++ b/testautomation/global/system/includes/gvariabl.inc @@ -91,6 +91,7 @@ Global gAccessibility as Boolean '///+ gAccessibility => If an accessibility Global gProductName as string '///+ gProductName => Name of the product (StarOffice, OpenOffice.org, ...) Global gMacroSecurityLevel as integer'///+ gMacroSecurityLevel => Macro Security Level (0: Low ... 3: Very High) Global gOfficeVersion as string '///+ gOfficeVersion => The version number of the office like 3.1, 9.0 ... +Global gAutoUpdate as boolean '///+ gAutoUpdate => if office is able to request update streams '/// - global OLE-objectnames global gOLEWriter as String '///+ gOLEWriter => OLE-object-name for Writer diff --git a/testautomation/global/system/includes/master.inc b/testautomation/global/system/includes/master.inc index 718a7cf066cc..37f8320b804c 100755 --- a/testautomation/global/system/includes/master.inc +++ b/testautomation/global/system/includes/master.inc @@ -924,8 +924,10 @@ sub mMakeGeneralOptionsAPI ' At this point there is no needed to think about what to do, if it doesn't work. end if xViewRoot.dispose() + gAutoUpdate = TRUE catch qaErrorLog( sFileFunction & "This build does not support online update." ) + gAutoUpdate = FALSE endcatch '///+ OOo Improvement - only if BUILD_SPECIAL is set we have this file created. -- cgit v1.2.3 From 57c6684c0dfdb8a8d1eb34d449b95ed4c9cd8f59 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Jan 2010 16:48:52 +0100 Subject: sw33bf02: #i108347#: change util::Duration to support MilliSeconds: SfxDocumentMetaData: adapt. dinfdlg.src: adapt dialog to milliseconds. sax::Converter: adapt. sax::Converter::convertDuration(): fix a bug in parsing fractional seconds. --- offapi/com/sun/star/util/Duration.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/offapi/com/sun/star/util/Duration.idl b/offapi/com/sun/star/util/Duration.idl index 39f3ca8114ce..486b7ae1d6ba 100644 --- a/offapi/com/sun/star/util/Duration.idl +++ b/offapi/com/sun/star/util/Duration.idl @@ -90,9 +90,9 @@ struct Duration unsigned short Seconds; //-------------------------------------------------------------------- - /** contains the hundredth seconds. + /** contains the milliseconds. */ - unsigned short HundredthSeconds; + unsigned short MilliSeconds; }; -- cgit v1.2.3 From 6eb97452d449b3d5427516abae2f98ee5352d9bf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 19 Jan 2010 17:43:50 +0100 Subject: sw33bf02: xmlsecurity: deliver unix libraries to lib, not bin --- xmlsecurity/prj/d.lst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmlsecurity/prj/d.lst b/xmlsecurity/prj/d.lst index f8e3722cc0b5..270415164c0f 100644 --- a/xmlsecurity/prj/d.lst +++ b/xmlsecurity/prj/d.lst @@ -3,8 +3,8 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid ..\%__SRC%\bin\xsec_fw.dll %_DEST%\bin%_EXT%\xsec_fw.dll ..\%__SRC%\bin\xsec_xmlsec.dll %_DEST%\bin%_EXT%\xsec_xmlsec.dll ..\%__SRC%\bin\xmlsecurity.dll %_DEST%\bin%_EXT%\xmlsecurity.dll -..\%__SRC%\lib\libxsec_fw.so %_DEST%\bin%_EXT%\libxsec_fw.so -..\%__SRC%\lib\libxsec_xmlsec.so %_DEST%\bin%_EXT%\libxsec_xmlsec.so -..\%__SRC%\lib\libxmlsecurity.so %_DEST%\bin%_EXT%\libxmlsecurity.so -..\%__SRC%\lib\*.dylib %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\libxsec_fw.so %_DEST%\lib%_EXT%\libxsec_fw.so +..\%__SRC%\lib\libxsec_xmlsec.so %_DEST%\lib%_EXT%\libxsec_xmlsec.so +..\%__SRC%\lib\libxmlsecurity.so %_DEST%\lib%_EXT%\libxmlsecurity.so +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* ..\%__SRC%\bin\xmlsec*.res %_DEST%\bin%_EXT%\xmlsec*.res -- cgit v1.2.3 From e0eaf93454424d7fc4ae2a75f9b8c24aa851abc5 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 19 Jan 2010 18:33:02 +0100 Subject: vcl109: #i65128# avoid breaking polygonal clip regions into rectangles in PDF export --- filter/source/pdf/makefile.mk | 1 + filter/source/pdf/pdfexport.cxx | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/filter/source/pdf/makefile.mk b/filter/source/pdf/makefile.mk index 5c4064d02cbd..146eb254267e 100644 --- a/filter/source/pdf/makefile.mk +++ b/filter/source/pdf/makefile.mk @@ -65,6 +65,7 @@ SHL1STDLIBS=\ $(TKLIB) \ $(VCLLIB) \ $(SVLLIB) \ + $(BASEGFXLIB) \ $(SFX2LIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 714ed9df7dc4..0e124dfda3ea 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -53,6 +53,9 @@ #include #include #include +#include "basegfx/polygon/b2dpolygon.hxx" +#include "basegfx/polygon/b2dpolypolygon.hxx" +#include "basegfx/polygon/b2dpolygontools.hxx" #include // only for testing of relative saving options in PDF @@ -971,7 +974,8 @@ sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, PDFExtOutDevData& rPDFEx rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() ); rWriter.SetMapMode( rMtf.GetPrefMapMode() ); - rWriter.SetClipRegion( aPageRect ); + basegfx::B2DRectangle aB2DRect( aPageRect.Left(), aPageRect.Top(), aPageRect.Right(), aPageRect.Bottom() ); + rWriter.SetClipRegion( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( aB2DRect ) ) ); bRet = ImplWriteActions( rWriter, &rPDFExtOutDevData, rMtf, aDummyVDev ); rPDFExtOutDevData.ResetSyncData(); @@ -1644,7 +1648,15 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction; if( pA->IsClipping() ) - rWriter.SetClipRegion( pA->GetRegion() ); + { + if( pA->GetRegion().IsEmpty() ) + rWriter.SetClipRegion( basegfx::B2DPolyPolygon() ); + else + { + Region aReg( pA->GetRegion() ); + rWriter.SetClipRegion( aReg.ConvertToB2DPolyPolygon() ); + } + } else rWriter.SetClipRegion(); } @@ -1659,8 +1671,9 @@ sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDF case( META_ISECTREGIONCLIPREGION_ACTION ): { - const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction; - rWriter.IntersectClipRegion( pA->GetRegion() ); + const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction; + Region aReg( pA->GetRegion() ); + rWriter.IntersectClipRegion( aReg.ConvertToB2DPolyPolygon() ); } break; @@ -1830,7 +1843,7 @@ void PDFExport::ImplWriteGradient( PDFWriter& rWriter, const PolyPolygon& rPolyP rDummyVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); rWriter.Push(); - rWriter.IntersectClipRegion( rPolyPoly ); + rWriter.IntersectClipRegion( rPolyPoly.getB2DPolyPolygon() ); ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev ); rWriter.Pop(); } -- cgit v1.2.3 From 4a0c47d0942624da509588fba2e0f72feb0e0a28 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 19 Jan 2010 21:24:13 -0500 Subject: koheicsvimport: remove warning on Windows. --- sc/source/ui/dbgui/csvruler.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 90acf4a45358..7c8211e642ff 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -77,7 +77,8 @@ static void load_FixedWidthList(ScCsvSplits &aSplits) sSplits = String( sFixedWidthLists ); // String ends with a semi-colon so there is no 'int' after the last one. - for(int i=0;i Date: Wed, 20 Jan 2010 09:41:47 -0500 Subject: koheicsvimport: more static_cast's to keep MSVC compiler happy. --- sc/source/ui/dbgui/scuiasciiopt.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 2b244d378197..40fc410ec47c 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -384,7 +384,7 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, RTL_TEXTENCODING_UNICODE : gsl_getSystemTextEncoding() ); if( nCharSet >= 0 ) - aLbCharSet.SelectEntryPos( nCharSet ); + aLbCharSet.SelectEntryPos( static_cast(nCharSet) ); SetSelectedCharSet(); aLbCharSet.SetSelectHdl( LINK( this, ScImportAsciiDlg, CharSetHdl ) ); @@ -425,7 +425,9 @@ ScImportAsciiDlg::~ScImportAsciiDlg() if (mbFileImport) save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), - aRbFixed.IsChecked(), aNfRow.GetValue(), aLbCharSet.GetSelectEntryPos(), + aRbFixed.IsChecked(), + static_cast(aNfRow.GetValue()), + static_cast(aLbCharSet.GetSelectEntryPos()), static_cast(aLbCustomLang.GetSelectLanguage()) ); delete[] mpRowPosArray; } -- cgit v1.2.3 From 6a5ed818840536f14ec340af4eea79e2ebbd3187 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Jan 2010 12:01:28 +0100 Subject: vcl109: #i108499# remove unused files (thanks dtardon !) --- .../xforms/submission/serialization_multi_form.hxx | 30 ---------------------- .../submission/serialization_multi_related.hxx | 30 ---------------------- 2 files changed, 60 deletions(-) delete mode 100644 forms/source/xforms/submission/serialization_multi_form.hxx delete mode 100644 forms/source/xforms/submission/serialization_multi_related.hxx diff --git a/forms/source/xforms/submission/serialization_multi_form.hxx b/forms/source/xforms/submission/serialization_multi_form.hxx deleted file mode 100644 index 12dde0f72583..000000000000 --- a/forms/source/xforms/submission/serialization_multi_form.hxx +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: serialization_multi_form.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - diff --git a/forms/source/xforms/submission/serialization_multi_related.hxx b/forms/source/xforms/submission/serialization_multi_related.hxx deleted file mode 100644 index 00519a9ef1fb..000000000000 --- a/forms/source/xforms/submission/serialization_multi_related.hxx +++ /dev/null @@ -1,30 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: serialization_multi_related.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -- cgit v1.2.3 From ffca8743e16d5afd101df88aa50f2c8735830e53 Mon Sep 17 00:00:00 2001 From: "Matthias Huetsch [mhu]" Date: Thu, 21 Jan 2010 18:50:03 +0100 Subject: #i108349# Removed remaining redundant store.flush() calls. --- registry/source/keyimpl.cxx | 4 ---- registry/source/regimpl.cxx | 5 ----- 2 files changed, 9 deletions(-) diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index b41fbbb5ada9..f8de7e20b148 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -365,7 +365,6 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal return REG_SET_VALUE_FAILED; } - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -424,7 +423,6 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL return REG_SET_VALUE_FAILED; } - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -492,7 +490,6 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu return REG_SET_VALUE_FAILED; } - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } @@ -560,7 +557,6 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p return REG_SET_VALUE_FAILED; } - //rValue.flush(); rtl_freeMemory(pBuffer); return REG_NO_ERROR; } diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index b9edca734232..7a4e8fc44083 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -550,7 +550,6 @@ RegError ORegistry::closeRegistry() if (m_file.isValid()) { closeKey(m_openKeyTable[ROOT]); - m_file.flush(); m_file.close(); m_isOpen = sal_False; return REG_NO_ERROR; @@ -848,7 +847,6 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName) { return REG_DELETE_KEY_FAILED; } - //sFile.flush(); // set flag deleted !!! ((ORegKey*)hOldKey)->setDeleted(sal_True); @@ -894,7 +892,6 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey) { return REG_DELETE_VALUE_FAILED; } - //((OStoreFile&)pKey->getStoreFile()).flush(); } _err = rStoreDir.next(iter); @@ -1065,7 +1062,6 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, { return REG_VALUE_NOT_EXISTS; } - //pSourceKey->getStoreFile().flush(); pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE); @@ -1137,7 +1133,6 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey, rtl_freeMemory(pBuffer); return REG_INVALID_VALUE; } - //rTargetFile.flush(); if (rwBytes != nSize) { -- cgit v1.2.3 From a394db3e9271f66122854e4b73f96f26841012b8 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 22 Jan 2010 12:16:08 +0100 Subject: dba33e: wrong header included --- dbaccess/source/ui/app/AppController.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 5b9c4311b9be..aee402bdfab7 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -91,7 +91,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3 From f6e4f736a63512f8dd9aff517fb12b05fb98f55e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 22 Jan 2010 13:32:32 +0100 Subject: vcl109: #i108553# add forgotten export statement --- cui/source/factory/init.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cui/source/factory/init.cxx b/cui/source/factory/init.cxx index de01a2deb1b3..6655ee834a06 100644 --- a/cui/source/factory/init.cxx +++ b/cui/source/factory/init.cxx @@ -39,7 +39,7 @@ // caution: needs C-Linkage since dynamically loaded via symbol name extern "C" { -bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, String& o_rResult) +SAL_DLLPUBLIC_EXPORT bool GetSpecialCharsForEdit(Window* i_pParent, const Font& i_rFont, String& o_rResult) { bool bRet = false; SvxCharacterMap* aDlg = new SvxCharacterMap( i_pParent ); -- cgit v1.2.3 From 74d5307270a229da2f6b2f5418ca0b95d6ea87fb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 22 Jan 2010 22:49:50 +0100 Subject: autorecovery: #i108366# attachResource: correct the calculation of DocFileLocation and DocURL, in case the doc has been recovered. --- dbaccess/source/core/dataaccess/ModelImpl.cxx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index ed071e0b01a7..26b078b2f4b0 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -816,19 +816,30 @@ const Reference< XNumberFormatsSupplier > & ODatabaseModelImpl::getNumberFormats void ODatabaseModelImpl::attachResource( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rArgs ) { ::comphelper::NamedValueCollection aMediaDescriptor( _rArgs ); + ENSURE_OR_THROW( _rURL.getLength(), "invalid URL" ); - ::rtl::OUString sDocumentLocation( aMediaDescriptor.getOrDefault( "SalvagedFile", _rURL ) ); - if ( !sDocumentLocation.getLength() ) - // this indicates "the document is being recovered, but _rURL already is the real document URL, - // not the temporary document location" - sDocumentLocation = _rURL; + ::rtl::OUString sDocumentLocation( _rURL ); + ::rtl::OUString sDocumentURL( _rURL ); if ( aMediaDescriptor.has( "SalvagedFile" ) ) + { + const ::rtl::OUString sSalvagedFile( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) ); + // If SalvagedFile is an empty string, this indicates "the document is being recovered, but _rURL already + // is the real document URL, not the temporary document location" + if ( sSalvagedFile.getLength() ) + { + // otherwise, SalvagedFile is the URL of the document which we should mimic, though we're loaded from + // the file denoted by _rURL. + sDocumentLocation = _rURL; + sDocumentURL = sSalvagedFile; + } + aMediaDescriptor.remove( "SalvagedFile" ); + } m_aArgs = stripLoadArguments( aMediaDescriptor ); - switchToURL( sDocumentLocation, _rURL ); + switchToURL( sDocumentLocation, sDocumentURL ); } // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 64b4e680a5af6677b4d8e5106fe02964fb305e4c Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 25 Jan 2010 09:56:57 +0100 Subject: autorecovery: do not remove SalvagedFile from DBDoc's args if it still carries information --- dbaccess/source/core/dataaccess/ModelImpl.cxx | 5 ++++- dbaccess/source/core/dataaccess/databasedocument.cxx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 26b078b2f4b0..112da2d19505 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -834,7 +834,10 @@ void ODatabaseModelImpl::attachResource( const ::rtl::OUString& _rURL, const Seq sDocumentURL = sSalvagedFile; } - aMediaDescriptor.remove( "SalvagedFile" ); + if ( sSalvagedFile == _rURL ) + // SalvagedFile doesn't carry any information anymore + aMediaDescriptor.remove( "SalvagedFile" ); + } m_aArgs = stripLoadArguments( aMediaDescriptor ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 7a234d2ce646..39afd5bf76b5 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -579,7 +579,7 @@ namespace DocumentGuard aGuard( *this ); // The implementation here is somewhat sloppy, in that it returns whether *any* part of the whole - // database document, including opened sub components, is modified. This is more that what is requested: + // database document, including opened sub components, is modified. This is more than what is requested: // We need to return if the doc itself, or any of the opened sub components, has been modified // since the last call to any of the save* methods, or since the document has been loaded/created. // However, the API definition explicitly allows to be that sloppy ... -- cgit v1.2.3 From d9c96494bfc4f749840ad972d6dbebbeb1b29ed2 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Mon, 25 Jan 2010 13:20:09 +0100 Subject: dba33e: wrong header from svtools --- dbaccess/source/core/dataaccess/databasedocument.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index ff57b3a82b06..862ebc664993 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -79,8 +79,6 @@ #include -#include - #include #include #include -- cgit v1.2.3 From 83ccb404e2829cba98cf0bb1290da489fd1f4c6c Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 25 Jan 2010 15:57:05 -0500 Subject: koheicsvimport: #i108645# Store the dialog parameters only when the OK is pressed. --- sc/inc/scabstdlg.hxx | 1 + sc/source/ui/attrdlg/scdlgfact.cxx | 5 +++++ sc/source/ui/attrdlg/scdlgfact.hxx | 1 + sc/source/ui/dbgui/scuiasciiopt.cxx | 21 ++++++++++++++------- sc/source/ui/inc/scuiasciiopt.hxx | 1 + sc/source/ui/unoobj/filtuno.cxx | 1 + 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 98ec2b6b5a71..824761804349 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -69,6 +69,7 @@ class AbstractScImportAsciiDlg : public VclAbstractDialog //add for ScImportAsc public: virtual void GetOptions( ScAsciiOptions& rOpt ) = 0; virtual void SetTextToColumnsMode() = 0; + virtual void SaveParameters() = 0; }; diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index d52a1f653c5c..66abfa79116e 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -198,6 +198,11 @@ void AbstractScImportAsciiDlg_Impl::SetTextToColumnsMode() pDlg->SetTextToColumnsMode(); } +void AbstractScImportAsciiDlg_Impl::SaveParameters() +{ + pDlg->SaveParameters(); +} + // AbstractScImportAsciiDlg_Impl end //AbstractScAutoFormatDlg_Impl begin diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index f9d06360d36c..36b7d89cceba 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -120,6 +120,7 @@ class AbstractScImportAsciiDlg_Impl : public AbstractScImportAsciiDlg //add for DECL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl, ScImportAsciiDlg) virtual void GetOptions( ScAsciiOptions& rOpt ); virtual void SetTextToColumnsMode(); + virtual void SaveParameters(); }; class AbstractScAutoFormatDlg_Impl : public AbstractScAutoFormatDlg //add for ScAutoFormatDlg diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 40fc410ec47c..244b2e785a72 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -422,13 +422,6 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, ScImportAsciiDlg::~ScImportAsciiDlg() { - if (mbFileImport) - save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), - aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), - aRbFixed.IsChecked(), - static_cast(aNfRow.GetValue()), - static_cast(aLbCharSet.GetSelectEntryPos()), - static_cast(aLbCustomLang.GetSelectLanguage()) ); delete[] mpRowPosArray; } @@ -542,6 +535,20 @@ void ScImportAsciiDlg::SetTextToColumnsMode() aCkbDetectNumber.Disable(); } +void ScImportAsciiDlg::SaveParameters() +{ + if (!mbFileImport) + // We save parameters only for file import. + return; + + save_Separators( maFieldSeparators, aCbTextSep.GetText(), aCkbAsOnce.IsChecked(), + aCkbQuotedAsText.IsChecked(), aCkbDetectNumber.IsChecked(), + aRbFixed.IsChecked(), + static_cast(aNfRow.GetValue()), + static_cast(aLbCharSet.GetSelectEntryPos()), + static_cast(aLbCustomLang.GetSelectLanguage()) ); +} + void ScImportAsciiDlg::SetSelectedCharSet() { meCharSet = aLbCharSet.GetSelectTextEncoding(); diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 82963d2904af..73dac06a3ed8 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -107,6 +107,7 @@ public: void GetOptions( ScAsciiOptions& rOpt ); void SetTextToColumnsMode(); + void SaveParameters(); private: /** Sets the selected char set data to meCharSet and mbCharSetSystem. */ diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index c8248b754708..90c86bca0cfb 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -179,6 +179,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) { ScAsciiOptions aOptions; pDlg->GetOptions( aOptions ); + pDlg->SaveParameters(); aFilterOptions = aOptions.WriteToString(); nRet = ui::dialogs::ExecutableDialogResults::OK; } -- cgit v1.2.3 From a2e88c92f9d23707d6aa72ecb635326f13a0d66a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 25 Jan 2010 22:35:24 +0100 Subject: autorecovery: introduce PersistentPath property at the document definition object --- .../source/core/dataaccess/documentdefinition.cxx | 69 ++++++++++++++++------ .../source/core/dataaccess/documentdefinition.hxx | 6 ++ dbaccess/source/core/misc/dbastrings.cxx | 5 +- dbaccess/source/inc/dbastrings.hrc | 4 +- dbaccess/source/inc/stringconstants.hrc | 1 + 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index d2fb5b15c405..1ed214036d66 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -632,15 +632,39 @@ IMPLEMENT_SERVICE_INFO1(ODocumentDefinition,"com.sun.star.comp.dba.ODocumentDefi //-------------------------------------------------------------------------- void ODocumentDefinition::registerProperties() { - registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.aTitle, ::getCppuType(&m_pImpl->m_aProps.aTitle)); - registerProperty(PROPERTY_AS_TEMPLATE, PROPERTY_ID_AS_TEMPLATE, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.bAsTemplate, ::getCppuType(&m_pImpl->m_aProps.bAsTemplate)); - registerProperty(PROPERTY_PERSISTENT_NAME, PROPERTY_ID_PERSISTENT_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_pImpl->m_aProps.sPersistentName, ::getCppuType(&m_pImpl->m_aProps.sPersistentName)); - registerProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsForm")), PROPERTY_ID_IS_FORM, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, - &m_bForm, ::getCppuType(&m_bForm)); +#define REGISTER_PROPERTY( name, location ) \ + registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::READONLY, &location, ::getCppuType( &location ) ); + +#define REGISTER_PROPERTY_BV( name, location ) \ + registerProperty( PROPERTY_##name, PROPERTY_ID_##name, PropertyAttribute::CONSTRAINED | PropertyAttribute::BOUND | PropertyAttribute::READONLY, &location, ::getCppuType( &location ) ); + + REGISTER_PROPERTY_BV( NAME, m_pImpl->m_aProps.aTitle ); + REGISTER_PROPERTY ( AS_TEMPLATE, m_pImpl->m_aProps.bAsTemplate ); + REGISTER_PROPERTY ( PERSISTENT_NAME, m_pImpl->m_aProps.sPersistentName ); + REGISTER_PROPERTY ( IS_FORM, m_bForm ); } + +// ----------------------------------------------------------------------------- +void SAL_CALL ODocumentDefinition::getFastPropertyValue( Any& o_rValue, sal_Int32 i_nHandle ) const +{ + if ( i_nHandle == PROPERTY_ID_PERSISTENT_PATH ) + { + ::rtl::OUString sPersistentPath; + if ( m_pImpl->m_aProps.sPersistentName.getLength() ) + { + ::rtl::OUStringBuffer aBuffer; + aBuffer.append( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) ); + aBuffer.append( sal_Unicode( '/' ) ); + aBuffer.append( m_pImpl->m_aProps.sPersistentName ); + sPersistentPath = aBuffer.makeStringAndClear(); + } + o_rValue <<= sPersistentPath; + return; + } + + OPropertyStateContainer::getFastPropertyValue( o_rValue, i_nHandle ); +} + // ----------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL ODocumentDefinition::getPropertySetInfo( ) throw(RuntimeException) { @@ -658,10 +682,21 @@ IPropertyArrayHelper& ODocumentDefinition::getInfoHelper() //-------------------------------------------------------------------------- IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const { + // properties maintained by our base class (see registerProperties) Sequence< Property > aProps; - describeProperties(aProps); - return new OPropertyArrayHelper(aProps); + describeProperties( aProps ); + + // properties not maintained by our base class + Sequence< Property > aManualProps( 1 ); + aManualProps[0].Name = PROPERTY_PERSISTENT_PATH; + aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH; + aManualProps[0].Type = ::getCppuType( static_cast< const ::rtl::OUString* >( NULL ) ); + aManualProps[0].Attributes = PropertyAttribute::READONLY; + + return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) ); } + +// ----------------------------------------------------------------------------- class OExecuteImpl { sal_Bool& m_rbSet; @@ -669,6 +704,7 @@ public: OExecuteImpl(sal_Bool& _rbSet) : m_rbSet(_rbSet){ m_rbSet=sal_True; } ~OExecuteImpl(){ m_rbSet = sal_False; } }; + // ----------------------------------------------------------------------------- namespace { @@ -1569,18 +1605,15 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const // ----------------------------------------------------------------------------- void ODocumentDefinition::separateOpenCommandArguments( const Sequence< PropertyValue >& i_rOpenCommandArguments, - ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor ) + ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& /*o_rEmbeddedObjectDescriptor*/ ) { ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); o_rDocumentLoadArgs.merge( aOpenCommandArguments, false ); - // the only OpenCommandArgument so far, which belongs into the EmbeddedObjectDescriptor, and not the document's - // media descriptor, is RecoverFromStorage - if ( aOpenCommandArguments.has( "RecoverFromStorage" ) ) - { - o_rEmbeddedObjectDescriptor.put( "RecoverFromStorage", aOpenCommandArguments.get( "RecoverFromStorage" ) ); - o_rDocumentLoadArgs.remove( "RecoverFromStorage" ); - } + // This method is to separate OpenCommandArguments into args which belong into the EmbeddedObjectDescriptor, + // and args which belong into the document's media descriptor. + + // Well, there was some intermediate state where such args really existed - at the moment, they don't. } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 5b2c43521f6b..0c164fd2e30d 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -133,6 +133,12 @@ public: // ::com::sun::star::beans::XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // OPropertySetHelper + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& o_rValue, + sal_Int32 i_nHandle + ) const; + // XComponentSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent( ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/core/misc/dbastrings.cxx b/dbaccess/source/core/misc/dbastrings.cxx index 4caaa5650656..96e6d86145cf 100644 --- a/dbaccess/source/core/misc/dbastrings.cxx +++ b/dbaccess/source/core/misc/dbastrings.cxx @@ -46,6 +46,7 @@ namespace dbaccess //============================================================ //= Properties //============================================================ - IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode"); - + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_APPLYFORMDESIGNMODE, "ApplyFormDesignMode" ); + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_IS_FORM, "IsForm" ); + IMPLEMENT_CONSTASCII_USTRING( PROPERTY_PERSISTENT_PATH, "PersistentPath" ); } diff --git a/dbaccess/source/inc/dbastrings.hrc b/dbaccess/source/inc/dbastrings.hrc index 1e5eb7984046..a881bb039194 100644 --- a/dbaccess/source/inc/dbastrings.hrc +++ b/dbaccess/source/inc/dbastrings.hrc @@ -48,7 +48,9 @@ namespace dbaccess //============================================================ //= Properties //============================================================ - DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFORMDESIGNMODE); + DECLARE_CONSTASCII_USTRING( PROPERTY_APPLYFORMDESIGNMODE ); + DECLARE_CONSTASCII_USTRING( PROPERTY_IS_FORM ); + DECLARE_CONSTASCII_USTRING( PROPERTY_PERSISTENT_PATH ); } #endif // DBACCESS_SHARED_DBASTRINGS_HRC diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index 6a58ba1ddd0d..02bb911ef287 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -183,6 +183,7 @@ #define PROPERTY_ID_THOUSAND_DELIMITER 140 #define PROPERTY_ID_ENCODING 141 #define PROPERTY_ID_HELP_URL 142 +#define PROPERTY_ID_PERSISTENT_PATH 143 //============================================================ //= property names -- cgit v1.2.3 From 84155f975046b221e626fbcbfd537b5ab9f44e0e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 25 Jan 2010 22:36:18 +0100 Subject: autorecovery: broadcast name changes also when a newly created, formerly unnamed, doc is saved --- .../source/core/dataaccess/documentdefinition.cxx | 66 +++++++++++++++++----- .../source/core/dataaccess/documentdefinition.hxx | 31 +++++++++- dbaccess/source/ui/app/AppControllerGen.cxx | 21 ++++--- 3 files changed, 94 insertions(+), 24 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 1ed214036d66..385b4516ac93 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1397,16 +1397,16 @@ sal_Bool ODocumentDefinition::save(sal_Bool _bApprove) return sal_True; if ( pDocuSave && pDocuSave->wasSelected() ) { - ::osl::MutexGuard aGuard(m_aMutex); - Reference xNC(pDocuSave->getContent(),UNO_QUERY); - if ( xNC.is() ) - { - m_pImpl->m_aProps.aTitle = pDocuSave->getName(); - Reference< XContent> xContent = this; - xNC->insertByName(pDocuSave->getName(),makeAny(xContent)); + Reference xNC( pDocuSave->getContent(), UNO_QUERY_THROW ); - updateDocumentTitle(); - } + ::osl::ResettableMutexGuard aGuard( m_aMutex ); + NameChangeNotifier aNameChangeAndNotify( *this, pDocuSave->getName(), aGuard ); + m_pImpl->m_aProps.aTitle = pDocuSave->getName(); + + Reference< XContent> xContent = this; + xNC->insertByName(pDocuSave->getName(),makeAny(xContent)); + + updateDocumentTitle(); } } @@ -2069,7 +2069,7 @@ void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) th { try { - osl::ClearableGuard< osl::Mutex > aGuard(m_aMutex); + ::osl::ResettableMutexGuard aGuard(m_aMutex); if ( _rNewName.equals( m_pImpl->m_aProps.aTitle ) ) return; @@ -2082,12 +2082,11 @@ void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) th Any aOld = makeAny( m_pImpl->m_aProps.aTitle ); Any aNew = makeAny( _rNewName ); - aGuard.clear(); - fire(&nHandle, &aNew, &aOld, 1, sal_True ); - m_pImpl->m_aProps.aTitle = _rNewName; - fire(&nHandle, &aNew, &aOld, 1, sal_False ); + { + NameChangeNotifier aNameChangeAndNotify( *this, _rNewName, aGuard ); + m_pImpl->m_aProps.aTitle = _rNewName; + } - ::osl::ClearableGuard< ::osl::Mutex > aGuard2( m_aMutex ); if ( m_xEmbeddedObject.is() && m_xEmbeddedObject->getCurrentState() == EmbedStates::ACTIVE ) updateDocumentTitle(); } @@ -2239,6 +2238,43 @@ void SAL_CALL ODocumentDefinition::notifyClosing( const lang::EventObject& /*Sou void SAL_CALL ODocumentDefinition::disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException) { } + +// ----------------------------------------------------------------------------- +void ODocumentDefinition::firePropertyChange( sal_Int32 i_nHandle, const Any& i_rNewValue, const Any& i_rOldValue, + sal_Bool i_bVetoable, const NotifierAccess ) +{ + fire( &i_nHandle, &i_rNewValue, &i_rOldValue, 1, i_bVetoable ); +} + +// ============================================================================= +// NameChangeNotifier +// ============================================================================= +// ----------------------------------------------------------------------------- +NameChangeNotifier::NameChangeNotifier( ODocumentDefinition& i_rDocumentDefinition, const ::rtl::OUString& i_rNewName, + ::osl::ResettableMutexGuard& i_rClearForNotify ) + :m_rDocumentDefinition( i_rDocumentDefinition ) + ,m_aOldValue( makeAny( i_rDocumentDefinition.getCurrentName() ) ) + ,m_aNewValue( makeAny( i_rNewName ) ) + ,m_rClearForNotify( i_rClearForNotify ) +{ + impl_fireEvent_throw( sal_True ); +} + +// ----------------------------------------------------------------------------- +NameChangeNotifier::~NameChangeNotifier() +{ + impl_fireEvent_throw( sal_False ); +} + +// ----------------------------------------------------------------------------- +void NameChangeNotifier::impl_fireEvent_throw( const sal_Bool i_bVetoable ) +{ + m_rClearForNotify.clear(); + m_rDocumentDefinition.firePropertyChange( + PROPERTY_ID_NAME, m_aNewValue, m_aOldValue, i_bVetoable, ODocumentDefinition::NotifierAccess() ); + m_rClearForNotify.reset(); +} + //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 0c164fd2e30d..ab8f13bc2cec 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -201,6 +201,16 @@ public: ::com::sun::star::uno::Sequence< sal_Int8 >& _rClassId ); + struct NotifierAccess { friend class NameChangeNotifier; private: NotifierAccess() { } }; + const ::rtl::OUString& getCurrentName() const { return m_pImpl->m_aProps.aTitle; } + void firePropertyChange( + sal_Int32 i_nHandle, + const ::com::sun::star::uno::Any& i_rNewValue, + const ::com::sun::star::uno::Any& i_rOldValue, + sal_Bool i_bVetoable, + const NotifierAccess + ); + private: /** does necessary initializations after our embedded object has been switched to ACTIVE @param _bOpenedInDesignMode @@ -238,7 +248,6 @@ private: bool impl_close_throw(); -private: // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; @@ -250,7 +259,6 @@ private: // OContentHelper overridables virtual ::rtl::OUString determineContentType() const; -private: /** fills the load arguments */ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > @@ -347,6 +355,25 @@ private: ::osl::ClearableMutexGuard & _aClearableGuard); }; +class NameChangeNotifier +{ +public: + NameChangeNotifier( + ODocumentDefinition& i_rDocumentDefinition, + const ::rtl::OUString& i_rNewName, + ::osl::ResettableMutexGuard& i_rClearForNotify + ); + ~NameChangeNotifier(); + +private: + ODocumentDefinition& m_rDocumentDefinition; + const ::com::sun::star::uno::Any m_aOldValue; + const ::com::sun::star::uno::Any m_aNewValue; + mutable ::osl::ResettableMutexGuard& m_rClearForNotify; + + void impl_fireEvent_throw( const sal_Bool i_bVetoable ); +}; + //........................................................................ } // namespace dbaccess //........................................................................ diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 5c9f66bd724b..d919d1457331 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -330,15 +330,22 @@ void SAL_CALL OApplicationController::propertyChange( const PropertyChangeEvent& ::rtl::OUString sOldName,sNewName; evt.OldValue >>= sOldName; evt.NewValue >>= sNewName; - Reference xChild(evt.Source,UNO_QUERY); - if ( xChild.is() ) + + // if the old name is empty, then this is a newly inserted content. We're notified of it via the + // elementInserted method, so there's no need to handle it here. + + if ( sOldName.getLength() ) { - Reference xContent(xChild->getParent(),UNO_QUERY); - if ( xContent.is() ) - sOldName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sOldName; - } + Reference xChild(evt.Source,UNO_QUERY); + if ( xChild.is() ) + { + Reference xContent(xChild->getParent(),UNO_QUERY); + if ( xContent.is() ) + sOldName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sOldName; + } - getContainer()->elementReplaced( eType , sOldName, sNewName ); + getContainer()->elementReplaced( eType , sOldName, sNewName ); + } } } -- cgit v1.2.3 From 6563b40e1486aaf51cf7d0463ada458a620d3c1f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 25 Jan 2010 22:36:24 +0100 Subject: autorecovery: when the name of a document definition changes, update our component map --- dbaccess/source/ui/app/subcomponentmanager.cxx | 56 +++++++++++++++++++++++++- dbaccess/source/ui/app/subcomponentmanager.hxx | 7 +++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index b2f7dab42958..3456ff75e232 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -29,6 +29,7 @@ #include "subcomponentmanager.hxx" #include "AppController.hxx" +#include "dbustrings.hrc" /** === begin UNO includes === **/ #include @@ -39,6 +40,7 @@ #include #include #include +#include /** === end UNO includes === **/ #include @@ -79,6 +81,8 @@ namespace dbaui using ::com::sun::star::ucb::XCommandProcessor; using ::com::sun::star::ucb::Command; using ::com::sun::star::document::XDocumentEventBroadcaster; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::beans::PropertyChangeEvent; /** === end UNO using === **/ //============================================================================== @@ -94,8 +98,10 @@ namespace dbaui Reference< XController > xController; /// the model of the sub component. Might be Reference< XModel > xModel; - /// the document definition which holds the component, if any - Reference< XCommandProcessor > xComponentCommandProcessor; + /// the document definition which holds the component, if any; as CommandProcessor + Reference< XCommandProcessor > xComponentCommandProcessor; + /// the document definition which holds the component, if any; as PropertySet + Reference< XPropertySet > xDocumentDefinitionProperties; SubComponentDescriptor() :xFrame() @@ -108,11 +114,14 @@ namespace dbaui { if ( !impl_constructFrom( _rxComponent ) ) { + // _rxComponent is neither a model, nor a controller, nor a frame + // => it must be a css.sdb.DocumentDefinition Reference< XComponentSupplier > xCompSupp( _rxComponent, UNO_QUERY_THROW ); Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW ); if ( !impl_constructFrom( xComponent ) ) throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal component type." ) ), NULL ); xComponentCommandProcessor.set( _rxComponent, UNO_QUERY_THROW ); + xDocumentDefinitionProperties.set( _rxComponent, UNO_QUERY_THROW ); } } @@ -361,6 +370,47 @@ namespace dbaui } } + //-------------------------------------------------------------------- + void SAL_CALL SubComponentManager::propertyChange( const PropertyChangeEvent& i_rEvent ) throw (RuntimeException) + { + if ( i_rEvent.PropertyName != PROPERTY_NAME ) + // by definition, it's allowed to broadcast more than what we've registered for + return; + + // find the sub component whose name changed + for ( SubComponentMap::iterator comp = m_pData->m_aComponents.begin(); + comp != m_pData->m_aComponents.end(); + ++comp + ) + { + if ( comp->second.xDocumentDefinitionProperties != i_rEvent.Source ) + continue; + + ::rtl::OUString sNewName; + OSL_VERIFY( i_rEvent.NewValue >>= sNewName ); + + ::rtl::OUString sOldKnownName( comp->first.sName ); + ::rtl::OUString sOldName; + OSL_VERIFY( i_rEvent.OldValue >>= sOldName ); + OSL_ENSURE( sOldName == sOldKnownName, "SubComponentManager::propertyChange: inconsistency in the old names!" ); + + // obtain old values + SubComponentAccessor aKey( comp->first ); + SubComponentDescriptor aElement( comp->second ); + + // remove old values + m_pData->m_aComponents.erase( comp ); + + // re-insert under new name + aKey.sName = sNewName; + m_pData->m_aComponents.insert( SubComponentMap::value_type( + aKey, aElement + ) ) ; + + break; + } + } + //-------------------------------------------------------------------- void SAL_CALL SubComponentManager::disposing( const EventObject& _rSource ) throw (RuntimeException) { @@ -480,6 +530,8 @@ namespace dbaui aElement.xController->addEventListener( this ); if ( aElement.xModel.is() ) aElement.xModel->addEventListener( this ); + if ( aElement.xDocumentDefinitionProperties.is() ) + aElement.xDocumentDefinitionProperties->addPropertyChangeListener( PROPERTY_NAME, this ); // notify this to interested parties aGuard.clear(); diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx index 85984c8e0d14..372a0a211af5 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.hxx +++ b/dbaccess/source/ui/app/subcomponentmanager.hxx @@ -33,7 +33,7 @@ #include "AppElementType.hxx" /** === begin UNO includes === **/ -#include +#include #include /** === end UNO includes === **/ @@ -53,7 +53,7 @@ namespace dbaui //==================================================================== //= SubComponentManager //==================================================================== - typedef ::cppu::WeakImplHelper1 < ::com::sun::star::lang::XEventListener + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener > SubComponentManager_Base; class SubComponentManager : public SubComponentManager_Base { @@ -63,6 +63,9 @@ namespace dbaui void disposing(); + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); + // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); -- cgit v1.2.3 From 2ed62793becce9a2830a6be70fc02be1296d4ee9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 09:01:50 +0100 Subject: autorecovery: unxlngi6: removed unused local variables --- dbaccess/source/core/dataaccess/documentdefinition.cxx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 385b4516ac93..a62a85501bb9 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -2078,14 +2078,8 @@ void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) th if ( _rNewName.indexOf( '/' ) != -1 ) m_aErrorHelper.raiseException( ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES, *this ); - sal_Int32 nHandle = PROPERTY_ID_NAME; - Any aOld = makeAny( m_pImpl->m_aProps.aTitle ); - Any aNew = makeAny( _rNewName ); - - { - NameChangeNotifier aNameChangeAndNotify( *this, _rNewName, aGuard ); - m_pImpl->m_aProps.aTitle = _rNewName; - } + NameChangeNotifier aNameChangeAndNotify( *this, _rNewName, aGuard ); + m_pImpl->m_aProps.aTitle = _rNewName; if ( m_xEmbeddedObject.is() && m_xEmbeddedObject->getCurrentState() == EmbedStates::ACTIVE ) updateDocumentTitle(); -- cgit v1.2.3 From 6adaf71970a32c81ed45755a513f3cda788f2427 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 13:19:11 +0100 Subject: autorecovery: mav sanctioned the approach of the (now so-called) RecoveryStorage --- dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 21 ++++++++++++++++----- .../source/core/dataaccess/documentdefinition.cxx | 19 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx index 9770808b98e5..b2e8f0433990 100644 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx @@ -27,6 +27,7 @@ #include "dbdocrecovery.hxx" #include "sdbcoretools.hxx" +#include "dbastrings.hrc" /** === begin UNO includes === **/ #include @@ -48,6 +49,7 @@ #include #include +#include //........................................................................ namespace dbaccess @@ -626,9 +628,17 @@ namespace dbaccess ++map ) { + const SubComponentType eComponentType = map->first; + if ( ( eComponentType != FORM ) && ( eComponentType != REPORT ) ) + { + // nobody saves tables/queries/relations at the moment, so encountering those is worth an assertion + OSL_ENSURE( false, "DatabaseDocumentRecovery::recoverSubDocuments: only embedded objects can be recovered currently!" ); + continue; + } + // the storage for all components of the current type Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( - lcl_getComponentsStorageName( map->first ), ElementModes::READ ), UNO_QUERY_THROW ); + lcl_getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_QUERY_THROW ); // loop thru all components of this type for ( MapStringToCompDesc::const_iterator stor = map->second.begin(); @@ -636,6 +646,7 @@ namespace dbaccess ++stor ) { + const ::rtl::OUString sComponentName( stor->second.sName ); if ( !xComponentsStor->hasByName( stor->first ) ) { #if OSL_DEBUG_LEVEL > 0 @@ -643,7 +654,7 @@ namespace dbaccess message.append( "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" ); message.append( ::rtl::OUStringToOString( stor->first, RTL_TEXTENCODING_ASCII_US ) ); message.append( "' not found in '" ); - message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( map->first ), RTL_TEXTENCODING_ASCII_US ) ); + message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( eComponentType ), RTL_TEXTENCODING_ASCII_US ) ); message.append( "', but required per map file!" ); OSL_ENSURE( false, message.makeStringAndClear() ); #endif @@ -656,12 +667,12 @@ namespace dbaccess // recover the single component Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) ); - ::comphelper::NamedValueCollection aLoadArgs; - aLoadArgs.put( "RecoverFromStorage", xCompStor ); + aLoadArgs.put( "RecoveryStorage", xCompStor ); + try { - Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( map->first, stor->second.sName, stor->second.bForEditing, + Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, stor->second.bForEditing, aLoadArgs.getPropertyValues() ); // at the moment, we only store, during session save, sub components which are modified. So, set this diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index a62a85501bb9..ec2e1d1e11f6 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1605,15 +1605,24 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const // ----------------------------------------------------------------------------- void ODocumentDefinition::separateOpenCommandArguments( const Sequence< PropertyValue >& i_rOpenCommandArguments, - ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& /*o_rEmbeddedObjectDescriptor*/ ) + ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor ) { ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); - o_rDocumentLoadArgs.merge( aOpenCommandArguments, false ); - // This method is to separate OpenCommandArguments into args which belong into the EmbeddedObjectDescriptor, - // and args which belong into the document's media descriptor. + const sal_Char* pObjectDescriptorArgs[] = + { + "RecoveryStorage" + }; + for ( size_t i=0; i < sizeof( pObjectDescriptorArgs ) / sizeof( pObjectDescriptorArgs[0] ); ++i ) + { + if ( aOpenCommandArguments.has( pObjectDescriptorArgs[i] ) ) + { + o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArgs[i], aOpenCommandArguments.get( pObjectDescriptorArgs[i] ) ); + aOpenCommandArguments.remove( pObjectDescriptorArgs[i] ); + } + } - // Well, there was some intermediate state where such args really existed - at the moment, they don't. + o_rDocumentLoadArgs.merge( aOpenCommandArguments, false ); } // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 68690a1b5bf58b59ff8ebd5bb1fd3548be4d7848 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 13:32:05 +0100 Subject: autorecovery: added RecoveryStorage --- offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl index be173afab5af..805beff167e6 100644 --- a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl +++ b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl @@ -92,6 +92,19 @@ service EmbeddedObjectDescriptor [optional,property] ::com::sun::star::frame::XDispatchProviderInterceptor OutplaceDispatchInterceptor; + /** denotes the storage from which the embedded object is to be recovered. + +

Upon activating the embedded object, it is normally loaded from a storage as denoted by + the parameters to the XEmbedObjectCreator method calls.

+ +

You can pass a non- RecoveryStorage in the object descriptor if you wish to load the + embedded object from an alternate storage.

+ +

The object will still be based on the storage denoted in the XEmbedObjectCreator method + call, i.e., subsequent save operations will still use that storage. RecoveryStorage is used + at loading time only, and then discarded.

+ */ + [optional, property] XStorage RecoveryStorage; }; //============================================================================ -- cgit v1.2.3 From 1fc2ddc87cdc286803baf6fa5a7933cd9b3fee14 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 14:48:33 +0100 Subject: #i10000# --- offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl index 805beff167e6..ba69f8e6f779 100644 --- a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl +++ b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl @@ -54,6 +54,8 @@ #include #endif +#include + //============================================================================ module com { module sun { module star { module embed { -- cgit v1.2.3 From 45dff81a9fff92003535f1e93d407caf487c92b1 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Fri, 26 Mar 2010 16:18:10 +0100 Subject: o5oo branding of startcenter - transplanted from 3b0a27115246@native0 --- framework/inc/framework.hrc | 1 + framework/source/services/backingwindow.cxx | 180 +++++++++++++++------ framework/source/services/backingwindow.hxx | 4 +- framework/source/services/fwk_services.src | 4 + .../registry/data/org/openoffice/Office/Common.xcu | 3 + .../schema/org/openoffice/Office/Common.xcs | 6 + 6 files changed, 146 insertions(+), 52 deletions(-) diff --git a/framework/inc/framework.hrc b/framework/inc/framework.hrc index acf1d19a193d..a8a0f3fdd390 100644 --- a/framework/inc/framework.hrc +++ b/framework/inc/framework.hrc @@ -67,6 +67,7 @@ #define STR_BACKING_INFOHELP 19 #define BMP_BACKING_TPLREP 20 #define STR_BACKING_TPLREP 21 +#define BMP_BACKING_FOLDER 22 #define RES_BACKING_IMAGES (DLG_BACKING+1) #define RES_BACKING_IMAGES_HC (DLG_BACKING+2) diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 4e1e094b0c72..394275a84289 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -140,10 +140,37 @@ BackingWindow::BackingWindow( Window* i_pParent ) : maTemplateString( FwkResId( STR_BACKING_TEMPLATE ) ), maButtonImageSize( 10, 10 ), mbInitControls( false ), - mpAccExec( NULL ) + mnLayoutStyle( 0 ), + mpAccExec( NULL ), + mnBtnPos( 240 ) { mnColumnWidth[0] = mnColumnWidth[1] = 0; + try + { + Reference xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY); + if( xConfig.is() ) + { + Sequence args(1); + PropertyValue val( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("nodepath") ), + 0, + Any(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/Help/StartCenter"))), + PropertyState_DIRECT_VALUE); + args.getArray()[0] <<= val; + Reference xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY); + if( xNameAccess.is() ) + { + //throws css::container::NoSuchElementException, css::lang::WrappedTargetException + Any value( xNameAccess->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartCenterLayoutStyle"))) ); + mnLayoutStyle = value.get(); + } + } + } + catch (Exception& ) + { + } + // get icon images from vcl resource and set them on the appropriate buttons loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); @@ -151,8 +178,16 @@ BackingWindow::BackingWindow( Window* i_pParent ) : loadImage( FwkResId( BMP_BACKING_DRAW ), maDrawButton ); loadImage( FwkResId( BMP_BACKING_DATABASE ), maDBButton ); loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); - loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); - loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + if( mnLayoutStyle == 1 ) + { + loadImage( FwkResId( BMP_BACKING_FOLDER ), maOpenButton ); + loadImage( FwkResId( BMP_BACKING_FOLDER ), maTemplateButton ); + } + else + { + loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); + loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); + } BitmapEx aExtImage( FwkResId( BMP_BACKING_EXT ) ); String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) ); @@ -309,6 +344,9 @@ void BackingWindow::initBackground() maTemplateText.SetControlBackground( aTextBGColor ); maOpenText.SetControlForeground( maLabelTextColor ); maOpenText.SetControlBackground( aTextBGColor ); + + if( mnLayoutStyle == 1 ) + mnBtnPos = maBackgroundLeft.GetSizePixel().Width(); } void BackingWindow::initControls() @@ -344,8 +382,8 @@ void BackingWindow::initControls() nYPos += (maWelcomeSize.Height()*3)/2; - if( maControlRect.GetWidth() < nBtnPos + maWelcomeSize.Width() + 20 ) - maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + nBtnPos + 20; + if( maControlRect.GetWidth() < mnBtnPos + maWelcomeSize.Width() + 20 ) + maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + mnBtnPos + 20; maWelcome.Show(); @@ -365,8 +403,8 @@ void BackingWindow::initControls() maProductSize = Size( maProduct.GetTextWidth( maProductString ), maProduct.GetTextHeight() ); maProductSize.Width() = (maProductSize.Width() * 20)/19; - if( maControlRect.GetWidth() < maProductSize.Width() + nBtnPos + 10 ) - maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + nBtnPos + 10; + if( maControlRect.GetWidth() < maProductSize.Width() + mnBtnPos + 10 ) + maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + mnBtnPos + 10; maProduct.Show(); @@ -376,13 +414,16 @@ void BackingWindow::initControls() maTextFont.SetSize( Size( 0, 11 ) ); maTextFont.SetWeight( WEIGHT_NORMAL ); - maCreateText.SetText( maCreateString ); - maCreateText.SetFont( maTextFont ); - maCreateText.SetControlFont( maTextFont ); - maCreateSize = Size( maCreateText.GetTextWidth( maCreateString ), maCreateText.GetTextHeight() ); - maCreateText.Show(); + if( mnLayoutStyle == 0 ) + { + maCreateText.SetText( maCreateString ); + maCreateText.SetFont( maTextFont ); + maCreateText.SetControlFont( maTextFont ); + maCreateSize = Size( maCreateText.GetTextWidth( maCreateString ), maCreateText.GetTextHeight() ); + maCreateText.Show(); - nYPos += (maCreateSize.Height()*3)/2; + nYPos += (maCreateSize.Height()*3)/2; + } // collect the URLs of the entries in the File/New menu SvtModuleOptions aModuleOptions; @@ -445,22 +486,46 @@ void BackingWindow::initControls() maMathButton, maMathText, aMnemns ); nYPos += 3*maButtonImageSize.Height() / 2; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maTemplateButton, maTemplateText, aMnemns, maTemplateString ); - nYPos += 10; - layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, - aModuleOptions, SvtModuleOptions::E_SWRITER, - maOpenButton, maOpenText, aMnemns, maOpenString ); - nYPos += 10; + if( mnLayoutStyle == 0 ) + { + layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maTemplateButton, maTemplateText, aMnemns, maTemplateString ); + + nYPos += 10; + layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maOpenButton, maOpenText, aMnemns, maOpenString ); + nYPos += 10; + } + else + { + layoutButtonAndText( NULL, 0, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maTemplateButton, maTemplateText, aMnemns, maTemplateString ); + layoutButtonAndText( NULL, 1, aFileNewAppsAvailable, + aModuleOptions, SvtModuleOptions::E_SWRITER, + maOpenButton, maOpenText, aMnemns, maOpenString ); + nYPos += 10; + } DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" ); - if( mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20 > maControlRect.GetWidth() ) - maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20; + if( mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20 > maControlRect.GetWidth() ) + maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + mnBtnPos + 20; + + if( mnLayoutStyle == 1 ) + { + if( maControlRect.GetWidth() < maControlRect.GetHeight() * 3 / 2 ) + { + maControlRect.Right() = maControlRect.Left() + maControlRect.GetHeight() * 3 / 2; + mnColumnWidth[0] += (maControlRect.GetWidth() - mnBtnPos - mnColumnWidth[1] - mnColumnWidth[0] - 20)/2; + } + } maToolbox.SetSelectHdl( LINK( this, BackingWindow, ToolboxHdl ) ); - maToolbox.Show(); + if( mnLayoutStyle == 0 ) + maToolbox.Show(); // scale middle map to formatted width Size aMiddleSegmentSize( maControlRect.GetSize().Width() + nShadowLeft + nShadowRight, @@ -637,47 +702,62 @@ void BackingWindow::Resize() long nYPos = maControlRect.Top(); nYPos += nW2Delta - nDiff; - maWelcome.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); + maWelcome.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), + Size( maControlRect.GetWidth() - mnBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); nYPos += nWDelta - nDiff; - maProduct.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maProductSize.Height()*20)/19 ) ); + maProduct.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), Size( maControlRect.GetWidth() - mnBtnPos - 5, (maProductSize.Height()*20)/19 ) ); nYPos += nPDelta - nDiff; - maCreateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), - Size( maControlRect.GetWidth() - nBtnPos - 5, maCreateSize.Height() ) ); + maCreateText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), + Size( maControlRect.GetWidth() - mnBtnPos - 5, maCreateSize.Height() ) ); - nYPos += nCDelta - nDiff; + if( mnLayoutStyle == 0 ) + nYPos += nCDelta - nDiff; + else + nYPos += nWDelta/2 - nDiff; - maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maWriterText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), + maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maWriterText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maCalcText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), + maCalcButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); + maCalcText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); nYPos += nBDelta - nDiff; - maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maImpressText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), + maImpressButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maImpressText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maDrawText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), + maDrawButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); + maDrawText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); nYPos += nBDelta - nDiff; - maDBButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maDBText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), + maDBButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maDBText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - maMathButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); - maMathText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), + maMathButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); + maMathText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); nYPos += nB2Delta - nDiff; - maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maTemplateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += nBDelta - nDiff; - maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); - maOpenText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos + maButtonImageSize.Width() + 10, nYPos ), - Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); - nYPos += nBDelta - nDiff; + if( mnLayoutStyle == 0 ) + { + maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maTemplateText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), + Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + nYPos += nBDelta - nDiff; + maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maOpenText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), + Size( mnColumnWidth[0]+mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + nYPos += nBDelta - nDiff; + } + else + { + maTemplateButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos, nYPos ), maButtonImageSize ); + maTemplateText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10, nYPos ), + Size( mnColumnWidth[0] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + maOpenButton.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + mnColumnWidth[0], nYPos ), maButtonImageSize ); + maOpenText.SetPosSizePixel( Point( maControlRect.Left() + mnBtnPos + maButtonImageSize.Width() + 10 + mnColumnWidth[0], nYPos ), + Size( mnColumnWidth[1] - maButtonImageSize.Width() - 10, maButtonImageSize.Height() ) ); + } } IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index de3797d3ab4f..e8c6224087b1 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -127,10 +127,10 @@ namespace framework Size maButtonImageSize; bool mbInitControls; + sal_Int32 mnLayoutStyle; svt::AcceleratorExecute* mpAccExec; + long mnBtnPos; - - static const long nBtnPos = 240; static const int nItemId_Extensions = 1; static const int nItemId_Reg = 2; static const int nItemId_Info = 3; diff --git a/framework/source/services/fwk_services.src b/framework/source/services/fwk_services.src index 62cc4a6055a9..3d6710fec872 100644 --- a/framework/source/services/fwk_services.src +++ b/framework/source/services/fwk_services.src @@ -85,6 +85,10 @@ Window DLG_BACKING { File = "template_32.png"; }; + Bitmap BMP_BACKING_FOLDER + { + File = "folder_32.png"; + }; Bitmap BMP_BACKING_EXT { File = "extension_plus_26.png"; diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index ddd4145e57da..fe1fb92abb0e 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -134,6 +134,9 @@ ${STARTCENTER_TEMPLREP_URL} + + ${STARTCENTER_LAYOUT_STYLE} + diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index cd95db59e028..a1e203a29366 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3551,6 +3551,12 @@ + + + Contains a number deciding the layout style of the start center + + 0 +
-- cgit v1.2.3 From 09b63f24fe56810eeb7a4b26cebcf4108650f6cb Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 26 Jan 2010 16:35:52 +0100 Subject: native0: #161561# rebrand links, exes and dlls --- desktop/util/ooverinfo.rc | 4 ++-- desktop/util/verinfo.rc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/desktop/util/ooverinfo.rc b/desktop/util/ooverinfo.rc index b2fab36e41d5..28b1e0d4a811 100644 --- a/desktop/util/ooverinfo.rc +++ b/desktop/util/ooverinfo.rc @@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" @@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc index a9f3dcd3f44c..d61493568490 100644 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } -- cgit v1.2.3 From 658c917af26adeb36e5da1498b23dfd4c8262f89 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Fri, 26 Mar 2010 16:18:10 +0100 Subject: o5oo branding of startcenter - transplanted from 3b0a27115246@native0 --- instsetoo_native/util/openoffice.lst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 7897327d8de8..f42fde4960f7 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -92,6 +92,7 @@ OpenOffice STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } @@ -156,6 +157,7 @@ OpenOffice_wJRE STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } @@ -227,6 +229,7 @@ OpenOffice_Dev STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } @@ -270,6 +273,7 @@ URE STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk PACKAGEMAP package_names_ext.txt } @@ -315,6 +319,7 @@ OpenOffice_SDK STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 } active 1 compression 5 @@ -364,6 +369,7 @@ OpenOffice_Dev_SDK STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/OpenOffice.org/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/OpenOffice.org/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/OpenOffice.org/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 } active 1 compression 5 @@ -427,6 +433,7 @@ BrOffice STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/BrOffice/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/BrOffice/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/BrOffice/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } @@ -495,6 +502,7 @@ BrOffice_wJRE STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/BrOffice/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/BrOffice/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/BrOffice/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } @@ -569,6 +577,7 @@ BrOffice_Dev STARTCENTER_ADDFEATURE_URL http://tools.services.openoffice.org/forward/BrOffice/extensions.jsp?cid=920794 STARTCENTER_INFO_URL http://tools.services.openoffice.org/forward/BrOffice/homepage.jsp STARTCENTER_TEMPLREP_URL http://tools.services.openoffice.org/forward/BrOffice/templates.jsp?cid=926383 + STARTCENTER_LAYOUT_STYLE 0 REGISTRATION_PRODUCT OpenOffice.org REGISTRATION_CID 926117 } -- cgit v1.2.3 From efd407736a900cfc6684cec8f4e20718e6fabeed Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 26 Jan 2010 16:35:52 +0100 Subject: native0: #161561# rebrand links, exes and dlls --- scp2/source/ooo/folderitem_ooo.ulf | 2 +- solenv/inc/shlinfo.rc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scp2/source/ooo/folderitem_ooo.ulf b/scp2/source/ooo/folderitem_ooo.ulf index 25443ea9253d..93d938531abe 100644 --- a/scp2/source/ooo/folderitem_ooo.ulf +++ b/scp2/source/ooo/folderitem_ooo.ulf @@ -32,4 +32,4 @@ en-US = "From Template" en-US = "Open Document" [STR_FI_TOOLTIP_SOFFICE] -en-US = "The office productivity suite compatible to the open and standardized ODF document format. Supported by Sun Microsystems." +en-US = "The office productivity suite compatible to the open and standardized ODF document format. Supported by Oracle." diff --git a/solenv/inc/shlinfo.rc b/solenv/inc/shlinfo.rc index 86257dc843a0..3e090272408d 100644 --- a/solenv/inc/shlinfo.rc +++ b/solenv/inc/shlinfo.rc @@ -79,7 +79,7 @@ VS_VERSION_INFO versioninfo value "FileVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(ORG_NAME) "\0" value "InternalName", PPS(INTERNAL_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" ADDITIONAL_VERINFO1 ADDITIONAL_VERINFO2 ADDITIONAL_VERINFO3 @@ -92,7 +92,7 @@ VS_VERSION_INFO versioninfo value "FileVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", PPS(ORG_NAME) "\0" value "InternalName", PPS(INTERNAL_NAME) "\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" ADDITIONAL_VERINFO1 ADDITIONAL_VERINFO2 ADDITIONAL_VERINFO3 -- cgit v1.2.3 From 61d77a767a0d519201f3a8554b343bce881c5991 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 23:25:22 +0100 Subject: autorecovery: introduce createComponent/WithArguments at the XDatabaseDocumentUI interface --- dbaccess/source/ui/app/AppController.cxx | 77 ++++++++------- dbaccess/source/ui/app/AppController.hxx | 11 ++- dbaccess/source/ui/app/AppControllerGen.cxx | 33 ++++++- dbaccess/source/ui/app/AppDetailPageHelper.cxx | 14 +-- dbaccess/source/ui/inc/databaseobjectview.hxx | 31 +++--- dbaccess/source/ui/inc/linkeddocuments.hxx | 4 +- dbaccess/source/ui/misc/databaseobjectview.cxx | 126 ++++++++++--------------- dbaccess/source/ui/misc/linkeddocuments.cxx | 9 +- 8 files changed, 157 insertions(+), 148 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 65ff1c0a3a30..f464ebf1c8f4 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1334,7 +1334,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { ElementType eType = E_TABLE; sal_Bool bAutoPilot = sal_False; - sal_Bool bSQLView = sal_False; + ::comphelper::NamedValueCollection aCreationArgs; switch( _nId ) { @@ -1358,7 +1358,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa eType = E_QUERY; break; case ID_NEW_QUERY_SQL: - bSQLView = sal_True; + aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_False ); // run through case ID_NEW_QUERY_DESIGN: eType = E_QUERY; @@ -1374,7 +1374,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa if ( bAutoPilot ) getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) ); else - newElement( eType, bSQLView ); + newElement( eType, aCreationArgs ); } break; case SID_APP_NEW_FOLDER: @@ -1983,7 +1983,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const aDataSource <<= getDatabaseName(); } - xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments.getPropertyValues() ) ); + xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments ) ); onDocumentOpened( _sName, _eType, _eOpenMode, xRet, NULL ); } } @@ -2057,52 +2057,59 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) } // ----------------------------------------------------------------------------- -void OApplicationController::newElement( ElementType _eType, sal_Bool _bSQLView ) +Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments ) { OSL_ENSURE(getContainer(),"View is NULL! -> GPF"); + Reference< XComponent > xComponent; + Reference< XComponent > xDefinition; + switch ( _eType ) { case E_FORM: case E_REPORT: - { - ::std::auto_ptr aHelper = getDocumentsAccess(_eType); - if ( aHelper->isConnected() ) - { - Reference< XComponent > xComponent,xDefinition; - sal_Int32 nCommandType = -1; - const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); - xComponent = aHelper->newDocument(_eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT,xDefinition,nCommandType,sName); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); - } - } - break; + { + ::std::auto_ptr aHelper = getDocumentsAccess( _eType ); + if ( !aHelper->isConnected() ) + break; + + xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, xDefinition ); + } + break; + case E_QUERY: case E_TABLE: - { - ::std::auto_ptr< DatabaseObjectView > pDesigner; - SharedConnection xConnection( ensureConnection() ); - if ( xConnection.is() ) - { - if ( _eType == E_TABLE ) - { - pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) ); - } - else if ( _eType == E_QUERY ) - { - pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false, _bSQLView ) ); - } + { + ::std::auto_ptr< DatabaseObjectView > pDesigner; + SharedConnection xConnection( ensureConnection() ); + if ( !xConnection.is() ) + break; - Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( pDesigner->createNew( xDataSource ), UNO_QUERY ); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL ); - } + if ( _eType == E_TABLE ) + { + pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) ); } - break; + else if ( _eType == E_QUERY ) + { + pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false, i_rAdditionalArguments ) ); + } + + Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); + xComponent.set( pDesigner->createNew( xDataSource ), UNO_QUERY ); + } + break; + default: + OSL_ENSURE( false, "OApplicationController::newElement: illegal type!" ); break; } + + if ( xComponent.is() ) + onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); + + return xComponent; } + // ----------------------------------------------------------------------------- void OApplicationController::addContainerListener(const Reference& _xCollection) { diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 27c6f3827adf..16c13fad2e12 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -197,10 +197,11 @@ namespace dbaui /** opens a new frame for creation or auto pilot @param _eType Defines the type to open - @param _bSQLView - If the query design will be opened in SQL view, otherwise not. + @param i_rAdditionalArguments + Additional arguments to pass when creating the component */ - void newElement( ElementType _eType , sal_Bool _bSQLView ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments ); /** creates a new database object, using an auto pilot @param _eType @@ -402,7 +403,7 @@ namespace dbaui /** verifies the object type denotes a valid DatabaseObject, and the object name denotes an existing object of this type. Throws if not. */ - void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName ); + void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName ); protected: // ---------------------------------------------------------------- @@ -467,6 +468,8 @@ namespace dbaui virtual ::sal_Bool SAL_CALL closeSubComponents( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XContextMenuInterception virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index d919d1457331..6ae9d59c7eda 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -458,7 +458,7 @@ namespace } // ----------------------------------------------------------------------------- -void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::rtl::OUString& _rObjectName ) +void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName ) { // ensure we're connected if ( !isConnected() ) @@ -475,6 +475,9 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + if ( !i_rObjectName ) + return; + // ensure an existing object Reference< XNameAccess > xContainer( getElements( lcl_objectType2ElementType( _nObjectType ) ) ); if ( !xContainer.is() ) @@ -487,19 +490,19 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int { case DatabaseObject::TABLE: case DatabaseObject::QUERY: - bExistentObject = xContainer->hasByName( _rObjectName ); + bExistentObject = xContainer->hasByName( *i_rObjectName ); break; case DatabaseObject::FORM: case DatabaseObject::REPORT: { Reference< XHierarchicalNameAccess > xHierarchy( xContainer, UNO_QUERY_THROW ); - bExistentObject = xHierarchy->hasByHierarchicalName( _rObjectName ); + bExistentObject = xHierarchy->hasByHierarchicalName( *i_rObjectName ); } break; } if ( !bExistentObject ) - throw NoSuchElementException( _rObjectName, *this ); + throw NoSuchElementException( *i_rObjectName, *this ); } // ----------------------------------------------------------------------------- @@ -529,6 +532,28 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume return xComponent; } +// ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >() ); +} + +// ----------------------------------------------------------------------------- +Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments ) throw (IllegalArgumentException, SQLException, RuntimeException) +{ + ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( getMutex() ); + + impl_validateObjectTypeAndName_throw( i_nObjectType, ::boost::optional< ::rtl::OUString >() ); + + Reference< XComponent > xComponent( newElement( + lcl_objectType2ElementType( i_nObjectType ), + ::comphelper::NamedValueCollection( i_rArguments ) + ) ); + + return xComponent; +} + // ----------------------------------------------------------------------------- void SAL_CALL OApplicationController::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException) { diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 50e357b687b8..00e65eb1e09c 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -1290,15 +1290,11 @@ void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName, ) ); pDispatcher->setTargetFrame( m_xFrame ); - Sequence < PropertyValue > aArgs( 4 ); - aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Preview")); - aArgs[0].Value <<= sal_True; - aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - aArgs[1].Value <<= sal_True; - aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - aArgs[2].Value <<= sal_False; - aArgs[3].Name = PROPERTY_SHOWMENU; - aArgs[3].Value <<= sal_False; + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "Preview", sal_True ); + aArgs.put( "ReadOnly", sal_True ); + aArgs.put( "AsTemplate", sal_False ); + aArgs.put( (::rtl::OUString)PROPERTY_SHOWMENU, sal_False ); Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); sal_Bool bClearPreview = !xPreview.is(); diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx index 07c77e388196..9d417035437a 100644 --- a/dbaccess/source/ui/inc/databaseobjectview.hxx +++ b/dbaccess/source/ui/inc/databaseobjectview.hxx @@ -67,6 +67,7 @@ #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ #include #endif +#include #include @@ -96,7 +97,7 @@ namespace dbaui private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doDispatch( - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments + const ::comphelper::NamedValueCollection& i_rDispatchArgs ); protected: @@ -116,11 +117,11 @@ namespace dbaui virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rCreationArgs + const ::comphelper::NamedValueCollection& i_rCreationArgs ); virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName ); @@ -176,7 +177,7 @@ namespace dbaui openExisting( const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs + const ::comphelper::NamedValueCollection& i_rDispatchArgs ); }; @@ -186,12 +187,12 @@ namespace dbaui class QueryDesigner : public DatabaseObjectView { protected: - sal_Int32 m_nCommandType; - sal_Bool m_bPreferSQLView; + sal_Int32 m_nCommandType; + ::comphelper::NamedValueCollection m_aCreationArgs; protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rObjectName ); @@ -202,7 +203,15 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, bool _bCreateView, - sal_Bool _bPreferSQLView + const ::comphelper::NamedValueCollection& i_rCreationArgs + ); + + QueryDesigner( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, + bool _bCreateView, + const bool i_bSQLView ); }; @@ -213,7 +222,7 @@ namespace dbaui { protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rObjectName ); @@ -221,7 +230,7 @@ namespace dbaui virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( const ::com::sun::star::uno::Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rCreationArgs + const ::comphelper::NamedValueCollection& i_rCreationArgs ); public: @@ -254,7 +263,7 @@ namespace dbaui protected: virtual void fillDispatchArgs( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const ::com::sun::star::uno::Any& _aDataSource, const ::rtl::OUString& _rQualifiedName ); diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index 8807e3b71840..c836121e8c60 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -114,9 +114,7 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > newDocument( sal_Int32 _nNewFormId, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, - const sal_Int32 _nCommandType, - const ::rtl::OUString& _sObjectName + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 24debbe9bf7d..15b309d38a33 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -100,30 +99,30 @@ namespace dbaui //---------------------------------------------------------------------- Reference< XComponent > DatabaseObjectView::createNew(const Reference< XDataSource >& _xDataSource ) { - return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), Sequence< PropertyValue >() ); + return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), ::comphelper::NamedValueCollection() ); } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName, const Sequence< PropertyValue >& _rArgs ) + Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName, + const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { - return doCreateView( _rDataSource, _rName, _rArgs ); + return doCreateView( _rDataSource, _rName, i_rDispatchArgs ); } //---------------------------------------------------------------------- Reference< XComponent > DatabaseObjectView::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const Sequence< PropertyValue >& _rCreationArgs ) + const ::comphelper::NamedValueCollection& i_rCreationArgs ) { - Sequence< PropertyValue > aDispatchArgs; + ::comphelper::NamedValueCollection aDispatchArgs; fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName ); - ::comphelper::NamedValueCollection aDispArgs( aDispatchArgs ); - aDispArgs.merge( _rCreationArgs, true ); + aDispatchArgs.merge( i_rCreationArgs, true ); - return doDispatch( aDispArgs.getPropertyValues() ); + return doDispatch( aDispatchArgs ); } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::doDispatch( const Sequence< PropertyValue >& _rArgs ) + Reference< XComponent > DatabaseObjectView::doDispatch( const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { Reference< XComponent > xReturn; if ( m_xORB.is() ) @@ -163,7 +162,7 @@ namespace dbaui m_sComponentURL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")), 0, - _rArgs + i_rDispatchArgs.getPropertyValues() ); if ( !xReturn.is() ) @@ -179,29 +178,23 @@ namespace dbaui //---------------------------------------------------------------------- void DatabaseObjectView::fillDispatchArgs( - Sequence< PropertyValue >& _rDispatchArguments, + ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& /* _rName */ ) { - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc( nPos + 2 ); - ::rtl::OUString sDataSource; Reference xDataSource; if ( _aDataSource >>= sDataSource ) { - _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCENAME; - _rDispatchArguments[nPos++].Value <<= sDataSource; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCENAME, sDataSource ); } else if ( _aDataSource >>= xDataSource ) { - _rDispatchArguments[nPos ].Name = PROPERTY_DATASOURCE; - _rDispatchArguments[nPos++].Value <<= xDataSource; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCE, xDataSource ); } - _rDispatchArguments[nPos ].Name = PROPERTY_ACTIVE_CONNECTION; - _rDispatchArguments[nPos++].Value <<= getConnection(); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, getConnection() ); } //====================================================================== @@ -209,49 +202,47 @@ namespace dbaui //====================================================================== //---------------------------------------------------------------------- QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, - const Reference< XFrame >& _rxParentFrame, - bool _bCreateView, sal_Bool _bPreferSQLView ) + const Reference< XFrame >& _rxParentFrame, bool _bCreateView, const ::comphelper::NamedValueCollection& i_rCreationArgs ) :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ) ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) - ,m_bPreferSQLView( _bPreferSQLView ) + ,m_aCreationArgs( i_rCreationArgs ) { } //---------------------------------------------------------------------- - void QueryDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, - const ::rtl::OUString& _rObjectName ) + QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, + const Reference< XFrame >& _rxParentFrame, bool _bCreateView, const bool i_bSQLView ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ) + ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName ); - - bool bIncludeQueryName = 0 != _rObjectName.getLength(); - bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && m_bPreferSQLView; - - sal_Int32 nPos = _rDispatchArguments.getLength(); + m_aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, !i_bSQLView ); + } - sal_Int32 nNewLen = _rDispatchArguments.getLength() + 2; - if ( bIncludeQueryName ) - ++nNewLen; - if ( bEditViewAsSQLCommand ) - ++nNewLen; - _rDispatchArguments.realloc( nNewLen ); + //---------------------------------------------------------------------- + void QueryDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, + const ::rtl::OUString& _rObjectName ) + { + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName ); + i_rDispatchArgs.merge( m_aCreationArgs, false ); // false => do not overwrite - _rDispatchArguments[nPos ].Name = PROPERTY_GRAPHICAL_DESIGN; - _rDispatchArguments[nPos++].Value <<= ::cppu::bool2any( !m_bPreferSQLView ); + const bool bIncludeQueryName = 0 != _rObjectName.getLength(); + const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True ); + const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign; - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE; - _rDispatchArguments[nPos++].Value <<= m_nCommandType; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, m_nCommandType ); if ( bIncludeQueryName ) { - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND; - _rDispatchArguments[nPos++].Value <<= _rObjectName; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rObjectName ); } if ( bEditViewAsSQLCommand ) { - _rDispatchArguments[nPos ].Name = PROPERTY_ESCAPE_PROCESSING; - _rDispatchArguments[nPos++].Value <<= sal_Bool( sal_False ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, sal_False ); } + + // give the args passed to our ctor the highest prio, let them overrule any self-made setting + i_rDispatchArgs.merge( m_aCreationArgs, true ); } //====================================================================== @@ -264,24 +255,20 @@ namespace dbaui } //---------------------------------------------------------------------- - void TableDesigner::fillDispatchArgs( Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, + void TableDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rObjectName ) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rObjectName ); - sal_Bool bIncludeName = 0 != _rObjectName.getLength(); + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName ); - if (bIncludeName) + if ( 0 != _rObjectName.getLength() ) { - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc(_rDispatchArguments.getLength() + 1); - _rDispatchArguments[nPos ].Name = PROPERTY_CURRENTTABLE; - _rDispatchArguments[nPos++].Value <<= _rObjectName; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_CURRENTTABLE, _rObjectName ); } } //---------------------------------------------------------------------- Reference< XComponent > TableDesigner::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName, - const Sequence< PropertyValue >& _rCreationArgs ) + const ::comphelper::NamedValueCollection& i_rCreationArgs ) { bool bIsNewDesign = ( _rObjectName.getLength() == 0 ); @@ -291,7 +278,7 @@ namespace dbaui xDesigner = impl_getConnectionProvidedDesigner_nothrow( _rObjectName ); if ( !xDesigner.is() ) - return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, _rCreationArgs ); + return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, i_rCreationArgs ); // try whether the designer is a dialog Reference< XExecutableDialog > xDialog( xDesigner, UNO_QUERY_THROW ); @@ -336,10 +323,10 @@ namespace dbaui } //---------------------------------------------------------------------- - void ResultSetBrowser::fillDispatchArgs(Sequence< PropertyValue >& _rDispatchArguments, const Any& _aDataSource, + void ResultSetBrowser::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rQualifiedName) { - DatabaseObjectView::fillDispatchArgs( _rDispatchArguments, _aDataSource, _rQualifiedName ); + DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName ); OSL_ENSURE( 0 != _rQualifiedName.getLength(),"A Table name must be set"); ::rtl::OUString sCatalog; ::rtl::OUString sSchema; @@ -347,26 +334,15 @@ namespace dbaui if ( m_bTable ) ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation ); - sal_Int32 nPos = _rDispatchArguments.getLength(); - _rDispatchArguments.realloc( _rDispatchArguments.getLength() + 3 + ( m_bTable ? 3 : 0 ) ); - - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND_TYPE; - _rDispatchArguments[nPos++].Value <<= (m_bTable ? CommandType::TABLE : CommandType::QUERY); - - _rDispatchArguments[nPos ].Name = PROPERTY_COMMAND; - _rDispatchArguments[nPos++].Value <<= _rQualifiedName; - - _rDispatchArguments[nPos ].Name = PROPERTY_ENABLE_BROWSER; - _rDispatchArguments[nPos++].Value <<= sal_False; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rQualifiedName ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ENABLE_BROWSER, sal_False ); if ( m_bTable ) { - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_CATALOGNAME; - _rDispatchArguments[nPos++].Value <<= sCatalog; - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_SCHEMANAME; - _rDispatchArguments[nPos++].Value <<= sSchema; - _rDispatchArguments[nPos ].Name = PROPERTY_UPDATE_TABLENAME; - _rDispatchArguments[nPos++].Value <<= sTable; + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, sCatalog ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, sSchema ); + i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_TABLENAME, sTable ); } } diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index a7be84b5e497..13fcc8a1f0d8 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -348,7 +348,7 @@ namespace dbaui return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() ); } //------------------------------------------------------------------ - Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition, const sal_Int32 _nCommandType, const ::rtl::OUString& _sObjectName ) + Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition ) { OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!"); // determine the URL to use for the new document @@ -367,6 +367,7 @@ namespace dbaui case ID_FORM_NEW_IMPRESS: aClassId = lcl_GetSequenceClassID(SO3_SIMPRESS_CLASSID); break; + case ID_REPORT_NEW_TEXT: aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); break; @@ -408,12 +409,6 @@ namespace dbaui aCommand.Argument <<= aOpenCommand; WaitObject aWaitCursor( m_pDialogParent ); xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); - Reference xProp(xNewDocument,UNO_QUERY); - if ( xProp.is() && _sObjectName.getLength() ) - { - xProp->setPropertyValue(PROPERTY_COMMAND_TYPE,makeAny(_nCommandType)); - xProp->setPropertyValue(PROPERTY_COMMAND,makeAny(_sObjectName)); - } } } } -- cgit v1.2.3 From 590b0c017c302ee0ec65f3617e9fada3a60cd330 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 26 Jan 2010 23:25:22 +0100 Subject: autorecovery: introduce createComponent/WithArguments at the XDatabaseDocumentUI interface --- .../star/sdb/application/XDatabaseDocumentUI.idl | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl index 60bed3306c66..ba68dbd79c48 100644 --- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -275,6 +275,35 @@ interface XDatabaseDocumentUI raises ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException ); + + /** creates a new sub cokmponent of the given type + +

In opposite to createComponent, this method allows you to specify + additional arguments which are passed to the to-be-loaded component.

+ +

The meaning of the the arguments is defined at the service which is effectively + created. See the above table for a list of those + services.

+ */ + ::com::sun::star::lang::XComponent createComponent( + [in] long ObjectType ) + raises ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::sdbc::SQLException ); + + /** creates a new sub cokmponent of the given type + +

In opposite to createComponent, this method allows you to specify + additional arguments which are passed to the to-be-loaded component.

+ +

The meaning of the the arguments is defined at the service which is effectively + created. See the above table for a list of those + services.

+ */ + ::com::sun::star::lang::XComponent createComponentWithArguments( + [in] long ObjectType, + [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments ) + raises ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::sdbc::SQLException ); }; //============================================================================= -- cgit v1.2.3 From 9b89df0e30a7f16c019e267610486f7e2d00b193 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 00:07:12 +0100 Subject: autorecovery: prepareClose: do not load it component if it does not exist (anymore) --- .../source/core/dataaccess/documentdefinition.cxx | 25 ++++++++++++++++------ .../source/core/dataaccess/documentdefinition.hxx | 19 +++++++++------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index ec2e1d1e11f6..d01bb3dd5cbd 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1922,18 +1922,18 @@ void ODocumentDefinition::onCommandGetDocumentProperties( Any& _rProps ) } } // ----------------------------------------------------------------------------- -Reference< util::XCloseable> ODocumentDefinition::getComponent() throw (RuntimeException) +Reference< util::XCloseable > ODocumentDefinition::impl_getComponent_throw( const bool i_ForceCreate ) { OSL_ENSURE(m_xEmbeddedObject.is(),"Illegal call for embeddedObject"); - Reference< util::XCloseable> xComp; + Reference< util::XCloseable > xComp; if ( m_xEmbeddedObject.is() ) { - int nOldState = m_xEmbeddedObject->getCurrentState(); - int nState = nOldState; - if ( nOldState == EmbedStates::LOADED ) + int nState = m_xEmbeddedObject->getCurrentState(); + if ( ( nState == EmbedStates::LOADED ) && i_ForceCreate ) { m_xEmbeddedObject->changeState( EmbedStates::RUNNING ); - nState = EmbedStates::RUNNING; + nState = m_xEmbeddedObject->getCurrentState(); + OSL_ENSURE( nState == EmbedStates::RUNNING, "ODocumentDefinition::impl_getComponent_throw: could not switch to RUNNING!" ); } if ( nState == EmbedStates::ACTIVE || nState == EmbedStates::RUNNING ) @@ -1949,6 +1949,13 @@ Reference< util::XCloseable> ODocumentDefinition::getComponent() throw (RuntimeE return xComp; } +// ----------------------------------------------------------------------------- +Reference< util::XCloseable > ODocumentDefinition::getComponent() throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return impl_getComponent_throw( true ); +} + // ----------------------------------------------------------------------------- namespace { @@ -2130,7 +2137,11 @@ bool ODocumentDefinition::prepareClose() // by the embedding component. Thus, we do the suspend call here. // #i49370# / 2005-06-09 / frank.schoenheit@sun.com - Reference< XModel > xModel( getComponent(), UNO_QUERY ); + Reference< util::XCloseable > xComponent( impl_getComponent_throw( false ) ); + if ( !xComponent.is() ) + return true; + + Reference< XModel > xModel( xComponent, UNO_QUERY ); Reference< XController > xController; if ( xModel.is() ) xController = xModel->getCurrentController(); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index ab8f13bc2cec..df4a6825fd7b 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -216,7 +216,7 @@ private: @param _bOpenedInDesignMode determines whether the embedded object has been opened for designing it or for data display */ - void impl_onActivateEmbeddedObject(); + void impl_onActivateEmbeddedObject(); /** initializes a newly created view/controller which is displaying our embedded object @@ -226,27 +226,30 @@ private: @param _rxController the controller which belongs to the XModel of our (active) embedded object */ - void impl_initObjectEditView( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController ); + void impl_initObjectEditView( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController ); /** removes the given frame from the desktop's frame collection @raises ::com::sun::star::uno::RuntimeException */ - void impl_removeFrameFromDesktop_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); + void impl_removeFrameFromDesktop_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); /** opens the UI for this sub document */ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - impl_openUI_nolck_throw( bool _bForEditing ); + impl_openUI_nolck_throw( bool _bForEditing ); /** stores our document, if it's already loaded */ - void - impl_store_throw(); + void impl_store_throw(); /** closes our document, if it's open */ - bool - impl_close_throw(); + bool impl_close_throw(); + + /** returns our component, creates it if necessary + */ + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > + impl_getComponent_throw( const bool i_ForceCreate = true ); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; -- cgit v1.2.3 From 9bbf0a62bab06c8479deb466540a93e8d702c419 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 10:42:49 +0100 Subject: autorecovery: when creating new documents, allow for additional arguments to be passed --- dbaccess/source/ui/app/AppController.cxx | 2 +- dbaccess/source/ui/inc/linkeddocuments.hxx | 5 +-- dbaccess/source/ui/misc/linkeddocuments.cxx | 51 +++++++++++++---------------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index f464ebf1c8f4..f8a2f6562027 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2073,7 +2073,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, if ( !aHelper->isConnected() ) break; - xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, xDefinition ); + xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, xDefinition ); } break; diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index c836121e8c60..e7030312cde6 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -113,8 +113,9 @@ namespace dbaui ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > newDocument( - sal_Int32 _nNewFormId, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition + sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDefinition ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 13fcc8a1f0d8..70f297f621f4 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -348,12 +348,13 @@ namespace dbaui return impl_newWithPilot( "com.sun.star.wizards.query.CallQueryWizard", xDefinition, -1, ::rtl::OUString() ); } //------------------------------------------------------------------ - Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 _nNewFormId, Reference< XComponent >& _xDefinition ) + Reference< XComponent > OLinkedDocumentsAccess::newDocument( sal_Int32 i_nActionID, + const ::comphelper::NamedValueCollection& i_rCreationArgs, Reference< XComponent >& o_rDefinition ) { OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid document container!"); // determine the URL to use for the new document Sequence aClassId; - switch (_nNewFormId) + switch ( i_nActionID ) { case ID_FORM_NEW_TEXT: aClassId = lcl_GetSequenceClassID(SO3_SW_CLASSID); @@ -372,9 +373,8 @@ namespace dbaui aClassId = comphelper::MimeConfigurationHelper::GetSequenceClassID(SO3_RPT_CLASSID_90); break; - case SID_DB_FORM_NEW_PILOT: default: - OSL_ENSURE(sal_False, "OLinkedDocumentsAccess::newForm: pleas use newFormWithPilot!"); + OSL_ENSURE( sal_False, "OLinkedDocumentsAccess::newForm: please use newFormWithPilot!" ); return Reference< XComponent >(); } @@ -386,30 +386,25 @@ namespace dbaui Reference xORB(m_xDocumentContainer,UNO_QUERY); if ( xORB.is() ) { - Sequence< Any > aArguments(2); - - PropertyValue aValue; - - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassID")); - aValue.Value <<= aClassId; - aArguments[0] <<= aValue; - - aValue.Name = PROPERTY_ACTIVE_CONNECTION; - aValue.Value <<= m_xConnection; - aArguments[1] <<= aValue; - - Reference xContent(xORB->createInstanceWithArguments(SERVICE_SDB_DOCUMENTDEFINITION,aArguments),UNO_QUERY); - if ( xContent.is() ) - { - _xDefinition.set(xContent,UNO_QUERY); - Command aCommand; - aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("openDesign")); - OpenCommandArgument2 aOpenCommand; - aOpenCommand.Mode = OpenMode::DOCUMENT; - aCommand.Argument <<= aOpenCommand; - WaitObject aWaitCursor( m_pDialogParent ); - xNewDocument.set(xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >()),UNO_QUERY); - } + ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); + aCreationArgs.put( "ClassID", aClassId ); + aCreationArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, m_xConnection ); + + Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments( + SERVICE_SDB_DOCUMENTDEFINITION, + aCreationArgs.getWrappedPropertyValues() + ), + UNO_QUERY_THROW + ); + + o_rDefinition.set( xContent, UNO_QUERY ); + Command aCommand; + aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "openDesign" ) ); + OpenCommandArgument2 aOpenCommand; + aOpenCommand.Mode = OpenMode::DOCUMENT; + aCommand.Argument <<= aOpenCommand; + WaitObject aWaitCursor( m_pDialogParent ); + xNewDocument.set( xContent->execute( aCommand, xContent->createCommandIdentifier(), NULL ), UNO_QUERY ); } } catch(const Exception& ) -- cgit v1.2.3 From c2923112026e811b495440d8256602e2f4e173c8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 10:43:52 +0100 Subject: autorecovery: when creating new documents, allow for additional arguments to be passed --- .../source/core/dataaccess/documentcontainer.cxx | 108 +++++++++++---------- .../source/core/dataaccess/documentdefinition.cxx | 25 +++-- .../source/core/dataaccess/documentdefinition.hxx | 16 +-- 3 files changed, 81 insertions(+), 68 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 806168ae5da3..2fe62eb420a5 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -205,6 +205,20 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstance( const ::rtl { return createInstanceWithArguments( aServiceSpecifier, Sequence< Any >() ); } + +namespace +{ + template< class TYPE > + void lcl_extractAndRemove( ::comphelper::NamedValueCollection& io_rArguments, const ::rtl::OUString& i_rName, TYPE& o_rValue ) + { + if ( io_rArguments.has( i_rName ) ) + { + io_rArguments.get_ensureType( i_rName, o_rValue ); + io_rArguments.remove( i_rName ); + } + } +} + // ----------------------------------------------------------------------------- Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& _aArguments ) throw (Exception, RuntimeException) { @@ -213,65 +227,46 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments if ( ServiceSpecifier == SERVICE_SDB_DOCUMENTDEFINITION ) { MutexGuard aGuard(m_aMutex); - ::rtl::OUString sName,sPersistentName,sURL; - Reference< XCommandProcessor > xCopyFrom; - Reference xConnection; - Sequence aClassID; - sal_Bool bAsTemplate = sal_False; - const Any* pBegin = _aArguments.getConstArray(); - const Any* pEnd = pBegin + _aArguments.getLength(); - PropertyValue aValue; - for(;pBegin != pEnd;++pBegin) + // extrat known arguments + ::rtl::OUString sName, sPersistentName, sURL; + Reference< XCommandProcessor > xCopyFrom; + Reference< XConnection > xConnection; + sal_Bool bAsTemplate; + Sequence< sal_Int8 > aClassID; + + ::comphelper::NamedValueCollection aArgs( _aArguments ); + lcl_extractAndRemove( aArgs, PROPERTY_NAME, sName ); + lcl_extractAndRemove( aArgs, PROPERTY_PERSISTENT_NAME, sPersistentName ); + lcl_extractAndRemove( aArgs, PROPERTY_URL, sURL ); + lcl_extractAndRemove( aArgs, PROPERTY_EMBEDDEDOBJECT, xCopyFrom ); + lcl_extractAndRemove( aArgs, PROPERTY_ACTIVE_CONNECTION, xConnection ); + lcl_extractAndRemove( aArgs, PROPERTY_AS_TEMPLATE, bAsTemplate ); + + // ClassID has two allowed types, so a special treatment here + Any aClassIDArg = aArgs.get( "ClassID" ); + if ( aClassIDArg.hasValue() ) { - *pBegin >>= aValue; - if ( aValue.Name.equalsAscii(PROPERTY_NAME) ) - { - aValue.Value >>= sName; - } - else if ( aValue.Name.equalsAscii(PROPERTY_PERSISTENT_NAME) ) - { - aValue.Value >>= sPersistentName; - } - else if ( aValue.Name.equalsAscii(PROPERTY_EMBEDDEDOBJECT) ) - { - xCopyFrom.set(aValue.Value,UNO_QUERY); - } - else if ( aValue.Name.equalsAscii(PROPERTY_URL) ) - { - aValue.Value >>= sURL; - } - else if ( aValue.Name.equalsAscii(PROPERTY_ACTIVE_CONNECTION) ) + if ( !( aClassIDArg >>= aClassID ) ) { - xConnection.set(aValue.Value,UNO_QUERY); - } - else if ( aValue.Name.equalsAscii("ClassID") ) - { - if (! ( aValue.Value >>= aClassID ) ) - { - // Extended for usage also with a string - ::rtl::OUString suValue; - aValue.Value >>= suValue; - aClassID = ::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation( suValue ); + // Extended for usage also with a string + ::rtl::OUString sClassIDString; + if ( !( aClassIDArg >>= sClassIDString ) ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 2 ); - } - rtl::OUString suClassID = ::comphelper::MimeConfigurationHelper::GetStringClassIDRepresentation(aClassID); - volatile int dummy = 0; - (void)dummy; - (void)suClassID; - } - else if ( aValue.Name.equalsAscii(PROPERTY_AS_TEMPLATE) ) - { - aValue.Value >>= bAsTemplate; - } - else - { - // DBG_ASSERT("unknown property exception"); + aClassID = ::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation( sClassIDString ); } + +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OUString sClassIDString = ::comphelper::MimeConfigurationHelper::GetStringClassIDRepresentation( aClassID ); + (void)sClassIDString; +#endif + aArgs.remove( "ClassID" ); } + // Everything which now is still present in the arguments is passed to the embedded object + const Sequence< PropertyValue > aCreationArgs( aArgs.getPropertyValues() ); const ODefinitionContainer_Impl& rDefinitions( getDefinitions() ); - sal_Bool bNew = ( 0 == sPersistentName.getLength() ); if ( bNew ) { @@ -317,7 +312,16 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments else pElementImpl = aFind->second; - xContent = new ODocumentDefinition( *this, m_aContext.getLegacyServiceFactory(), pElementImpl, m_bFormsContainer, aClassID, xConnection ); + ::rtl::Reference< ODocumentDefinition > pDocDef = new ODocumentDefinition( *this, m_aContext.getLegacyServiceFactory(), pElementImpl, m_bFormsContainer ); + if ( aClassID.getLength() ) + { + pDocDef->initialLoad( aClassID, aCreationArgs, xConnection ); + } + else + { + OSL_ENSURE( aCreationArgs.getLength() == 0, "ODocumentContainer::createInstance: additional creation args are lost, if you do not provide a class ID." ); + } + xContent = pDocDef.get(); if ( sURL.getLength() ) { diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index d01bb3dd5cbd..50f391c64afb 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -548,14 +548,9 @@ namespace dbaccess DBG_NAME(ODocumentDefinition) //-------------------------------------------------------------------------- -ODocumentDefinition::ODocumentDefinition(const Reference< XInterface >& _rxContainer - , const Reference< XMultiServiceFactory >& _xORB - ,const TContentPtr& _pImpl - , sal_Bool _bForm - , const Sequence< sal_Int8 >& _aClassID - ,const Reference& _xConnection - ) - :OContentHelper(_xORB,_rxContainer,_pImpl) +ODocumentDefinition::ODocumentDefinition( const Reference< XInterface >& _rxContainer, const Reference< XMultiServiceFactory >& _xORB, + const TContentPtr& _pImpl, sal_Bool _bForm ) + :OContentHelper(_xORB,_rxContainer,_pImpl) ,OPropertyStateContainer(OContentHelper::rBHelper) ,m_pInterceptor(NULL) ,m_bForm(_bForm) @@ -566,9 +561,19 @@ ODocumentDefinition::ODocumentDefinition(const Reference< XInterface >& _rxConta { DBG_CTOR(ODocumentDefinition, NULL); registerProperties(); - if ( _aClassID.getLength() ) - loadEmbeddedObject( _xConnection, _aClassID, Sequence< PropertyValue >(), false, false ); } + +//-------------------------------------------------------------------------- +void ODocumentDefinition::initialLoad( const Sequence< sal_Int8 >& i_rClassID, const Sequence< PropertyValue >& i_rCreationArgs, + const Reference< XConnection >& i_rConnection ) +{ + OSL_ENSURE( i_rClassID.getLength(), "ODocumentDefinition::initialLoad: illegal class ID!" ); + if ( !i_rClassID.getLength() ) + return; + + loadEmbeddedObject( i_rConnection, i_rClassID, i_rCreationArgs, false, false ); +} + //-------------------------------------------------------------------------- ODocumentDefinition::~ODocumentDefinition() { diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index df4a6825fd7b..32ec2c68a083 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -113,14 +113,18 @@ protected: public: ODocumentDefinition( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - ,const TContentPtr& _pImpl - ,sal_Bool _bForm - ,const ::com::sun::star::uno::Sequence< sal_Int8 >& _aClassID = ::com::sun::star::uno::Sequence< sal_Int8 >() - ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection = ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>() + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, + const TContentPtr& _pImpl, + sal_Bool _bForm ); + void initialLoad( + const ::com::sun::star::uno::Sequence< sal_Int8 >& i_rClassID, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rCreationArgs, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& i_rConnection + ); + // com::sun::star::lang::XTypeProvider DECLARE_TYPEPROVIDER( ); -- cgit v1.2.3 From 6e56ff42613dcdcd5dd5421c5a810197a1e0f1da Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 10:53:54 +0100 Subject: autorecovery: also recover new forms/reports, which were not yet stored --- dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx index b2e8f0433990..2f2bdcd667d6 100644 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx +++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx @@ -672,8 +672,16 @@ namespace dbaccess try { - Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, stor->second.bForEditing, - aLoadArgs.getPropertyValues() ); + Reference< XComponent > xSubComponent; + if ( sComponentName.getLength() ) + { + xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, + stor->second.bForEditing, aLoadArgs.getPropertyValues() ); + } + else + { + xSubComponent = xDocumentUI->createComponentWithArguments( eComponentType, aLoadArgs.getPropertyValues() ); + } // at the moment, we only store, during session save, sub components which are modified. So, set this // recovered sub component to "modified", too. -- cgit v1.2.3 From 925a669a32688360e49ab972351fba2226a6a905 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 11:18:20 +0100 Subject: autorecovery: yet another slight refactoring of the DatabaseObjectView hierarchy, to allow the AppController, in newElement, to respect the additional args in all cases --- dbaccess/source/ui/app/AppController.cxx | 36 ++++++++++++++++++------- dbaccess/source/ui/inc/databaseobjectview.hxx | 16 +++-------- dbaccess/source/ui/misc/databaseobjectview.cxx | 37 +++++++++----------------- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index f8a2f6562027..b5111d19376e 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1357,10 +1357,10 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa bAutoPilot = sal_True; eType = E_QUERY; break; - case ID_NEW_QUERY_SQL: - aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_False ); - // run through case ID_NEW_QUERY_DESIGN: + aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True ); + // run through + case ID_NEW_QUERY_SQL: eType = E_QUERY; break; case ID_NEW_TABLE_DESIGN_AUTO_PILOT: @@ -1390,10 +1390,13 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa SharedConnection xConnection( ensureConnection() ); if ( xConnection.is() ) { - QueryDesigner aDesigner( getORB(), this, getFrame(), true, SID_DB_NEW_VIEW_SQL == _nId ); + QueryDesigner aDesigner( getORB(), this, getFrame(), true ); + + ::comphelper::NamedValueCollection aArgs; + aArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY ); + Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aArgs ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL ); } } @@ -1958,20 +1961,33 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const Any aDataSource; if ( _eOpenMode == E_OPEN_DESIGN ) { - sal_Bool bQuerySQLMode =( _nInstigatorCommand == SID_DB_APP_EDIT_SQL_VIEW ); + bool bAddViewTypeArg = false; if ( _eType == E_TABLE ) { if ( impl_isAlterableView_nothrow( _sName ) ) - pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true, bQuerySQLMode ) ); + { + pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true ) ); + bAddViewTypeArg = true; + } else + { pDesigner.reset( new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) ); + } } else if ( _eType == E_QUERY ) { - pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false, bQuerySQLMode ) ); + pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false ) ); + bAddViewTypeArg = true; } aDataSource <<= m_xDataSource; + + if ( bAddViewTypeArg ) + { + const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW ); + aArguments.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode ); + } + } else { @@ -2091,11 +2107,11 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, } else if ( _eType == E_QUERY ) { - pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false, i_rAdditionalArguments ) ); + pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false ) ); } Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - xComponent.set( pDesigner->createNew( xDataSource ), UNO_QUERY ); + xComponent.set( pDesigner->createNew( xDataSource, i_rAdditionalArguments ), UNO_QUERY ); } break; diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx index 9d417035437a..b295aae146a0 100644 --- a/dbaccess/source/ui/inc/databaseobjectview.hxx +++ b/dbaccess/source/ui/inc/databaseobjectview.hxx @@ -94,6 +94,7 @@ namespace dbaui m_xApplication; ::rtl::OUString m_sComponentURL; + private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doDispatch( @@ -159,7 +160,8 @@ namespace dbaui */ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > createNew( - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource, + const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection() ); /** opens a view for an existent object @@ -188,7 +190,6 @@ namespace dbaui { protected: sal_Int32 m_nCommandType; - ::comphelper::NamedValueCollection m_aCreationArgs; protected: virtual void fillDispatchArgs( @@ -202,16 +203,7 @@ namespace dbaui const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, - bool _bCreateView, - const ::comphelper::NamedValueCollection& i_rCreationArgs - ); - - QueryDesigner( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, - bool _bCreateView, - const bool i_bSQLView + bool _bCreateView ); }; diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 15b309d38a33..3f9e94453d78 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -77,11 +77,11 @@ namespace dbaui const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame, const ::rtl::OUString& _rComponentURL ) - :m_xORB ( _rxORB ) - ,m_xParentFrame ( _rxParentFrame ) - ,m_xFrameLoader ( ) - ,m_xApplication ( _rxApplication ) - ,m_sComponentURL( _rComponentURL ) + :m_xORB ( _rxORB ) + ,m_xParentFrame ( _rxParentFrame ) + ,m_xFrameLoader ( ) + ,m_xApplication ( _rxApplication ) + ,m_sComponentURL ( _rComponentURL ) { OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" ); OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" ); @@ -97,9 +97,9 @@ namespace dbaui } //---------------------------------------------------------------------- - Reference< XComponent > DatabaseObjectView::createNew(const Reference< XDataSource >& _xDataSource ) + Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs ) { - return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), ::comphelper::NamedValueCollection() ); + return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), i_rDispatchArgs ); } //---------------------------------------------------------------------- @@ -114,9 +114,10 @@ namespace dbaui const ::comphelper::NamedValueCollection& i_rCreationArgs ) { ::comphelper::NamedValueCollection aDispatchArgs; - fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName ); - aDispatchArgs.merge( i_rCreationArgs, true ); + aDispatchArgs.merge( i_rCreationArgs, false ); // false => do not overwrite + fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName ); + aDispatchArgs.merge( i_rCreationArgs, true ); // true => do overwrite return doDispatch( aDispatchArgs ); } @@ -202,28 +203,17 @@ namespace dbaui //====================================================================== //---------------------------------------------------------------------- QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, - const Reference< XFrame >& _rxParentFrame, bool _bCreateView, const ::comphelper::NamedValueCollection& i_rCreationArgs ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ) + const Reference< XFrame >& _rxParentFrame, bool _bCreateView ) + :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) - ,m_aCreationArgs( i_rCreationArgs ) { } - //---------------------------------------------------------------------- - QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, - const Reference< XFrame >& _rxParentFrame, bool _bCreateView, const bool i_bSQLView ) - :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN ) ) - ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY ) - { - m_aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, !i_bSQLView ); - } - //---------------------------------------------------------------------- void QueryDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource, const ::rtl::OUString& _rObjectName ) { DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName ); - i_rDispatchArgs.merge( m_aCreationArgs, false ); // false => do not overwrite const bool bIncludeQueryName = 0 != _rObjectName.getLength(); const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True ); @@ -240,9 +230,6 @@ namespace dbaui { i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, sal_False ); } - - // give the args passed to our ctor the highest prio, let them overrule any self-made setting - i_rDispatchArgs.merge( m_aCreationArgs, true ); } //====================================================================== -- cgit v1.2.3 From e10fc78fea6728cb1a8819daab3beee7823627f3 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 11:50:04 +0100 Subject: autorecovery: allow an empty URL in the attachResource call, which means 'determine the proper Location/URL yourself'. Needed so that not every client has to do this. Location precedes URL, this ensures that a recovered document, when saved, saves to the salvaged-file, not to the recovery-file --- dbaccess/source/core/dataaccess/ModelImpl.cxx | 2 +- dbaccess/source/core/dataaccess/databasedocument.cxx | 11 +++++++++-- dbaccess/source/ui/browser/dataview.cxx | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 112da2d19505..4095a608733c 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1048,7 +1048,7 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b // then nobody would call the doc's attachResource. So, we do it here, to ensure it's in a proper // state, fires all events, and so on. // #i105505# / 2009-10-02 / frank.schoenheit@sun.com - xModel->attachResource( xModel->getURL(), m_aArgs ); + xModel->attachResource( ::rtl::OUString(), m_aArgs ); } if ( _bInitialize ) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 39afd5bf76b5..67e97110ad0f 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -702,7 +702,14 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR // (we do not support macro signatures, so we can ignore this call) } - m_pImpl->attachResource( _rURL, _rArguments ); + // if no URL has been provided, the caller was lazy enough to not call our getLocation/getURL - which is allowed ... + ::rtl::OUString sURL( _rURL ); + if ( !sURL.getLength() ) + sURL = getLocation(); + if ( !sURL.getLength() ) + sURL = getURL(); + + m_pImpl->attachResource( sURL, _rArguments ); if ( impl_isInitializing() ) { // this means we've just been loaded, and this is the attachResource call which follows @@ -886,7 +893,7 @@ sal_Bool SAL_CALL ODatabaseDocument::hasLocation( ) throw (RuntimeException) ::rtl::OUString SAL_CALL ODatabaseDocument::getLocation( ) throw (RuntimeException) { DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit ); - return m_pImpl->getURL(); + return m_pImpl->getDocFileLocation(); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseDocument::isReadonly( ) throw (RuntimeException) diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx index a66f6ec6d11a..efeb65adf442 100644 --- a/dbaccess/source/ui/browser/dataview.cxx +++ b/dbaccess/source/ui/browser/dataview.cxx @@ -236,7 +236,7 @@ namespace dbaui { ::comphelper::NamedValueCollection aArgs( xModel->getArgs() ); aArgs.remove( "Hidden" ); - xModel->attachResource( xModel->getURL(), aArgs.getPropertyValues() ); + xModel->attachResource( ::rtl::OUString(), aArgs.getPropertyValues() ); } } catch( const Exception& ) -- cgit v1.2.3 From 6ecc93369b92fe1f8669ed8e429121f038178753 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- sd/source/ui/dlg/headerfooterdlg.cxx | 3 +-- sd/source/ui/view/sdview.cxx | 2 +- slideshow/source/engine/slideview.cxx | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index fd8719d60927..620d5aa1fb41 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -859,8 +859,7 @@ void PresLayoutPreview::Paint( OutputDevice& aOut, SdrTextObj* pObj, bool bVisib aObjectTransform.translate(maOutRect.TopLeft().X(), maOutRect.TopLeft().Y()); // create geometry using unit range and object transform - const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - basegfx::B2DPolyPolygon aGeometry(basegfx::tools::createPolygonFromRect(aUnitRange)); + basegfx::B2DPolyPolygon aGeometry(basegfx::tools::createUnitPolygon()); aGeometry.transform(aObjectTransform); // apply line pattern if wanted diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index d38704bd124c..debe811a6a22 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -314,7 +314,7 @@ drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedP // create dashed border { // create object polygon - basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0))); + basegfx::B2DPolygon aPolygon(basegfx::tools::createUnitPolygon()); aPolygon.transform(aObjectMatrix); // create line and stroke attribute diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index dcca4a51b4d7..85c1dfc82fef 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -86,9 +86,7 @@ struct StaticUnitRectPoly : public rtl::StaticWithInit Date: Wed, 27 Jan 2010 11:51:56 +0100 Subject: aw079: #i99147# attribute rework and others --- sw/source/core/draw/dflyobj.cxx | 16 +++++----------- sw/source/ui/docvw/postit.cxx | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index cda428f124eb..6346e920b206 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -71,10 +71,9 @@ using namespace ::com::sun::star; // AW: For VCOfDrawVirtObj and stuff #include #include -#include #include #include -#include +#include using namespace ::com::sun::star; @@ -249,17 +248,12 @@ namespace drawinglayer // create an invisible HitTestPrimitive to allow hitting the object. Use a filled primitive // to get a HitTest which uses 'inside' as default object hit. The special cases from // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj; - // this removed the 'hack' to get a view from inside model data or to react on noll-tolerance + // this removed the 'hack' to get a view from inside model data or to react on null-tolerance // as it was done in the old implementation - const basegfx::B2DPolygon aOuterRangePolygon(basegfx::tools::createPolygonFromRect(getOuterRange())); - const basegfx::BColor aColor(0.0, 0.0, 0.0); - const Primitive2DReference aContentReference( - new PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aOuterRangePolygon), - aColor)); const Primitive2DReference aHitTestReference( - new HitTestPrimitive2D( - Primitive2DSequence(&aContentReference, 1))); + createFallbackHitTestPrimitive( + true, + basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getOuterRange())))); aRetval = Primitive2DSequence(&aHitTestReference, 1); } diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index 77ded3905220..3a44da498911 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -120,7 +120,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From 42614dac6359f8ea3a3446f089f17b5054dbe50b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 27 Jan 2010 12:11:39 +0100 Subject: autorecovery: renamed local var shadowing another local var (GCC warning) --- dbaccess/source/ui/app/AppController.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index b5111d19376e..9e6890f728eb 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1392,11 +1392,11 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa { QueryDesigner aDesigner( getORB(), this, getFrame(), true ); - ::comphelper::NamedValueCollection aArgs; - aArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); + ::comphelper::NamedValueCollection aCreationArgs; + aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId ); Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); - Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aArgs ), UNO_QUERY ); + Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY ); onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL ); } } -- cgit v1.2.3 From dc45080c4f44ced9e0d1916f7760268ccf95c376 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 27 Jan 2010 14:30:04 +0100 Subject: #161434# Support png and bmp intro/about images --- desktop/source/splash/splash.cxx | 38 ++++++++++++++++++++++++++++++++------ sfx2/source/dialog/about.cxx | 8 ++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 97029b0701f4..5f6167fafd2c 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -446,8 +446,14 @@ bool SplashScreen::findBitmap(rtl::OUString const & path) { haveBitmap = findAppBitmap(path); } if ( !haveBitmap ) + { haveBitmap = loadBitmap( path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.png"))); + if ( !haveBitmap ) + haveBitmap = loadBitmap( + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + } + return haveBitmap; } @@ -477,10 +483,17 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".png" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); bool haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } + if ( !haveBitmap ) { aStrBuf.appendAscii( "intro_" ); @@ -488,10 +501,16 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".png" ); - aBmpFileName = aStrBuf.makeStringAndClear(); + + aRootIntroFileName = aStrBuf.makeStringAndClear(); + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } @@ -506,9 +525,16 @@ bool SplashScreen::findAppBitmap(rtl::OUString const & path) aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( _sAppName ); - aStrBuf.appendAscii( ".png" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".png" ); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".bmp" ); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index ba3d04b42927..433cf6d69344 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -161,6 +161,10 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } if ( !bLoaded ) @@ -168,6 +172,10 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } // Transparenter Font -- cgit v1.2.3 From cd6abead393fa3f4edef8ac056dd8e548d7cf3d1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- extensions/source/abpilot/datasourcehandling.cxx | 2 +- extensions/source/bibliography/datman.cxx | 2 +- extensions/source/dbpilots/controlwizard.cxx | 2 +- extensions/source/dbpilots/controlwizard.hxx | 2 +- wizards/com/sun/star/wizards/db/DBMetaData.java | 4 ++-- wizards/com/sun/star/wizards/db/RecordParser.java | 2 +- wizards/source/formwizard/DBMeta.xba | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 14ad3543ac51..a33133916219 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -565,7 +565,7 @@ namespace abp // ................................................................ // create the interaction handler (needed for authentication and error handling) - static ::rtl::OUString s_sInteractionHandlerServiceName = ::rtl::OUString::createFromAscii("com.sun.star.sdb.InteractionHandler"); + static ::rtl::OUString s_sInteractionHandlerServiceName = ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler"); Reference< XInteractionHandler > xInteractions; try { diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 5a95f61f50c1..754fdc53f01b 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -150,7 +150,7 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL) try { - Reference xHdl = xMgr->createInstance(C2U("com.sun.star.sdb.InteractionHandler")); + Reference xHdl = xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")); Reference xIHdl(xHdl, UNO_QUERY); xConn = xComplConn->connectWithCompletion(xIHdl); // xConn = xDataSource->getConnection(sUser, sPwd); diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 169286a19a5f..d96876258d8d 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -521,7 +521,7 @@ namespace dbp //--------------------------------------------------------------------- Reference< XInteractionHandler > OControlWizard::getInteractionHandler(Window* _pWindow) const { - const ::rtl::OUString sInteractionHandlerServiceName = ::rtl::OUString::createFromAscii("com.sun.star.sdb.InteractionHandler"); + const ::rtl::OUString sInteractionHandlerServiceName = ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandler"); Reference< XInteractionHandler > xHandler; try { diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index d50cc8e0b8df..0facd1672de8 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -148,7 +148,7 @@ namespace dbp ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getFormConnection(const OAccessRegulator&) const; - /** returns the com.sun.star.sdb.InteractionHandler + /** returns the com.sun.star.task.InteractionHandler @param _pWindow The window will be used when an error message has to be shown. */ ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler(Window* _pWindow) const; diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 2a7151cd1135..1c934b83f0d5 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -220,7 +220,7 @@ public class DBMetaData this.xMSF = xMSF; xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext"); xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDatabaseContext); - XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); + XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); oInteractionHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); DataSourceNames = xNameAccess.getElementNames(); } @@ -722,7 +722,7 @@ public class DBMetaData } else { - XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); + XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); XInteractionHandler oInteractionHandler2 = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); boolean bExitLoop = true; do diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java index cf2853861ccd..fccfe7e4d1f6 100644 --- a/wizards/com/sun/star/wizards/db/RecordParser.java +++ b/wizards/com/sun/star/wizards/db/RecordParser.java @@ -84,7 +84,7 @@ public class RecordParser extends QueryMetaData xRowSetColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet); xRowSetComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xRowSet); xExecute = (com.sun.star.sdb.XCompletedExecution) UnoRuntime.queryInterface(com.sun.star.sdb.XCompletedExecution.class, xRowSet); - XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); + XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); xInteraction = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction); } catch (Exception exception) diff --git a/wizards/source/formwizard/DBMeta.xba b/wizards/source/formwizard/DBMeta.xba index f4ac2bbb7fb0..2d8dc2838f5c 100644 --- a/wizards/source/formwizard/DBMeta.xba +++ b/wizards/source/formwizard/DBMeta.xba @@ -86,7 +86,7 @@ Dim Nulllist() oDBConnection = oDBContext.GetByName(sDBName).GetConnection("","") GetConnection() = True Else - oInteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler") + oInteractionHandler = createUnoService("com.sun.star.task.InteractionHandler") oDataSource = oDBContext.GetByName(sDBName) On Local Error Goto NOCONNECTION Do -- cgit v1.2.3 From 6242c77610b6d6c4206da895dfa430b781f60996 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 22:42:50 +0100 Subject: autorecovery: addDatabaseDocument: do not close the document after having disposed it - this will throw nowadays --- wizards/com/sun/star/wizards/db/DBMetaData.java | 125 ++++++++++++------------ 1 file changed, 61 insertions(+), 64 deletions(-) diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 1c934b83f0d5..296d73c5c31a 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -32,9 +32,7 @@ package com.sun.star.wizards.db; import com.sun.star.awt.XWindow; import com.sun.star.lang.XInitialization; import com.sun.star.ui.dialogs.XExecutableDialog; -import java.util.*; -// import com.sun.star.io.IOException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XMultiServiceFactory; @@ -48,7 +46,6 @@ import com.sun.star.container.XHierarchicalNameAccess; import com.sun.star.container.XHierarchicalNameContainer; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; -// import com.sun.star.container.XNamed; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XModel; import com.sun.star.frame.XStorable; @@ -57,7 +54,6 @@ import com.sun.star.sdbc.DataType; import com.sun.star.sdb.XOfficeDatabaseDocument; import com.sun.star.sdb.XDocumentDataSource; import com.sun.star.sdb.tools.XConnectionTools; -// import com.sun.star.sdbcx.XAppend; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.ucb.XSimpleFileAccess; @@ -67,14 +63,10 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.util.XCloseable; import com.sun.star.util.XNumberFormatsSupplier; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.common.*; -// import com.sun.star.wizards.ui.UnoDialog; import com.sun.star.task.XInteractionHandler; import com.sun.star.sdb.XFormDocumentsSupplier; import com.sun.star.sdb.XQueryDefinitionsSupplier; import com.sun.star.sdb.XReportDocumentsSupplier; -// import com.sun.star.sdbc.ColumnValue; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbc.XDatabaseMetaData; import com.sun.star.sdbc.XDataSource; @@ -82,10 +74,18 @@ import com.sun.star.sdbc.XResultSet; import com.sun.star.sdbc.XRow; import com.sun.star.sdb.XCompletedConnection; import com.sun.star.lang.Locale; -// import com.sun.star.util.XFlushable; import com.sun.star.lang.XSingleServiceFactory; import com.sun.star.sdb.XQueriesSupplier; import com.sun.star.sdbcx.XTablesSupplier; +import com.sun.star.wizards.common.Configuration; +import com.sun.star.wizards.common.Desktop; +import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.NumberFormatter; +import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.Resource; +import com.sun.star.wizards.common.SystemDialog; +import java.util.Vector; public class DBMetaData { @@ -219,9 +219,9 @@ public class DBMetaData { this.xMSF = xMSF; xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext"); - xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDatabaseContext); + xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext ); XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); - oInteractionHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); + oInteractionHandler = UnoRuntime.queryInterface( XInteractionHandler.class, xInteractionHandler ); DataSourceNames = xNameAccess.getElementNames(); } catch (Exception exception) @@ -262,6 +262,7 @@ public class DBMetaData return getTableNamesAsNameAccess().hasByName(_stablename); } + @SuppressWarnings("unchecked") public void setTableByName(String _tableName) { CommandObject oTableObject = new CommandObject(_tableName, com.sun.star.sdb.CommandType.TABLE); @@ -330,10 +331,10 @@ public class DBMetaData { oCommand = getQueryNamesAsNameAccess().getByName(Name); } - XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand); - xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand); + XColumnsSupplier xCommandCols = UnoRuntime.queryInterface( XColumnsSupplier.class, oCommand ); + xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oCommand ); // TODO: Performance leak getColumns() take very long. - xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns()); + xColumns = UnoRuntime.queryInterface( XNameAccess.class, xCommandCols.getColumns() ); } catch (Exception exception) { @@ -378,14 +379,14 @@ public class DBMetaData public XNameAccess getQueryNamesAsNameAccess() { - XQueriesSupplier xDBQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, DBConnection); - xQueryNames = (XNameAccess) xDBQueries.getQueries(); + XQueriesSupplier xDBQueries = UnoRuntime.queryInterface( XQueriesSupplier.class, DBConnection ); + xQueryNames = xDBQueries.getQueries(); return xQueryNames; } public XNameAccess getTableNamesAsNameAccess() { - XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); + XTablesSupplier xDBTables = UnoRuntime.queryInterface( XTablesSupplier.class, DBConnection ); XNameAccess xTableNames = xDBTables.getTables(); return xTableNames; } @@ -412,7 +413,7 @@ public class DBMetaData return TableNames; } } - TableNames = (String[]) getTableNamesAsNameAccess().getElementNames(); + TableNames = getTableNamesAsNameAccess().getElementNames(); return TableNames; } @@ -458,7 +459,7 @@ public class DBMetaData int itablecount = xDBMetaData.getMaxTablesInSelect(); if (itablecount == 0) { - return this.NOLIMIT; + return DBMetaData.NOLIMIT; } else { @@ -487,7 +488,7 @@ public class DBMetaData iMaxColumnsInSelect = xDBMetaData.getMaxColumnsInSelect(); if (iMaxColumnsInSelect == 0) { - iMaxColumnsInSelect = this.NOLIMIT; + iMaxColumnsInSelect = DBMetaData.NOLIMIT; } } @@ -496,7 +497,7 @@ public class DBMetaData iMaxColumnsInGroupBy = xDBMetaData.getMaxColumnsInGroupBy(); if (iMaxColumnsInGroupBy == 0) { - iMaxColumnsInGroupBy = this.NOLIMIT; + iMaxColumnsInGroupBy = DBMetaData.NOLIMIT; } } @@ -505,7 +506,7 @@ public class DBMetaData iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable(); if (iMaxColumnsInTable == 0) { - iMaxColumnsInTable = this.NOLIMIT; + iMaxColumnsInTable = DBMetaData.NOLIMIT; } return iMaxColumnsInTable; } @@ -515,8 +516,6 @@ public class DBMetaData try { xDBMetaData = DBConnection.getMetaData(); - XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, DBConnection); - Object oDataSource = xChild.getParent(); getDataSourceInterfaces(); setMaxColumnsInGroupBy(); setMaxColumnsInSelect(); @@ -567,7 +566,7 @@ public class DBMetaData try { Object oDataSource = xNameAccess.getByName(DataSourceName); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource); + xDataSource = UnoRuntime.queryInterface( XDataSource.class, oDataSource ); } catch (com.sun.star.container.NoSuchElementException e) { @@ -585,7 +584,7 @@ public class DBMetaData { this.DataSourceName = _DataSourceName; getDataSourceInterfaces(); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, getDataSource()); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, getDataSource() ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); @@ -599,8 +598,8 @@ public class DBMetaData public void getDataSourceInterfaces() throws Exception { - xCompleted = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, getDataSource()); - xDataSourcePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getDataSource()); + xCompleted = UnoRuntime.queryInterface( XCompletedConnection.class, getDataSource() ); + xDataSourcePropertySet = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() ); bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue(); } @@ -615,15 +614,15 @@ public class DBMetaData Properties.getPropertyValue(curproperties, "ActiveConnection")); if (xConnection != null) { - com.sun.star.container.XChild child = (com.sun.star.container.XChild) UnoRuntime.queryInterface(com.sun.star.container.XChild.class, xConnection); + com.sun.star.container.XChild child = UnoRuntime.queryInterface( com.sun.star.container.XChild.class, xConnection ); - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, child.getParent()); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + xDataSource = UnoRuntime.queryInterface( XDataSource.class, child.getParent() ); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, this.xDataSource ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); } - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDataSource); + XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, xDataSource ); if (xPSet != null) { DataSourceName = AnyConverter.toString(xPSet.getPropertyValue("Name")); @@ -646,8 +645,8 @@ public class DBMetaData } else if (Properties.hasPropertyValue(curproperties, "DataSource")) { - xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, Properties.getPropertyValue(curproperties, "DataSource")); - XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource); + xDataSource = UnoRuntime.queryInterface( XDataSource.class, Properties.getPropertyValue( curproperties, "DataSource" ) ); + XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, this.xDataSource ); if (xDocu != null) { xModel = xDocu.getDatabaseDocument(); @@ -692,7 +691,7 @@ public class DBMetaData try { this.DBConnection = _DBConnection; - this.ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, this.DBConnection); + this.ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, this.DBConnection ); getDataSourceObjects(); return true; } @@ -723,11 +722,11 @@ public class DBMetaData else { XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); - XInteractionHandler oInteractionHandler2 = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler); + XInteractionHandler oInteractionHandler2 = UnoRuntime.queryInterface( XInteractionHandler.class, xInteractionHandler ); boolean bExitLoop = true; do { - XCompletedConnection xCompleted2 = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, xDataSource); + XCompletedConnection xCompleted2 = UnoRuntime.queryInterface( XCompletedConnection.class, xDataSource ); try { DBConnection = xCompleted2.connectWithCompletion(oInteractionHandler2); @@ -755,8 +754,8 @@ public class DBMetaData } else { - xConnectionComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, DBConnection); - ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, DBConnection); + xConnectionComponent = UnoRuntime.queryInterface( XComponent.class, DBConnection ); + ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, DBConnection ); getDataSourceObjects(); } return bgetConnection; @@ -831,17 +830,16 @@ public class DBMetaData { try { - XQueryDefinitionsSupplier xQueryDefinitionsSuppl = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class, xDataSource); + XQueryDefinitionsSupplier xQueryDefinitionsSuppl = UnoRuntime.queryInterface( XQueryDefinitionsSupplier.class, xDataSource ); XNameAccess xQueryDefs = xQueryDefinitionsSuppl.getQueryDefinitions(); - XSingleServiceFactory xSSFQueryDefs = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xQueryDefs); + XSingleServiceFactory xSSFQueryDefs = UnoRuntime.queryInterface( XSingleServiceFactory.class, xQueryDefs ); Object oQuery = xSSFQueryDefs.createInstance(); //"com.sun.star.sdb.QueryDefinition" - XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oQuery); + XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, oQuery ); String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery(); xPSet.setPropertyValue("Command", s); - XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQueryDefs); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xQueryDefs); + XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, xQueryDefs ); ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName); xNameCont.insertByName(_QueryName, oQuery); return true; @@ -885,23 +883,23 @@ public class DBMetaData public XHierarchicalNameAccess getReportDocuments() { - XReportDocumentsSupplier xReportDocumentSuppl = (XReportDocumentsSupplier) UnoRuntime.queryInterface(XReportDocumentsSupplier.class, this.xModel); + XReportDocumentsSupplier xReportDocumentSuppl = UnoRuntime.queryInterface( XReportDocumentsSupplier.class, this.xModel ); xReportDocumentSuppl.getReportDocuments(); - XHierarchicalNameAccess xReportHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments()); + XHierarchicalNameAccess xReportHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() ); return xReportHier; } public XHierarchicalNameAccess getFormDocuments() { - XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel); - XHierarchicalNameAccess xFormHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments()); + XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel ); + XHierarchicalNameAccess xFormHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); return xFormHier; } public boolean hasFormDocumentByName(String _sFormName) { - XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel); - XNameAccess xFormNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormDocumentSuppl.getFormDocuments()); + XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel ); + XNameAccess xFormNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xFormDocumentSuppl.getFormDocuments() ); return xFormNameAccess.hasByName(_sFormName); } @@ -929,11 +927,10 @@ public class DBMetaData try { PropertyValue[] aDocProperties; - XModel xDocumentModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xComponent); + XModel xDocumentModel = UnoRuntime.queryInterface( XModel.class, _xComponent ); String sPath = xDocumentModel.getURL(); String basename = FileAccess.getBasename(sPath, "/"); - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xComponent); - _xComponent.dispose(); + XCloseable xCloseable = UnoRuntime.queryInterface( XCloseable.class, _xComponent ); xCloseable.close(false); if (_bcreateTemplate) { @@ -951,13 +948,13 @@ public class DBMetaData { aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate)); } - XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, _xDocNameAccess); + XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess ); Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties); - XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocNameAccess); + XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocNameAccess ); String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename); xHier.insertByHierarchicalName(sdocname, oDBDocument); XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface ); xSimpleFileAccess.kill(sPath); } catch (Exception e) @@ -971,16 +968,16 @@ public class DBMetaData XComponent[] xRetComponent = new XComponent[2]; try { - XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, _xDocuments); + XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xDocuments ); PropertyValue[] aPropertyValues = new PropertyValue[4]; aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign" : "open"); aPropertyValues[1] = Properties.createProperty("ActiveConnection", this.DBConnection); aPropertyValues[2] = Properties.createProperty("DocumentTitle", _docname); aPropertyValues[3] = Properties.createProperty("AsTemplate", new Boolean(_bAsTemplate)); - XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocuments); + XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocuments ); if (xHier.hasByHierarchicalName(_docname)) { - xRetComponent[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xHier.getByHierarchicalName(_docname)); + xRetComponent[0] = UnoRuntime.queryInterface( XComponent.class, xHier.getByHierarchicalName( _docname ) ); xRetComponent[1] = xComponentLoader.loadComponentFromURL(_docname, "", 0, aPropertyValues); } } @@ -1018,7 +1015,7 @@ public class DBMetaData String[] sColValues = null; try { - XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, _xResultSet); + XRow xRow = UnoRuntime.queryInterface( XRow.class, _xResultSet ); Vector aColVector = new Vector(); while (_xResultSet.next()) { @@ -1067,9 +1064,9 @@ public class DBMetaData try { XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); + XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface ); String storepath = FileAccess.getOfficePath(xMSF, "Temp", xSimpleFileAccess) + "/" + _storename; - XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, _xcomponent); + XStorable xStoreable = UnoRuntime.queryInterface( XStorable.class, _xcomponent ); PropertyValue[] oStoreProperties = new PropertyValue[1]; oStoreProperties[0] = Properties.createProperty("FilterName", "writer8"); storepath += ".odt"; @@ -1118,12 +1115,12 @@ public class DBMetaData try { Object oDialog = xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog"); - XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oDialog); + XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oDialog ); PropertyValue[] aPropertyValue = new PropertyValue[2]; aPropertyValue[0] = Properties.createProperty("SQLException", oSQLException); aPropertyValue[1] = Properties.createProperty("ParentWindow", _xWindow); xInitialization.initialize(aPropertyValue); - XExecutableDialog xExecutableDialog = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oDialog); + XExecutableDialog xExecutableDialog = UnoRuntime.queryInterface( XExecutableDialog.class, oDialog ); xExecutableDialog.execute(); } catch (com.sun.star.uno.Exception ex) -- cgit v1.2.3 From a31b27b704d5c669674afdf135a61cdf1f30ff3b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 11:52:40 +0100 Subject: autorecovery: re-work the table wizard so that it does not open the table itself, but uses XDatabaseDocumentUI Consequently, it does not need to return the created model/controller anymore. This way, the application controller has full control over its sub components, which didn't work reliably before. Other wizards (query/form/report) are to follow. For this purpose, they're also to be based on the newly introduced DatabaseObjectWizard class. --- .../star/wizards/common/NamedValueCollection.java | 90 ++++++++++++++++++++++ .../sun/star/wizards/db/DatabaseObjectWizard.java | 75 ++++++++++++++++++ .../com/sun/star/wizards/db/TableDescriptor.java | 11 ++- wizards/com/sun/star/wizards/makefile.mk | 2 + .../sun/star/wizards/table/CallTableWizard.java | 43 ++++------- .../com/sun/star/wizards/table/TableWizard.java | 74 ++++++------------ .../sun/star/wizards/table/XCallTableWizard.java | 42 ---------- wizards/com/sun/star/wizards/table/makefile.mk | 1 - 8 files changed, 212 insertions(+), 126 deletions(-) create mode 100644 wizards/com/sun/star/wizards/common/NamedValueCollection.java create mode 100644 wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java delete mode 100644 wizards/com/sun/star/wizards/table/XCallTableWizard.java diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java new file mode 100644 index 000000000000..f8f2cd05224a --- /dev/null +++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.sun.star.wizards.common; + +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +/** + * + * @author frank.schoenheit@sun.com + */ +public class NamedValueCollection +{ + final private HashMap< String, Object > m_values = new HashMap< String, Object >(); + + public NamedValueCollection() + { + } + + public NamedValueCollection( final PropertyValue[] i_values ) + { + for ( int i = 0; i < i_values.length; ++i ) + m_values.put( i_values[i].Name, i_values[i].Value ); + } + + public final void put( final String i_name, final Object i_value ) + { + m_values.put( i_name, i_value ); + } + + @SuppressWarnings("unchecked") + public final < T extends Object > T getOrDefault( final String i_key, final T i_default ) + { + if ( m_values.containsKey( i_key ) ) + { + final Object value = m_values.get( i_key ); + try + { + return (T)value; + } + catch ( ClassCastException e ) { } + } + return i_default; + } + + @SuppressWarnings("unchecked") + public final < T extends XInterface > T queryOrDefault( final String i_key, final T i_default, Class i_interfaceClass ) + { + if ( m_values.containsKey( i_key ) ) + { + final Object value = m_values.get( i_key ); + return (T)UnoRuntime.queryInterface( i_interfaceClass, value ); + } + return i_default; + } + + public final boolean has( final String i_key ) + { + return m_values.containsKey( i_key ); + } + + public final PropertyValue[] getPropertyValues() + { + PropertyValue[] values = new PropertyValue[ m_values.size() ]; + + Iterator< Entry< String, Object > > iter = m_values.entrySet().iterator(); + int i = 0; + while ( iter.hasNext() ) + { + Entry< String, Object > entry = iter.next(); + values[i++] = new PropertyValue( + entry.getKey(), + 0, + entry.getValue(), + PropertyState.DIRECT_VALUE + ); + } + + return values; + } +} diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java new file mode 100644 index 000000000000..5c65d73794f0 --- /dev/null +++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.sun.star.wizards.db; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.NoSuchElementException; +import com.sun.star.frame.XController; +import com.sun.star.frame.XFrame; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.sdb.application.XDatabaseDocumentUI; +import com.sun.star.sdbc.SQLException; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.Desktop; +import com.sun.star.wizards.common.NamedValueCollection; +import com.sun.star.wizards.ui.WizardDialog; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * is a base class for a wizard creating a database object + * @author frank.schoenheit@sun.com + */ +public abstract class DatabaseObjectWizard extends WizardDialog +{ + protected final PropertyValue[] m_wizardContext; + protected final XDatabaseDocumentUI m_docUI; + protected final XFrame m_frame; + + protected DatabaseObjectWizard( final XMultiServiceFactory i_orb, final int i_helpIDBase, final PropertyValue[] i_wizardContext ) + { + super( i_orb, i_helpIDBase ); + m_wizardContext = i_wizardContext; + + final NamedValueCollection wizardContext = new NamedValueCollection( m_wizardContext ); + m_docUI = wizardContext.queryOrDefault( "DocumentUI", (XDatabaseDocumentUI)null, XDatabaseDocumentUI.class ); + + if ( m_docUI != null ) + { + XController docController = UnoRuntime.queryInterface( XController.class, m_docUI ); + m_frame = docController.getFrame(); + } + else + { + XFrame parentFrame = wizardContext.queryOrDefault( "ParentFrame", (XFrame)null, XFrame.class ); + if ( parentFrame != null ) + m_frame = parentFrame; + else + m_frame = Desktop.getActiveFrame( xMSF ); + } + } + + protected final void loadSubComponent( final int i_type, final String i_name, final boolean i_forEditing ) + { + try + { + m_docUI.loadComponent( i_type, i_name, i_forEditing ); + } + catch ( IllegalArgumentException ex ) + { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex ); + } + catch ( NoSuchElementException ex ) + { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex ); + } + catch ( SQLException ex ) + { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex ); + } + } +} diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java index aa9986b8d9db..74930e6d1bb6 100644 --- a/wizards/com/sun/star/wizards/db/TableDescriptor.java +++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java @@ -36,7 +36,6 @@ import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.sdbc.SQLException; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.ui.WizardDialog; import java.util.Vector; import com.sun.star.awt.VclWindowPeerAttribute; @@ -120,13 +119,13 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen { // XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection); // xTableNames = xDBTables.getTables(); - xTableAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, getTableNamesAsNameAccess()); - xTableDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, getTableNamesAsNameAccess()); - xTableDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, getTableNamesAsNameAccess()); + xTableAppend = UnoRuntime.queryInterface( XAppend.class, getTableNamesAsNameAccess() ); + xTableDrop = UnoRuntime.queryInterface( XDrop.class, getTableNamesAsNameAccess() ); + xTableDataDescriptorFactory = UnoRuntime.queryInterface( XDataDescriptorFactory.class, getTableNamesAsNameAccess() ); xPropTableDataDescriptor = xTableDataDescriptorFactory.createDataDescriptor(); - XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropTableDataDescriptor); + XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropTableDataDescriptor ); xNameAccessColumns = xColumnsSupplier.getColumns(); - xColumnDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xNameAccessColumns); + xColumnDataDescriptorFactory = UnoRuntime.queryInterface( XDataDescriptorFactory.class, xNameAccessColumns ); try { createTypeInspector(); diff --git a/wizards/com/sun/star/wizards/makefile.mk b/wizards/com/sun/star/wizards/makefile.mk index d876d1903d5d..ac4e2d87ece0 100644 --- a/wizards/com/sun/star/wizards/makefile.mk +++ b/wizards/com/sun/star/wizards/makefile.mk @@ -82,6 +82,7 @@ JAVAFILES= \ common$/DebugHelper.java \ common$/PropertySetHelper.java \ common$/NumericalHelper.java \ + common$/NamedValueCollection.java \ db$/DBMetaData.java \ db$/CommandMetaData.java \ db$/QueryMetaData.java \ @@ -94,6 +95,7 @@ JAVAFILES= \ db$/RelationController.java \ db$/TableDescriptor.java \ db$/SQLQueryComposer.java \ + db$/DatabaseObjectWizard.java \ ui$/event$/AbstractListener.java \ ui$/event$/CommonListener.java \ ui$/event$/DataAware.java \ diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index 7455df894c73..8f7cab8732d6 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -31,7 +31,6 @@ package com.sun.star.wizards.table; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.XComponent; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; @@ -86,41 +85,31 @@ public class CallTableWizard public static class TableWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { - PropertyValue[] databaseproperties; - public XComponent Document = null; - public XComponent DocumentDefinition = null; + private PropertyValue[] m_wizardContext; + // + public String Command; + public final Integer CommandType = com.sun.star.sdb.CommandType.TABLE; + // /** The constructor of the inner class has a XMultiServiceFactory parameter. - * @param xmultiservicefactoryInitialization A special service factory - * could be introduced while initializing. + * @param i_serviceFactory */ - public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) + public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory i_serviceFactory) { super(); - xmultiservicefactory = xmultiservicefactoryInitialization; - registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); - registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); + m_serviceFactory = i_serviceFactory; + registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); + registerProperty( "CommandType", PropertyAttribute.READONLY ); } - public void trigger(String sEvent) + public void trigger( String sEvent ) { try { - if (sEvent.compareTo("start") == 0) + if ( sEvent.compareTo("start") == 0 ) { - TableWizard CurTableWizard = new TableWizard(xmultiservicefactory); - XComponent[] obj = CurTableWizard.startTableWizard(xmultiservicefactory, databaseproperties); - if (obj != null) - { - DocumentDefinition = obj[1]; - Document = obj[0]; - } - } - else if (sEvent.compareTo("end") == 0) - { - DocumentDefinition = null; - Document = null; - databaseproperties = null; + TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext ); + CurTableWizard.startTableWizard(); } } catch (Exception exception) @@ -134,7 +123,7 @@ public class CallTableWizard private static final String __serviceName = "com.sun.star.wizards.table.CallTableWizard"; /** The service manager, that gives access to all registered services. */ - private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory; + private com.sun.star.lang.XMultiServiceFactory m_serviceFactory; /** This method is a member of the interface for initializing an object * directly after its creation. @@ -145,7 +134,7 @@ public class CallTableWizard */ public void initialize(Object[] object) throws com.sun.star.uno.Exception { - databaseproperties = Properties.convertToPropertyValueArray(object); + m_wizardContext = Properties.convertToPropertyValueArray(object); } /** This method returns an array of all supported service names. diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 8b4e0288ef8c..1995a442d58c 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -35,20 +35,19 @@ import com.sun.star.awt.TextEvent; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XTextListener; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; -import com.sun.star.frame.XFrame; -import com.sun.star.lang.XComponent; import com.sun.star.lang.XInitialization; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.CommandType; +import com.sun.star.sdb.application.DatabaseObject; import com.sun.star.sdbc.SQLException; import com.sun.star.task.XJobExecutor; import com.sun.star.uno.UnoRuntime; import com.sun.star.wizards.common.*; +import com.sun.star.wizards.db.DatabaseObjectWizard; import com.sun.star.wizards.db.TableDescriptor; import com.sun.star.wizards.ui.*; -public class TableWizard extends WizardDialog implements XTextListener, XCompletion +public class TableWizard extends DatabaseObjectWizard implements XTextListener, XCompletion { static String slblFields; @@ -71,13 +70,11 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet public static final int SOPRIMARYKEYPAGE = 3; public static final int SOFINALPAGE = 4; private String sMsgColumnAlreadyExists = ""; - XComponent[] components = null; - XFrame CurFrame; String WizardHeaderText[] = new String[8]; - public TableWizard(XMultiServiceFactory xMSF) + public TableWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext ) { - super(xMSF, 41200); + super( xMSF, 41200, i_wizardContext ); super.addResourceHandler("TableWizard", "dbw"); String sTitle = m_oResource.getResText(UIConsts.RID_TABLE + 1); Helper.setUnoPropertyValues(xDialogModel, @@ -298,21 +295,15 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet { Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(this.curTableDescriptor.xMSF), tablename); } - if (tablename != "") + if ( tablename.length() > 0 ) { if (!curTableDescriptor.hasTableByName(scomposedtablename)) { wizardmode = curFinalizer.finish(); if (createTable()) { - if (wizardmode == Finalizer.MODIFYTABLEMODE) - { - components = curTableDescriptor.switchtoDesignmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame); - } - else if (wizardmode == Finalizer.WORKWITHTABLEMODE) - { - components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame); - } + final boolean editTableDesign = (wizardmode == Finalizer.MODIFYTABLEMODE ); + loadSubComponent( DatabaseObject.TABLE, curTableDescriptor.getComposedTableName(), editTableDesign ); super.xDialog.endExecute(); } } @@ -330,18 +321,17 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet try { Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard"); - PropertyValue[] aProperties = new PropertyValue[4]; - aProperties[0] = Properties.createProperty("ActiveConnection", curTableDescriptor.DBConnection); - aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.getDataSource()); - aProperties[2] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE)); - aProperties[3] = Properties.createProperty("Command", scomposedtablename); - XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oFormWizard); - xInitialization.initialize(aProperties); - XJobExecutor xJobExecutor = (XJobExecutor) UnoRuntime.queryInterface(XJobExecutor.class, oFormWizard); + + NamedValueCollection wizardContext = new NamedValueCollection(); + wizardContext.put( "ActiveConnection", curTableDescriptor.DBConnection ); + wizardContext.put( "DataSource", curTableDescriptor.getDataSource() ); + wizardContext.put( "CommandType", CommandType.TABLE ); + wizardContext.put( "Command", scomposedtablename ); + wizardContext.put( "DocumentUI", m_docUI ); + XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oFormWizard ); + xInitialization.initialize( wizardContext.getPropertyValues() ); + XJobExecutor xJobExecutor = UnoRuntime.queryInterface( XJobExecutor.class, oFormWizard ); xJobExecutor.trigger("start"); - XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xJobExecutor); - components[0] = (XComponent) prop.getPropertyValue("Document"); - components[1] = (XComponent) prop.getPropertyValue("DocumentDefinition"); } catch (Exception e) { @@ -370,39 +360,24 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet setCurrentRoadmapItemID((short) 1); } - public XComponent[] startTableWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue) + public void startTableWizard( ) { try { curTableDescriptor = new TableDescriptor(xMSF, super.xWindow, this.sMsgColumnAlreadyExists); - if (curTableDescriptor.getConnection(CurPropertyValue)) + if ( curTableDescriptor.getConnection( m_wizardContext ) ) { - if (Properties.hasPropertyValue(CurPropertyValue, "ParentFrame")) - { - CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValue, "ParentFrame")); - } - else - { - CurFrame = Desktop.getActiveFrame(xMSF); - } buildSteps(); createWindowPeer(); curTableDescriptor.setWindowPeer(this.xControl.getPeer()); - // setAutoMnemonic("lblDialogHeader", false); insertFormRelatedSteps(); short RetValue = executeDialog(); xComponent.dispose(); - switch (RetValue) + if ( ( RetValue == 0 ) + && ( wizardmode == Finalizer.STARTFORMWIZARDMODE ) + ) { - case 0: // via Cancelbutton or via sourceCode with "endExecute" - if (wizardmode == Finalizer.STARTFORMWIZARDMODE) - { - callFormWizard(); - } - break; - case 1: - - break; + callFormWizard(); } } } @@ -410,7 +385,6 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet { jexception.printStackTrace(System.out); } - return components; } public boolean getTableResources() diff --git a/wizards/com/sun/star/wizards/table/XCallTableWizard.java b/wizards/com/sun/star/wizards/table/XCallTableWizard.java deleted file mode 100644 index 47cba7da9314..000000000000 --- a/wizards/com/sun/star/wizards/table/XCallTableWizard.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - ************************************************************************ - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XCallTableWizard.java,v $ - * - * $Revision: 1.3.192.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package com.sun.star.wizards.table; - -public interface XCallTableWizard extends com.sun.star.uno.XInterface -{ - // Methods - public void CallTableDialog(); // static Member - public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = - { - new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallTableDialog", 0, 0) - }; -} diff --git a/wizards/com/sun/star/wizards/table/makefile.mk b/wizards/com/sun/star/wizards/table/makefile.mk index d845f6456efb..d0d689fabed7 100644 --- a/wizards/com/sun/star/wizards/table/makefile.mk +++ b/wizards/com/sun/star/wizards/table/makefile.mk @@ -61,7 +61,6 @@ JAVAFILES= \ PrimaryKeyHandler.java \ ScenarioSelector.java \ TableWizard.java \ - XCallTableWizard.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -- cgit v1.2.3 From e2fa939261e012bfe2a675079a0707bcdf8fec54 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 11:53:44 +0100 Subject: autorecovery: removed unused class XCallQueryWizard --- .../sun/star/wizards/query/XCallQueryWizard.java | 42 ---------------------- wizards/com/sun/star/wizards/query/makefile.mk | 1 - 2 files changed, 43 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/query/XCallQueryWizard.java diff --git a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java b/wizards/com/sun/star/wizards/query/XCallQueryWizard.java deleted file mode 100644 index 04cb6303db3f..000000000000 --- a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - ************************************************************************ - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XCallQueryWizard.java,v $ - * - * $Revision: 1.3.192.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package com.sun.star.wizards.query; - -public interface XCallQueryWizard extends com.sun.star.uno.XInterface -{ - // Methods - public void CallQueryDialog(); // static Member - public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = - { - new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallQueryDialog", 0, 0) - }; -} diff --git a/wizards/com/sun/star/wizards/query/makefile.mk b/wizards/com/sun/star/wizards/query/makefile.mk index 887b470b6d8a..c935dc41a49d 100644 --- a/wizards/com/sun/star/wizards/query/makefile.mk +++ b/wizards/com/sun/star/wizards/query/makefile.mk @@ -57,7 +57,6 @@ JAVAFILES= \ Finalizer.java \ QueryWizard.java \ QuerySummary.java\ - XCallQueryWizard.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -- cgit v1.2.3 From 619a6a4ab19ba81c46caad249eaf926281f897d9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 12:44:27 +0100 Subject: autorecovery: also moved the QueryWizard to using XDatabaseDocumentUI.loadComponent, instead of opening the sub component itself --- .../com/sun/star/wizards/db/CommandMetaData.java | 88 ++++----------------- .../sun/star/wizards/query/CallQueryWizard.java | 38 ++++----- wizards/com/sun/star/wizards/query/Finalizer.java | 90 +++++++++------------- .../com/sun/star/wizards/query/QueryWizard.java | 79 +++++++++---------- 4 files changed, 104 insertions(+), 191 deletions(-) diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java index b26259fc8a47..7fae3651a61d 100644 --- a/wizards/com/sun/star/wizards/db/CommandMetaData.java +++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java @@ -30,10 +30,6 @@ package com.sun.star.wizards.db; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.common.*; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdbc.SQLException; import com.sun.star.sdbcx.KeyType; @@ -41,29 +37,31 @@ import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.sdbcx.XKeysSupplier; import com.sun.star.uno.AnyConverter; import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.beans.*; import com.sun.star.uno.UnoRuntime; -import java.util.*; import com.sun.star.lang.Locale; -import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.embed.EntryInitModes; -import com.sun.star.frame.*; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.NumberFormatter; +import com.sun.star.wizards.common.Resource; +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; public class CommandMetaData extends DBMetaData { public Map FieldTitleSet = new HashMap(); public String[] m_aAllFieldNames = new String[]{}; public FieldColumn[] FieldColumns = new FieldColumn[]{}; -// public String[] FieldNames = new String[] {}; public String[] GroupFieldNames = new String[] {}; private String[][] SortFieldNames = new String[][] {}; private String[] RecordFieldNames = new String[] {}; public String[][] AggregateFieldNames = new String[][] {}; public String[] NumericFieldNames = new String[] {}; public String[] NonAggregateFieldNames; - // private int[] FieldTypes; private int CommandType; private String Command; boolean bCatalogAtStart = true; @@ -154,7 +152,7 @@ public class CommandMetaData extends DBMetaData String CurCommandName = CurFieldColumn.getCommandName(); CommandObject oCommand = getTableByName(CurCommandName); Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName()); - XPropertySet xColumn = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn); + XPropertySet xColumn = UnoRuntime.queryInterface( XPropertySet.class, oColumn ); return xColumn; } catch (Exception exception) @@ -616,64 +614,6 @@ public class CommandMetaData extends DBMetaData return RecordFieldNames[i]; } - public XComponent[] switchtoDesignmode(String _commandname, int _commandtype,XFrame parentFrame) - { - XComponent[] ret = null; - PropertyValue[] rDispatchArguments = new PropertyValue[_commandtype == com.sun.star.sdb.CommandType.QUERY ? 5 : 3]; - rDispatchArguments[0] = Properties.createProperty("DataSourceName", this.DataSourceName); - rDispatchArguments[1] = Properties.createProperty("ActiveConnection", this.DBConnection); - if (_commandtype == com.sun.star.sdb.CommandType.QUERY) - { - rDispatchArguments[2] = Properties.createProperty("GraphicalDesign", Boolean.TRUE); - rDispatchArguments[3] = Properties.createProperty("Command", _commandname); - rDispatchArguments[4] = Properties.createProperty("CommandType", new Integer(_commandtype)); - ret = showCommandView(".component:DB/QueryDesign", rDispatchArguments,parentFrame); - } - else - { - rDispatchArguments[2] = Properties.createProperty("CurrentTable", _commandname); - ret = showCommandView(".component:DB/TableDesign", rDispatchArguments,parentFrame); - } - return ret; - } - - public XComponent[] switchtoDataViewmode(String _commandname, int _commandtype,XFrame parentFrame) - { - PropertyValue[] rDispatchArguments = new PropertyValue[7]; - rDispatchArguments[0] = Properties.createProperty("DataSourceName", this.DataSourceName); - rDispatchArguments[1] = Properties.createProperty("ActiveConnection", this.DBConnection); - rDispatchArguments[2] = Properties.createProperty("Command", _commandname); - rDispatchArguments[3] = Properties.createProperty("CommandType", new Integer(_commandtype)); - rDispatchArguments[4] = Properties.createProperty("ShowTreeView", Boolean.FALSE); - rDispatchArguments[5] = Properties.createProperty("ShowTreeViewButton", Boolean.FALSE); - rDispatchArguments[6] = Properties.createProperty("ShowMenu", Boolean.TRUE); - return showCommandView(".component:DB/DataSourceBrowser", rDispatchArguments,parentFrame); - } - - // - public XComponent[] showCommandView(String surl, PropertyValue[] _rArgs,XFrame parentFrame) - { - XComponent[] ret = new XComponent[2]; - try - { - XSingleServiceFactory xFac = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class,xMSF.createInstance("com.sun.star.frame.TaskCreator")); - Object[] args = new Object[2]; - args[0] = Properties.createProperty("ParentFrame",parentFrame); - args[1] = Properties.createProperty("TopWindow",Boolean.TRUE); - - XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xFac.createInstanceWithArguments(args)); - ret[0] = xLoader.loadComponentFromURL(surl, "_self", 0, _rArgs); - if ( ret[0] != null) - { - ret[0] = (XComponent)UnoRuntime.queryInterface(XComponent.class,xLoader); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - return ret; - } /**@deprecated use 'RelationController' class instead * * @param _stablename @@ -691,11 +631,11 @@ public class CommandMetaData extends DBMetaData { java.util.Vector TableVector = new java.util.Vector(); Object oTable = getTableNamesAsNameAccess().getByName(_stablename); - XKeysSupplier xKeysSupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, oTable); + XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface( XKeysSupplier.class, oTable ); xIndexKeys = xKeysSupplier.getKeys(); for (int i = 0; i < xIndexKeys.getCount(); i++) { - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i) ); + XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) ); int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); if (curtype == KeyType.FOREIGN) { @@ -734,7 +674,7 @@ public class CommandMetaData extends DBMetaData { for (int i = 0; i < xIndexKeys.getCount(); i++) { - XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i) ); + XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) ); int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type")); if (curtype == KeyType.FOREIGN) { @@ -743,14 +683,14 @@ public class CommandMetaData extends DBMetaData { if (scurreftablename.equals(_sreferencedtablename)) { - XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropertySet); + XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropertySet ); String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames(); skeycolumnnames = new String[2][smastercolnames.length]; skeycolumnnames[0] = smastercolnames; skeycolumnnames[1] = new String[smastercolnames.length]; for (int n = 0; n < smastercolnames.length; n++) { - XPropertySet xcolPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnsSupplier.getColumns().getByName(smastercolnames[n])); + XPropertySet xcolPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xColumnsSupplier.getColumns().getByName( smastercolnames[n] ) ); skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn")); } return skeycolumnnames; diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java index dd9170fb741f..0fa602f67358 100644 --- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java +++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java @@ -32,6 +32,7 @@ package com.sun.star.wizards.query; import com.sun.star.beans.PropertyAttribute; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Type; import com.sun.star.wizards.common.Properties; @@ -85,21 +86,22 @@ public class CallQueryWizard */ public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { - - PropertyValue[] databaseproperties; - public XComponent Document = null; - public XComponent DocumentDefinition = null; + private PropertyValue[] m_wizardContext; + // + public String Command; + public final Integer CommandType = com.sun.star.sdb.CommandType.QUERY; + // /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory * could be introduced while initializing. */ - public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) + public QueryWizardImplementation( XMultiServiceFactory i_serviceFactory ) { super(); - xmultiservicefactory = xmultiservicefactoryInitialization; - registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); - registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); + m_serviceFactory = i_serviceFactory; + registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) ); + registerProperty( "CommandType", PropertyAttribute.READONLY ); } public void trigger(String sEvent) @@ -108,20 +110,8 @@ public class CallQueryWizard { if (sEvent.compareTo("start") == 0) { - QueryWizard CurQueryWizard = new QueryWizard(xmultiservicefactory); - XComponent[] obj = CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties); - if (obj != null) - { - DocumentDefinition = obj[1]; - Document = obj[0]; - } - CurQueryWizard = null; - } - else if (sEvent.compareTo("end") == 0) - { - DocumentDefinition = null; - Document = null; - databaseproperties = null; + QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext ); + Command = CurQueryWizard.startQueryWizard(); } } catch (Exception exception) @@ -135,7 +125,7 @@ public class CallQueryWizard private static final String __serviceName = "com.sun.star.wizards.query.CallQueryWizard"; /** The service manager, that gives access to all registered services. */ - private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory; + private com.sun.star.lang.XMultiServiceFactory m_serviceFactory; /** This method is a member of the interface for initializing an object * directly after its creation. @@ -146,7 +136,7 @@ public class CallQueryWizard */ public void initialize(Object[] object) throws com.sun.star.uno.Exception { - databaseproperties = Properties.convertToPropertyValueArray(object); + m_wizardContext = Properties.convertToPropertyValueArray(object); } /** This method returns an array of all supported service names. diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 7079b1109742..24f71220c5c7 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -37,19 +37,18 @@ import com.sun.star.lang.XComponent; import com.sun.star.sdb.CommandType; import com.sun.star.uno.*; import com.sun.star.wizards.ui.*; +import java.util.logging.Level; +import java.util.logging.Logger; public class Finalizer { - - private QueryWizard CurUnoDialog; + private QueryWizard m_queryWizard; private String resQuery; - private Object m_aTxtSummary; private Object m_aTxtTitle; private XRadioButton xRadioDisplayQuery; - private XRadioButton xRadioModifyQuery; private QuerySummary CurDBMetaData; - public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData) + public Finalizer( QueryWizard i_queryWizard, QuerySummary _CurDBMetaData ) { short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE); String reslblQueryTitle; @@ -57,17 +56,17 @@ public class Finalizer String resoptModifyQuery; String resflnSummary; String reslblHowGoOn; - this.CurUnoDialog = _CurUnoDialog; + this.m_queryWizard = i_queryWizard; this.CurDBMetaData = _CurDBMetaData; - reslblQueryTitle = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 5); - resoptDisplayQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 6); - resoptModifyQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 7); - resflnSummary = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 87); - reslblHowGoOn = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 8); - resQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 1); + reslblQueryTitle = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 5); + resoptDisplayQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 6); + resoptModifyQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 7); + resflnSummary = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 87); + reslblHowGoOn = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 8); + resQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 1); int curHelpIndex = 40955; - CurUnoDialog.insertLabel("lblQueryTitle", new String[] + m_queryWizard.insertLabel("lblQueryTitle", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, @@ -75,7 +74,7 @@ public class Finalizer { new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52) }); - m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] + m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", 0, null, new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, @@ -83,7 +82,7 @@ public class Finalizer { new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90) }); - CurUnoDialog.insertLabel("lblHowGoOn", new String[] + m_queryWizard.insertLabel("lblHowGoOn", new String[] { "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, @@ -91,7 +90,7 @@ public class Finalizer { new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112) }); - this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery", + this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery", new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" @@ -101,7 +100,7 @@ public class Finalizer new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); - this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery", + m_queryWizard.insertRadioButton("optModifyQuery", new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" @@ -110,7 +109,7 @@ public class Finalizer { new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118) }); - CurUnoDialog.insertFixedLine("flnSummary", new String[] + m_queryWizard.insertFixedLine("flnSummary", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, @@ -118,7 +117,7 @@ public class Finalizer { new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209) }); - m_aTxtSummary = CurUnoDialog.insertTextField("txtSummary", 0, null, new String[] + m_queryWizard.insertTextField("txtSummary", 0, null, new String[] { "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width" }, @@ -148,7 +147,7 @@ public class Finalizer } CurDBMetaData.setSummaryString(); - CurUnoDialog.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString()); + m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString()); return sCurQueryName; } catch (com.sun.star.uno.Exception exception) @@ -164,43 +163,30 @@ public class Finalizer return sTitle; } - public XComponent[] finish() + public String finish() + { + CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData); + String queryName = getTitle(); + if ( CurDBMetaData.oSQLQueryComposer.setQueryCommand( queryName, m_queryWizard.xWindow, true, true ) + && CurDBMetaData.createQuery( CurDBMetaData.oSQLQueryComposer, queryName ) + ) + return queryName; + + return ""; + } + + public final boolean displayQueryDesign() { - XComponent[] ret = null; try { - CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData); - String queryname = getTitle(); - boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true); - if (bsuccess) - { - bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname); - if (bsuccess) - { - short igoon = AnyConverter.toShort(Helper.getUnoPropertyValue(UnoDialog.getModel(xRadioDisplayQuery), "State")); - if (igoon == (short) 1) - { - ret = CurDBMetaData.switchtoDataViewmode(queryname, - CommandType.QUERY, - CurUnoDialog.getCurFrame()); - } - else - { - ret = CurDBMetaData.switchtoDesignmode(queryname, - CommandType.QUERY, - CurUnoDialog.getCurFrame()); - } - CurUnoDialog.xDialog.endExecute(); - } - } - CurDBMetaData.oSQLQueryComposer = null; - CurDBMetaData = null; - CurUnoDialog = null; + final short state = AnyConverter.toShort( Helper.getUnoPropertyValue( UnoDialog.getModel( xRadioDisplayQuery ), "State" ) ); + final boolean viewMode = state == (short)1; + return !viewMode; } - catch (IllegalArgumentException e) + catch ( IllegalArgumentException ex ) { - e.printStackTrace(); + Logger.getLogger( Finalizer.class.getName() ).log( Level.SEVERE, null, ex ); } - return ret; + return false; } } diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index dcbb920e4b0d..e46065a4d430 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -29,29 +29,30 @@ ************************************************************************/ package com.sun.star.wizards.query; -import com.sun.star.frame.XFrame; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; -import com.sun.star.lang.XComponent; -import com.sun.star.wizards.common.*; -import com.sun.star.wizards.db.*; +import com.sun.star.frame.XFrame; +import com.sun.star.sdb.CommandType; import com.sun.star.sdbc.SQLException; -import com.sun.star.uno.*; -import com.sun.star.wizards.ui.*; +import com.sun.star.uno.AnyConverter; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.Resource; +import com.sun.star.wizards.db.DatabaseObjectWizard; +import com.sun.star.wizards.db.QueryMetaData; +import com.sun.star.wizards.ui.AggregateComponent; +import com.sun.star.wizards.ui.CommandFieldSelection; +import com.sun.star.wizards.ui.FieldSelection; +import com.sun.star.wizards.ui.FilterComponent; +import com.sun.star.wizards.ui.SortingComponent; +import com.sun.star.wizards.ui.TitlesComponent; -public class QueryWizard extends WizardDialog +public class QueryWizard extends DatabaseObjectWizard { - - private XFrame CurFrame; - - public XFrame getCurFrame() - { - return CurFrame; - } public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox"; private static final int SOFIELDSELECTION_PAGE = 1; private static final int SOSORTING_PAGE = 2; @@ -75,23 +76,21 @@ public class QueryWizard extends WizardDialog private String reslblFields; private String reslblSelFields; private String reslblTables; - // private String resQuery; private String resQueryWizard; private String reslblGroupBy; private String resmsgNonNumericAsGroupBy; - private XComponent[] components = null; //Resources Object - // private short CurTabIndex = 0; + private String m_createdQuery; - public QueryWizard(XMultiServiceFactory xMSF) + public QueryWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext ) { - super(xMSF, 40970); + super( xMSF, 40970, i_wizardContext ); addResourceHandler("QueryWizard", "dbw"); CurDBMetaData = new QuerySummary(xMSF, m_oResource); } - public static void main(String args[]) +/* public static void main(String args[]) { - String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager"; + String ConnectStr = "uno:pipe,name=foo;urp;StarOffice.ServiceManager"; try { XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr); @@ -109,13 +108,18 @@ public class QueryWizard extends WizardDialog { jexception.printStackTrace(System.out); } + }*/ + + public final XFrame getFrame() + { + return m_frame; } - public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) + public String startQueryWizard() { try { - if (CurDBMetaData.getConnection(CurPropertyValues)) + if ( CurDBMetaData.getConnection( m_wizardContext ) ) { reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4); reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent @@ -137,22 +141,13 @@ public class QueryWizard extends WizardDialog setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); this.setMaxStep(8); buildSteps(); - this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValues, false); - if (Properties.hasPropertyValue(CurPropertyValues, "ParentFrame")) - { - CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValues, "ParentFrame")); - } - else - { - CurFrame = Desktop.getActiveFrame(xMSF); - } + this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false ); - XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow()); - this.xMSF = xMSF; + XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() ); createWindowPeer(windowPeer); CurDBMetaData.setWindowPeer(this.xControl.getPeer()); insertQueryRelatedSteps(); - executeDialog(CurFrame.getContainerWindow().getPosSize()); + executeDialog( m_frame.getContainerWindow().getPosSize() ); } } catch (java.lang.Exception jexception) @@ -164,14 +159,12 @@ public class QueryWizard extends WizardDialog CurAggregateComponent = null; CurDBCommandFieldSelection = null; xWindowPeer = null; - CurFrame = null; CurFinalizer = null; CurDBMetaData.finish(); CurDBMetaData = null; - XComponent[] ret = components; - components = null; System.gc(); - return ret; + + return m_createdQuery; } public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled) @@ -229,7 +222,6 @@ public class QueryWizard extends WizardDialog { try { -// String[] sRMItemLabels = getRMItemLabels(); setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80); addRoadmap(); int i = 0; @@ -297,7 +289,12 @@ public class QueryWizard extends WizardDialog int ncurStep = getCurrentStep(); if ((switchToStep(ncurStep, SOSUMMARY_PAGE)) || (ncurStep == SOSUMMARY_PAGE)) { - components = CurFinalizer.finish(); + m_createdQuery = CurFinalizer.finish(); + if ( m_createdQuery.length() > 0 ) + { + loadSubComponent( CommandType.QUERY, m_createdQuery, CurFinalizer.displayQueryDesign() ); + xDialog.endExecute(); + } } } -- cgit v1.2.3 From a44bc63de98cdf39179f742b1e661b23749eaffa Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 12:50:22 +0100 Subject: autorecovery: populate the 'Command' property --- wizards/com/sun/star/wizards/table/CallTableWizard.java | 2 +- wizards/com/sun/star/wizards/table/TableWizard.java | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java index 8f7cab8732d6..f52a3d79c430 100644 --- a/wizards/com/sun/star/wizards/table/CallTableWizard.java +++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java @@ -109,7 +109,7 @@ public class CallTableWizard if ( sEvent.compareTo("start") == 0 ) { TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext ); - CurTableWizard.startTableWizard(); + Command = CurTableWizard.startTableWizard(); } } catch (Exception exception) diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java index 1995a442d58c..84accf582174 100644 --- a/wizards/com/sun/star/wizards/table/TableWizard.java +++ b/wizards/com/sun/star/wizards/table/TableWizard.java @@ -72,6 +72,8 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, private String sMsgColumnAlreadyExists = ""; String WizardHeaderText[] = new String[8]; + private String m_tableName; + public TableWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext ) { super( xMSF, 41200, i_wizardContext ); @@ -304,6 +306,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, { final boolean editTableDesign = (wizardmode == Finalizer.MODIFYTABLEMODE ); loadSubComponent( DatabaseObject.TABLE, curTableDescriptor.getComposedTableName(), editTableDesign ); + m_tableName = curTableDescriptor.getComposedTableName(); super.xDialog.endExecute(); } } @@ -360,7 +363,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, setCurrentRoadmapItemID((short) 1); } - public void startTableWizard( ) + public String startTableWizard( ) { try { @@ -373,11 +376,11 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, insertFormRelatedSteps(); short RetValue = executeDialog(); xComponent.dispose(); - if ( ( RetValue == 0 ) - && ( wizardmode == Finalizer.STARTFORMWIZARDMODE ) - ) + if ( RetValue == 0 ) { - callFormWizard(); + if ( wizardmode == Finalizer.STARTFORMWIZARDMODE ) + callFormWizard(); + return m_tableName; } } } @@ -385,6 +388,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener, { jexception.printStackTrace(System.out); } + return ""; } public boolean getTableResources() -- cgit v1.2.3 From 722556b9cd099cbb352cb11692ec1b27adfac5dd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 12:51:47 +0100 Subject: autorecovery: more unused interfaces removed --- .../com/sun/star/wizards/form/XCallFormWizard.java | 40 --------------------- wizards/com/sun/star/wizards/form/makefile.mk | 1 - .../sun/star/wizards/report/XCallReportWizard.java | 42 ---------------------- 3 files changed, 83 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/form/XCallFormWizard.java delete mode 100644 wizards/com/sun/star/wizards/report/XCallReportWizard.java diff --git a/wizards/com/sun/star/wizards/form/XCallFormWizard.java b/wizards/com/sun/star/wizards/form/XCallFormWizard.java deleted file mode 100644 index c3da310a583d..000000000000 --- a/wizards/com/sun/star/wizards/form/XCallFormWizard.java +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XCallFormWizard.java,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package com.sun.star.wizards.form; - -public interface XCallFormWizard extends com.sun.star.uno.XInterface -{ - // Methods - public void CallFormDialog(); // static Member - public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = - { - new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallFormDialog", 0, 0) - }; -} diff --git a/wizards/com/sun/star/wizards/form/makefile.mk b/wizards/com/sun/star/wizards/form/makefile.mk index 2237ac207759..50ee454ef1a5 100644 --- a/wizards/com/sun/star/wizards/form/makefile.mk +++ b/wizards/com/sun/star/wizards/form/makefile.mk @@ -63,7 +63,6 @@ JAVAFILES= \ FormDocument.java \ StyleApplier.java \ UIControlArranger.java \ - XCallFormWizard.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff --git a/wizards/com/sun/star/wizards/report/XCallReportWizard.java b/wizards/com/sun/star/wizards/report/XCallReportWizard.java deleted file mode 100644 index 562ce506cc56..000000000000 --- a/wizards/com/sun/star/wizards/report/XCallReportWizard.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - ************************************************************************ - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XCallReportWizard.java,v $ - * - * $Revision: 1.8.36.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -package com.sun.star.wizards.report; - -public interface XCallReportWizard extends com.sun.star.uno.XInterface -{ - // Methods - public void CallReportDialog(); // static Member - public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = - { - new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallReportDialog", 0, 0) - }; -} -- cgit v1.2.3 From b691607b3bda98cee1bb923ccf59cb248bf9cb25 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 14:13:58 +0100 Subject: autorecovery: post-rebase build problems solved --- wizards/com/sun/star/wizards/query/Finalizer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java index 083669192bab..71fddc422d6a 100644 --- a/wizards/com/sun/star/wizards/query/Finalizer.java +++ b/wizards/com/sun/star/wizards/query/Finalizer.java @@ -131,8 +131,9 @@ public class Finalizer public void changeTitle() { final String TitleName = m_aTxtTitle.getText(); - CurUnoDialog.enableFinishButton(!"".equals(TitleName)); + m_queryWizard.enableFinishButton( TitleName.length() > 0 ); } + /* TODO: The title textbox always has to be updated when a new Table has been selected if it is clear that the user has not made any input meanwhile */ -- cgit v1.2.3 From c0ea2fcd404cd3830c71752cf1a0c0ee6e5b4e76 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 4 Feb 2010 16:04:06 +0100 Subject: autorecovery: form and report wizzard now also using XDatabaseDocumentUI, instead of manipulating document definitions All database object wizards by now employ XDatabaseDocumentUI. This way, it is ensured that the controller has the full control over the opened sub components. Still, other third-party code could use direct access to the document definitions, and open sub documents this way. This would go unnoticed by the application controller at the moment. I would be possible to fix this, by introducing broadcasts from the document definitions, listened to by the controller. But as this sounds like a rare case, and XDatabaseDocumentUI is the preferred way for third-party components, too, such an implementation is deferred to Later ... --- wizards/com/sun/star/wizards/db/DBMetaData.java | 70 +-- .../com/sun/star/wizards/form/CallFormWizard.java | 30 +- wizards/com/sun/star/wizards/form/Finalizer.java | 9 +- wizards/com/sun/star/wizards/form/FormWizard.java | 84 ++-- .../sun/star/wizards/report/CallReportWizard.java | 63 +-- .../com/sun/star/wizards/report/Dataimport.java | 8 +- .../sun/star/wizards/report/IReportDocument.java | 18 +- .../wizards/report/ReportTextImplementation.java | 106 ++--- .../com/sun/star/wizards/report/ReportWizard.java | 478 ++++++--------------- .../reportbuilder/ReportBuilderImplementation.java | 390 ++++++----------- 10 files changed, 372 insertions(+), 884 deletions(-) diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index 296d73c5c31a..40966bf8e813 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -81,6 +81,7 @@ import com.sun.star.wizards.common.Configuration; import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.FileAccess; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.NamedValueCollection; import com.sun.star.wizards.common.NumberFormatter; import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.Resource; @@ -922,82 +923,33 @@ public class DBMetaData * @param _xDocNameAccess * @param _bcreateTemplate describes the type of the document: "form" or "report" */ - public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean _bcreateTemplate) + public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean i_createTemplate) { try { - PropertyValue[] aDocProperties; XModel xDocumentModel = UnoRuntime.queryInterface( XModel.class, _xComponent ); - String sPath = xDocumentModel.getURL(); - String basename = FileAccess.getBasename(sPath, "/"); + String documentURL = xDocumentModel.getURL(); + String basename = FileAccess.getBasename(documentURL, "/"); XCloseable xCloseable = UnoRuntime.queryInterface( XCloseable.class, _xComponent ); xCloseable.close(false); - if (_bcreateTemplate) - { - aDocProperties = new PropertyValue[5]; - } - else - { - aDocProperties = new PropertyValue[4]; - } - aDocProperties[0] = Properties.createProperty("Name", basename); - aDocProperties[1] = Properties.createProperty("Parent", _xDocNameAccess); - aDocProperties[2] = Properties.createProperty("URL", sPath); - aDocProperties[3] = Properties.createProperty("DocumentTitle", basename); - if (_bcreateTemplate) - { - aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate)); - } + + NamedValueCollection creationArgs = new NamedValueCollection(); + creationArgs.put( "Name", basename ); + creationArgs.put( "URL", documentURL ); + creationArgs.put( "AsTemplate", new Boolean( i_createTemplate ) ); XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess ); - Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties); + Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() ); XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocNameAccess ); String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename); xHier.insertByHierarchicalName(sdocname, oDBDocument); XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface ); - xSimpleFileAccess.kill(sPath); - } - catch (Exception e) - { - e.printStackTrace(System.out); - } - } - - public XComponent[] openDatabaseDocument(String _docname, boolean _bAsTemplate, boolean _bOpenInDesign, XHierarchicalNameAccess _xDocuments) - { - XComponent[] xRetComponent = new XComponent[2]; - try - { - XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xDocuments ); - PropertyValue[] aPropertyValues = new PropertyValue[4]; - aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign" : "open"); - aPropertyValues[1] = Properties.createProperty("ActiveConnection", this.DBConnection); - aPropertyValues[2] = Properties.createProperty("DocumentTitle", _docname); - aPropertyValues[3] = Properties.createProperty("AsTemplate", new Boolean(_bAsTemplate)); - XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocuments ); - if (xHier.hasByHierarchicalName(_docname)) - { - xRetComponent[0] = UnoRuntime.queryInterface( XComponent.class, xHier.getByHierarchicalName( _docname ) ); - xRetComponent[1] = xComponentLoader.loadComponentFromURL(_docname, "", 0, aPropertyValues); - } + xSimpleFileAccess.kill(documentURL); } catch (Exception e) { e.printStackTrace(System.out); } - return xRetComponent; - } - - public XComponent[] openFormDocument(String _sformname, boolean _bOpenInDesign) - { - XHierarchicalNameAccess xFormDocuments = getFormDocuments(); - return openDatabaseDocument(_sformname, false, _bOpenInDesign, xFormDocuments); - } - - public XComponent[] openReportDocument(String _sreportname, boolean _bAsTemplate, boolean _bOpenInDesign) - { - XHierarchicalNameAccess xReportDocuments = getReportDocuments(); - return openDatabaseDocument(_sreportname, _bAsTemplate, _bOpenInDesign, xReportDocuments); } public void createTypeInspector() throws SQLException diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java index 60b0b1705487..a7894ce281ca 100644 --- a/wizards/com/sun/star/wizards/form/CallFormWizard.java +++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java @@ -30,9 +30,7 @@ package com.sun.star.wizards.form; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyAttribute; import com.sun.star.uno.Type; -import com.sun.star.lang.XComponent; import com.sun.star.wizards.common.Properties; /** This class capsulates the class, that implements the minimal component, a @@ -85,10 +83,7 @@ public class CallFormWizard */ public static class FormWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { - - PropertyValue[] databaseproperties; - public XComponent Document = null; - public XComponent DocumentDefinition = null; + private PropertyValue[] m_wizardContext; /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory @@ -97,9 +92,7 @@ public class CallFormWizard public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) { super(); - xmultiservicefactory = xmultiservicefactoryInitialization; - registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); - registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); + m_serviceFactory = xmultiservicefactoryInitialization; } public void trigger(String sEvent) @@ -108,19 +101,8 @@ public class CallFormWizard { if (sEvent.compareTo("start") == 0) { - FormWizard CurFormWizard = new FormWizard(xmultiservicefactory); - XComponent[] obj = CurFormWizard.startFormWizard(xmultiservicefactory, databaseproperties); - if (obj != null) - { - DocumentDefinition = obj[0]; - Document = obj[1]; - } - } - else if (sEvent.compareTo("end") == 0) - { - DocumentDefinition = null; - Document = null; - databaseproperties = null; + FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext ); + CurFormWizard.startFormWizard(); } } catch (Exception exception) @@ -134,7 +116,7 @@ public class CallFormWizard private static final String __serviceName = "com.sun.star.wizards.form.CallFormWizard"; /** The service manager, that gives access to all registered services. */ - private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory; + private com.sun.star.lang.XMultiServiceFactory m_serviceFactory; /** This method is a member of the interface for initializing an object * directly after its creation. @@ -145,7 +127,7 @@ public class CallFormWizard */ public void initialize(Object[] object) throws com.sun.star.uno.Exception { - databaseproperties = Properties.convertToPropertyValueArray(object); + m_wizardContext = Properties.convertToPropertyValueArray(object); } /** This method returns an array of all supported service names. diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java index 2b1ffc5786e2..2294586b813d 100644 --- a/wizards/com/sun/star/wizards/form/Finalizer.java +++ b/wizards/com/sun/star/wizards/form/Finalizer.java @@ -32,7 +32,6 @@ package com.sun.star.wizards.form; import com.sun.star.awt.XRadioButton; import com.sun.star.awt.XTextComponent; import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.ui.UIConsts; import com.sun.star.wizards.ui.*; /** @@ -45,7 +44,6 @@ public class Finalizer { WizardDialog CurUnoDialog; - Desktop.OfficePathRetriever curofficepath; short curtabindex; XRadioButton optModifyForm; XRadioButton optWorkWithForm; @@ -88,7 +86,7 @@ public class Finalizer { UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185) }); - XRadioButton optWorkWithForm = CurUnoDialog.insertRadioButton("optWorkWithForm", null, + CurUnoDialog.insertRadioButton("optWorkWithForm", null, new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" @@ -130,10 +128,9 @@ public class Finalizer return txtFormName.getText(); } - public boolean getOpenMode() + public boolean getOpenForEditing() { - boolean bOpenMode = optModifyForm.getState() ? true : false; - return bOpenMode; + return optModifyForm.getState() ? true : false; } public boolean finish() diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java index 5b0a7939f6c2..9a6c0763aebf 100644 --- a/wizards/com/sun/star/wizards/form/FormWizard.java +++ b/wizards/com/sun/star/wizards/form/FormWizard.java @@ -33,12 +33,18 @@ import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XComponent; -import com.sun.star.wizards.common.*; +import com.sun.star.sdb.application.DatabaseObject; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.NoValidPathException; +import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.db.DatabaseObjectWizard; import com.sun.star.wizards.db.RelationController; import com.sun.star.wizards.document.OfficeDocument; -import com.sun.star.wizards.ui.*; +import com.sun.star.wizards.ui.CommandFieldSelection; +import com.sun.star.wizards.ui.UIConsts; -public class FormWizard extends WizardDialog +public class FormWizard extends DatabaseObjectWizard { private CommandFieldSelection curDBCommandFieldSelection; @@ -67,13 +73,13 @@ public class FormWizard extends WizardDialog public static final int SOGRID = 3; public static final int SOTOPJUSTIFIED = 4; private String slblTables; - private boolean bFormOpenMode; - private boolean bcreateForm = false; + private boolean m_openForEditing; + private boolean m_success = false; private String FormName; - public FormWizard(XMultiServiceFactory xMSF) + public FormWizard( XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext ) { - super(xMSF, 34400); + super( i_servicFactory, 34400, i_wizardContext ); super.addResourceHandler("FormWizard", "dbw"); Helper.setUnoPropertyValues(xDialogModel, new String[] @@ -171,7 +177,6 @@ public class FormWizard extends WizardDialog switch (nOldStep) { case SOMAIN_PAGE: -// curFormDocument.oMainFormDBMetaData.setFieldNames(curDBCommandFieldSelection.getSelectedFieldNames()); { final String sTableName = curDBCommandFieldSelection.getSelectedCommandName(); final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames(); @@ -219,40 +224,6 @@ public class FormWizard extends WizardDialog } } -/* - public static void main(String args[]) - { - - String ConnectStr = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 - PropertyValue[] curproperties = null; - try - { - XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr); - FormWizard CurFormWizard = new FormWizard(xLocMSF); - if (xLocMSF != null) - { - System.out.println("Connected to " + ConnectStr); - curproperties = new PropertyValue[1]; -// curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); - curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); - // file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); - // MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1"); - // /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1"); - // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); - // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); - // Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties); - - CurFormWizard.startFormWizard(xLocMSF, curproperties); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - } -*/ - public void buildSteps() throws NoValidPathException { curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411); @@ -317,14 +288,14 @@ public class FormWizard extends WizardDialog String sNewFormName = curFinalizer.getName(); if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName)) { - bFormOpenMode = curFinalizer.getOpenMode(); + m_openForEditing = curFinalizer.getOpenForEditing(); FormName = curFinalizer.getName(); if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration)) { if (curFinalizer.finish()) { - bcreateForm = true; + m_success = true; xDialog.endExecute(); } } @@ -340,7 +311,7 @@ public class FormWizard extends WizardDialog // @Override public void cancelWizard() { - bcreateForm = false; + m_success = false; xDialog.endExecute(); } @@ -361,33 +332,29 @@ public class FormWizard extends WizardDialog setCurrentRoadmapItemID((short) 1); } - public XComponent[] startFormWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue) + public void startFormWizard() { - XComponent[] ret = null; try { curFormDocument = new FormDocument(xMSF); - if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue)) + if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) ) { curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[] { Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection) }); curFormDocument.xProgressBar.setValue(20); - // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); buildSteps(); - // SystemDialog.showMessageBox(xMSF, "FormName", 0, "slblFields"); - this.curDBCommandFieldSelection.preselectCommand(CurPropertyValue, false); + this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false ); XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer); - curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2 /* xControl.getPeer() */ ); - // setAutoMnemonic("lblDialogHeader", false); + curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 ); insertFormRelatedSteps(); - short RetValue = executeDialog(curFormDocument.xFrame); + short dialogReturn = executeDialog(curFormDocument.xFrame); xComponent.dispose(); - if (bcreateForm) + if ( ( dialogReturn == 0 ) && m_success ) { - curFormDocument.oMainFormDBMetaData.addFormDocument(curFormDocument.xComponent); - ret = curFormDocument.oMainFormDBMetaData.openFormDocument(FormName, bFormOpenMode); + curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent ); + loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing ); } } } @@ -395,11 +362,10 @@ public class FormWizard extends WizardDialog { jexception.printStackTrace(System.out); } - if ((!bcreateForm) && (curFormDocument != null)) + if ((!m_success) && (curFormDocument != null)) { OfficeDocument.close(curFormDocument.xComponent); } - return ret; } private boolean getFormResources() diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java index 82c405747ad8..424e117c4d4f 100644 --- a/wizards/com/sun/star/wizards/report/CallReportWizard.java +++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java @@ -30,14 +30,12 @@ package com.sun.star.wizards.report; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.PropertyAttribute; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.text.XTextDocument; import com.sun.star.wizards.common.Properties; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Desktop; +import com.sun.star.sdb.application.XDatabaseDocumentUI; +import com.sun.star.wizards.common.NamedValueCollection; /** This class capsulates the class, that implements the minimal component, a * factory for creating the service (__getServiceFactory) and a @@ -50,7 +48,7 @@ public class CallReportWizard static boolean bWizardstartedalready; - public static void main(String args[]) +/* public static void main(String args[]) { String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager"; try @@ -61,15 +59,15 @@ public class CallReportWizard PropertyValue[] curproperties = new PropertyValue[1]; curproperties[0] = Properties.createProperty("DataSourceName", "countries"); - ReportWizard wizard = new ReportWizard(orb); - wizard.startReportWizard(orb, curproperties); + ReportWizard wizard = new ReportWizard( orb, curproperties ); + wizard.startReportWizard(); } } catch (java.lang.Exception jexception) { jexception.printStackTrace(System.out); } - } + }*/ /** Gives a factory for creating the service. * This method is called by the JavaLoader @@ -121,9 +119,7 @@ public class CallReportWizard public static class ReportWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor { - PropertyValue[] databaseproperties; - public XComponent DocumentDefinition = null; - public XComponent Document = null; + private PropertyValue[] m_wizardContext; /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory @@ -133,59 +129,32 @@ public class CallReportWizard { super(); xmultiservicefactory = xmultiservicefactoryInitialization; - registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); - registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID)); } public void trigger(String sEvent) { try { - com.sun.star.frame.XComponentLoader xcomponentloader = (com.sun.star.frame.XComponentLoader) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, xmultiservicefactory.createInstance("com.sun.star.frame.Desktop")); if (sEvent.compareTo("start") == 0) { if (bWizardstartedalready != true) { - ReportWizard CurReportWizard = new ReportWizard(xmultiservicefactory); - XComponent[] obj = CurReportWizard.startReportWizard(xmultiservicefactory, databaseproperties); - if (obj != null) - { - DocumentDefinition = obj[0]; - if (obj.length > 1) - { - Document = obj[1]; - } - else - { - Document = null; - } - } + ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext ); + CurReportWizard.startReportWizard(); } bWizardstartedalready = false; } - else if (sEvent.compareTo("end") == 0) - { - DocumentDefinition = null; - Document = null; - databaseproperties = null; - } else if (sEvent.compareTo("fill") == 0) { Dataimport CurDataimport = new Dataimport(xmultiservicefactory); - XTextDocument xTextDocument = null; - if (databaseproperties != null) + if (m_wizardContext != null) { - for (int i = 0; i < databaseproperties.length; ++i) - { - if (databaseproperties[i].Name.equals("TextDocument")) - { - xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, databaseproperties[i].Value); - } - - } - if (xTextDocument != null) + NamedValueCollection context = new NamedValueCollection( m_wizardContext ); + XTextDocument textDocument = context.queryOrDefault( "TextDocument", null, XTextDocument.class ); + XDatabaseDocumentUI documentUI = context.queryOrDefault( "DocumentUI", null, XDatabaseDocumentUI.class ); + if ( textDocument != null ) { - CurDataimport.createReport(xmultiservicefactory, xTextDocument, databaseproperties); + CurDataimport.createReport(xmultiservicefactory, documentUI, textDocument, m_wizardContext); } } } @@ -212,7 +181,7 @@ public class CallReportWizard */ public void initialize(Object[] object) throws com.sun.star.uno.Exception { - this.databaseproperties = Properties.convertToPropertyValueArray(object); + this.m_wizardContext = Properties.convertToPropertyValueArray(object); // xmultiservicefactory = (XMultiservicefactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, object[0]); } diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java index d0f6c4a0ceca..067e14d496a5 100644 --- a/wizards/com/sun/star/wizards/report/Dataimport.java +++ b/wizards/com/sun/star/wizards/report/Dataimport.java @@ -31,6 +31,7 @@ package com.sun.star.wizards.report; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.text.XTextDocument; import com.sun.star.wizards.ui.*; @@ -214,11 +215,10 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi CurReportDocument.getRecordParser().dispose(); } - public void createReport(final XMultiServiceFactory xMSF, XTextDocument _textDocument, PropertyValue[] properties) + public void createReport( XMultiServiceFactory xMSF, XDatabaseDocumentUI i_documentUI, XTextDocument _textDocument, + PropertyValue[] properties) { - // CurReportDocument = new ReportTextDocument(xMSF, _textDocument,m_oResource); - CurReportDocument = ReportTextImplementation.create(xMSF, _textDocument, m_oResource); -// CurProperties = properties; + CurReportDocument = ReportTextImplementation.create( xMSF, i_documentUI, _textDocument, m_oResource ); showProgressDisplay(xMSF, true); importReportData(xMSF, this, CurReportDocument, properties); } diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java index af8476f5c3e9..7629b6f54ffd 100644 --- a/wizards/com/sun/star/wizards/report/IReportDocument.java +++ b/wizards/com/sun/star/wizards/report/IReportDocument.java @@ -34,6 +34,8 @@ package com.sun.star.wizards.report; import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.sdb.application.XDatabaseDocumentUI; +import com.sun.star.wizards.common.Resource; import java.util.ArrayList; import java.util.Vector; @@ -45,14 +47,14 @@ import java.util.Vector; */ public interface IReportDocument { - // public ReportTextDocument getDoc(); // ------------------------------------------------------------------------- // initialisation // ------------------------------------------------------------------------- + public void initialize( + final XDatabaseDocumentUI i_documentUI, + final Resource i_resource + ); - // ------------------------------------------------------------------------- - // opening the dialog - // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Access Helper // ------------------------------------------------------------------------- @@ -211,7 +213,7 @@ public interface IReportDocument * * TODO: add Name to this functionality */ - public void addReportToDBView(/* String Name */); + public void addReportToDBView(); public void importReportData(ReportWizard aWizard); @@ -222,7 +224,11 @@ public interface IReportDocument * @param _bOpenInDesign * @return */ - public XComponent[] createFinalReportDocument(String Name, boolean _bAsTemplate, boolean _bOpenInDesign); + public void createAndOpenReportDocument( + final String Name, + final boolean _bAsTemplate, + final boolean _bOpenInDesign + ); public void dispose(); // ------------------------------------------------------------------------- diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java index 3d79c5d2d8ac..53d7e75dd006 100644 --- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java +++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java @@ -34,13 +34,16 @@ package com.sun.star.wizards.report; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; +import com.sun.star.container.NoSuchElementException; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.container.XNamed; +import com.sun.star.frame.XController; import com.sun.star.frame.XFrame; -// import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; import com.sun.star.sdb.CommandType; +import com.sun.star.sdbc.SQLException; import com.sun.star.table.XCellRange; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; @@ -56,6 +59,8 @@ import com.sun.star.wizards.common.JavaTools; import com.sun.star.wizards.common.Resource; import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.sdb.application.DatabaseObject; +import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.wizards.common.SystemDialog; import com.sun.star.wizards.db.DBMetaData; import com.sun.star.wizards.db.SQLQueryComposer; @@ -63,6 +68,8 @@ import com.sun.star.wizards.document.OfficeDocument; import com.sun.star.wizards.ui.UIConsts; import java.util.ArrayList; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; /** * @@ -71,11 +78,12 @@ import java.util.Vector; public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument { - private ReportTextDocument m_aDoc; - private Object m_aInitialDoc; - private Resource m_aResource; + private ReportTextDocument m_aDoc; + private Object m_aInitialDoc; + private Resource m_resource; + private XDatabaseDocumentUI m_documentUI; - public void setInitialDocument(Object _aDoc) + private void setInitialDocument(Object _aDoc) { m_aInitialDoc = _aDoc; } @@ -91,15 +99,15 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { if (m_aInitialDoc instanceof XTextDocument) { - m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_aResource, getRecordParser()); + m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_resource, getRecordParser()); } else if (m_aInitialDoc instanceof String) { - m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_aResource, getRecordParser()); + m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_resource, getRecordParser()); } else { - throw new RuntimeException("Unknown type for setInitialDoc() given."); + throw new RuntimeException("Unknown type for setInitialDocument() given."); } } return m_aDoc; @@ -107,40 +115,37 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme public void clearDocument() { - int dummy = 0; - /*CurReportDocument.*/ getDoc().oTextSectionHandler.removeAllTextSections(); - /*CurReportDocument.*/ getDoc().oTextTableHandler.removeAllTextTables(); - /*CurReportDocument.*/ getDoc().DBColumnsVector = new Vector(); - //getRecordParser().setGroupFieldNames(new String[]{}); - // CurGroupFieldHandler.removeGroupFieldNames(); + getDoc().oTextSectionHandler.removeAllTextSections(); + getDoc().oTextTableHandler.removeAllTextTables(); + getDoc().DBColumnsVector = new Vector(); } - private ReportTextImplementation(XMultiServiceFactory _xMSF, Resource _oResource) + protected ReportTextImplementation( XMultiServiceFactory i_serviceFactory ) { - super(_xMSF, ReportLayouter.SOOPTLANDSCAPE); - m_aResource = _oResource; + super( i_serviceFactory, ReportLayouter.SOOPTLANDSCAPE ); } - static IReportDocument create(XMultiServiceFactory _xMSF /*, String _sPreviewURL */, Resource _oResource) + public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource ) { - ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource); - String sPreviewURL = a.getLayoutPath(); // a.getReportPath() + "/stl-default.ott"; - a.setInitialDocument(sPreviewURL); - a.initialResources(); - return a; + m_documentUI = i_documentUI; + m_resource = i_resource; + + if ( m_aInitialDoc == null ) + setInitialDocument( getLayoutPath() ); + + initialResources(); } - static IReportDocument create(XMultiServiceFactory _xMSF, XTextDocument _aDoc, Resource _oResource) + static IReportDocument create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources ) { - ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource); - a.setInitialDocument(_aDoc); - a.initialResources(); + ReportTextImplementation a = new ReportTextImplementation( i_serviceFactory ); + a.setInitialDocument(i_initialDocument); + a.initialize( i_documentUI, i_resources ); return a; } public XWindowPeer getWizardParent() { - // throw new UnsupportedOperationException("Not supported yet."); return getDoc().xWindowPeer; } static String sMsgQueryCreationImpossible; @@ -153,11 +158,11 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme private void initialResources() { - sReportFormNotExisting = m_aResource.getResText(UIConsts.RID_REPORT + 64); - sMsgQueryCreationImpossible = m_aResource.getResText(UIConsts.RID_REPORT + 65); - sMsgHiddenControlMissing = m_aResource.getResText(UIConsts.RID_REPORT + 66); - sMsgEndAutopilot = m_aResource.getResText(UIConsts.RID_DB_COMMON + 33); - sMsgNoConnection = m_aResource.getResText(UIConsts.RID_DB_COMMON + 14); + sReportFormNotExisting = m_resource.getResText(UIConsts.RID_REPORT + 64); + sMsgQueryCreationImpossible = m_resource.getResText(UIConsts.RID_REPORT + 65); + sMsgHiddenControlMissing = m_resource.getResText(UIConsts.RID_REPORT + 66); + sMsgEndAutopilot = m_resource.getResText(UIConsts.RID_DB_COMMON + 33); + sMsgNoConnection = m_resource.getResText(UIConsts.RID_DB_COMMON + 14); } public void addTextSectionCopies() @@ -185,8 +190,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme try { XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection"); - XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection); - xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection); + XTextContent xTextSectionContent = UnoRuntime.queryInterface( XTextContent.class, xTextSection ); + xNamedTextSection = UnoRuntime.queryInterface( XNamed.class, xTextSection ); xTextCursor.gotoEnd(false); xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true); Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion); @@ -196,7 +201,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme if (bIsGroupTable == true) { XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); - XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable); + XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable ); CurDBColumn.modifyCellContent(xCellRange, CurGroupValue); } } @@ -211,7 +216,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme private void renameTableofLastSection(String _snewname) { XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable(); - XNamed xNamedTable = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable); + XNamed xNamedTable = UnoRuntime.queryInterface( XNamed.class, xTextTable ); xNamedTable.setName(_snewname); } @@ -231,7 +236,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme if (oDBForm != null) { String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot; - XNameAccess xNamedForm = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oDBForm); + XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm ); getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Command", sMsg); String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", sMsg); String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg); @@ -346,7 +351,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme { CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1); oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName); - xGroupBaseTables[ColIndex] = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable); + xGroupBaseTables[ColIndex] = UnoRuntime.queryInterface( XTextTable.class, oTable ); CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex); OldGroupFieldValues[ColIndex] = CurGroupValue; CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex); @@ -574,24 +579,23 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme public void liveupdate_updateReportTitle(String _sTitleName) { - int dummy = 0; - // getDoc().updateReportTitle(_sTitleName); } -// public void finish() -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } public void addReportToDBView() { getRecordParser().addReportDocument(getComponent(), true); } - public XComponent[] createFinalReportDocument(String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign) + public void createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign ) { - // create the real report document, filled with content - XComponent[] ret = getRecordParser().openReportDocument(sReportName, _bAsTemplate, _bOpenInDesign); - return ret; + try + { + m_documentUI.loadComponent( DatabaseObject.REPORT, sReportName, _bOpenInDesign ); + } + catch ( Exception ex ) + { + Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex ); + } } public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames) @@ -715,8 +719,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme public void importReportData(ReportWizard _aWizard) { Dataimport CurDataimport = new Dataimport(_aWizard.xMSF); - CurDataimport.CurReportDocument = _aWizard.CurReportDocument; - // CurDataimport.showProgressDisplay(xMSF, false); + CurDataimport.CurReportDocument = this; _aWizard.importReportData(_aWizard.xMSF, CurDataimport); } @@ -728,7 +731,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme public void setCommand(String _sCommand) { getRecordParser().Command = _sCommand; - // throw new UnsupportedOperationException("Not supported yet."); } public void checkInvariants() throws java.lang.Exception diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java index a4b4e3af18ad..245e3716be04 100644 --- a/wizards/com/sun/star/wizards/report/ReportWizard.java +++ b/wizards/com/sun/star/wizards/report/ReportWizard.java @@ -32,24 +32,15 @@ package com.sun.star.wizards.report; // import java.util.Vector; -// import com.sun.star.wizards.reportbuilder.ReportBuilderImplementation; -import com.sun.star.awt.Size; import com.sun.star.awt.TextEvent; import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XControlModel; -import com.sun.star.awt.XFixedText; -import com.sun.star.awt.XLayoutConstrains; import com.sun.star.awt.XTextListener; -import com.sun.star.awt.XWindow; import com.sun.star.beans.PropertyValue; -// import com.sun.star.beans.XPropertySet; import com.sun.star.container.XContentEnumerationAccess; import com.sun.star.deployment.XPackageInformationProvider; import com.sun.star.lang.EventObject; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; import com.sun.star.logging.XLogger; import com.sun.star.logging.XLoggerPool; import com.sun.star.sdb.CommandType; @@ -57,39 +48,40 @@ import com.sun.star.sdb.CommandType; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import com.sun.star.wizards.common.*; -import com.sun.star.wizards.ui.*; -import com.sun.star.wizards.db.*; -import com.sun.star.lang.XComponent; +import com.sun.star.logging.LogLevel; +import com.sun.star.wizards.common.Helper; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.Resource; +import com.sun.star.wizards.common.SystemDialog; +import com.sun.star.wizards.db.DBMetaData; +import com.sun.star.wizards.db.DatabaseObjectWizard; +import com.sun.star.wizards.db.SQLQueryComposer; +import com.sun.star.wizards.ui.CommandFieldSelection; +import com.sun.star.wizards.ui.FieldSelection; +import com.sun.star.wizards.ui.SortingComponent; +import com.sun.star.wizards.ui.TitlesComponent; +import com.sun.star.wizards.ui.UIConsts; +import com.sun.star.wizards.ui.UnoDialog; +import com.sun.star.wizards.ui.XCompletion; import java.lang.reflect.Method; import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.util.Map; -public class ReportWizard extends WizardDialog implements XTextListener, XCompletion +public class ReportWizard extends DatabaseObjectWizard implements XTextListener, XCompletion { - // XMultiServiceFactory xMSF; - // QueryMetaData CurDBMetaData; protected FieldSelection CurGroupFieldSelection; private SortingComponent CurSortingComponent; - // private UnoDialog CurUnoProgressDialog; private TitlesComponent CurTitlesComponent; private CommandFieldSelection CurDBCommandFieldSelection; private GroupFieldHandler CurGroupFieldHandler; private ReportLayouter CurReportLayouter; private ReportFinalizer CurReportFinalizer; - private PropertyValue[] DBGPROPERTYVALUE; - // private String sCommandName = ""; - // private int nCommandType = -1; private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT; private String m_sReportName = ""; protected static final String SOREPORTFORMNAME = "ReportSource"; - // private final int SOSELGROUPLST = 33; - // private final int SOTXTCOLTITLE = 48; - // private final int SOTITLESCROLLBAR = 49; - // private static final int SONULLPAGE = 0; private static final int SOMAINPAGE = 1; private static final int SOTITLEPAGE = 2; protected static final int SOGROUPPAGE = 3; @@ -97,36 +89,21 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple protected static final int SOTEMPLATEPAGE = 5; protected static final int SOSTOREPAGE = 6; - // ReportTextDocument CurReportDocument; - // ReportTextImplementation CurReportDocument; - protected IReportDocument CurReportDocument; + private IReportDocument m_reportDocument; private static String sMsgWizardName; private static String slblFields; private static String slblSelFields; private static String sShowBinaryFields; - // private static String sGroupings; private String[] WizardHeaderText = new String[6]; - // private static String[] WizardTitle = new String[6]; - // private static String sWriterFilterName; - private static String slstDatabasesDefaultText; - private static String slstTablesDefaultText; - private static String sMsgErrorOccured; - private static String sMsgSavingImpossible; - // private static String sMsgNoConnection; - // Progress display relevant Strings private static String slblColumnTitles; private static String slblColumnNames; - private static String sMsgNoConnectionforDataimport; - private static String sMsgQueryCreationImpossible; - private static String sMsgFilePathInvalid; private static String slblTables; -// public static String sBlindTextNote; protected static boolean bCloseDocument; private boolean bHasEscapeProcessing = true; - public ReportWizard(XMultiServiceFactory xMSF) + public ReportWizard( XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext ) { - super(xMSF, 34320); + super(i_serviceFactory, 34320, i_wizardContext ); super.addResourceHandler("Report Wizard", "dbw"); if (getReportResources(false) == true) { @@ -166,7 +143,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple { // CurReportDocument.getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection"); // CurReportDocument.getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection"); - CurReportDocument.removeTextTableAndTextSection(); + m_reportDocument.removeTextTableAndTextSection(); } switch (nNewStep) { @@ -175,8 +152,8 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple break; case SOTITLEPAGE: - String[] aFieldNames = CurReportDocument.getRecordParser().getFieldNames(); - Map aFieldTitleSet = CurReportDocument.getRecordParser().getFieldTitleSet(); + String[] aFieldNames = m_reportDocument.getRecordParser().getFieldNames(); + Map aFieldTitleSet = m_reportDocument.getRecordParser().getFieldTitleSet(); CurTitlesComponent.initialize(aFieldNames, aFieldTitleSet); break; @@ -185,10 +162,10 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple break; case SOSORTPAGE: - String[] aFieldNames2 = CurReportDocument.getRecordParser().getFieldNames(); - String[][] aSortFieldNames = CurReportDocument.getRecordParser().getSortFieldNames(); + String[] aFieldNames2 = m_reportDocument.getRecordParser().getFieldNames(); + String[][] aSortFieldNames = m_reportDocument.getRecordParser().getSortFieldNames(); CurSortingComponent.initialize(aFieldNames2, aSortFieldNames); - int nLength = CurReportDocument.getRecordParser().GroupFieldNames.length; + int nLength = m_reportDocument.getRecordParser().GroupFieldNames.length; CurSortingComponent.setReadOnlyUntil(nLength, false); break; @@ -197,7 +174,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple case SOSTOREPAGE: //TODO initialize with suitable PathName - CurReportFinalizer.initialize(CurReportDocument.getRecordParser()); + CurReportFinalizer.initialize(m_reportDocument.getRecordParser()); break; default: @@ -213,23 +190,13 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple case SOMAINPAGE: String[] aSelectedFieldNames = CurDBCommandFieldSelection.getSelectedFieldNames(); String aTableName = CurDBCommandFieldSelection.getSelectedCommandName(); - // set all selected field names, DB Table name - // CurReportDocument.getRecordParser().initializeFieldColumns(aSelectedFieldNames, aTableName); int nType = CurDBCommandFieldSelection.getSelectedCommandType(); - // nType = com.sun.star.sdb.CommandType.TABLE; - CurReportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames); - // CurReportDocument.initializeFieldColumns(aSelectedFieldNames, aSelectedCommandName); - // CurReportDocument.getRecordParser().setAllIncludedFieldNames(false); + m_reportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames); if (CurDBCommandFieldSelection.isModified()) { // cleanup document - CurReportDocument.clearDocument(); - // CurReportDocument.getDoc().oTextSectionHandler.removeAllTextSections(); - // CurReportDocument.getDoc().oTextTableHandler.removeAllTextTables(); - // CurReportDocument.getDoc().DBColumnsVector = new Vector(); - CurReportDocument.getRecordParser().setGroupFieldNames(new String[] - { - }); + m_reportDocument.clearDocument(); + m_reportDocument.getRecordParser().setGroupFieldNames(new String[]{}); CurGroupFieldHandler.removeGroupFieldNames(); } break; @@ -238,21 +205,21 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple String[] sFieldTitles = CurTitlesComponent.getFieldTitles(); // set new field name titles // CurReportDocument.getRecordParser().setFieldTitles(sFieldTitles); - CurReportDocument.setFieldTitles(sFieldTitles); + m_reportDocument.setFieldTitles(sFieldTitles); break; case SOGROUPPAGE: // TODO: DESIGN!!! a getter should return a value!!! - CurGroupFieldHandler.getGroupFieldNames(CurReportDocument.getRecordParser()); - String[] aGroupFieldNames = CurReportDocument.getRecordParser().GroupFieldNames; + CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser()); + String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames; // CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames); - CurReportDocument.setGrouping(aGroupFieldNames); + m_reportDocument.setGrouping(aGroupFieldNames); break; case SOSORTPAGE: String[][] aSortFieldNames = CurSortingComponent.getSortFieldNames(); // CurReportDocument.getRecordParser().SortFieldNames = aSortFieldNames; - CurReportDocument.setSorting(aSortFieldNames); + m_reportDocument.setSorting(aSortFieldNames); // TODO: why do we make a switch here super.enablefromStep(SOTEMPLATEPAGE, true); break; @@ -270,58 +237,33 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE)) { // this is called before SOTEMPLATEPAGE, after SOGROUPPAGE - CurReportDocument.getRecordParser().createRecordFieldNames(); - CurReportLayouter.initialize(CurReportDocument.getContentPath()); + m_reportDocument.getRecordParser().createRecordFieldNames(); + CurReportLayouter.initialize(m_reportDocument.getContentPath()); } } - private XComponent[] dialogFinish(short RetValue) + private void dialogFinish() { - XComponent[] ret = null; - // Report Wizard Dialog is done. - boolean bdisposeDialog = true; - switch (RetValue) - { - case 0: - // via Cancelbutton or via sourceCode with "endExecute" - this.xComponent.dispose(); - if (bCloseDocument == true) - { - // OfficeDocument.dispose(xMSF, CurReportDocument.getDoc().xComponent); - CurReportDocument.dispose(); - return ret; - } - if ((nReportMode == ReportFinalizer.SOCREATETEMPLATE) || (nReportMode == ReportFinalizer.SOUSETEMPLATE)) - { - bdisposeDialog = false; - // Add Report to the DB View - // old: CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), true); - CurReportDocument.addReportToDBView(); - boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE); - // Create Report - // old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, true, bOpenInDesign); - ret = CurReportDocument.createFinalReportDocument(m_sReportName, true, bOpenInDesign); - } - else - { - bdisposeDialog = false; - CurReportDocument.importReportData(this); - // Dataimport CurDataimport = new Dataimport(xMSF); - // CurDataimport.CurReportDocument = CurReportDocument; - // CurDataimport.showProgressDisplay(xMSF, false); - // importReportData(xMSF, CurDataimport); - // old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, false, false); - ret = CurReportDocument.createFinalReportDocument(m_sReportName, false, false); - } - return ret; - case 1: - if (bdisposeDialog == true) - { - // CurReportDocument.getDoc().unlockallControllers(); - } - break; + this.xComponent.dispose(); + if (bCloseDocument == true) + { + m_reportDocument.dispose(); + return; + } + + if ( ( nReportMode == ReportFinalizer.SOCREATETEMPLATE ) + || ( nReportMode == ReportFinalizer.SOUSETEMPLATE ) + ) + { + m_reportDocument.addReportToDBView(); + boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE); + m_reportDocument.createAndOpenReportDocument( m_sReportName, true, bOpenInDesign); + } + else + { + m_reportDocument.importReportData(this); + m_reportDocument.createAndOpenReportDocument( m_sReportName, false, false ); } - return null; } private boolean executeQuery() @@ -329,35 +271,35 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple boolean bQueryCreated = false; if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE) { - bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false); + bQueryCreated = m_reportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false); - CurReportDocument.setCommandType(CommandType.COMMAND); - String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery(); - CurReportDocument.setCommand(sQuery); + m_reportDocument.setCommandType(CommandType.COMMAND); + String sQuery = m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery(); + m_reportDocument.setCommand(sQuery); } else { try { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); - DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); + DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName); + bHasEscapeProcessing = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command"); if (bHasEscapeProcessing) { // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command"); bQueryCreated = (!sCommand.equals("")); - CurReportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); - CurReportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria(); + m_reportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand); + m_reportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria(); // TODO: check with query - CurReportDocument.setCommandType(CommandType.COMMAND); - CurReportDocument.setCommand(CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery()); + m_reportDocument.setCommandType(CommandType.COMMAND); + m_reportDocument.setCommand(m_reportDocument.getRecordParser().oSQLQueryComposer.getQuery()); bQueryCreated = true; } else { - CurReportDocument.setCommandType(CommandType.COMMAND); - CurReportDocument.setCommand(sCommand); + m_reportDocument.setCommandType(CommandType.COMMAND); + m_reportDocument.setCommand(sCommand); bQueryCreated = true; } } @@ -372,124 +314,10 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple } return bQueryCreated; } -/* - public static void main(String args[]) - { - String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155 - try - { - XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr); - - tests(xLocMSF); - - ReportWizard CurReportWizard = new ReportWizard(xLocMSF); - if (xLocMSF != null) - { - System.out.println("Connected to " + ConnectStr); - PropertyValue[] curproperties = new PropertyValue[1]; - // curproperties[0] = Properties.createProperty( - // "DatabaseLocation", - // "file:///localhome/bc93774/NewDatabase2" + - // "C:/Documents and Settings/ll93751/My Documents/RptWizard01_DB.odb"); - // "file://C:/Documents%20and%20Settings/ll93751/My%20Documents/RptWizard01_DB.odb"); -// "C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); //MyDocAssign.odb; baseLocation ); "DataSourceName", "db1"); - // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); - curproperties[0] = Properties.createProperty("DataSourceName", "RptWizard01_DB"); - CurReportWizard.startReportWizard(xLocMSF, curproperties, true); - } - } - catch (Exception exception) - { - exception.printStackTrace(System.out); - } - System.exit(1); - } -*/ -/* - private static void tests(XMultiServiceFactory _xMSF) - { - try - { -// String[] sServices = _xMSF.getAvailableServiceNames(); -// File aFile = new File("C:/temp/services.txt"); -// aFile.delete(); -// FileWriter aRAF = new FileWriter(aFile); -// for (int i=0;i 0 ) { - // debug == false - - // Get the path to the extension and try to add the path to the class loader - String sLocation = getPathToExtension(xMSF); - // TODO: Umlaut in filename! - if (sLocation.length() > 0) + try { - try - { - URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar"); - - URL[] aURLs = new URL[1]; - aURLs[0] = aLocationURI.toURL(); - URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader()); - Class a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation"); - Method aMethod = a.getMethod("create", new Class[] - { - XMultiServiceFactory.class, Resource.class - }); - CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[] - { - xMSF, m_oResource - }); - } - catch (Exception e) - { - // TODO: Exception not handled. - int dummy = 0; - // Maybe problems in URI create() if a wrong char is used like '[' ']', ... - System.out.println("There could be a problem with the path '" + sLocation + "'"); - } + URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar"); + + URL[] aURLs = new URL[1]; + aURLs[0] = aLocationURI.toURL(); + URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader()); + Class a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation"); + Method aMethod = a.getMethod("create", new Class[] { XMultiServiceFactory.class }); + m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] { xMSF }); + } + catch (Exception e) + { + // Maybe problems in URI create() if a wrong char is used like '[' ']', ... + System.out.println("There could be a problem with the path '" + sLocation + "'"); } } } + try { - if (CurReportDocument == null) + if (m_reportDocument == null) { // Fallback, if there is no reportbuilder wizard implementation, we use the old wizard - CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource); + m_reportDocument = new ReportTextImplementation( xMSF ); } - // CurDBMetaData = CurReportDocument.getRecordParser(); -// tests(); + m_reportDocument.initialize( m_docUI, m_oResource ); - if (CurReportDocument.getRecordParser().getConnection(CurPropertyValue)) + if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) ) { - // CurReportDocument.getDoc().xProgressBar.setValue(20); - CurReportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(CurReportDocument.getRecordParser()); + m_reportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(m_reportDocument.getRecordParser()); buildSteps(); - CurReportDocument.checkInvariants(); + m_reportDocument.checkInvariants(); - this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValue, false); + this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false ); - createWindowPeer(CurReportDocument.getWizardParent()); + createWindowPeer(m_reportDocument.getWizardParent()); - CurReportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer()); + m_reportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer()); insertQueryRelatedSteps(); - short RetValue = executeDialog(CurReportDocument.getFrame().getComponentWindow().getPosSize()); - ret = dialogFinish(RetValue); + short RetValue = executeDialog(m_reportDocument.getFrame().getComponentWindow().getPosSize()); + if ( RetValue == 0 ) + dialogFinish(); } - CurReportDocument.getRecordParser().dispose(); + m_reportDocument.getRecordParser().dispose(); } catch (java.io.IOException e) { @@ -742,7 +514,6 @@ public static XLogger getLogger() { jexception.printStackTrace(System.out); } - return ret; } public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport) @@ -753,25 +524,25 @@ public static XLogger getLogger() boolean bexecute = false; if (!bHasEscapeProcessing) { - bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)) + bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)) } else { - bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)) + bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot)) } if (bexecute) { - bexecute = CurReportDocument.getRecordParser().getFields(CurReportDocument.getRecordParser().getFieldNames(), false); + bexecute = m_reportDocument.getRecordParser().getFields(m_reportDocument.getRecordParser().getFieldNames(), false); } if (bexecute) { // CurDataimport.insertDatabaseDatatoReportDocument(xMSF); - CurReportDocument.insertDatabaseDatatoReportDocument(xMSF); + m_reportDocument.insertDatabaseDatatoReportDocument(xMSF); } if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT) { - bDocisStored = CurReportDocument.getRecordParser().storeDatabaseDocumentToTempPath(CurReportDocument.getComponent(), CurReportFinalizer.getStoreName()); + bDocisStored = m_reportDocument.getRecordParser().storeDatabaseDocumentToTempPath(m_reportDocument.getComponent(), CurReportFinalizer.getStoreName()); } } catch (com.sun.star.wizards.common.InvalidQueryException queryexception) @@ -780,10 +551,10 @@ public static XLogger getLogger() CurDataimport.xComponent.dispose(); if (bDocisStored) { - CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), false); + m_reportDocument.getRecordParser().addReportDocument(m_reportDocument.getComponent(), false); } - CurReportDocument.getRecordParser().dispose(); + m_reportDocument.getRecordParser().dispose(); } public boolean getReportResources(boolean bgetProgressResourcesOnly) @@ -792,9 +563,6 @@ public static XLogger getLogger() if (bgetProgressResourcesOnly == false) { sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60); - slstDatabasesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 37); - slstTablesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 38); - sMsgErrorOccured = m_oResource.getResText(UIConsts.RID_DB_COMMON + 6); slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6); slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12); slblSelFields = m_oResource.getResText(UIConsts.RID_REPORT + 9); @@ -804,13 +572,9 @@ public static XLogger getLogger() WizardHeaderText[3] = m_oResource.getResText(UIConsts.RID_REPORT + 30); WizardHeaderText[4] = m_oResource.getResText(UIConsts.RID_REPORT + 31); WizardHeaderText[5] = m_oResource.getResText(UIConsts.RID_REPORT + 32); - sMsgSavingImpossible = m_oResource.getResText(UIConsts.RID_DB_COMMON + 30); } - sMsgFilePathInvalid = m_oResource.getResText(UIConsts.RID_DB_COMMON + 36); slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70); slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71); -// sBlindTextNote = m_oResource.getResText(UIConsts.RID_REPORT + 75); -// sBlindTextNote = JavaTools.replaceSubString( sBlindTextNote, String.valueOf((char)13), "
"); return true; } @@ -871,7 +635,7 @@ public static XLogger getLogger() String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text"); String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel); // CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle); - CurReportDocument.liveupdate_changeUserFieldContent(fieldname, sContent); + m_reportDocument.liveupdate_changeUserFieldContent(fieldname, sContent); } catch (Exception exception) { @@ -901,8 +665,8 @@ public static XLogger getLogger() if (!bdoenable) { String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName(); - DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName); - bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); + DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName); + bdoenable = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()); } super.setStepEnabled(SOSORTPAGE, bdoenable); diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index dad827841e96..f14f4dce0bd9 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -33,11 +33,9 @@ package com.sun.star.wizards.reportbuilder; import com.sun.star.util.XModeSelector; -import com.sun.star.wizards.report.*; import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.frame.XController; import com.sun.star.frame.XDispatch; @@ -46,10 +44,15 @@ import com.sun.star.frame.XFrame; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.report.XReportDefinition; +import com.sun.star.sdb.XSubDocument; +import com.sun.star.sdb.application.DatabaseObject; +import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.sdbc.XConnection; import com.sun.star.ucb.XCommandProcessor; import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XModifiable; import com.sun.star.util.XURLTransformer; +import com.sun.star.wizards.common.NoValidPathException; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.FieldColumn; import java.lang.reflect.Constructor; @@ -59,6 +62,15 @@ import java.util.LinkedHashMap; import java.util.Set; import java.util.Vector; import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.NamedValueCollection; +import com.sun.star.wizards.report.IReportBuilderLayouter; +import com.sun.star.wizards.report.IReportDefinitionReadAccess; +import com.sun.star.wizards.report.IReportDocument; +import com.sun.star.wizards.report.ReportImplementationHelper; +import com.sun.star.wizards.report.ReportLayouter; +import com.sun.star.wizards.report.ReportWizard; +import java.util.logging.Level; +import java.util.logging.Logger; /** * This class use the IReportDocument Interface to communicate between the UI @@ -69,61 +81,35 @@ import com.sun.star.wizards.common.FileAccess; public class ReportBuilderImplementation extends ReportImplementationHelper implements IReportDocument, IReportDefinitionReadAccess { + private Resource m_resource; + private XDatabaseDocumentUI m_documentUI; private static final int MAXIMUM_GROUPCOUNT = 4; -// public ReportTextDocument getDoc() -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } - public void clearDocument() + + private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory ) { - // throw new UnsupportedOperationException("Not supported yet."); + // creates an access to the ReportBuilder Extension + super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE); } - private Resource m_aResource; - public ReportBuilderImplementation() + public static IReportDocument create( XMultiServiceFactory i_serviceFactory ) { - // super(null, ReportLayouter.SOOPTPORTRAIT); - super(null, ReportLayouter.SOOPTLANDSCAPE); - m_aResource = null; + return new ReportBuilderImplementation( i_serviceFactory ); } - private ReportBuilderImplementation(XMultiServiceFactory _aMSF, Resource _oResource) + public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource ) { - // creates an access to the ReportBuilder Extension - // super(_aMSF, ReportLayouter.SOOPTPORTRAIT); - super(_aMSF, ReportLayouter.SOOPTLANDSCAPE); - m_aResource = _oResource; + m_documentUI = i_documentUI; + m_resource = i_resource; } - /** - * This is the Factory method. To create a ReportBuilderImplementation Object. - * - * @param _xMSF - * @param _oResource - * @return - */ - public static IReportDocument create(XMultiServiceFactory _xMSF, Resource _oResource) + public void clearDocument() { - final ReportBuilderImplementation a = new ReportBuilderImplementation(_xMSF, _oResource); - // a.m_xGlobalServiceFactory = _xGlobalServiceFactory; - return a; } -// public void setInitialDocument(Object _aDoc) -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } public XWindowPeer getWizardParent() { - // throw new UnsupportedOperationException("Not supported yet."); - // com.sun.star.frame.XFrame xFrame = thisComponent; - // openReportBuilderView(); - // XInterface xInterface = (XInterface) getMSF().createInstance("com.sun.star.frame.Desktop"); - // XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface); - // XFrame xFrame = xDesktop.getCurrentFrame(); - - final XWindowPeer aWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow()); + final XWindowPeer aWindowPeer = UnoRuntime.queryInterface( XWindowPeer.class, getFrame().getComponentWindow() ); return aWindowPeer; } private XFrame m_xFrame = null; @@ -137,17 +123,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper */ private IReportBuilderLayouter getReportBuilderLayouter() { - // if (m_aReportBuilderLayouter == null) - // { - // m_aReportBuilderLayouter = ReportBuilderLayouter.create(getRecordParser().getReportDocuments(), getConnection()); - // m_aReportBuilderLayouter = ReportBuilderLayouter.create(m_xReportDefinition /* , getConnection() */ ); final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName); return aReportBuilderLayouter; - // } } private Object m_aReportDocument; - private XPropertySet m_aDocumentDefinition; - private XReportDefinition m_xReportDefinition; + private XPropertySet m_documentDefinition; + private XReportDefinition m_reportDocument; /** * initialize the Report Builder and open it representation @@ -160,75 +141,36 @@ public class ReportBuilderImplementation extends ReportImplementationHelper // TODO: type down how we got such ID final String sClassID = "d7896d52-b7af-4820-9dfe-d404d015960f"; // CLASSID for Report Builder - Object args[] = new Object[2]; - - final PropertyValue aClassID = new PropertyValue(); - aClassID.Name = "ClassID"; - aClassID.Value = sClassID; - args[0] = aClassID; - - PropertyValue aConnection = new PropertyValue(); - aConnection.Name = "ActiveConnection"; - aConnection.Value = _xConnection; - args[1] = aConnection; - - - XReportDefinition xReportDefinition = null; - final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, /* getRecordParser().getReportDocuments() */ _aDoc); try { - final Object aObj = xMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", args); - final XPropertySet aDocumentDefinition = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aObj); - m_aDocumentDefinition = aDocumentDefinition; + NamedValueCollection creationArgs = new NamedValueCollection(); + creationArgs.put( "ActiveConnection", _xConnection ); + creationArgs.put( "ClassID", sClassID ); + creationArgs.put( "Mode", "remote" ); - final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, aObj); - final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); - aCommand.Name = "openDesign"; - final com.sun.star.ucb.OpenCommandArgument2 aOpenCommand = new com.sun.star.ucb.OpenCommandArgument2(); - aOpenCommand.Mode = com.sun.star.ucb.OpenMode.DOCUMENT; + XComponent[] docDefinition = new XComponent[] { null }; + XComponent reportDefinitionComp = m_documentUI.createComponentWithArguments( + DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition ); - PropertyValue args2[] = new PropertyValue[2]; - - PropertyValue aPropOpenCommand = new PropertyValue(); - aPropOpenCommand.Name = ""; - aPropOpenCommand.Value = aOpenCommand; - args2[0] = aPropOpenCommand; - - PropertyValue aAddField = new PropertyValue(); - aAddField.Name = "Mode"; - aAddField.Value = "remote"; - args2[1] = aAddField; - - aCommand.Argument = args2; - // com.sun.star.usb.XCommandEnvironment xEnv = new com.sun.star.ucb.XCommandEnvironment(); - final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); - xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj2); + m_documentDefinition = UnoRuntime.queryInterface( XPropertySet.class, docDefinition[0] ); + m_reportDocument = UnoRuntime.queryInterface( XReportDefinition.class, reportDefinitionComp ); } catch (com.sun.star.uno.Exception e) { ReportWizard.getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Problems with initialize the ReportDefinition" + e.getMessage()); } - m_xReportDefinition = xReportDefinition; switchOffPropertyBrowser(); switchOffAddFieldWindow(); setPageOrientation(m_nDefaultPageOrientation, false /* NO_LAYOUT*/); - // try - // { - // Thread.sleep(1000); - // } - // catch (java.lang.InterruptedException e) - // { - // } - } private XModeSelector getModeSelector() { final XController xController = getReportDefinition().getCurrentController(); - final XModeSelector xModeSelector = (XModeSelector) UnoRuntime.queryInterface(XModeSelector.class, xController); + final XModeSelector xModeSelector = UnoRuntime.queryInterface( XModeSelector.class, xController ); return xModeSelector; } @@ -273,11 +215,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper try { final XController xController = getReportDefinition().getCurrentController(); - final XDispatchProvider xDP = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xController); + final XDispatchProvider xDP = UnoRuntime.queryInterface( XDispatchProvider.class, xController ); // Create special service for parsing of given URL. final Object aURLTransformer = getMSF().createInstance("com.sun.star.util.URLTransformer"); - final XURLTransformer xURLTransformer = (XURLTransformer) UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, aURLTransformer); + final XURLTransformer xURLTransformer = UnoRuntime.queryInterface( com.sun.star.util.XURLTransformer.class, aURLTransformer ); com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1]; aURL[0] = new com.sun.star.util.URL(); @@ -309,41 +251,27 @@ public class ReportBuilderImplementation extends ReportImplementationHelper if (m_xFrame == null) { initialize(getRecordParser().getReportDocuments(), getConnection()); - // m_xFrame = getFrame(); m_xFrame = getReportDefinition().getCurrentController().getFrame(); setPageOrientation(m_nDefaultPageOrientation, true /* NO_LAYOUT*/); } return m_xFrame; } -// public XMultiServiceFactory getDocumentServiceFactory() -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } - -// public void addTextSectionCopies() -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties) { - throw new UnsupportedOperationException("Not supported yet."); + return false; } public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF) { - // throw new UnsupportedOperationException("Not supported yet."); } public void StopProcess() { - throw new UnsupportedOperationException("Not supported yet."); } public void store(String Name, int OpenMode) { - // throw new UnsupportedOperationException("Not supported yet."); - // getReportBuilderLayouter().store(Name); // store into the ZIP Storage if (OpenMode == 1 /* static Report */) { @@ -353,34 +281,25 @@ public class ReportBuilderImplementation extends ReportImplementationHelper try { - final XNameAccess aNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_aReportDocument); - final String[] aNames = aNameAccess.getElementNames(); - -// m_xReportDefinition.storeToStorage(m_xReportDefinition.getDocumentStorage(), m_xReportDefinition.getArgs()); - - final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition); + final XCommandProcessor xProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, m_documentDefinition ); com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); - aCommand.Name = "storeOwn"; + aCommand.Name = "store"; - final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); + xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); - final XNameContainer aNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, m_aReportDocument); -// aNameContainer.insertByName(Name, m_xReportDefinition); - aNameContainer.insertByName(Name, m_aDocumentDefinition); + final XNameContainer aNameContainer = UnoRuntime.queryInterface( XNameContainer.class, m_aReportDocument ); + aNameContainer.insertByName(Name, m_documentDefinition); } catch (Exception e) { - int dummy = 0; } } public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount) { - // throw new UnsupportedOperationException("Not supported yet."); final int GroupCount = GroupFieldVector.size(); if (GroupCount < MAXIMUM_GROUPCOUNT) { - // removeGroupNamesofRecordTable(iSelCount); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); GroupFieldVector.addElement(CurFieldColumn.getFieldName()); } @@ -389,16 +308,10 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void refreshGroupFields(String[] _sNewNames) { - // throw new UnsupportedOperationException("Not supported yet."); } -// public boolean isGroupField(String _FieldName) -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector) { - // throw new UnsupportedOperationException("Not supported yet."); final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle); GroupFieldVector.removeElement(CurFieldColumn.getFieldName()); } @@ -414,15 +327,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void setPageOrientation(int nOrientation) { - // throw new UnsupportedOperationException("Not supported yet."); setPageOrientation(nOrientation, true); } public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/) { - // throw new UnsupportedOperationException("Not supported yet."); /* Right Listbox */ - final IReportBuilderLayouter aLayouter = getReportBuilderLayouter(); aLayouter.loadAndSetBackgroundTemplate(LayoutTemplatePath); aLayouter.layout(); @@ -448,147 +358,131 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void liveupdate_changeContentTemplate(String ContentTemplatePath) { - // throw new UnsupportedOperationException("Not supported yet."); /* Left Listbox */ setReportBuilderLayouterName(ContentTemplatePath); } public void layout_setupRecordSection(String TemplateName) { - // throw new UnsupportedOperationException("Not supported yet."); } public void removeTextTableAndTextSection() { - // throw new UnsupportedOperationException("Not supported yet."); } public void layout_selectFirstPage() { - // throw new UnsupportedOperationException("Not supported yet."); } - public void dispose() + private void closeReportDefinition() { - // throw new UnsupportedOperationException("Not supported yet."); - getReportBuilderLayouter().dispose(); - try { - // XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, m_xReportDefinition); - // xClose.close(true); - // Failed! - - // next idea, which should always work. - // XController xController = m_xReportDefinition.getCurrentController(); - // XDispatchProvider xDispatcher = (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, xController); - // xDispatcher.queryDispatch(); - - final XComponent xDocumentComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_aDocumentDefinition); - xDocumentComponent.dispose(); - m_xReportDefinition = null; - - // TODO: dispose() office will be killed. - // m_xReportDefinition.dispose(); + if ( m_documentDefinition != null ) + { + // set the document to "not modified", to ensure that it won't ask the user before closing + XModifiable documentModify = UnoRuntime.queryInterface( XModifiable.class, m_reportDocument ); + documentModify.setModified( false ); + // actually close + XSubDocument subComponent = UnoRuntime.queryInterface( XSubDocument.class, m_documentDefinition ); + subComponent.close(); + } } - catch (Exception e) + catch ( Exception ex ) { - // catch all possible exceptions - int dummy = 0; + Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } + m_documentDefinition = null; + m_reportDocument = null; + } + + public void dispose() + { + getReportBuilderLayouter().dispose(); + closeReportDefinition(); } public XComponent getComponent() { - // throw new UnsupportedOperationException("Not supported yet."); return null; } public void liveupdate_changeUserFieldContent(String fieldName, String titlename) { - // throw new UnsupportedOperationException("Not supported yet."); } public void liveupdate_updateReportTitle(String _sTitleName) { - // throw new UnsupportedOperationException("Not supported yet."); } -// public void finish() -// { -// throw new UnsupportedOperationException("Not supported yet."); -// } public void addReportToDBView() { - // throw new UnsupportedOperationException("Not supported yet."); } - private XComponent[] createFinalReportDocument(String Name, Object _aDBConnection, boolean _bAsTemplate, boolean _bOpenInDesign) + private XComponent loadReport( final String i_reportName ) { - XComponent[] xComponents = new XComponent[1]; try { - PropertyValue[] aProperties = new PropertyValue[2]; - aProperties[0] = new PropertyValue(); - aProperties[0].Name = "ActiveConnection"; - // aProperties[0].Value = m_aDocumentDefinition; - aProperties[0].Value = _aDBConnection; - - final com.sun.star.ucb.OpenCommandArgument2 aOpenCommand = new com.sun.star.ucb.OpenCommandArgument2(); - aOpenCommand.Mode = com.sun.star.ucb.OpenMode.DOCUMENT; - - aProperties[1] = new PropertyValue(); - aProperties[1].Name = "OpenCommand"; // This name is 'Schall und Rauch' -// // since Java 6 -// // aProperties[1].Value = Integer.valueOf(com.sun.star.ucb.OpenMode.DOCUMENT); - aProperties[1].Value = aOpenCommand; - -// aProperties[2] = new PropertyValue(); -// aProperties[2].Name = "Title"; // This name is 'Schall und Rauch' -// aProperties[2].Value = Name; - - final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition); - com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); - aCommand.Name = "open"; - aCommand.Argument = aProperties; - - final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null); - xComponents[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, aObj2); + return m_documentUI.loadComponent( DatabaseObject.REPORT, i_reportName, false ); } - catch (com.sun.star.uno.Exception e) + catch ( Exception ex ) { - int dummy = 0; + Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } - return xComponents; + return null; } - public XComponent[] createFinalReportDocument(String Name, boolean _bAsTemplate, boolean _bOpenInDesign) + private XComponent loadReportFromDocumentDefinition() { - // XComponent[] xComponents = getReportBuilderLayouter().createFinalReportDocument(Name, getRecordParser().DBConnection ,_bAsTemplate, _bOpenInDesign); - if (_bAsTemplate == true && _bOpenInDesign == false) + final XCommandProcessor commandProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, m_documentDefinition); + + com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command(); + aCommand.Name = "open"; + try { - final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection, _bAsTemplate, _bOpenInDesign); - dispose(); - return xComponents; + final Object result = commandProcessor.execute( aCommand, commandProcessor.createCommandIdentifier(), null ); + return UnoRuntime.queryInterface( XComponent.class, result ); } - else if (_bAsTemplate == false) + catch ( Exception ex ) { - final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection, _bAsTemplate, _bOpenInDesign); - boolean bDocisStored = getRecordParser().storeDatabaseDocumentToTempPath(xComponents[0], Name); - if (bDocisStored) - { - getRecordParser().addReportDocument(xComponents[0], false); - } - dispose(); + Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } - else + return null; + } + + public void createAndOpenReportDocument( String i_name, boolean i_asTemplate, boolean i_openForEditing ) + { + if ( i_openForEditing ) { // we won't destroy the report builder window, also don't create a document // Do we need to reopen the report builder with the known name? switchOnAddFieldWindow(); switchOnPropertyBrowser(); + return; } - return null; + + if ( i_asTemplate ) + { + // don't need the report definition anymore - the document it represents has already been stored + closeReportDefinition(); + + // open the report, again, this time not in design, but containing data + loadReport( i_name ); + } + else + { + // execute the report from the (yet unsaved) report definition + XComponent document = loadReportFromDocumentDefinition(); + + // don't need the report definition anymore + closeReportDefinition(); + + // store the generated report + if ( getRecordParser().storeDatabaseDocumentToTempPath( document, i_name ) ) + getRecordParser().addReportDocument( document, false ); + } + + dispose(); } private XConnection getConnection() @@ -599,7 +493,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames) { getRecordParser().initializeFieldColumns(FieldNames, TableName); -// getRecordParser().createRecordFieldNames(); final com.sun.star.wizards.db.RecordParser a = getRecordParser(); int[] FieldTypes = new int[FieldNames.length]; @@ -610,7 +503,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper FieldWidths[i] = a.FieldColumns[i].getFieldWidth(); } getReportBuilderLayouter().setTableName(_nType, TableName); -// getReportBuilderLayouter().insertFields(getRecordParser().getRecordFieldNames()); getReportBuilderLayouter().insertFieldNames(FieldNames); getReportBuilderLayouter().insertFieldTypes(FieldTypes); getReportBuilderLayouter().insertFieldWidths(FieldWidths); @@ -621,7 +513,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void setFieldTitles(String[] _aFieldTitles) { getRecordParser().setFieldTitles(_aFieldTitles); -// getRecordParser().createRecordFieldNames(); getReportBuilderLayouter().insertFieldTitles(_aFieldTitles); getReportBuilderLayouter().layout(); @@ -630,18 +521,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void setSorting(String[][] _aSortFieldNames) { getRecordParser().setSortFieldNames(_aSortFieldNames); -// getRecordParser().createRecordFieldNames(); } public void setGrouping(String[] _aGroupFieldNames) { getRecordParser().prependSortFieldNames(_aGroupFieldNames); - // getRecordParser().createRecordFieldNames(); - - // getReportBuilderLayouter().insertFields(getRecordParser().getRecordFieldNames()); -// getReportBuilderLayouter().insertFieldTitles(getRecordParser().get); - // getReportBuilderLayouter().insertGroups(_aGroupFieldNames); getReportBuilderLayouter().insertGroupNames(_aGroupFieldNames); getReportBuilderLayouter().layout(); } @@ -656,18 +541,18 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { if (m_aReportPath == null) { - // Check general availability of office paths try { - m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard"); - FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report"); + // Check general availability of office paths + m_aReportPath = FileAccess.getOfficePaths( getMSF(), "Template", "share", "/wizard" ); + FileAccess.combinePaths( getMSF(), m_aReportPath, "/wizard/report" ); } - catch (Exception e) + catch ( NoValidPathException ex ) { + Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex ); } } return m_aReportPath; - // return ""; } public String getContentPath() @@ -699,7 +584,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper }); Object[] aParams = new Object[2]; aParams[0] = this; - aParams[1] = m_aResource; + aParams[1] = m_resource; final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams); return aReportBuilderLayouter; } @@ -707,34 +592,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { e.printStackTrace(); } -// catch (NoSuchMethodException ex) -// { -// ex.printStackTrace(); -// } -// catch (SecurityException ex) -// { -// ex.printStackTrace(); -// } -// catch (InstantiationException ex) -// { -// ex.printStackTrace(); -// } -// catch (IllegalAccessException ex) -// { -// ex.printStackTrace(); -// } -// catch (IllegalArgumentException ex) -// { -// ex.printStackTrace(); -// } -// catch (InvocationTargetException ex) -// { -// ex.printStackTrace(); -// } -// catch (ClassNotFoundException e) -// { -// e.printStackTrace(); -// } return null; } private LinkedHashMap m_aLayoutMap = null; @@ -850,11 +707,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public XReportDefinition getReportDefinition() { - if (m_xReportDefinition == null) + if (m_reportDocument == null) { throw new NullPointerException("Report Definition is not already initialized, check if you too early access the report definition."); } - return m_xReportDefinition; + return m_reportDocument; } public XMultiServiceFactory getGlobalMSF() @@ -864,7 +721,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper public void importReportData(ReportWizard aWizard) { - // throw new UnsupportedOperationException("Not supported yet."); } public String getDefaultHeaderLayout() @@ -876,7 +732,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { getRecordParser().Command = _sCommand; getReportDefinition().setCommand(_sCommand); - // throw new UnsupportedOperationException("Not supported yet."); } public void setCommandType(int _nCommand) @@ -893,11 +748,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper throw new java.io.IOException("default.otr"); } - final String sName = FileAccess.getFilename(sDefaultHeaderLayoutPath); - // if (sName.toLowerCase().equals("default.otr_") || - // LayoutTemplatePath.equals("DefaultLayoutOfHeaders")) - // File aFile = new File(sDefaultHeaderLayoutPath); - // File aFile = new File(sName); FileAccess aAccess = new FileAccess(getGlobalMSF()); if (! aAccess.exists(sDefaultHeaderLayoutPath, true)) { -- cgit v1.2.3 From 5a6a877ad0cc8b0703d55302ac01bf79530664fe Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Feb 2010 14:11:36 +0100 Subject: autorecovery: use a human-readable media type instead of this strange class ID --- .../sun/star/wizards/reportbuilder/ReportBuilderImplementation.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 9fb9ce575417..59c99b77de03 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -139,14 +139,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper private void initialize(Object _aDoc, XConnection _xConnection) { m_aReportDocument = _aDoc; - // TODO: type down how we got such ID - final String sClassID = "d7896d52-b7af-4820-9dfe-d404d015960f"; // CLASSID for Report Builder try { NamedValueCollection creationArgs = new NamedValueCollection(); creationArgs.put( "ActiveConnection", _xConnection ); - creationArgs.put( "ClassID", sClassID ); + creationArgs.put( "MediaType", "com.sun.star.report.ReportDefinition" ); creationArgs.put( "Mode", "remote" ); XComponent[] docDefinition = new XComponent[] { null }; -- cgit v1.2.3 From 4fa9df70fc2aadfc3777878e6e8d7a6e02715cbd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 5 Feb 2010 22:03:01 +0100 Subject: autorecovery: allow for a human-readable DocumentServiceName instead of this strange class ID when creating a document definition --- .../star/wizards/reportbuilder/ReportBuilderImplementation.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java index 59c99b77de03..c1f8bee703db 100644 --- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java +++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java @@ -136,15 +136,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper * @param _aDoc * @param _xConnection */ - private void initialize(Object _aDoc, XConnection _xConnection) + private void initialize(Object _aDoc) { m_aReportDocument = _aDoc; try { NamedValueCollection creationArgs = new NamedValueCollection(); - creationArgs.put( "ActiveConnection", _xConnection ); - creationArgs.put( "MediaType", "com.sun.star.report.ReportDefinition" ); + creationArgs.put( "DocumentServiceName", "com.sun.star.report.ReportDefinition" ); creationArgs.put( "Mode", "remote" ); XComponent[] docDefinition = new XComponent[] { null }; @@ -249,7 +248,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper { if (m_xFrame == null) { - initialize(getRecordParser().getReportDocuments(), getConnection()); + initialize(getRecordParser().getReportDocuments()); m_xFrame = getReportDefinition().getCurrentController().getFrame(); setPageOrientation(m_nDefaultPageOrientation, true /* NO_LAYOUT*/); } -- cgit v1.2.3 From 41f067606af0344a78f624cd4df564c9fdd8e850 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 8 Feb 2010 14:33:01 +0100 Subject: mtaccfixes: #i104470# Don't notify selection changes for caret movements --- .../accessibility/standard/vclxaccessibleedit.hxx | 3 +- .../source/standard/vclxaccessibleedit.cxx | 52 ++++++++++------------ 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx index 0e3f1a929f8d..03b38bec80d4 100644 --- a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx +++ b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx @@ -56,13 +56,12 @@ class VCLXAccessibleEdit : public VCLXAccessibleTextComponent, friend class VCLXAccessibleBox; private: + sal_Int32 m_nSelectionStart; sal_Int32 m_nCaretPosition; protected: virtual ~VCLXAccessibleEdit(); - void UpdateCaretPosition(); - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 06dd0e1e094c..2ae7ab149bbc 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -70,6 +70,7 @@ using namespace ::comphelper; VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow ) :VCLXAccessibleTextComponent( pVCLWindow ) { + m_nSelectionStart = getSelectionStart(); m_nCaretPosition = getCaretPosition(); } @@ -81,22 +82,6 @@ VCLXAccessibleEdit::~VCLXAccessibleEdit() // ----------------------------------------------------------------------------- -void VCLXAccessibleEdit::UpdateCaretPosition() -{ - sal_Int32 nCaretPosition = getCaretPosition(); - - if ( m_nCaretPosition != nCaretPosition ) - { - Any aOldValue, aNewValue; - aOldValue <<= (sal_Int32) m_nCaretPosition; - aNewValue <<= (sal_Int32) nCaretPosition; - m_nCaretPosition = nCaretPosition; - NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); - } -} - -// ----------------------------------------------------------------------------- - void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { switch ( rVclWindowEvent.GetId() ) @@ -108,11 +93,31 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve break; case VCLEVENT_EDIT_SELECTIONCHANGED: { + sal_Int32 nOldCaretPosition = m_nCaretPosition; + sal_Int32 nOldSelectionStart = m_nSelectionStart; + + m_nCaretPosition = getCaretPosition(); + m_nSelectionStart = getSelectionStart(); + Window* pWindow = GetWindow(); if ( pWindow && pWindow->HasChildPathFocus() ) { - NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); - UpdateCaretPosition(); + if ( m_nCaretPosition != nOldCaretPosition ) + { + Any aOldValue, aNewValue; + aOldValue <<= (sal_Int32) nOldCaretPosition; + aNewValue <<= (sal_Int32) m_nCaretPosition; + NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); + } + + // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED + sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition ); + sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition ); + if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) ) + { + NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); + } + } } break; @@ -308,22 +313,13 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBin sal_Int32 VCLXAccessibleEdit::getCaretPosition( ) throw (RuntimeException) { - OExternalLockGuard aGuard( this ); - - awt::Selection aSelection; - VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); - if ( pVCLXEdit ) - aSelection = pVCLXEdit->getSelection(); - - return aSelection.Max; + return getSelectionEnd(); } // ----------------------------------------------------------------------------- sal_Bool VCLXAccessibleEdit::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - return setSelection( nIndex, nIndex ); } -- cgit v1.2.3 From 515edd55e546f810455f469e9725fb22e3ed8367 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Thu, 18 Feb 2010 16:15:58 +0100 Subject: mtaccfixes: #100833# FixedLine needs to be in correct z-order --- cui/source/inc/optpath.hxx | 2 +- cui/source/options/optpath.cxx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx index c05b0b778c58..1255f0f70676 100644 --- a/cui/source/inc/optpath.hxx +++ b/cui/source/inc/optpath.hxx @@ -71,12 +71,12 @@ class SvxPathTabPage; class SvxPathTabPage : public SfxTabPage { private: + FixedLine aStdBox; FixedText aTypeText; FixedText aPathText; SvxControlFocusHelper aPathCtrl; PushButton aStandardBtn; PushButton aPathBtn; - FixedLine aStdBox; HeaderBar* pHeaderBar; ::svx::OptHeaderTabListBox* pPathBox; diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 8e004b54b018..7dc3ba68b68d 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -220,13 +220,12 @@ SvxPathTabPage::SvxPathTabPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_PATH ), rSet ), + aStdBox ( this, CUI_RES( GB_STD ) ), aTypeText ( this, CUI_RES( FT_TYPE ) ), aPathText ( this, CUI_RES( FT_PATH ) ), aPathCtrl ( this, CUI_RES( LB_PATH ) ), aStandardBtn ( this, CUI_RES( BTN_STANDARD ) ), aPathBtn ( this, CUI_RES( BTN_PATH ) ), - aStdBox ( this, CUI_RES( GB_STD ) ), - pHeaderBar ( NULL ), pPathBox ( NULL ), pImpl ( new OptPath_Impl( CUI_RES(IMG_LOCK), CUI_RES(IMG_LOCK_HC) ) ), -- cgit v1.2.3 From e412e3ad219c36d151cfa4304380e38dda7438d3 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Fri, 19 Feb 2010 13:02:37 +0100 Subject: mtaccfixes: #100833# FixedLine needs to be in correct z-order --- cui/source/inc/cuioptgenrl.hxx | 3 +-- cui/source/inc/dbregister.hxx | 3 +-- cui/source/options/dbregister.cxx | 2 +- cui/source/options/optgenrl.cxx | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx index 19d21ba5c255..0c28bf90c8fc 100644 --- a/cui/source/inc/cuioptgenrl.hxx +++ b/cui/source/inc/cuioptgenrl.hxx @@ -70,6 +70,7 @@ class SvxGeneralTabPage : public SfxTabPage { using TabPage::DeactivatePage; private: + FixedLine aAddrFrm; FixedText aCompanyLbl; SvxUserEdit aCompanyEdit; FixedText aNameLbl; @@ -100,12 +101,10 @@ private: FixedText aFaxMailLbl; SvxUserEdit aFaxEdit; SvxUserEdit aEmailEdit; - FixedLine aAddrFrm; CheckBox aUseDataCB; GeneralTabPage_Impl* pImpl; - #ifdef _SVX_OPTGENRL_CXX DECL_LINK( ModifyHdl_Impl, Edit * ); diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx index 84bc2fa4054c..311c2ce6e111 100644 --- a/cui/source/inc/dbregister.hxx +++ b/cui/source/inc/dbregister.hxx @@ -54,13 +54,13 @@ namespace svx class DbRegistrationOptionsPage : public SfxTabPage { private: + FixedLine aStdBox; FixedText aTypeText; FixedText aPathText; SvxControlFocusHelper aPathCtrl; PushButton m_aNew; PushButton m_aEdit; PushButton m_aDelete; - FixedLine aStdBox; HeaderBar* pHeaderBar; ::svx::OptHeaderTabListBox* pPathBox; @@ -68,7 +68,6 @@ namespace svx ULONG m_nOldCount; BOOL m_bModified; - #ifdef SVX_DBREGISTER_HXX DECL_LINK( NewHdl, void * ); DECL_LINK( EditHdl, void * ); diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx index 91635d80f5f1..37861d52e623 100644 --- a/cui/source/options/dbregister.cxx +++ b/cui/source/options/dbregister.cxx @@ -121,13 +121,13 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( Window* pParent, const Sfx SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_DBREGISTER), rSet ), + aStdBox ( this, CUI_RES( GB_STD ) ), aTypeText ( this, CUI_RES( FT_TYPE ) ), aPathText ( this, CUI_RES( FT_PATH ) ), aPathCtrl ( this, CUI_RES( LB_PATH ) ), m_aNew ( this, CUI_RES( BTN_NEW ) ), m_aEdit ( this, CUI_RES( BTN_EDIT ) ), m_aDelete ( this, CUI_RES( BTN_DELETE ) ), - aStdBox ( this, CUI_RES( GB_STD ) ), pHeaderBar ( NULL ), pPathBox ( NULL ), m_pCurEntry ( NULL ), diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx index 85c0d450cc47..567c37b8bbe4 100644 --- a/cui/source/options/optgenrl.cxx +++ b/cui/source/options/optgenrl.cxx @@ -96,6 +96,7 @@ SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSe SfxTabPage( pParent, CUI_RES(RID_SFXPAGE_GENERAL), rCoreSet ), + aAddrFrm ( this, CUI_RES( GB_ADDRESS ) ), aCompanyLbl ( this, CUI_RES( FT_COMPANY ), true ), aCompanyEdit ( this, CUI_RES( ED_COMPANY ), INDEX_NOTSET, &aCompanyLbl ), aNameLbl ( this, CUI_RES( FT_NAME ), true ), @@ -126,9 +127,7 @@ SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSe aFaxMailLbl ( this, CUI_RES( FT_FAXMAIL ), true ), aFaxEdit ( this, CUI_RES( ED_FAX ), 0, &aFaxMailLbl ), aEmailEdit ( this, CUI_RES( ED_EMAIL ), 1, &aFaxMailLbl ), - aAddrFrm ( this, CUI_RES( GB_ADDRESS ) ), aUseDataCB ( this, CUI_RES( CB_USEDATA ) ), - pImpl ( new GeneralTabPage_Impl ) { -- cgit v1.2.3 From 53cec388721ea68eb667d60eeb286c1bd24ffa02 Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Fri, 19 Feb 2010 13:15:33 +0100 Subject: mtaccfixes: #i100788# group lines support accessible text now --- accessibility/source/helper/acc_factory.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 60e4f416dc3c..87e614e36f00 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -387,7 +387,7 @@ inline bool hasFloatingChild(Window *pWindow) { xContext = new FloatingWindowAccessible( _pXWindow ); } - else if ( nType == WINDOW_HELPTEXTWINDOW ) + else if ( ( nType == WINDOW_HELPTEXTWINDOW ) || ( nType == WINDOW_FIXEDLINE ) ) { xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleFixedText( _pXWindow ); } -- cgit v1.2.3 From 1816f3232b325c81b4d843925476a9cc1f089041 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 22 Feb 2010 12:36:29 +0100 Subject: autorecovery: pass a MacroExecMode when creating a blank document - with the changed implementation, it is not (as before) by accident that a suitable MacroExecMode is set automatically --- forms/qa/integration/forms/DocumentHelper.java | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/forms/qa/integration/forms/DocumentHelper.java b/forms/qa/integration/forms/DocumentHelper.java index 81b0c3a86f5a..3aae6bafc21a 100644 --- a/forms/qa/integration/forms/DocumentHelper.java +++ b/forms/qa/integration/forms/DocumentHelper.java @@ -29,11 +29,13 @@ ************************************************************************/ package integration.forms; +import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XChild; import com.sun.star.container.XIndexContainer; import com.sun.star.container.XNameContainer; +import com.sun.star.document.MacroExecMode; import com.sun.star.drawing.XDrawPage; import com.sun.star.drawing.XDrawPageSupplier; import com.sun.star.drawing.XDrawPages; @@ -70,6 +72,12 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception + { + return implLoadAsComponent( orb, documentOrFactoryURL, new PropertyValue[0] ); + } + + /* ------------------------------------------------------------------ */ + protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception { XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, @@ -77,7 +85,7 @@ public class DocumentHelper ); XComponent document = dbfTools.queryComponent( - aLoader.loadComponentFromURL( documentOrFactoryURL, "_blank", 0, new PropertyValue[ 0 ] ) + aLoader.loadComponentFromURL( documentOrFactoryURL, "_blank", 0, i_args ) ); return document; } @@ -85,7 +93,13 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception { - XComponent document = implLoadAsComponent( orb, documentOrFactoryURL ); + return implLoadDocument( orb, documentOrFactoryURL, new PropertyValue[0] ); + } + + /* ------------------------------------------------------------------ */ + private static DocumentHelper implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception + { + XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args ); XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, document ); @@ -115,7 +129,10 @@ public class DocumentHelper /* ------------------------------------------------------------------ */ public static DocumentHelper blankDocument( XMultiServiceFactory orb, DocumentType eType ) throws com.sun.star.uno.Exception { - return implLoadDocument( orb, getDocumentFactoryURL( eType ) ); + final PropertyValue[] args = new PropertyValue[] { + new PropertyValue( "MacroExecutionMode", -1, MacroExecMode.ALWAYS_EXECUTE, PropertyState.DIRECT_VALUE ) + }; + return implLoadDocument( orb, getDocumentFactoryURL( eType ), args ); } /* ================================================================== */ -- cgit v1.2.3 From ecb93931a141e675da1196266a4058d233ac91e1 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 4 Mar 2010 11:25:02 +0100 Subject: native287 #i92147# fixing langpack problem --- .../source/packinfo/spellchecker_selection.txt | 60 ++++++++++++---------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt index 03d741b0afbb..526058086f67 100644 --- a/setup_native/source/packinfo/spellchecker_selection.txt +++ b/setup_native/source/packinfo/spellchecker_selection.txt @@ -3,42 +3,48 @@ # First column: Language in the installation set. # Second column: Assigned spellchecker languages. Comma separated list. +# The first entry after the "=" is the entry, that will be included into +# a language pack of the corresponding language. If no spellchecker +# shall be included into the language pack, the keyword "EMPTY" can +# be used as first entry. + af = "af,en-US" -ar = "en-US" +ar = "EMPTY,en-US" ca = "ca,es,en-US,fr" cs = "cs,en-US" da = "da,de-DE,en-US" -de = "de-AT,de-CH,de-DE,en-US,fr,it" +de = "de-DE,de-AT,de-CH,en-US,fr,it" en-US = "en-US,es,fr" en-GB = "en-US,es,fr" -es = "en-US,es,fr,pt" -et = "en-US,et" -fr = "en-US,es,fr" -gl = "en-US,pt,es,gl" -he = "en-US,he" -hu = "de-DE,en-US,hu" -it = "de-DE,en-US,fr,it" -ja = "en-US" -ko = "en-US" -lt = "en-US,lt" +es = "es,en-US,fr,pt" +et = "et,en-US" +fr = "fr,en-US,es" +gl = "gl,en-US,pt,es" +he = "he,en-US" +hu = "hu,de-DE,en-US" +it = "it,de-DE,en-US,fr" +ja = "EMPTY,en-US" +ko = "EMPTY,en-US" +lt = "lt,en-US" nb = "no,en-US,fr,de-DE,es" -ne = "en-US,ne" -nl = "en-US,fr,de-DE,nl" +ne = "ne,en-US" +nl = "nl,en-US,fr,de-DE" nn = "no,en-US,fr,de-DE,es" -pl = "de-DE,en-US,pl,ru" -pt-BR = "en-US,es,pt" -pt = "en-US,es,pt" +pl = "pl,de-DE,en-US,ru" +pt-BR = "pt,en-US,es" +pt = "pt,en-US,es" ro = "ro,en-US,de-DE,hu" -ru = "de-DE,en-US,ru" -sk = "en-US,sk" -sl = "en-US,sl" -sv = "de-DE,en-US,sv" +ru = "ru,de-DE,en-US" +sk = "sk,en-US" +sl = "sl,en-US" +sv = "sv,de-DE,en-US" sr = "sr,en-US" # ! Note the package 'sr' also holds the dictionaries for 'sh' ! sh = "sr,en-US" -sw = "en-US,sw" -th = "en-US,th" -vi = "en-US,fr,vi" -zh-TW = "en-US" -zh-CN = "en-US" -zu = "en-US,zu" +sw = "sw,en-US" +th = "th,en-US" +vi = "vi,en-US,fr" +zh-TW = "EMPTY,en-US" +zh-CN = "EMPTY,en-US" +zu = "zu,en-US" + -- cgit v1.2.3 From f20e966e2479610f155c8498c625693e365c9c48 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 27 Jan 2010 14:56:18 +0100 Subject: native0: #161561# changes for Oracle products --- setup_native/source/packinfo/packinfo_office.txt | 102 +++++++++++------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index d4ba6e1be452..ffbcb3da15a6 100755 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -287,7 +287,7 @@ packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-onlineupdate" requires = "%BASISPACKAGEPREFIX%OOOBASEVERSION-core01" copyright = "1999-2005 by Sun Microsystems" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Online update modul for OpenOffice.org %OOOBASEVERSION" destpath = "/opt" packageversion = "%OOOPACKAGEVERSION" @@ -485,7 +485,7 @@ requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BAS linuxpatchrequires = "" copyright = "1999-2008 by Sun Microsystems" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "OOo improvement extension for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -499,9 +499,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-af" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Af dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -531,9 +531,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-cs" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Cs dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -547,9 +547,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-da" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Da dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -611,9 +611,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-en" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "En dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -627,9 +627,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-es" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Es dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -643,9 +643,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-et" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Et dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -659,9 +659,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-fr" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Fr dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -675,9 +675,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-gl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Gl dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%OOOPACKAGEVERSION" @@ -691,9 +691,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-he" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "He dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -707,9 +707,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-hu" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Hu dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -723,9 +723,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-it" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "It dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -739,9 +739,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-lt" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Lt dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -755,9 +755,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ne" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Ne dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -771,9 +771,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-nl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Nl dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -803,9 +803,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Pl dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -819,9 +819,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pt" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Pt dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -851,9 +851,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ru" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Ru dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -867,9 +867,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sk" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Sk dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -883,9 +883,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Sl dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -901,7 +901,7 @@ requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BAS linuxpatchrequires = "" copyright = "1999-2007 by Sun Microsystems" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Sr dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -915,9 +915,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sv" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Sv dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -931,9 +931,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sw" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Sw dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -947,9 +947,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-th" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Th dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" @@ -963,9 +963,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-vi" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Vietnamese dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%OOOPACKAGEVERSION" @@ -979,9 +979,9 @@ solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOB packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-zu" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." +vendor = "Oracle, Inc." description = "Zu dictionary for %PRODUCTNAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" -- cgit v1.2.3 From 8bc916663d3e41bc00660e3829765d7276dbc675 Mon Sep 17 00:00:00 2001 From: Oliver Craemer Date: Fri, 29 Jan 2010 09:12:18 +0100 Subject: #i108733# Autotest for enhanced csv import --- testautomation/global/win/dial_t_z.win | 16 ---- testautomation/global/win/edia_d_h.win | 6 ++ testautomation/global/win/edia_t_z.win | 19 +++++ .../required/includes/c_upd_filemenu.inc | 93 ++++++++++++++++++++-- 4 files changed, 111 insertions(+), 23 deletions(-) diff --git a/testautomation/global/win/dial_t_z.win b/testautomation/global/win/dial_t_z.win index 5c52f92c1de4..fe45e267db72 100755 --- a/testautomation/global/win/dial_t_z.win +++ b/testautomation/global/win/dial_t_z.win @@ -108,22 +108,6 @@ Neu SW:EDIT:DLG_RENAME_GLOS:ED_NN KuerzelAlt SW:EDIT:DLG_RENAME_GLOS:ED_OS KuerzelNeu SW:EDIT:DLG_RENAME_GLOS:ED_NS -*TextImport SC:MODALDIALOG:RID_SCDLG_ASCII -AbZeile SC:NUMERICFIELD:RID_SCDLG_ASCII:NF_AT_ROW -Zeichensatz SC:LISTBOX:RID_SCDLG_ASCII:LB_CHARSET -FesteBreite SC:RADIOBUTTON:RID_SCDLG_ASCII:RB_FIXED -Getrennt SC:RADIOBUTTON:RID_SCDLG_ASCII:RB_SEPARATED -Tabulator SC:CHECKBOX:RID_SCDLG_ASCII:CKB_TAB -Semikolon SC:CHECKBOX:RID_SCDLG_ASCII:CKB_SEMICOLON -Komma SC:CHECKBOX:RID_SCDLG_ASCII:CKB_COMMA -Leerzeichen SC:CHECKBOX:RID_SCDLG_ASCII:CKB_SPACE -Andere SC:CHECKBOX:RID_SCDLG_ASCII:CKB_OTHER -AndereText SC:EDIT:RID_SCDLG_ASCII:ED_OTHER -Feldtrennerzusammen SC:CHECKBOX:RID_SCDLG_ASCII:CB_ASONCE -Texttrenner SC:COMBOBOX:RID_SCDLG_ASCII:CB_TEXTSEP -Typ SC:LISTBOX:RID_SCDLG_ASCII:LB_TYPE1 -Vorschau HID_SC_ASCII_TABCTR - *TextInTabelleUmwandeln FN_CONVERT_TEXT_TABLE sw:ModalDialog:DLG_CONV_TEXT_TABLE Tabulator sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_TAB Semikolon sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_SEMI diff --git a/testautomation/global/win/edia_d_h.win b/testautomation/global/win/edia_d_h.win index de1b69ab4429..de135a6ca137 100755 --- a/testautomation/global/win/edia_d_h.win +++ b/testautomation/global/win/edia_d_h.win @@ -467,3 +467,9 @@ Suggestion3 cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_3 Suggestion4 cui:Edit:RID_SVX_MDLG_HANGULHANJA_EDIT:ED_4 NewEntry cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_NEW DeleteEntry cui:PushButton:RID_SVX_MDLG_HANGULHANJA_EDIT:PB_HHE_DELETE + +*HTMLImportOptions sc:ModalDialog:RID_SCDLG_TEXT_IMPORT_OPTIONS +Automatic sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_AUTOMATIC +Custom sc:RadioButton:RID_SCDLG_TEXT_IMPORT_OPTIONS:RB_CUSTOM +CustomLanguage sc:ListBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:LB_CUSTOM_LANG +DetectSpecialNumbers sc:CheckBox:RID_SCDLG_TEXT_IMPORT_OPTIONS:BTN_CONVERT_DATE \ No newline at end of file diff --git a/testautomation/global/win/edia_t_z.win b/testautomation/global/win/edia_t_z.win index 67465a360f91..a53038e79394 100755 --- a/testautomation/global/win/edia_t_z.win +++ b/testautomation/global/win/edia_t_z.win @@ -128,6 +128,25 @@ RecentFile HID_XML_FILTER_TEST_IMPORT_RECENT FixedRecentFile HID_XML_FILTER_TEST_IMPORT_RECENT_FILE CloseBtn HID_XML_FILTER_TEST_CLOSE +*TextImport SC:MODALDIALOG:RID_SCDLG_ASCII +CharacterSet SC:LISTBOX:RID_SCDLG_ASCII:LB_CHARSET +Language sc:ListBox:RID_SCDLG_ASCII:LB_CUSTOMLANG +FromRow SC:NUMERICFIELD:RID_SCDLG_ASCII:NF_AT_ROW +FixedWidth SC:RADIOBUTTON:RID_SCDLG_ASCII:RB_FIXED +Separated SC:RADIOBUTTON:RID_SCDLG_ASCII:RB_SEPARATED +Tab SC:CHECKBOX:RID_SCDLG_ASCII:CKB_TAB +Semicolon SC:CHECKBOX:RID_SCDLG_ASCII:CKB_SEMICOLON +Comma SC:CHECKBOX:RID_SCDLG_ASCII:CKB_COMMA +SpaceCB SC:CHECKBOX:RID_SCDLG_ASCII:CKB_SPACE +Other SC:CHECKBOX:RID_SCDLG_ASCII:CKB_OTHER +OtherText SC:EDIT:RID_SCDLG_ASCII:ED_OTHER +MergeDelimiter SC:CHECKBOX:RID_SCDLG_ASCII:CB_ASONCE +TextDelimiter SC:COMBOBOX:RID_SCDLG_ASCII:CB_TEXTSEP +QuotedAsText sc:CheckBox:RID_SCDLG_ASCII:CB_QUOTED_AS_TEXT +DetectSpecialNumbers sc:CheckBox:RID_SCDLG_ASCII:CB_DETECT_SPECIAL_NUMBER +Type SC:LISTBOX:RID_SCDLG_ASCII:LB_TYPE1 +Preview HID_SC_ASCII_TABCTR + *UnsatisfiedDependencies desktop:ModalDialog:RID_DLG_DEPENDENCIES UnsatisfiedDependencyList desktop:ListBox:RID_DLG_DEPENDENCIES:RID_DLG_DEPENDENCIES_LIST diff --git a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc index a05f22ed9360..e84ef9d0567f 100755 --- a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc @@ -42,10 +42,11 @@ ' #1 tFileOpen ' #1 tFileOpenCSV ' #1 tFileOpenDBF +' #1 tFileOpenHTML ' #1 tFileRecentDocuments ' #1 tFileClose ' #1 tFileSave -' #0 tFileSaveAsDBF +' #1 tFileSaveAsDBF ' #1 tFileVersions ' #1 tFilePagePreview ' #1 tFilePrint @@ -61,6 +62,7 @@ sub c_upd_filemenu Call tFileOpen Call tFileOpenCSV Call tFileOpenDBF + Call tFileOpenHTML Call tFileRecentDocuments Call tFileClose Call tFileSave @@ -176,20 +178,15 @@ testcase tFileOpenCSV dim sTestFile as string sTestFile = convertpath(gTesttoolPath & "spreadsheet/required/input/tFileOpen_CSV.csv" - '/// Opening new spreadsheet document for getting defined starting environment Printlog " Opening new spreadsheet document for getting defined starting environment" Call hNewDocument - '/// Open File-Open-dialog Printlog " Open File-Open-dialog" FileOpen Kontext "OeffnenDlg" - '/// Enter filename spreadsheet/required/input/tFileOpen_CSV.csv Printlog " Enter filename spreadsheet/required/input/tFileOpen_CSV.csv" Dateiname.settext (sTestFile) - '/// Click on Open Printlog " Click on Open" Oeffnen.Click - '/// Check existence of CSV import dialog Printlog " Check existence of CSV import dialog" Kontext "TextImport" if Not TextImport.exists(2) then @@ -220,10 +217,36 @@ testcase tFileOpenCSV end if end if Call Dialogtest (TextImport) + Kontext "TextImport" + Printlog " Use every control" + CharacterSet.GetItemCount + Language.GetItemCount + FromRow.More + FixedWidth.Check + Separated.Check + Tab.Check + Semicolon.Check + Comma.Check + SpaceCB.Check + Other.Check + OtherText.SetText "a" + MergeDelimiter.Check + TextDelimiter.GetItemCount + QuotedAsText.Check + DetectSpecialNumbers.Check + Printlog " Cancel Text Import dialog" + TextImport.cancel + Printlog " Open File-Open-dialog" + FileOpen + Kontext "OeffnenDlg" + Printlog " Enter filename spreadsheet/required/input/tFileOpen_CSV.csv" + Dateiname.settext (sTestFile) + Printlog " Click on Open" + Oeffnen.Click + Kontext "TextImport" TextImport.ok Printlog " - CSV import dialog is in function" Kontext "DocumentCalc" - '/// Close document printlog " Close document" Call hCloseDocument @@ -280,6 +303,62 @@ endcase '----------------------------------------------------------- +testcase tFileOpenHTML + + Dim sTestFile as string + Dim sTestFilter1 as string + Dim sTestFilter2 as string + + sTestFile = convertpath(gTesttoolPath & "spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html" + sTestFilter1 = hGetUIFiltername ("HTML (StarCalc)") + sTestFilter2 = hGetUIFiltername ("calc_HTML_WebQuery") + + Printlog " Opening new spreadsheet document for getting defined starting environment" + Call hNewDocument + Printlog " Open File-Open-dialog" + FileOpen + Kontext "OeffnenDlg" + Printlog " Enter filename spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html" + Dateiname.settext (sTestFile) + Printlog " Choose Calc HTML filter" + Call hSelectUIFilter (sTestFilter1) + Printlog " Click on Open" + Oeffnen.Click + sleep (1) + Kontext "HTMLImportOptions" + Printlog " Use every control on dialog Import Options" + Custom.Check + CustomLanguage.GetItemCount + Automatic.Check + DetectSpecialNumbers.Check + HTMLImportOptions.OK + Printlog " Close recent document" + Call hCloseDocument + Printlog " Retry with Calc Web Querry filter" + Printlog " Open File-Open-dialog" + FileOpen + Kontext "OeffnenDlg" + Printlog " Enter filename spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html" + Dateiname.settext (sTestFile) + Printlog " Choose Calc Web Query filter" + Call hSelectUIFilter (sTestFilter2) + Printlog " Click on Open" + Oeffnen.Click + sleep (1) + Kontext "HTMLImportOptions" + Printlog " Use every control on dialog Import Options" + Custom.Check + CustomLanguage.GetItemCount + Automatic.Check + DetectSpecialNumbers.Check + HTMLImportOptions.OK + Printlog " Close recent document" + Call hCloseDocument + +endcase + +'----------------------------------------------------------- + testcase tFileRecentDocuments dim sTestFile as string -- cgit v1.2.3 From 5b1016bf0ec38c25b016669ee20645b207db85cd Mon Sep 17 00:00:00 2001 From: Oliver Craemer Date: Fri, 29 Jan 2010 10:37:07 +0100 Subject: #i108733# Autotest for enhanced csv import --- .../input/HTML_Doc_Numberformats_in_table.html | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 testautomation/spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html diff --git a/testautomation/spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html b/testautomation/spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html new file mode 100644 index 000000000000..364e8bb812e6 --- /dev/null +++ b/testautomation/spreadsheet/required/input/HTML_Doc_Numberformats_in_table.html @@ -0,0 +1,107 @@ + + + + + + + + + + +

HTML Document for testing Import compatibility of HTML and RTF + clipboard content and also the Link to external Data and/or Insert + Sheet from File.

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Number english

+
+

Number German

+
+

1.1

+
+

1,2

+
+

1.12

+
+

1,12

+
+

3.45

+
+

3,45

+
+

13.12

+
+

13,12

+
+

1,234.45

+
+

1.234,45

+
+

123,456,789.66

+
+

123.456.789,66

+
+

1.000

+
+

1,000

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+ + -- cgit v1.2.3 From 6f013a4859726d7665a3b212108596aca1789b62 Mon Sep 17 00:00:00 2001 From: tb121644 Date: Thu, 4 Feb 2010 15:33:15 +0100 Subject: #i108832# guessing culprint --- testautomation/global/system/includes/status.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testautomation/global/system/includes/status.inc b/testautomation/global/system/includes/status.inc index 32899a4d39bb..c5d512b729d9 100755 --- a/testautomation/global/system/includes/status.inc +++ b/testautomation/global/system/includes/status.inc @@ -422,7 +422,7 @@ gTestName="" '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! wend bError = True if (i = 18) then ' big database error; resultfile wasn't created - warnlog "Status Write Error! (TimeOut waiting for webservice result)" +chr(13)+ "Email is send to: " + gReturnAddress + warnlog "Status Write Error! (TimeOut waiting for webservice result)" else ListRead(glsStatusPage(), sOutFileTemp) '3 i = ListCount(glsStatusPage()) -- cgit v1.2.3 From 220073a41a5bc68e84aaf19124ef487ab361a31b Mon Sep 17 00:00:00 2001 From: ms93807 Date: Fri, 5 Feb 2010 08:39:58 +0100 Subject: dba33e: #108973# refactor and code cleanup --- .../dbaccess/optional/includes/ctrl_General.inc | 2 +- .../dbaccess/optional/includes/db_JDBCMySQL.inc | 122 +- .../dbaccess/optional/includes/frm_FormFilter.inc | 4 +- .../optional/includes/wiz_DatabaseWizard.inc | 71 + .../dbaccess/required/includes/DatabaseTypes.inc | 1507 ++++++++++---------- testautomation/dbaccess/tools/dbcreatetools.inc | 66 +- testautomation/dbaccess/tools/dbtools.inc | 60 +- 7 files changed, 999 insertions(+), 833 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/ctrl_General.inc b/testautomation/dbaccess/optional/includes/ctrl_General.inc index 80fc173652b2..af63b06545bd 100755 --- a/testautomation/dbaccess/optional/includes/ctrl_General.inc +++ b/testautomation/dbaccess/optional/includes/ctrl_General.inc @@ -1031,7 +1031,7 @@ testcase tAddFields Liste.TypeKeys "" , 4, true sControlName2 = Liste.getSelText if sControlName1 <> sControlName2 then - qaerrorlog "#i98316# The control name is not the same as the fieldname." + warnlog "The control name is not the same as the fieldname. controlname = " + sControlName2 + " fieldname = " + sControlName1 endif sleep (2) diff --git a/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc b/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc index b2571dfd64ac..d5db37e4f527 100755 --- a/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc +++ b/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc @@ -42,27 +42,44 @@ testcase db_JDBCMySQL ' databases specific settings for JDBC MySQL ' ************************************************** - qaerrorlog "due to issue 98387 this test will not work anymore." - goto endsub - - Dim sFileName as string + dim sDBConfigFile as string + + sDBConfigFile = environ ( "VTT_DB_CONFIG_FILE" ) + + printlog sDBConfigFile + + if (sDBConfigFile = "") then + qaerrorlog "settings for external databases not found. see wiki page. This test ist stopped now" + goto endsub + else + if Dir( sDBConfigFile ) = "" then ' the file does not exists + qaerrorlog "settings for external databases not found. see wiki page. This test ist stopped now" + else + ' file exists , so we can do th next step + endif + + endif + + + + Dim sFileName as string sFileName = gOfficePath + Convertpath("user/work/TT_JDBC-MYSQL.odb") - - Dim sTableName as string - sTableName = "tt_test_create-table" - - Dim sUser as string - sUser = "testtool" - - Dim sPWD as string - sPWD = "testtool" - - dim sCatalog as string - sCatalog = " " ' not used in this ds - - dim sSchema as string - sSchema = " " ' not used in this ds - + + Dim sTableName as string + sTableName = "tt_test_create-table" + + Dim sUser as string + sUser = "testtool" + + Dim sPWD as string + sPWD = "testtool" + + dim sCatalog as string + sCatalog = " " ' not used in this ds + + dim sSchema as string + sSchema = " " ' not used in this ds + Dim aFieldTypeContent(30,2) as string 'database specific data matrix aFieldTypeContent(1,1)="tt_bool" @@ -162,39 +179,38 @@ testcase db_JDBCMySQL aFieldContent(1,4)="1" aFieldContent(1,5)="1" aFieldContent(1,6)="1" - - call fSetJDBCDriverFiles(gTesttoolPath + Convertpath("dbaccess/optional/input/driver/mysql_jconnector.jar")) - 'after changing the classpath the office has to be restarted. - call ExitRestartTheOffice - dim dbok as boolean - dbok = false - - dim aDatabaseProperties(5) as string - aDatabaseProperties() = tools_dbtools_fgetMySQLJDBCDatabaseProperties() - - ' if and only if no properties are defined in the environment file the test is stopped - if(aDatabaseProperties(1) = "no") then - qaerrorlog "No database properties from Mysql defiened. The Test is stopped here." - goto endsub - endif - - dbok = fCreateMySQL_JDBC_Datasource(sFileName,aDatabaseProperties(3),aDatabaseProperties(2),aDatabaseProperties(4),aDatabaseProperties(5)) - if dbok = true then - - call fOpendatabase(sFileName,aDatabaseProperties(6)) - call fCreateTable( aFieldTypeContent(), sTableName) - call fInsertIntoTable( aFieldContent(), sTableName) - call fCloseDatabase - - 'use "dbaccess/optional/includes/b_lvl1_Query.inc" - 'call b_lvl1_Query(sFileName,"dbase") - - call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" ) - - else - warnlog "Data Source could not be created - beyond testcases stopped" - endif - + dim aDatabaseProperties(7) as string + aDatabaseProperties() = tools_dbtools_fgetMySQLJDBCDatabaseProperties(sDBConfigFile) + + call fSetJDBCDriverFiles(aDatabaseProperties(7)) + 'after changing the classpath the office has to be restarted. + call ExitRestartTheOffice + + dim dbok as boolean + dbok = false + + ' if and only if no properties are defined in the environment file the test is stopped + if(aDatabaseProperties(1) = "no") then + qaerrorlog "No database properties from Mysql defiened. The Test is stopped here." + goto endsub + endif + + dbok = fCreateMySQL_JDBC_Datasource(sFileName,aDatabaseProperties(3),aDatabaseProperties(2),aDatabaseProperties(4),aDatabaseProperties(5)) + if dbok = true then + call fOpendatabase(sFileName,aDatabaseProperties(6)) + call fCreateTable( aFieldTypeContent(), sTableName) + call fInsertIntoTable( aFieldContent(), sTableName) + call fCloseDatabase + + 'use "dbaccess/optional/includes/b_lvl1_Query.inc" + 'call b_lvl1_Query(sFileName,"dbase") + + 'call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" ) + + else + warnlog "Data Source could not be created - beyond testcases stopped" + endif + endcase diff --git a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc index 243e186c209d..2fd7efa31b8c 100755 --- a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc +++ b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc @@ -72,7 +72,7 @@ testcase tLoadForm printlog "execute the form filter" FM_FF_Execute wait(1000) - qaerrorlog "workarounf issue 102010" + printlog "workaround issue 102010" DocumentWriter.TypeKeys "" , true sleep(1) DocumentWriter.TypeKeys "" , true @@ -105,7 +105,7 @@ testcase tLoadForm FM_FF_Execute wait(1000) - qaerrorlog "workarounf issue 102010" + printlog "workaround issue 102010" DocumentWriter.TypeKeys "" , true sleep(1) DocumentWriter.TypeKeys "" , true diff --git a/testautomation/dbaccess/optional/includes/wiz_DatabaseWizard.inc b/testautomation/dbaccess/optional/includes/wiz_DatabaseWizard.inc index 98771d2340ea..f379f2b35e26 100755 --- a/testautomation/dbaccess/optional/includes/wiz_DatabaseWizard.inc +++ b/testautomation/dbaccess/optional/includes/wiz_DatabaseWizard.inc @@ -40,6 +40,7 @@ sub wiz_DatabaseWizard call tNewDatabase call tOpenDatabase call tOpenNoneDatabaseDocument + call tStartTableWizardFromWizard call tODBC call tEvolution call tMozilla @@ -312,3 +313,73 @@ testcase tOracleJDBC qaerrorlog "not yet implemented" endcase '------------------------------------------------------------------------- +testcase tStartTableWizardFromWizard + + printlog "start database wizard via FILE / NEW / DATABASE" + Kontext "DocumentWriter" + if (DocumentWriter.exists(1)) then + DocumentWriter.UseMenu + else + Kontext "DocumentBackground" + DocumentBackground.UseMenu + endif + hMenuSelectNr(1) + hMenuSelectNr(1) + hMenuSelectNr(5) + + sleep(10) + + Kontext "DatabaseWizard" + printlog "check create new database" + CreateNewDatabase.Check + sleep(1) + printlog "click next button" + NextBtn.Click + sleep(1) + printlog "check the 'Create Table with wizard' option" + StartTableWizard.check() + printlog "click finished button" + FinishBtn.Click + sleep(1) + + Kontext "SpeichernDlg" + printlog "click save in the save as dialog" + if ( Dateiname.getSelText() = "" ) then + warnlog "#i58413# Default filename is missing" + Dim sFileName as String + sFileName = ConvertPath(gOfficePath + "user/work/TTDB1.odb") + if ( app.Dir( ConvertPath(sFileName) ) ) <> "" then + app.kill(ConvertPath(sFileName)) + endif + Dateiname.setText(sFileName) + endif + Speichern.click + sleep(10) + + Kontext "MessageBox" + if MessageBox.exists then + MessageBox.yes + end if + + sleep(5) + + Kontext "TableWizard" + printlog "check if the table wizard appear" + if( TableWizard.exists(10) ) then + printlog "the table wizard appear." + CancelBtn.click() + else + warnlog "the table wizard does not appear." + endif + + Kontext "ContainerView" + + ViewTables + + sleep(1) + + printlog "close the database" + call fCloseDatabase(true) + +endcase +'------------------------------------------------------------------------- diff --git a/testautomation/dbaccess/required/includes/DatabaseTypes.inc b/testautomation/dbaccess/required/includes/DatabaseTypes.inc index 2c2178f1c6ee..22dd347b2bea 100755 --- a/testautomation/dbaccess/required/includes/DatabaseTypes.inc +++ b/testautomation/dbaccess/required/includes/DatabaseTypes.inc @@ -1,747 +1,760 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -'* -'* Copyright 2008 by Sun Microsystems, Inc. -'* -'* OpenOffice.org - a multi-platform office productivity suite -'* -'* $RCSfile: DatabaseTypes.inc,v $ -'* -'* $Revision: 1.1 $ -'* -'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ -'* -'* This file is part of OpenOffice.org. -'* -'* OpenOffice.org is free software: you can redistribute it and/or modify -'* it under the terms of the GNU Lesser General Public License version 3 -'* only, as published by the Free Software Foundation. -'* -'* OpenOffice.org is distributed in the hope that it will be useful, -'* but WITHOUT ANY WARRANTY; without even the implied warranty of -'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'* GNU Lesser General Public License version 3 for more details -'* (a copy is included in the LICENSE file that accompanied this code). -'* -'* You should have received a copy of the GNU Lesser General Public License -'* version 3 along with OpenOffice.org. If not, see -'* -'* for a copy of the LGPLv3 License. -'* -'/************************************************************************ -'* -'* owner : marc.neumann@sun.com -'* -'* short description : test the database types -'* -'************************************************************************ -'* -' #1 tMySQLODBCProperties -' #1 tMySQLJDBCProperties -' #1 tAdabasProperties -' #1 tOracleJDBCProperties -' #1 tJDBCProperties -' #1 tODBCProperties -' #1 tdBaseProperties -' #1 tTextProperties -' #1 tSpreadsheetProperties -' #1 tMozillaProperties -' #1 tLDAPProperties -' #1 tEvolutionProperties -' #1 tCheckHSQLDB -'* -'\*********************************************************************************** -sub DatabaseTypes - - printlog "------------------ DatabaseTypes.inc ---------------------" - - call tMySQLODBCProperties - call tMySQLJDBCProperties - call tAdabasProperties - call tOracleJDBCProperties - call tJDBCProperties - call tODBCProperties - call tdBaseProperties - call tTextProperties - call tSpreadsheetProperties - call tMozillaProperties - call tLDAPProperties - call tEvolutionProperties - call tCheckHSQLDB - -end sub -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -testcase tMySQLODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLODBC" - '/// check the MySQLODBC page - call fCheckTabPage(TabMySQLODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMySQLJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLJDBC" - '/// check the MySQLJDBC page - call fCheckTabPage(TabMySQLJDBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLJDBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tAdabasProperties - - if gPlatform = "x86" then - printlog "Adabas is not available under x86." - goto endsub - end if - - if gPlatform = "osx" then - printlog "Adabas doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - sleep(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Adabas") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabAdabas" - '/// check the Adabas page - call fCheckTabPage(TabAdabas) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("Adabas") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tOracleJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("OracleJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabOracleJDBC" - '/// check the TabOracleJDBC page - call fCheckTabPage(TabOracleJDBC) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("JDBC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tLDAPProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("LDAP") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabLDAP" - '/// check the LDAP page - call fChecktabPage(TabLDAP) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tEvolutionProperties - - if gPlatform <> "lin" then - printlog "Evolution does only exists under linux." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - try - if ( DatabaseType.getItemCount() > 12 ) then - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) - Kontext "ConnectionType" - ConnectionType.OK - else - qaerrorlog "Evolution does not appear to be available on this system" - Kontext "ConnectionType" - ConnectionType.Cancel - endif - catch - warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" - TabGeneral.Cancel - call fCloseDatabase - goto endsub - endcatch - - 'call fCheckAdvancedDialog("Evolution") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMozillaProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) - - 'add sleep to give OOo time to react - sleep(2) - - Kontext "ConnectionType" - ConnectionType.OK - - 'call fCheckAdvancedDialog("Mozilla") - - 'add sleep to give OOo time to react - sleep(2) - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tSpreadsheetProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("CALC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - 'call fCheckAdvancedDialog("CALC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tTextProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Text") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabTextBase" - '/// check the Text page - call fCheckTabPage(TabTextBase) - - Kontext "ConnectionType" - ConnectionType.ok - - call fCheckAdvancedDialog("Text") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tdBaseProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("dBase") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabdBase" - '/// check the dBase page - call fCheckTabPage(TabdBase) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("dBase") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("ODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabODBC" - '/// check the ODBC page - call fCheckTabPage(TabODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("ODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tCheckHSQLDB - - Dim sDatasourceFileName as String - sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") - call fCreateHSQLDatasource(sDatasourceFileName) - - call fOpenDatabase(sDatasourceFileName) - - Kontext "ContainerView" - ViewTables - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -function fCheckAdvancedDialog(sType as string) - - printlog "+Check the Advanced Settings for the datasource type " + sType - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(3) - - Kontext "Advanced" - - if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then - TabControl.setPage AdvancedSettingsSpecial - call fcheckControl(SQL92Check) - call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - TabControl.setPage TabGeneratedValues - call fcheckControl(RetrieveGeneratedValues) - call fcheckControl(AutoIncrementStatement) - call fcheckControl(QueryGeneratedValues) - - elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then - - 'call fcheckControl(SQL92Check) - 'call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - 'call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - 'call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - - elseif sType = "dBase" OR sType = "Text" then - call fcheckControl(SQL92Check) - 'call fcheckControl(BooleanComparison) - 'call fcheckControl(AppendAlias) - - elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then - ' call fcheckControl(BooleanComparison) - ' call fcheckControl(AppendAlias) - - elseif sType = "Adabas" then - call fcheckControl(AppendAlias) - call fcheckControl(BooleanComparison) - call fcheckControl(SQL92Check) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(CheckRequiredFields) - else - qaerrorlog "unknown database type" - end if - - Kontext "Advanced" - Advanced.Cancel - -end function -'------------------------------------------------------------------------- -function fcheckControl(oControl as object) - - if oControl.exists() then - printlog "|The control " + oControl.Name + " exists." - else - warnlog "|The control " + oControl.Name + " doesn't exists." - end if - -end function -'------------------------------------------------------------------------- -function fCheckConnectionTabPage(sType as string) - - printlog "+check the connection page for the datasource type " + sType - - Kontext "TabConnection" - - call DialogTest(TabConnection) - - if sType = "MySQLODBC" then - call fcheckControl(MySQLODBCDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "MySQLJDBC" then - call fcheckControl(MySQLJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "Adabas" then - call fcheckControl(AdabasDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "OracleJDBC" then - call fcheckControl(OracleJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "JDBC" then - call fcheckControl(ConnectUrl) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - call fcheckControl(TestDriver) - call fcheckControl(JDBCDriverClass) - - elseif sType = "ODBC" then - call fcheckControl(OdbcDatasourceName) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "dBase" then - call fcheckControl(dBasePath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "CALC" then - call fcheckControl(SpreadsheetPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "Text" then - call fcheckControl(TextPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "LDAP" then - call fcheckControl(HostName) - call fcheckControl(TestConnection) - - elseif sType = "Mozilla" OR sType = "Evolution" then - call fcheckControl(TestConnection) - end if - -end function -'------------------------------------------------------------------------- -function fCheckTabPage(oType as object) - - printlog "+check the " + oType.Name + " page." - Kontext oType.Name - - call DialogTest(oType) - - if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(PortNumber) - call fcheckControl(DriverClass) - call fcheckControl(TestClass) - - elseif oType.Name = "TabAdabas" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(CacheSize) - call fcheckControl(DataIncrement) - call fcheckControl(CotrolUser) - call fcheckControl(ControlPassword) - call fcheckControl(ShutdownService) - call fcheckControl(Extended) - - elseif oType.Name = "TabODBC" then - call fcheckControl(UseCatalogs) - call fcheckControl(Options) - call fcheckControl(CharSet) - - elseif oType.Name = "TabdBase" then - call fcheckControl(CharSet) - call fcheckControl(DisplayInactiveRecords) - call fcheckControl(Indexes) - - elseif ( oType.Name = "TabLDAP" ) then - call fcheckControl(BaseDN) - call fcheckControl(PortNumber) - call fcheckControl(Records) - - elseif ( oType.Name = "TabTextBase" ) then - call fcheckControl(TextContainsHeaders) - call fcheckControl(FieldSeparator) - call fcheckControl(TextSeparator) - call fcheckControl(DecimalSeparator) - call fcheckControl(ThousandsSeparator) - call fcheckControl(PlainTextFiles) - call fcheckControl(CVSFiles) - call fcheckControl(Custom) - call fcheckControl(CustomTxt) - call fcheckControl(CharSet) - end if - -end function +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: DatabaseTypes.inc,v $ +'* +'* $Revision: 1.1 $ +'* +'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ +'* +'* This file is part of OpenOffice.org. +'* +'* OpenOffice.org is free software: you can redistribute it and/or modify +'* it under the terms of the GNU Lesser General Public License version 3 +'* only, as published by the Free Software Foundation. +'* +'* OpenOffice.org is distributed in the hope that it will be useful, +'* but WITHOUT ANY WARRANTY; without even the implied warranty of +'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +'* GNU Lesser General Public License version 3 for more details +'* (a copy is included in the LICENSE file that accompanied this code). +'* +'* You should have received a copy of the GNU Lesser General Public License +'* version 3 along with OpenOffice.org. If not, see +'* +'* for a copy of the LGPLv3 License. +'* +'/************************************************************************ +'* +'* owner : marc.neumann@sun.com +'* +'* short description : test the database types +'* +'************************************************************************ +'* +' #1 tMySQLODBCProperties +' #1 tMySQLJDBCProperties +' #1 tAdabasProperties +' #1 tOracleJDBCProperties +' #1 tJDBCProperties +' #1 tODBCProperties +' #1 tdBaseProperties +' #1 tTextProperties +' #1 tSpreadsheetProperties +' #1 tMozillaProperties +' #1 tLDAPProperties +' #1 tEvolutionProperties +' #1 tCheckHSQLDB +'* +'\*********************************************************************************** +sub DatabaseTypes + + printlog "------------------ DatabaseTypes.inc ---------------------" + + ' call tMySQLODBCProperties + ' call tMySQLJDBCProperties + 'call tAdabasProperties + 'call tOracleJDBCProperties + 'call tJDBCProperties + 'call tODBCProperties + 'call tdBaseProperties + 'call tTextProperties + 'call tSpreadsheetProperties + call tMozillaProperties + call tLDAPProperties + call tEvolutionProperties + call tCheckHSQLDB + +end sub +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +testcase tMySQLODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLODBC" + '/// check the MySQLODBC page + call fCheckTabPage(TabMySQLODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMySQLJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLJDBC" + '/// check the MySQLJDBC page + call fCheckTabPage(TabMySQLJDBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLJDBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tAdabasProperties + + if gPlatform = "x86" then + printlog "Adabas is not available under x86." + goto endsub + end if + + if gPlatform = "osx" then + printlog "Adabas doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + sleep(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Adabas") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabAdabas" + '/// check the Adabas page + call fCheckTabPage(TabAdabas) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("Adabas") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tOracleJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("OracleJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabOracleJDBC" + '/// check the TabOracleJDBC page + call fCheckTabPage(TabOracleJDBC) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("JDBC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tLDAPProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("LDAP") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabLDAP" + '/// check the LDAP page + call fChecktabPage(TabLDAP) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tEvolutionProperties + + if gPlatform <> "lin" then + printlog "Evolution does only exists under linux." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:evolution:ldap")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Evolution does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + 'call fCheckAdvancedDialog("Evolution") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMozillaProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:mozilla:")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Mozilla does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Mozilla - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + + 'add sleep to give OOo time to react + sleep(2) + + 'call fCheckAdvancedDialog("Mozilla") + + 'add sleep to give OOo time to react + sleep(2) + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tSpreadsheetProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("CALC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + 'call fCheckAdvancedDialog("CALC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tTextProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Text") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabTextBase" + '/// check the Text page + call fCheckTabPage(TabTextBase) + + Kontext "ConnectionType" + ConnectionType.ok + + call fCheckAdvancedDialog("Text") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tdBaseProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("dBase") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabdBase" + '/// check the dBase page + call fCheckTabPage(TabdBase) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("dBase") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("ODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabODBC" + '/// check the ODBC page + call fCheckTabPage(TabODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("ODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tCheckHSQLDB + + Dim sDatasourceFileName as String + sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") + call fCreateHSQLDatasource(sDatasourceFileName) + + call fOpenDatabase(sDatasourceFileName) + + Kontext "ContainerView" + ViewTables + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +function fCheckAdvancedDialog(sType as string) + + printlog "+Check the Advanced Settings for the datasource type " + sType + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(3) + + Kontext "Advanced" + + if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then + TabControl.setPage AdvancedSettingsSpecial + call fcheckControl(SQL92Check) + call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + TabControl.setPage TabGeneratedValues + call fcheckControl(RetrieveGeneratedValues) + call fcheckControl(AutoIncrementStatement) + call fcheckControl(QueryGeneratedValues) + + elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then + + 'call fcheckControl(SQL92Check) + 'call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + 'call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + 'call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + + elseif sType = "dBase" OR sType = "Text" then + call fcheckControl(SQL92Check) + 'call fcheckControl(BooleanComparison) + 'call fcheckControl(AppendAlias) + + elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then + ' call fcheckControl(BooleanComparison) + ' call fcheckControl(AppendAlias) + + elseif sType = "Adabas" then + call fcheckControl(AppendAlias) + call fcheckControl(BooleanComparison) + call fcheckControl(SQL92Check) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(CheckRequiredFields) + else + qaerrorlog "unknown database type" + end if + + Kontext "Advanced" + Advanced.Cancel + +end function +'------------------------------------------------------------------------- +function fcheckControl(oControl as object) + + if oControl.exists() then + printlog "|The control " + oControl.Name + " exists." + else + warnlog "|The control " + oControl.Name + " doesn't exists." + end if + +end function +'------------------------------------------------------------------------- +function fCheckConnectionTabPage(sType as string) + + printlog "+check the connection page for the datasource type " + sType + + Kontext "TabConnection" + + call DialogTest(TabConnection) + + if sType = "MySQLODBC" then + call fcheckControl(MySQLODBCDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "MySQLJDBC" then + call fcheckControl(MySQLJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "Adabas" then + call fcheckControl(AdabasDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "OracleJDBC" then + call fcheckControl(OracleJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "JDBC" then + call fcheckControl(ConnectUrl) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + call fcheckControl(TestDriver) + call fcheckControl(JDBCDriverClass) + + elseif sType = "ODBC" then + call fcheckControl(OdbcDatasourceName) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "dBase" then + call fcheckControl(dBasePath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "CALC" then + call fcheckControl(SpreadsheetPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "Text" then + call fcheckControl(TextPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "LDAP" then + call fcheckControl(HostName) + call fcheckControl(TestConnection) + + elseif sType = "Mozilla" OR sType = "Evolution" then + call fcheckControl(TestConnection) + end if + +end function +'------------------------------------------------------------------------- +function fCheckTabPage(oType as object) + + printlog "+check the " + oType.Name + " page." + Kontext oType.Name + + call DialogTest(oType) + + if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(PortNumber) + call fcheckControl(DriverClass) + call fcheckControl(TestClass) + + elseif oType.Name = "TabAdabas" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(CacheSize) + call fcheckControl(DataIncrement) + call fcheckControl(CotrolUser) + call fcheckControl(ControlPassword) + call fcheckControl(ShutdownService) + call fcheckControl(Extended) + + elseif oType.Name = "TabODBC" then + call fcheckControl(UseCatalogs) + call fcheckControl(Options) + call fcheckControl(CharSet) + + elseif oType.Name = "TabdBase" then + call fcheckControl(CharSet) + call fcheckControl(DisplayInactiveRecords) + call fcheckControl(Indexes) + + elseif ( oType.Name = "TabLDAP" ) then + call fcheckControl(BaseDN) + call fcheckControl(PortNumber) + call fcheckControl(Records) + + elseif ( oType.Name = "TabTextBase" ) then + call fcheckControl(TextContainsHeaders) + call fcheckControl(FieldSeparator) + call fcheckControl(TextSeparator) + call fcheckControl(DecimalSeparator) + call fcheckControl(ThousandsSeparator) + call fcheckControl(PlainTextFiles) + call fcheckControl(CVSFiles) + call fcheckControl(Custom) + call fcheckControl(CustomTxt) + call fcheckControl(CharSet) + end if + +end function diff --git a/testautomation/dbaccess/tools/dbcreatetools.inc b/testautomation/dbaccess/tools/dbcreatetools.inc index f3d5abd6c944..6e4670966927 100755 --- a/testautomation/dbaccess/tools/dbcreatetools.inc +++ b/testautomation/dbaccess/tools/dbcreatetools.inc @@ -58,6 +58,9 @@ ' #1 getIdForDatabaseType '* '\*********************************************************************************** + +private const VERBOSE = true + function fCreateMySQL_ODBC_Datasource(sFileName, sOdbcDSN, sUser,optional sRegister) as boolean '/// create a new MySQL database via ODBC file with the given filename '///+ and the given URL @@ -159,7 +162,9 @@ function fCreateMySQL_JDBC_Datasource(sFileName,sDatabaseName,sHost,sPort,sUser, '/// sUser: the user for the connection '/// optional sRegister: the name under which the database is be registered dim bOK as boolean - bOK = FALSE + bOK = FALSE + + dim sEntry as string ' delete the file if ( app.Dir( ConvertPath(sFileName) ) ) <> "" then @@ -181,8 +186,12 @@ function fCreateMySQL_JDBC_Datasource(sFileName,sDatabaseName,sHost,sPort,sUser, Kontext "DatabaseWizard" ConnectToDatabase.Check - sleep(1) - DatabaseType.select( hGetDatabaseDisplayName( "sdbc:mysql:jdbc:*" ) ) + sleep(1) + sEntry = hGetDatabaseDisplayName( "sdbc:mysql:jdbc:*" ) + 'cut off the (JDBC) string + sEntry = Mid( sEntry , 1, len(sEntry) - Instr(sEntry,"(") ) + printlog "entry = " + sEntry + DatabaseType.select( sEntry ) sleep(1) NextBtn.Click sleep(1) @@ -203,8 +212,8 @@ function fCreateMySQL_JDBC_Datasource(sFileName,sDatabaseName,sHost,sPort,sUser, '/// check the password required checkbox printlog "check the password required checkbox" PasswordRequired.Check - - Kontext "DatabaseWizard" + + NextBtn.Click FinishBtn.Click Kontext "SpeichernDlg" @@ -1460,13 +1469,12 @@ function fSetJDBCDriverFiles(sClassPath) as boolean end function '------------------------------------------------------------------------- -private const VERBOSE = false function hGetInstalledDatabaseDrivers( dbDriverList() as string ) as integer ' This function returns the number of currently installed database drivers. ' Additionally it fills a given list (which should be large enough to hold - ' the names of all installed drivers) with the names and makes the list + ' the names of all installed drivers) with the url and makes the list ' compatible to the listfunctions (which places the list size in element 0) ' The list is platform dependent and might be locale dependent ' Note that some drivers (like e.g. HSQL Database Engine) do *not* show up @@ -1480,7 +1488,7 @@ function hGetInstalledDatabaseDrivers( dbDriverList() as string ) as integer dim iCurrentDriver as integer dim iDriverCount as integer - const CFN = "global::tools::includes::optional::t_database.inc::hGetInstalledDatabaseDrivers(): " + const CFN = "dbaccess::tools::dbcreatetools.inc::hGetInstalledDatabaseDrivers(): " ' Path to the node, searches all files below "Drivers" for "Installed" aPropertyValue( 0 ).Name = "nodepath" @@ -1499,11 +1507,11 @@ function hGetInstalledDatabaseDrivers( dbDriverList() as string ) as integer ' Get access xViewRoot = oUnoConfigurationAccess.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aPropertyValue() ) aElements() = xViewRoot.getElementNames() - + iDriverCount = ubound( aElements() ) dbDriverList( 0 ) = iDriverCount for iCurrentDriver = 1 to iDriverCount - dbDriverList( iCurrentDriver ) = xViewRoot.getByName( aElements( iCurrentDriver ) ).getByName( "DriverTypeDisplayName" ) + dbDriverList( iCurrentDriver ) = aElements( iCurrentDriver ) next iCurrentDriver endif @@ -1511,11 +1519,12 @@ function hGetInstalledDatabaseDrivers( dbDriverList() as string ) as integer if ( VERBOSE ) then printlog( CFN & "Returning " & iDriverCount & " drivers" ) endif + hGetInstalledDatabaseDrivers() = iDriverCount end function -'******************************************************************************* +'------------------------------------------------------------------------- function hGetDatabaseDisplayName( dbDriverURL as string ) as string @@ -1557,7 +1566,7 @@ function hGetDatabaseDisplayName( dbDriverURL as string ) as string dim oDriver as object dim sDatabaseName as string - const CFN = "global::tools::includes::optional::t_database.inc::hGetDatabaseDisplayName(): " + const CFN = "dbaccess::tools::dbcreatetools.inc::hGetDatabaseDisplayName(): " ' Path to the node, searches all files below "Drivers" for "Installed" aPropertyValue( 0 ).Name = "nodepath" @@ -1591,4 +1600,37 @@ function hGetDatabaseDisplayName( dbDriverURL as string ) as string hGetDataBaseDisplayName() = sDatabaseName end function +'------------------------------------------------------------------------- +function isDriverInstalled( dbDriverURL as string ) as string + + ' This function return true or false if a driver for a given URL is installed + + Dim myDriverList(20) as string + Dim i as integer + Dim sDriver as string + Dim breturn as boolean + breturn = false + + const CFN = "dbaccess::tools::dbcreatetools.inc::isDriverInstalled(): " + + if VERBOSE then + printlog CFN + printlog "url to search for : " + dbDriverURL + endif + + hGetInstalledDatabaseDrivers( myDriverList() ) + + for i = 1 to ubound(myDriverList) + sDriver = myDriverList(i) + if VERBOSE then + printlog "found url : " + sDriver + endif + if sDriver = dbDriverURL then + breturn = true + endif + next + + isDriverInstalled = breturn + +end function diff --git a/testautomation/dbaccess/tools/dbtools.inc b/testautomation/dbaccess/tools/dbtools.inc index 22e16211360c..0f37061b7ae4 100755 --- a/testautomation/dbaccess/tools/dbtools.inc +++ b/testautomation/dbaccess/tools/dbtools.inc @@ -46,6 +46,9 @@ ' #1 tools_dbtools_fgetMySQLDatabaseProperties '* '\*********************************************************************************** + +private const VERBOSE = true + '-------------------------------------------------------------------- function fSelectDatasourceInBeamer(sDSName1) '/// select a datasource in the beamer with the given name @@ -169,13 +172,20 @@ function fOpenDataBase ( sFileName , optional sPassword) Dim DieDatei as String DieDatei = ConvertPath ( sFileName ) + + if(VERBOSE) then + printlog "Filename : " + sFileName + if(NOT isMissing(sPassword)) then + printlog "Password : " + sPassword + endif + endif + '/// open the File Open dialog printlog "open the File Open dialog" FileOpen sleep (1) Kontext "OeffnenDlg" - '/// open the given file - printlog "open the given file: " + sFileName + '/// open the given file Dateiname.SetText DieDatei sleep (3) Oeffnen.Click @@ -195,7 +205,7 @@ function fOpenDataBase ( sFileName , optional sPassword) printlog "set password : " + sPassword Kontext "LoginDialog" if LoginDialog.Exists then - Password.setText sPassword + LoginPassword.setText sPassword LoginDialog.OK sleep(1) endif @@ -270,7 +280,7 @@ sub sCloseAllToolbars end sub '------------------------------------------------------------------------- -function tools_dbtools_fgetMySQLJDBCDatabaseProperties() +function tools_dbtools_fgetMySQLJDBCDatabaseProperties(sDBConfigFileName as string) '/// return the databaseserver properties from the environment directory '/// parameter: '///
@@ -281,21 +291,10 @@ function tools_dbtools_fgetMySQLJDBCDatabaseProperties() '/// entry 3 database name '/// entry 4 database port '/// entry 5 database user name - '/// entry 6 database user password + '/// entry 6 database user password + '/// entry 7 jdbc driver file path - dim i as integer - dim b(10000) as String - dim c - c = hGetDataFileSection( gTesttoolPath + gPrivateEnvironmentLocation + "input/base.txt", b(), "mysql_jdbc" , "" , "" ) - - ' split the string at = and return the right part - for i = 1 to 6 - 'printlog b(i) - b(i) = Right(b(i),len(b(i))-Instr(b(i),"=")) - 'printlog b(i) - next - - tools_dbtools_fgetMySQLJDBCDatabaseProperties = b() + tools_dbtools_fgetMySQLJDBCDatabaseProperties = fgetGenericDatabaseProperties( sDBConfigFileName, "mysql_jdbc" ) end function '------------------------------------------------------------------------- @@ -353,3 +352,28 @@ function tools_dbtools_fgetAdabasDatabaseProperties() tools_dbtools_fgetAdabasDatabaseProperties = b() end function +'------------------------------------------------------------------------------- +function fgetGenericDatabaseProperties(sDBConfigFileName as string, sType as String) + + dim i as integer + dim b(10000) as String + dim c + c = hGetDataFileSection( sDBConfigFileName, b(), sType , "" , "" ) + + ' split the string at = and return the right part + for i = 1 to 7 + if(VERBOSE) then + printlog "orig. string : " + b(i) + endif + b(i) = Right(b(i),len(b(i))-Instr(b(i),"=")) + if(VERBOSE) then + printlog "string after the '=' : " + b(i) + endif + next + + + + + fgetGenericDatabaseProperties = b() + +end function \ No newline at end of file -- cgit v1.2.3 From 7ac0030b242d47e7aed9b9e8fb02853327d3383f Mon Sep 17 00:00:00 2001 From: ms93807 Date: Fri, 5 Feb 2010 08:42:41 +0100 Subject: dba33e: #108973# refactor and code cleanup --- testautomation/global/win/edia_d_h.win | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testautomation/global/win/edia_d_h.win b/testautomation/global/win/edia_d_h.win index de1b69ab4429..ce281ddfe262 100755 --- a/testautomation/global/win/edia_d_h.win +++ b/testautomation/global/win/edia_d_h.win @@ -52,6 +52,7 @@ MySQLODBCDSName HID_PAGE_DBWIZARD_ODBC_ET_NAMEOFODBCDATASOURCE MySQLHostName HID_PAGE_DBWIZARD_JDBC_ET_MYSQLHOSTSERVER MySQLPort HID_PAGE_DBWIZARD_JDBC_ET_MYSQLPORT AdoURL HID_PAGE_DBWIZARD_ADO_ET_ADOURL +StartTableWizard HID_PAGE_DBWIZARD_FINAL_CB_STARTTABLEWIZARD *CreateDatabaseLink cui:ModalDialog:DLG_DOCUMENTLINK DatabaseFile SID_OPENURL @@ -406,10 +407,10 @@ ChooseARemoteDirectory HID_FTP_TXT_PATH ChooseARemoteDirectoryB HID_FTP_BTN_PATH CancelB HID_FTP_CANCEL -*FTPLoginDialog HID_DLG_LOGIN -FTPName uui:Edit:DLG_UUI_LOGIN:ED_LOGIN_USERNAME -FTPPassword uui:Edit:DLG_UUI_LOGIN:ED_LOGIN_PASSWORD -FTPSavePassword uui:CheckBox:DLG_UUI_LOGIN:CB_LOGIN_SAVEPASSWORD +*LoginDialog HID_DLG_LOGIN +LoginName uui:Edit:DLG_UUI_LOGIN:ED_LOGIN_USERNAME +LoginPassword uui:Edit:DLG_UUI_LOGIN:ED_LOGIN_PASSWORD +LoginSavePassword uui:CheckBox:DLG_UUI_LOGIN:CB_LOGIN_SAVEPASSWORD *Gallery SID_GALLERY NewTheme HID_GALLERY_NEWTHEME -- cgit v1.2.3 From cf41d699cd2ea30c3ce50d5ea05db134f4f3316b Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Wed, 10 Feb 2010 09:26:59 +0100 Subject: dba33e: #108973# reenable misc_Macro.bas --- testautomation/global/win/edia_i_o.win | 1 + 1 file changed, 1 insertion(+) diff --git a/testautomation/global/win/edia_i_o.win b/testautomation/global/win/edia_i_o.win index 17e3e286f237..e6fe0b91b8fc 100755 --- a/testautomation/global/win/edia_i_o.win +++ b/testautomation/global/win/edia_i_o.win @@ -184,6 +184,7 @@ DatabaseFile SID_OPENURL Browse dbaccess:PushButton:TP_SAVE_DBDOC_AS:PB_BROWSE_SAVE_AS_LOCATION BackButton HID_WIZARD_PREVIOUS NextButton HID_WIZARD_NEXT +BackupLocation HID_MACRO_MIGRATION_BACKUP_LOCATION *MailMerge HID_MAIL_MERGE_CREATE_FROM ThisDocument sw:RadioButton:DLG_MERGE_CREATE:RB_THISDOC -- cgit v1.2.3 From e1f565b70019c0aed02543aa2d06db73a6ff0f54 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Wed, 10 Feb 2010 09:27:19 +0100 Subject: dba33e: #108973# reenable misc_Macro.bas --- testautomation/dbaccess/optional/includes/misc_Macros.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/misc_Macros.inc b/testautomation/dbaccess/optional/includes/misc_Macros.inc index 3b2ab6bf2345..b18421428dc9 100755 --- a/testautomation/dbaccess/optional/includes/misc_Macros.inc +++ b/testautomation/dbaccess/optional/includes/misc_Macros.inc @@ -39,7 +39,7 @@ sub misc_Macros - printlog "------------------- misc_Macros.inc ------------------------" + printlog "------------------- misc_Macros.inc ------------------------" call tMacros @@ -86,11 +86,11 @@ testcase tMacros endif NextButton.click + + BackupLocation.settext sFileName + "backup.odb" - DatabaseFile.settext sFileName + "backup.odb" - - NextButton.click - sleep(20) + NextButton.click + sleep(20) MacroMigration.OK call fCloseDatabase @@ -111,7 +111,7 @@ testcase tMacros if (MessageBox.exists(1)) then warnlog "MessageBox about macros appear. Should not after migration." else - 'nothing + 'nothing endif call fCloseDatabase -- cgit v1.2.3 From 0f19f462556666884a426a32d36b1a9fe64db6da Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Wed, 10 Feb 2010 10:19:08 +0100 Subject: dba33e: #108973# reenable db_JDBCMySQL.inc --- testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc b/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc index d5db37e4f527..5fdd5887b7f5 100755 --- a/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc +++ b/testautomation/dbaccess/optional/includes/db_JDBCMySQL.inc @@ -198,15 +198,15 @@ testcase db_JDBCMySQL dbok = fCreateMySQL_JDBC_Datasource(sFileName,aDatabaseProperties(3),aDatabaseProperties(2),aDatabaseProperties(4),aDatabaseProperties(5)) if dbok = true then - call fOpendatabase(sFileName,aDatabaseProperties(6)) - call fCreateTable( aFieldTypeContent(), sTableName) - call fInsertIntoTable( aFieldContent(), sTableName) - call fCloseDatabase + 'call fOpendatabase(sFileName,aDatabaseProperties(6)) + 'call fCreateTable( aFieldTypeContent(), sTableName) + 'call fInsertIntoTable( aFieldContent(), sTableName) + 'call fCloseDatabase 'use "dbaccess/optional/includes/b_lvl1_Query.inc" 'call b_lvl1_Query(sFileName,"dbase") - 'call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" ) + call tRelation( sFileName, aDatabaseProperties(6), "rel1", "rel2" ) else warnlog "Data Source could not be created - beyond testcases stopped" -- cgit v1.2.3 From dd2d5f2f4a694f5390de4be66f630271badf4618 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Thu, 18 Feb 2010 08:50:59 +0100 Subject: dba33e: #108973# refactor and code cleanup and minor fixes --- .../dbaccess/optional/includes/ctrl_Wizards.inc | 15 ++++++++------- .../dbaccess/optional/includes/frm_FormFilter.inc | 14 ++++++++------ testautomation/dbaccess/tools/dbtools.inc | 2 +- testautomation/global/win/edia_i_o.win | 8 -------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc index ae090136d2ee..4fbd36119909 100755 --- a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc +++ b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc @@ -102,7 +102,7 @@ testcase tGroupBoxWithDatasource printlog "insert password 'testtool' into login dialog" Kontext "LoginDialog" if LoginDialog.Exists then - Password.setText "testtool" + LoginPassword.setText "testtool" LoginDialog.OK sleep(1) else @@ -110,7 +110,7 @@ testcase tGroupBoxWithDatasource endif Kontext "LoginDialog" if LoginDialog.Exists then - Password.setText "testtool" + LoginPassword.setText "testtool" LoginDialog.OK sleep(1) else @@ -118,9 +118,10 @@ testcase tGroupBoxWithDatasource endif Kontext "TabDataForm" '/// set the table TT_Control - printlog "set the table TT_Control" - Content.setText("TT_Control") - Content.TypeKeys "" , true + printlog "set the table TT_Control" + Content.setText("TT_Control") + Content.TypeKeys "" , true + sleep(1) Kontext "ControlPropertiesDialog" ControlPropertiesDialog.Close sleep(3) @@ -596,7 +597,7 @@ testcase tListBox Kontext "LoginDialog" if LoginDialog.Exists(3) then printlog "login dialog" - Password.SetText "testtool" + LoginPassword.SetText "testtool" LoginDialog.OK sleep 1 end if @@ -820,7 +821,7 @@ testcase tTableControl Kontext "LoginDialog" if LoginDialog.Exists(3) then printlog "login dialog" - Password.SetText "testtool" + LoginPassword.SetText "testtool" LoginDialog.OK sleep (1) end if diff --git a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc index 2fd7efa31b8c..495c22117149 100755 --- a/testautomation/dbaccess/optional/includes/frm_FormFilter.inc +++ b/testautomation/dbaccess/optional/includes/frm_FormFilter.inc @@ -147,11 +147,7 @@ testcase tFF_Navigator printlog "activate the form based filter" FM_FormFilter_Start wait(1000) - '/// open the FormFilterNavigator - printlog "open the FormFilterNavigator" - FM_FF_Navigator - wait(1000) - Kontext "DocumentWriter" + Kontext "DocumentWriter" '/// press CTRL + F5 to get into the first textbox printlog "press CTRL + F5 to get into the first textbox" DocumentWriter.TypeKeys "" , true @@ -167,7 +163,13 @@ testcase tFF_Navigator DocumentWriter.TypeKeys "like '%value%'" , true DocumentWriter.TypeKeys "" , true wait(1000) - Kontext "FilterNavigator" + Kontext "FilterNavigator" + '/// open the FormFilterNavigator + printlog "open the FormFilterNavigator" + if( NOT FilterNavigator.exists(3)) then + FM_FF_Navigator + endif + wait(1000) '/// check if the filter criterion is insert in the form filter navigator printlog "check if the filter criterion is insert in the form filter navigator" FilterNavigator.TypeKeys "" diff --git a/testautomation/dbaccess/tools/dbtools.inc b/testautomation/dbaccess/tools/dbtools.inc index 0f37061b7ae4..e44ac7fe9588 100755 --- a/testautomation/dbaccess/tools/dbtools.inc +++ b/testautomation/dbaccess/tools/dbtools.inc @@ -100,7 +100,7 @@ function fConnectToDatasourceInBeamer(sDSName , sPWD, optional bNewDoc) DatabaseSelection.TypeKeys "" Kontext "LoginDialog" if LoginDialog.Exists(3) then - Password.SetText sPWD + LoginPassword.SetText sPWD LoginDialog.OK end if bConnect = true diff --git a/testautomation/global/win/edia_i_o.win b/testautomation/global/win/edia_i_o.win index e6fe0b91b8fc..c2353a085c3b 100755 --- a/testautomation/global/win/edia_i_o.win +++ b/testautomation/global/win/edia_i_o.win @@ -160,14 +160,6 @@ ScrollBtn framework:PushButton:DLG_LICENSE:PB_PAGEDOWN DeclineBtn framework:PushButton:DLG_LICENSE:PB_DECLINE AcceptBtn framework:PushButton:DLG_LICENSE:PB_ACCEPT -*LoginDialog svtools:ModalDialog:DLG_LOGIN -Path svtools:Edit:DLG_LOGIN:ED_LOGIN_PATH -BrowsePath svtools:PushButton:DLG_LOGIN:BTN_LOGIN_PATH -Username svtools:Edit:DLG_LOGIN:ED_LOGIN_USERNAME -Password svtools:Edit:DLG_LOGIN:ED_LOGIN_PASSWORD -Accountname svtools:Edit:DLG_LOGIN:ED_LOGIN_ACCOUNT -Remember svtools:CheckBox:DLG_LOGIN:CB_LOGIN_SAVEPASSWORD - *FormLinkDialog extensions:ModalDialog:RID_DLG_FORMLINKS LinkDetail1 UID_FIELDLINK_DETAIL1 LinkMaster1 UID_FIELDLINK_MASTER1 -- cgit v1.2.3 From 268ea8cb56a30bb40580b4d8b622a9aacd310581 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Thu, 18 Feb 2010 09:12:30 +0100 Subject: dba33e: #108973# reactivate testcases --- .../dbaccess/required/includes/DatabaseTypes.inc | 1520 ++++++++++---------- 1 file changed, 760 insertions(+), 760 deletions(-) mode change 100755 => 100644 testautomation/dbaccess/required/includes/DatabaseTypes.inc diff --git a/testautomation/dbaccess/required/includes/DatabaseTypes.inc b/testautomation/dbaccess/required/includes/DatabaseTypes.inc old mode 100755 new mode 100644 index 22dd347b2bea..aec063499d3c --- a/testautomation/dbaccess/required/includes/DatabaseTypes.inc +++ b/testautomation/dbaccess/required/includes/DatabaseTypes.inc @@ -1,760 +1,760 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -'* -'* Copyright 2008 by Sun Microsystems, Inc. -'* -'* OpenOffice.org - a multi-platform office productivity suite -'* -'* $RCSfile: DatabaseTypes.inc,v $ -'* -'* $Revision: 1.1 $ -'* -'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ -'* -'* This file is part of OpenOffice.org. -'* -'* OpenOffice.org is free software: you can redistribute it and/or modify -'* it under the terms of the GNU Lesser General Public License version 3 -'* only, as published by the Free Software Foundation. -'* -'* OpenOffice.org is distributed in the hope that it will be useful, -'* but WITHOUT ANY WARRANTY; without even the implied warranty of -'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'* GNU Lesser General Public License version 3 for more details -'* (a copy is included in the LICENSE file that accompanied this code). -'* -'* You should have received a copy of the GNU Lesser General Public License -'* version 3 along with OpenOffice.org. If not, see -'* -'* for a copy of the LGPLv3 License. -'* -'/************************************************************************ -'* -'* owner : marc.neumann@sun.com -'* -'* short description : test the database types -'* -'************************************************************************ -'* -' #1 tMySQLODBCProperties -' #1 tMySQLJDBCProperties -' #1 tAdabasProperties -' #1 tOracleJDBCProperties -' #1 tJDBCProperties -' #1 tODBCProperties -' #1 tdBaseProperties -' #1 tTextProperties -' #1 tSpreadsheetProperties -' #1 tMozillaProperties -' #1 tLDAPProperties -' #1 tEvolutionProperties -' #1 tCheckHSQLDB -'* -'\*********************************************************************************** -sub DatabaseTypes - - printlog "------------------ DatabaseTypes.inc ---------------------" - - ' call tMySQLODBCProperties - ' call tMySQLJDBCProperties - 'call tAdabasProperties - 'call tOracleJDBCProperties - 'call tJDBCProperties - 'call tODBCProperties - 'call tdBaseProperties - 'call tTextProperties - 'call tSpreadsheetProperties - call tMozillaProperties - call tLDAPProperties - call tEvolutionProperties - call tCheckHSQLDB - -end sub -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -testcase tMySQLODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLODBC" - '/// check the MySQLODBC page - call fCheckTabPage(TabMySQLODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMySQLJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLJDBC" - '/// check the MySQLJDBC page - call fCheckTabPage(TabMySQLJDBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLJDBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tAdabasProperties - - if gPlatform = "x86" then - printlog "Adabas is not available under x86." - goto endsub - end if - - if gPlatform = "osx" then - printlog "Adabas doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - sleep(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Adabas") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabAdabas" - '/// check the Adabas page - call fCheckTabPage(TabAdabas) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("Adabas") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tOracleJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("OracleJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabOracleJDBC" - '/// check the TabOracleJDBC page - call fCheckTabPage(TabOracleJDBC) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("JDBC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tLDAPProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("LDAP") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabLDAP" - '/// check the LDAP page - call fChecktabPage(TabLDAP) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tEvolutionProperties - - if gPlatform <> "lin" then - printlog "Evolution does only exists under linux." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - try - if ( isDriverInstalled("sdbc:address:evolution:ldap")) then - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) - Kontext "ConnectionType" - ConnectionType.OK - else - qaerrorlog "Evolution does not appear to be available on this system" - Kontext "ConnectionType" - ConnectionType.Cancel - endif - catch - warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" - TabGeneral.Cancel - call fCloseDatabase - goto endsub - endcatch - - 'call fCheckAdvancedDialog("Evolution") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMozillaProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - try - if ( isDriverInstalled("sdbc:address:mozilla:")) then - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) - Kontext "ConnectionType" - ConnectionType.OK - else - qaerrorlog "Mozilla does not appear to be available on this system" - Kontext "ConnectionType" - ConnectionType.Cancel - endif - catch - warnlog "failed to select DataBaseType Mozilla - maybe not installed or activated in this build" - TabGeneral.Cancel - call fCloseDatabase - goto endsub - endcatch - - - 'add sleep to give OOo time to react - sleep(2) - - 'call fCheckAdvancedDialog("Mozilla") - - 'add sleep to give OOo time to react - sleep(2) - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tSpreadsheetProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("CALC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - 'call fCheckAdvancedDialog("CALC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tTextProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Text") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabTextBase" - '/// check the Text page - call fCheckTabPage(TabTextBase) - - Kontext "ConnectionType" - ConnectionType.ok - - call fCheckAdvancedDialog("Text") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tdBaseProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("dBase") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabdBase" - '/// check the dBase page - call fCheckTabPage(TabdBase) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("dBase") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("ODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabODBC" - '/// check the ODBC page - call fCheckTabPage(TabODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("ODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tCheckHSQLDB - - Dim sDatasourceFileName as String - sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") - call fCreateHSQLDatasource(sDatasourceFileName) - - call fOpenDatabase(sDatasourceFileName) - - Kontext "ContainerView" - ViewTables - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -function fCheckAdvancedDialog(sType as string) - - printlog "+Check the Advanced Settings for the datasource type " + sType - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(3) - - Kontext "Advanced" - - if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then - TabControl.setPage AdvancedSettingsSpecial - call fcheckControl(SQL92Check) - call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - TabControl.setPage TabGeneratedValues - call fcheckControl(RetrieveGeneratedValues) - call fcheckControl(AutoIncrementStatement) - call fcheckControl(QueryGeneratedValues) - - elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then - - 'call fcheckControl(SQL92Check) - 'call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - 'call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - 'call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - - elseif sType = "dBase" OR sType = "Text" then - call fcheckControl(SQL92Check) - 'call fcheckControl(BooleanComparison) - 'call fcheckControl(AppendAlias) - - elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then - ' call fcheckControl(BooleanComparison) - ' call fcheckControl(AppendAlias) - - elseif sType = "Adabas" then - call fcheckControl(AppendAlias) - call fcheckControl(BooleanComparison) - call fcheckControl(SQL92Check) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(CheckRequiredFields) - else - qaerrorlog "unknown database type" - end if - - Kontext "Advanced" - Advanced.Cancel - -end function -'------------------------------------------------------------------------- -function fcheckControl(oControl as object) - - if oControl.exists() then - printlog "|The control " + oControl.Name + " exists." - else - warnlog "|The control " + oControl.Name + " doesn't exists." - end if - -end function -'------------------------------------------------------------------------- -function fCheckConnectionTabPage(sType as string) - - printlog "+check the connection page for the datasource type " + sType - - Kontext "TabConnection" - - call DialogTest(TabConnection) - - if sType = "MySQLODBC" then - call fcheckControl(MySQLODBCDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "MySQLJDBC" then - call fcheckControl(MySQLJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "Adabas" then - call fcheckControl(AdabasDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "OracleJDBC" then - call fcheckControl(OracleJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "JDBC" then - call fcheckControl(ConnectUrl) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - call fcheckControl(TestDriver) - call fcheckControl(JDBCDriverClass) - - elseif sType = "ODBC" then - call fcheckControl(OdbcDatasourceName) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "dBase" then - call fcheckControl(dBasePath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "CALC" then - call fcheckControl(SpreadsheetPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "Text" then - call fcheckControl(TextPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "LDAP" then - call fcheckControl(HostName) - call fcheckControl(TestConnection) - - elseif sType = "Mozilla" OR sType = "Evolution" then - call fcheckControl(TestConnection) - end if - -end function -'------------------------------------------------------------------------- -function fCheckTabPage(oType as object) - - printlog "+check the " + oType.Name + " page." - Kontext oType.Name - - call DialogTest(oType) - - if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(PortNumber) - call fcheckControl(DriverClass) - call fcheckControl(TestClass) - - elseif oType.Name = "TabAdabas" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(CacheSize) - call fcheckControl(DataIncrement) - call fcheckControl(CotrolUser) - call fcheckControl(ControlPassword) - call fcheckControl(ShutdownService) - call fcheckControl(Extended) - - elseif oType.Name = "TabODBC" then - call fcheckControl(UseCatalogs) - call fcheckControl(Options) - call fcheckControl(CharSet) - - elseif oType.Name = "TabdBase" then - call fcheckControl(CharSet) - call fcheckControl(DisplayInactiveRecords) - call fcheckControl(Indexes) - - elseif ( oType.Name = "TabLDAP" ) then - call fcheckControl(BaseDN) - call fcheckControl(PortNumber) - call fcheckControl(Records) - - elseif ( oType.Name = "TabTextBase" ) then - call fcheckControl(TextContainsHeaders) - call fcheckControl(FieldSeparator) - call fcheckControl(TextSeparator) - call fcheckControl(DecimalSeparator) - call fcheckControl(ThousandsSeparator) - call fcheckControl(PlainTextFiles) - call fcheckControl(CVSFiles) - call fcheckControl(Custom) - call fcheckControl(CustomTxt) - call fcheckControl(CharSet) - end if - -end function +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: DatabaseTypes.inc,v $ +'* +'* $Revision: 1.1 $ +'* +'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ +'* +'* This file is part of OpenOffice.org. +'* +'* OpenOffice.org is free software: you can redistribute it and/or modify +'* it under the terms of the GNU Lesser General Public License version 3 +'* only, as published by the Free Software Foundation. +'* +'* OpenOffice.org is distributed in the hope that it will be useful, +'* but WITHOUT ANY WARRANTY; without even the implied warranty of +'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +'* GNU Lesser General Public License version 3 for more details +'* (a copy is included in the LICENSE file that accompanied this code). +'* +'* You should have received a copy of the GNU Lesser General Public License +'* version 3 along with OpenOffice.org. If not, see +'* +'* for a copy of the LGPLv3 License. +'* +'/************************************************************************ +'* +'* owner : marc.neumann@sun.com +'* +'* short description : test the database types +'* +'************************************************************************ +'* +' #1 tMySQLODBCProperties +' #1 tMySQLJDBCProperties +' #1 tAdabasProperties +' #1 tOracleJDBCProperties +' #1 tJDBCProperties +' #1 tODBCProperties +' #1 tdBaseProperties +' #1 tTextProperties +' #1 tSpreadsheetProperties +' #1 tMozillaProperties +' #1 tLDAPProperties +' #1 tEvolutionProperties +' #1 tCheckHSQLDB +'* +'\*********************************************************************************** +sub DatabaseTypes + + printlog "------------------ DatabaseTypes.inc ---------------------" + + call tMySQLODBCProperties + call tMySQLJDBCProperties + call tAdabasProperties + call tOracleJDBCProperties + call tJDBCProperties + call tODBCProperties + call tdBaseProperties + call tTextProperties + call tSpreadsheetProperties + call tMozillaProperties + call tLDAPProperties + call tEvolutionProperties + call tCheckHSQLDB + +end sub +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +testcase tMySQLODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLODBC" + '/// check the MySQLODBC page + call fCheckTabPage(TabMySQLODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMySQLJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLJDBC" + '/// check the MySQLJDBC page + call fCheckTabPage(TabMySQLJDBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLJDBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tAdabasProperties + + if gPlatform = "x86" then + printlog "Adabas is not available under x86." + goto endsub + end if + + if gPlatform = "osx" then + printlog "Adabas doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + sleep(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Adabas") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabAdabas" + '/// check the Adabas page + call fCheckTabPage(TabAdabas) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("Adabas") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tOracleJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("OracleJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabOracleJDBC" + '/// check the TabOracleJDBC page + call fCheckTabPage(TabOracleJDBC) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("JDBC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tLDAPProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("LDAP") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabLDAP" + '/// check the LDAP page + call fChecktabPage(TabLDAP) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tEvolutionProperties + + if gPlatform <> "lin" then + printlog "Evolution does only exists under linux." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:evolution:ldap")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Evolution does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + 'call fCheckAdvancedDialog("Evolution") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMozillaProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:mozilla:")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Mozilla does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Mozilla - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + + 'add sleep to give OOo time to react + sleep(2) + + 'call fCheckAdvancedDialog("Mozilla") + + 'add sleep to give OOo time to react + sleep(2) + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tSpreadsheetProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("CALC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + 'call fCheckAdvancedDialog("CALC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tTextProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Text") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabTextBase" + '/// check the Text page + call fCheckTabPage(TabTextBase) + + Kontext "ConnectionType" + ConnectionType.ok + + call fCheckAdvancedDialog("Text") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tdBaseProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("dBase") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabdBase" + '/// check the dBase page + call fCheckTabPage(TabdBase) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("dBase") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("ODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabODBC" + '/// check the ODBC page + call fCheckTabPage(TabODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("ODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tCheckHSQLDB + + Dim sDatasourceFileName as String + sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") + call fCreateHSQLDatasource(sDatasourceFileName) + + call fOpenDatabase(sDatasourceFileName) + + Kontext "ContainerView" + ViewTables + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +function fCheckAdvancedDialog(sType as string) + + printlog "+Check the Advanced Settings for the datasource type " + sType + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(3) + + Kontext "Advanced" + + if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then + TabControl.setPage AdvancedSettingsSpecial + call fcheckControl(SQL92Check) + call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + TabControl.setPage TabGeneratedValues + call fcheckControl(RetrieveGeneratedValues) + call fcheckControl(AutoIncrementStatement) + call fcheckControl(QueryGeneratedValues) + + elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then + + 'call fcheckControl(SQL92Check) + 'call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + 'call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + 'call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + + elseif sType = "dBase" OR sType = "Text" then + call fcheckControl(SQL92Check) + 'call fcheckControl(BooleanComparison) + 'call fcheckControl(AppendAlias) + + elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then + ' call fcheckControl(BooleanComparison) + ' call fcheckControl(AppendAlias) + + elseif sType = "Adabas" then + call fcheckControl(AppendAlias) + call fcheckControl(BooleanComparison) + call fcheckControl(SQL92Check) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(CheckRequiredFields) + else + qaerrorlog "unknown database type" + end if + + Kontext "Advanced" + Advanced.Cancel + +end function +'------------------------------------------------------------------------- +function fcheckControl(oControl as object) + + if oControl.exists() then + printlog "|The control " + oControl.Name + " exists." + else + warnlog "|The control " + oControl.Name + " doesn't exists." + end if + +end function +'------------------------------------------------------------------------- +function fCheckConnectionTabPage(sType as string) + + printlog "+check the connection page for the datasource type " + sType + + Kontext "TabConnection" + + call DialogTest(TabConnection) + + if sType = "MySQLODBC" then + call fcheckControl(MySQLODBCDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "MySQLJDBC" then + call fcheckControl(MySQLJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "Adabas" then + call fcheckControl(AdabasDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "OracleJDBC" then + call fcheckControl(OracleJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "JDBC" then + call fcheckControl(ConnectUrl) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + call fcheckControl(TestDriver) + call fcheckControl(JDBCDriverClass) + + elseif sType = "ODBC" then + call fcheckControl(OdbcDatasourceName) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "dBase" then + call fcheckControl(dBasePath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "CALC" then + call fcheckControl(SpreadsheetPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "Text" then + call fcheckControl(TextPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "LDAP" then + call fcheckControl(HostName) + call fcheckControl(TestConnection) + + elseif sType = "Mozilla" OR sType = "Evolution" then + call fcheckControl(TestConnection) + end if + +end function +'------------------------------------------------------------------------- +function fCheckTabPage(oType as object) + + printlog "+check the " + oType.Name + " page." + Kontext oType.Name + + call DialogTest(oType) + + if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(PortNumber) + call fcheckControl(DriverClass) + call fcheckControl(TestClass) + + elseif oType.Name = "TabAdabas" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(CacheSize) + call fcheckControl(DataIncrement) + call fcheckControl(CotrolUser) + call fcheckControl(ControlPassword) + call fcheckControl(ShutdownService) + call fcheckControl(Extended) + + elseif oType.Name = "TabODBC" then + call fcheckControl(UseCatalogs) + call fcheckControl(Options) + call fcheckControl(CharSet) + + elseif oType.Name = "TabdBase" then + call fcheckControl(CharSet) + call fcheckControl(DisplayInactiveRecords) + call fcheckControl(Indexes) + + elseif ( oType.Name = "TabLDAP" ) then + call fcheckControl(BaseDN) + call fcheckControl(PortNumber) + call fcheckControl(Records) + + elseif ( oType.Name = "TabTextBase" ) then + call fcheckControl(TextContainsHeaders) + call fcheckControl(FieldSeparator) + call fcheckControl(TextSeparator) + call fcheckControl(DecimalSeparator) + call fcheckControl(ThousandsSeparator) + call fcheckControl(PlainTextFiles) + call fcheckControl(CVSFiles) + call fcheckControl(Custom) + call fcheckControl(CustomTxt) + call fcheckControl(CharSet) + end if + +end function -- cgit v1.2.3 From f21b8fe3f510dddbf13ecec0610ee3fb5ce4ffef Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Wed, 24 Feb 2010 10:30:22 +0100 Subject: dba33e: #108973# reactivate testcases --- .../dbaccess/required/includes/DatabaseTypes.inc | 1520 ++++++++++---------- 1 file changed, 760 insertions(+), 760 deletions(-) mode change 100755 => 100644 testautomation/dbaccess/required/includes/DatabaseTypes.inc diff --git a/testautomation/dbaccess/required/includes/DatabaseTypes.inc b/testautomation/dbaccess/required/includes/DatabaseTypes.inc old mode 100755 new mode 100644 index 22dd347b2bea..aec063499d3c --- a/testautomation/dbaccess/required/includes/DatabaseTypes.inc +++ b/testautomation/dbaccess/required/includes/DatabaseTypes.inc @@ -1,760 +1,760 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -'* -'* Copyright 2008 by Sun Microsystems, Inc. -'* -'* OpenOffice.org - a multi-platform office productivity suite -'* -'* $RCSfile: DatabaseTypes.inc,v $ -'* -'* $Revision: 1.1 $ -'* -'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ -'* -'* This file is part of OpenOffice.org. -'* -'* OpenOffice.org is free software: you can redistribute it and/or modify -'* it under the terms of the GNU Lesser General Public License version 3 -'* only, as published by the Free Software Foundation. -'* -'* OpenOffice.org is distributed in the hope that it will be useful, -'* but WITHOUT ANY WARRANTY; without even the implied warranty of -'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -'* GNU Lesser General Public License version 3 for more details -'* (a copy is included in the LICENSE file that accompanied this code). -'* -'* You should have received a copy of the GNU Lesser General Public License -'* version 3 along with OpenOffice.org. If not, see -'* -'* for a copy of the LGPLv3 License. -'* -'/************************************************************************ -'* -'* owner : marc.neumann@sun.com -'* -'* short description : test the database types -'* -'************************************************************************ -'* -' #1 tMySQLODBCProperties -' #1 tMySQLJDBCProperties -' #1 tAdabasProperties -' #1 tOracleJDBCProperties -' #1 tJDBCProperties -' #1 tODBCProperties -' #1 tdBaseProperties -' #1 tTextProperties -' #1 tSpreadsheetProperties -' #1 tMozillaProperties -' #1 tLDAPProperties -' #1 tEvolutionProperties -' #1 tCheckHSQLDB -'* -'\*********************************************************************************** -sub DatabaseTypes - - printlog "------------------ DatabaseTypes.inc ---------------------" - - ' call tMySQLODBCProperties - ' call tMySQLJDBCProperties - 'call tAdabasProperties - 'call tOracleJDBCProperties - 'call tJDBCProperties - 'call tODBCProperties - 'call tdBaseProperties - 'call tTextProperties - 'call tSpreadsheetProperties - call tMozillaProperties - call tLDAPProperties - call tEvolutionProperties - call tCheckHSQLDB - -end sub -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -testcase tMySQLODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLODBC" - '/// check the MySQLODBC page - call fCheckTabPage(TabMySQLODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMySQLJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("MySQLJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabMySQLJDBC" - '/// check the MySQLJDBC page - call fCheckTabPage(TabMySQLJDBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("MySQLJDBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tAdabasProperties - - if gPlatform = "x86" then - printlog "Adabas is not available under x86." - goto endsub - end if - - if gPlatform = "osx" then - printlog "Adabas doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - sleep(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Adabas") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabAdabas" - '/// check the Adabas page - call fCheckTabPage(TabAdabas) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("Adabas") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tOracleJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("OracleJDBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabOracleJDBC" - '/// check the TabOracleJDBC page - call fCheckTabPage(TabOracleJDBC) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tJDBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("JDBC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tLDAPProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("LDAP") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabLDAP" - '/// check the LDAP page - call fChecktabPage(TabLDAP) - - Kontext "ConnectionType" - ConnectionType.Cancel - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tEvolutionProperties - - if gPlatform <> "lin" then - printlog "Evolution does only exists under linux." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - try - if ( isDriverInstalled("sdbc:address:evolution:ldap")) then - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) - Kontext "ConnectionType" - ConnectionType.OK - else - qaerrorlog "Evolution does not appear to be available on this system" - Kontext "ConnectionType" - ConnectionType.Cancel - endif - catch - warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" - TabGeneral.Cancel - call fCloseDatabase - goto endsub - endcatch - - 'call fCheckAdvancedDialog("Evolution") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tMozillaProperties - - if gPlatform = "osx" then - printlog "LDAP doesn't exists under mac osx." - goto endsub - end if - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - try - if ( isDriverInstalled("sdbc:address:mozilla:")) then - DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) - Kontext "ConnectionType" - ConnectionType.OK - else - qaerrorlog "Mozilla does not appear to be available on this system" - Kontext "ConnectionType" - ConnectionType.Cancel - endif - catch - warnlog "failed to select DataBaseType Mozilla - maybe not installed or activated in this build" - TabGeneral.Cancel - call fCloseDatabase - goto endsub - endcatch - - - 'add sleep to give OOo time to react - sleep(2) - - 'call fCheckAdvancedDialog("Mozilla") - - 'add sleep to give OOo time to react - sleep(2) - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tSpreadsheetProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("CALC") - - Kontext "ConnectionType" - ConnectionType.Cancel - - 'call fCheckAdvancedDialog("CALC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tTextProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("Text") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabTextBase" - '/// check the Text page - call fCheckTabPage(TabTextBase) - - Kontext "ConnectionType" - ConnectionType.ok - - call fCheckAdvancedDialog("Text") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tdBaseProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("dBase") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabdBase" - '/// check the dBase page - call fCheckTabPage(TabdBase) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("dBase") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tODBCProperties - - call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) - - ViewForms - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(2) - - Kontext "TabGeneral" - call DialogTest(TabGeneral) - DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - call fCheckConnectionTabPage("ODBC") - - Kontext "ConnectionType" - NextBtn.Click - sleep(1) - - Kontext "TabODBC" - '/// check the ODBC page - call fCheckTabPage(TabODBC) - - Kontext "ConnectionType" - ConnectionType.OK - - call fCheckAdvancedDialog("ODBC") - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -testcase tCheckHSQLDB - - Dim sDatasourceFileName as String - sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") - call fCreateHSQLDatasource(sDatasourceFileName) - - call fOpenDatabase(sDatasourceFileName) - - Kontext "ContainerView" - ViewTables - - call fCloseDatabase() - -endcase -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -'------------------------------------------------------------------------- -function fCheckAdvancedDialog(sType as string) - - printlog "+Check the Advanced Settings for the datasource type " + sType - - Kontext "DATABASE" - Database.UseMenu - hMenuSelectNr(2) - hMenuSelectNr(15) - hMenuSelectNr(3) - - Kontext "Advanced" - - if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then - TabControl.setPage AdvancedSettingsSpecial - call fcheckControl(SQL92Check) - call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - TabControl.setPage TabGeneratedValues - call fcheckControl(RetrieveGeneratedValues) - call fcheckControl(AutoIncrementStatement) - call fcheckControl(QueryGeneratedValues) - - elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then - - 'call fcheckControl(SQL92Check) - 'call fcheckControl(AppendAlias) - call fcheckControl(Ignoreprivileges) - 'call fcheckControl(ParameterSubstiti) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(BooleanComparison) - 'call fcheckControl(EnableOuterJoin) - call fcheckControl(CheckRequiredFields) - - - elseif sType = "dBase" OR sType = "Text" then - call fcheckControl(SQL92Check) - 'call fcheckControl(BooleanComparison) - 'call fcheckControl(AppendAlias) - - elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then - ' call fcheckControl(BooleanComparison) - ' call fcheckControl(AppendAlias) - - elseif sType = "Adabas" then - call fcheckControl(AppendAlias) - call fcheckControl(BooleanComparison) - call fcheckControl(SQL92Check) - call fcheckControl(DisplayVersionColumns) - call fcheckControl(CheckRequiredFields) - else - qaerrorlog "unknown database type" - end if - - Kontext "Advanced" - Advanced.Cancel - -end function -'------------------------------------------------------------------------- -function fcheckControl(oControl as object) - - if oControl.exists() then - printlog "|The control " + oControl.Name + " exists." - else - warnlog "|The control " + oControl.Name + " doesn't exists." - end if - -end function -'------------------------------------------------------------------------- -function fCheckConnectionTabPage(sType as string) - - printlog "+check the connection page for the datasource type " + sType - - Kontext "TabConnection" - - call DialogTest(TabConnection) - - if sType = "MySQLODBC" then - call fcheckControl(MySQLODBCDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "MySQLJDBC" then - call fcheckControl(MySQLJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "Adabas" then - call fcheckControl(AdabasDatasource) - call fcheckControl(SelectPath) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "OracleJDBC" then - call fcheckControl(OracleJDBCDatasource) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "JDBC" then - call fcheckControl(ConnectUrl) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - call fcheckControl(TestDriver) - call fcheckControl(JDBCDriverClass) - - elseif sType = "ODBC" then - call fcheckControl(OdbcDatasourceName) - call fcheckControl(Username) - call fcheckControl(PasswordRequired) - call fcheckControl(TestConnection) - - elseif sType = "dBase" then - call fcheckControl(dBasePath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "CALC" then - call fcheckControl(SpreadsheetPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "Text" then - call fcheckControl(TextPath) - call fcheckControl(SelectPath) - call fcheckControl(TestConnection) - - elseif sType = "LDAP" then - call fcheckControl(HostName) - call fcheckControl(TestConnection) - - elseif sType = "Mozilla" OR sType = "Evolution" then - call fcheckControl(TestConnection) - end if - -end function -'------------------------------------------------------------------------- -function fCheckTabPage(oType as object) - - printlog "+check the " + oType.Name + " page." - Kontext oType.Name - - call DialogTest(oType) - - if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(PortNumber) - call fcheckControl(DriverClass) - call fcheckControl(TestClass) - - elseif oType.Name = "TabAdabas" then - call fcheckControl(CharSet) - call fcheckControl(HostName) - call fcheckControl(CacheSize) - call fcheckControl(DataIncrement) - call fcheckControl(CotrolUser) - call fcheckControl(ControlPassword) - call fcheckControl(ShutdownService) - call fcheckControl(Extended) - - elseif oType.Name = "TabODBC" then - call fcheckControl(UseCatalogs) - call fcheckControl(Options) - call fcheckControl(CharSet) - - elseif oType.Name = "TabdBase" then - call fcheckControl(CharSet) - call fcheckControl(DisplayInactiveRecords) - call fcheckControl(Indexes) - - elseif ( oType.Name = "TabLDAP" ) then - call fcheckControl(BaseDN) - call fcheckControl(PortNumber) - call fcheckControl(Records) - - elseif ( oType.Name = "TabTextBase" ) then - call fcheckControl(TextContainsHeaders) - call fcheckControl(FieldSeparator) - call fcheckControl(TextSeparator) - call fcheckControl(DecimalSeparator) - call fcheckControl(ThousandsSeparator) - call fcheckControl(PlainTextFiles) - call fcheckControl(CVSFiles) - call fcheckControl(Custom) - call fcheckControl(CustomTxt) - call fcheckControl(CharSet) - end if - -end function +'encoding UTF-8 Do not remove or change this line! +'************************************************************************** +'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +'* +'* Copyright 2008 by Sun Microsystems, Inc. +'* +'* OpenOffice.org - a multi-platform office productivity suite +'* +'* $RCSfile: DatabaseTypes.inc,v $ +'* +'* $Revision: 1.1 $ +'* +'* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $ +'* +'* This file is part of OpenOffice.org. +'* +'* OpenOffice.org is free software: you can redistribute it and/or modify +'* it under the terms of the GNU Lesser General Public License version 3 +'* only, as published by the Free Software Foundation. +'* +'* OpenOffice.org is distributed in the hope that it will be useful, +'* but WITHOUT ANY WARRANTY; without even the implied warranty of +'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +'* GNU Lesser General Public License version 3 for more details +'* (a copy is included in the LICENSE file that accompanied this code). +'* +'* You should have received a copy of the GNU Lesser General Public License +'* version 3 along with OpenOffice.org. If not, see +'* +'* for a copy of the LGPLv3 License. +'* +'/************************************************************************ +'* +'* owner : marc.neumann@sun.com +'* +'* short description : test the database types +'* +'************************************************************************ +'* +' #1 tMySQLODBCProperties +' #1 tMySQLJDBCProperties +' #1 tAdabasProperties +' #1 tOracleJDBCProperties +' #1 tJDBCProperties +' #1 tODBCProperties +' #1 tdBaseProperties +' #1 tTextProperties +' #1 tSpreadsheetProperties +' #1 tMozillaProperties +' #1 tLDAPProperties +' #1 tEvolutionProperties +' #1 tCheckHSQLDB +'* +'\*********************************************************************************** +sub DatabaseTypes + + printlog "------------------ DatabaseTypes.inc ---------------------" + + call tMySQLODBCProperties + call tMySQLJDBCProperties + call tAdabasProperties + call tOracleJDBCProperties + call tJDBCProperties + call tODBCProperties + call tdBaseProperties + call tTextProperties + call tSpreadsheetProperties + call tMozillaProperties + call tLDAPProperties + call tEvolutionProperties + call tCheckHSQLDB + +end sub +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +testcase tMySQLODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLODBC" + '/// check the MySQLODBC page + call fCheckTabPage(TabMySQLODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMySQLJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("MySQLJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabMySQLJDBC" + '/// check the MySQLJDBC page + call fCheckTabPage(TabMySQLJDBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("MySQLJDBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tAdabasProperties + + if gPlatform = "x86" then + printlog "Adabas is not available under x86." + goto endsub + end if + + if gPlatform = "osx" then + printlog "Adabas doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + sleep(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Adabas") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabAdabas" + '/// check the Adabas page + call fCheckTabPage(TabAdabas) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("Adabas") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tOracleJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("OracleJDBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabOracleJDBC" + '/// check the TabOracleJDBC page + call fCheckTabPage(TabOracleJDBC) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tJDBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("jdbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("JDBC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tLDAPProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("LDAP") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabLDAP" + '/// check the LDAP page + call fChecktabPage(TabLDAP) + + Kontext "ConnectionType" + ConnectionType.Cancel + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tEvolutionProperties + + if gPlatform <> "lin" then + printlog "Evolution does only exists under linux." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:evolution:ldap")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Evolution does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + 'call fCheckAdvancedDialog("Evolution") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tMozillaProperties + + if gPlatform = "osx" then + printlog "LDAP doesn't exists under mac osx." + goto endsub + end if + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + try + if ( isDriverInstalled("sdbc:address:mozilla:")) then + DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:")) + Kontext "ConnectionType" + ConnectionType.OK + else + qaerrorlog "Mozilla does not appear to be available on this system" + Kontext "ConnectionType" + ConnectionType.Cancel + endif + catch + warnlog "failed to select DataBaseType Mozilla - maybe not installed or activated in this build" + TabGeneral.Cancel + call fCloseDatabase + goto endsub + endcatch + + + 'add sleep to give OOo time to react + sleep(2) + + 'call fCheckAdvancedDialog("Mozilla") + + 'add sleep to give OOo time to react + sleep(2) + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tSpreadsheetProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("CALC") + + Kontext "ConnectionType" + ConnectionType.Cancel + + 'call fCheckAdvancedDialog("CALC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tTextProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("Text") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabTextBase" + '/// check the Text page + call fCheckTabPage(TabTextBase) + + Kontext "ConnectionType" + ConnectionType.ok + + call fCheckAdvancedDialog("Text") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tdBaseProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("dBase") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabdBase" + '/// check the dBase page + call fCheckTabPage(TabdBase) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("dBase") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tODBCProperties + + call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb")) + + ViewForms + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(2) + + Kontext "TabGeneral" + call DialogTest(TabGeneral) + DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*")) + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + call fCheckConnectionTabPage("ODBC") + + Kontext "ConnectionType" + NextBtn.Click + sleep(1) + + Kontext "TabODBC" + '/// check the ODBC page + call fCheckTabPage(TabODBC) + + Kontext "ConnectionType" + ConnectionType.OK + + call fCheckAdvancedDialog("ODBC") + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +testcase tCheckHSQLDB + + Dim sDatasourceFileName as String + sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb") + call fCreateHSQLDatasource(sDatasourceFileName) + + call fOpenDatabase(sDatasourceFileName) + + Kontext "ContainerView" + ViewTables + + call fCloseDatabase() + +endcase +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +'------------------------------------------------------------------------- +function fCheckAdvancedDialog(sType as string) + + printlog "+Check the Advanced Settings for the datasource type " + sType + + Kontext "DATABASE" + Database.UseMenu + hMenuSelectNr(2) + hMenuSelectNr(15) + hMenuSelectNr(3) + + Kontext "Advanced" + + if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then + TabControl.setPage AdvancedSettingsSpecial + call fcheckControl(SQL92Check) + call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + TabControl.setPage TabGeneratedValues + call fcheckControl(RetrieveGeneratedValues) + call fcheckControl(AutoIncrementStatement) + call fcheckControl(QueryGeneratedValues) + + elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then + + 'call fcheckControl(SQL92Check) + 'call fcheckControl(AppendAlias) + call fcheckControl(Ignoreprivileges) + 'call fcheckControl(ParameterSubstiti) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(BooleanComparison) + 'call fcheckControl(EnableOuterJoin) + call fcheckControl(CheckRequiredFields) + + + elseif sType = "dBase" OR sType = "Text" then + call fcheckControl(SQL92Check) + 'call fcheckControl(BooleanComparison) + 'call fcheckControl(AppendAlias) + + elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then + ' call fcheckControl(BooleanComparison) + ' call fcheckControl(AppendAlias) + + elseif sType = "Adabas" then + call fcheckControl(AppendAlias) + call fcheckControl(BooleanComparison) + call fcheckControl(SQL92Check) + call fcheckControl(DisplayVersionColumns) + call fcheckControl(CheckRequiredFields) + else + qaerrorlog "unknown database type" + end if + + Kontext "Advanced" + Advanced.Cancel + +end function +'------------------------------------------------------------------------- +function fcheckControl(oControl as object) + + if oControl.exists() then + printlog "|The control " + oControl.Name + " exists." + else + warnlog "|The control " + oControl.Name + " doesn't exists." + end if + +end function +'------------------------------------------------------------------------- +function fCheckConnectionTabPage(sType as string) + + printlog "+check the connection page for the datasource type " + sType + + Kontext "TabConnection" + + call DialogTest(TabConnection) + + if sType = "MySQLODBC" then + call fcheckControl(MySQLODBCDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "MySQLJDBC" then + call fcheckControl(MySQLJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "Adabas" then + call fcheckControl(AdabasDatasource) + call fcheckControl(SelectPath) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "OracleJDBC" then + call fcheckControl(OracleJDBCDatasource) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "JDBC" then + call fcheckControl(ConnectUrl) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + call fcheckControl(TestDriver) + call fcheckControl(JDBCDriverClass) + + elseif sType = "ODBC" then + call fcheckControl(OdbcDatasourceName) + call fcheckControl(Username) + call fcheckControl(PasswordRequired) + call fcheckControl(TestConnection) + + elseif sType = "dBase" then + call fcheckControl(dBasePath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "CALC" then + call fcheckControl(SpreadsheetPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "Text" then + call fcheckControl(TextPath) + call fcheckControl(SelectPath) + call fcheckControl(TestConnection) + + elseif sType = "LDAP" then + call fcheckControl(HostName) + call fcheckControl(TestConnection) + + elseif sType = "Mozilla" OR sType = "Evolution" then + call fcheckControl(TestConnection) + end if + +end function +'------------------------------------------------------------------------- +function fCheckTabPage(oType as object) + + printlog "+check the " + oType.Name + " page." + Kontext oType.Name + + call DialogTest(oType) + + if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(PortNumber) + call fcheckControl(DriverClass) + call fcheckControl(TestClass) + + elseif oType.Name = "TabAdabas" then + call fcheckControl(CharSet) + call fcheckControl(HostName) + call fcheckControl(CacheSize) + call fcheckControl(DataIncrement) + call fcheckControl(CotrolUser) + call fcheckControl(ControlPassword) + call fcheckControl(ShutdownService) + call fcheckControl(Extended) + + elseif oType.Name = "TabODBC" then + call fcheckControl(UseCatalogs) + call fcheckControl(Options) + call fcheckControl(CharSet) + + elseif oType.Name = "TabdBase" then + call fcheckControl(CharSet) + call fcheckControl(DisplayInactiveRecords) + call fcheckControl(Indexes) + + elseif ( oType.Name = "TabLDAP" ) then + call fcheckControl(BaseDN) + call fcheckControl(PortNumber) + call fcheckControl(Records) + + elseif ( oType.Name = "TabTextBase" ) then + call fcheckControl(TextContainsHeaders) + call fcheckControl(FieldSeparator) + call fcheckControl(TextSeparator) + call fcheckControl(DecimalSeparator) + call fcheckControl(ThousandsSeparator) + call fcheckControl(PlainTextFiles) + call fcheckControl(CVSFiles) + call fcheckControl(Custom) + call fcheckControl(CustomTxt) + call fcheckControl(CharSet) + end if + +end function -- cgit v1.2.3 From 1628154ed4a7c3c34b155685c98b0c3b04cecc77 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Thu, 25 Feb 2010 09:12:33 +0100 Subject: dba33e: #108973# fix double win declaration --- .../dbaccess/optional/includes/ctrl_Wizards.inc | 144 ++++++++++----------- testautomation/dbaccess/tools/dbtools.inc | 8 +- testautomation/global/win/edia_i_o.win | 8 -- 3 files changed, 76 insertions(+), 84 deletions(-) diff --git a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc index ae090136d2ee..f111e917ebea 100755 --- a/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc +++ b/testautomation/dbaccess/optional/includes/ctrl_Wizards.inc @@ -102,7 +102,7 @@ testcase tGroupBoxWithDatasource printlog "insert password 'testtool' into login dialog" Kontext "LoginDialog" if LoginDialog.Exists then - Password.setText "testtool" + LoginPassword.setText "testtool" LoginDialog.OK sleep(1) else @@ -110,7 +110,7 @@ testcase tGroupBoxWithDatasource endif Kontext "LoginDialog" if LoginDialog.Exists then - Password.setText "testtool" + LoginPassword.setText "testtool" LoginDialog.OK sleep(1) else @@ -593,12 +593,12 @@ testcase tListBox Kontext "TabListBoxData" '/// choose database TT & click next DataSource.Select(sDSName) - Kontext "LoginDialog" + Kontext "LoginDialog" if LoginDialog.Exists(3) then - printlog "login dialog" - Password.SetText "testtool" - LoginDialog.OK - sleep 1 + printlog "login dialog" + LoginPassword.SetText "testtool" + LoginDialog.OK + sleep 1 end if '/// choose table TPCoA-1 & click next Kontext "TabListBoxData" @@ -793,72 +793,72 @@ endcase testcase tTableControl - printlog "- Formular toolbox: Tablecontrol element (" & gApplication & ")" - '/// open a new textdocument & insert a table control - call hNewDocument - sleep(1) - - call hToolbarSelect("MoreControls",true) - - Kontext "MoreControls" - Grid.Click - call hDrawingWithSelection ( 40, 20, 60, 40 ) - sleep(10) - '/// take as datasource table biblio, mark it & next - '/// select some fields (in both directions) & create - '/// switch off the design view & open the database beamer (TODO) - '/// compare the header & the contents with the table control (TODO) - Dim k as integer - Kontext "AutopilotTableElement" - AutopilotTableElement.MouseDown (10,10) - AutopilotTableElement.MouseUp (10,10) - if AutopilotTableElement.Exists(3) then - printlog " - Autopilot Table Element: Page 1/2" - Kontext "TabListBoxData" - DataSource.Select(sDSName) - sleep (1) - Kontext "LoginDialog" - if LoginDialog.Exists(3) then - printlog "login dialog" - Password.SetText "testtool" - LoginDialog.OK - sleep (1) - end if + printlog "- Formular toolbox: Tablecontrol element (" & gApplication & ")" + '/// open a new textdocument & insert a table control + call hNewDocument + sleep(1) + + call hToolbarSelect("MoreControls",true) + + Kontext "MoreControls" + Grid.Click + call hDrawingWithSelection ( 40, 20, 60, 40 ) + sleep(10) + '/// take as datasource table biblio, mark it & next + '/// select some fields (in both directions) & create + '/// switch off the design view & open the database beamer (TODO) + '/// compare the header & the contents with the table control (TODO) + Dim k as integer + Kontext "AutopilotTableElement" + AutopilotTableElement.MouseDown (10,10) + AutopilotTableElement.MouseUp (10,10) + if AutopilotTableElement.Exists(3) then + printlog " - Autopilot Table Element: Page 1/2" + Kontext "TabListBoxData" + DataSource.Select(sDSName) + sleep (1) + Kontext "LoginDialog" + if LoginDialog.Exists(3) then + printlog "login dialog" + LoginPassword.SetText "testtool" + LoginDialog.OK sleep (1) - Kontext "TabListBoxData" - Table.Select("TT_Control") - sleep(3) - Kontext "AutopilotTableElement" - if NextButton.IsEnabled then - NextButton.Click - else - warnlog "In first window the 'Next'-button is disabled!" - AutopilotTableElement.Cancel - end if - sleep(1) - printlog " - Autopilot Table Element: Page 2/2" - Kontext "TabTableFieldSelection" - ExistingFields.Select("ID") - AddTo.Click - ExistingFields.Select("Colors") - AddTo.Click - ExistingFields.Select("InfoColor") - AddTo.Click - sleep(1) - Kontext "AutopilotTableElement" - if CreateButton.IsEnabled then - CreateButton.Click - else - warnlog "In fourth window the 'Create'-button is disabled!" - AutopilotTableElement.Cancel - end if - else - warnlog "- Autopilot for Table Element didn't appear!" - end if - sleep(2) - - hCloseDocument - + end if + sleep (1) + Kontext "TabListBoxData" + Table.Select("TT_Control") + sleep(3) + Kontext "AutopilotTableElement" + if NextButton.IsEnabled then + NextButton.Click + else + warnlog "In first window the 'Next'-button is disabled!" + AutopilotTableElement.Cancel + end if + sleep(1) + printlog " - Autopilot Table Element: Page 2/2" + Kontext "TabTableFieldSelection" + ExistingFields.Select("ID") + AddTo.Click + ExistingFields.Select("Colors") + AddTo.Click + ExistingFields.Select("InfoColor") + AddTo.Click + sleep(1) + Kontext "AutopilotTableElement" + if CreateButton.IsEnabled then + CreateButton.Click + else + warnlog "In fourth window the 'Create'-button is disabled!" + AutopilotTableElement.Cancel + end if + else + warnlog "- Autopilot for Table Element didn't appear!" + end if + sleep(2) + + hCloseDocument + endcase '------------------------------------------------------------------------- diff --git a/testautomation/dbaccess/tools/dbtools.inc b/testautomation/dbaccess/tools/dbtools.inc index 0f37061b7ae4..70a96653188a 100755 --- a/testautomation/dbaccess/tools/dbtools.inc +++ b/testautomation/dbaccess/tools/dbtools.inc @@ -99,10 +99,10 @@ function fConnectToDatasourceInBeamer(sDSName , sPWD, optional bNewDoc) DatabaseSelection.TypeKeys "" DatabaseSelection.TypeKeys "" Kontext "LoginDialog" - if LoginDialog.Exists(3) then - Password.SetText sPWD - LoginDialog.OK - end if + if LoginDialog.Exists(3) then + LoginPassword.SetText sPWD + LoginDialog.OK + end if bConnect = true else warnlog "Could not found the datasource " + sDSName diff --git a/testautomation/global/win/edia_i_o.win b/testautomation/global/win/edia_i_o.win index e6fe0b91b8fc..c2353a085c3b 100755 --- a/testautomation/global/win/edia_i_o.win +++ b/testautomation/global/win/edia_i_o.win @@ -160,14 +160,6 @@ ScrollBtn framework:PushButton:DLG_LICENSE:PB_PAGEDOWN DeclineBtn framework:PushButton:DLG_LICENSE:PB_DECLINE AcceptBtn framework:PushButton:DLG_LICENSE:PB_ACCEPT -*LoginDialog svtools:ModalDialog:DLG_LOGIN -Path svtools:Edit:DLG_LOGIN:ED_LOGIN_PATH -BrowsePath svtools:PushButton:DLG_LOGIN:BTN_LOGIN_PATH -Username svtools:Edit:DLG_LOGIN:ED_LOGIN_USERNAME -Password svtools:Edit:DLG_LOGIN:ED_LOGIN_PASSWORD -Accountname svtools:Edit:DLG_LOGIN:ED_LOGIN_ACCOUNT -Remember svtools:CheckBox:DLG_LOGIN:CB_LOGIN_SAVEPASSWORD - *FormLinkDialog extensions:ModalDialog:RID_DLG_FORMLINKS LinkDetail1 UID_FIELDLINK_DETAIL1 LinkMaster1 UID_FIELDLINK_MASTER1 -- cgit v1.2.3 From 7f4fa441c9a3f04aeaf89be7aa5b5735b165de70 Mon Sep 17 00:00:00 2001 From: "Marc Neumann [msc]" Date: Thu, 25 Feb 2010 10:24:48 +0100 Subject: dba33e: #108973# fix sid/win declaration --- testautomation/global/sid/all.sid | 2 -- testautomation/global/sid/bars.sid | 10 ---------- testautomation/global/sid/e_all.sid | 1 - testautomation/global/win/bars.win | 1 - 4 files changed, 14 deletions(-) mode change 100644 => 100755 testautomation/global/sid/all.sid mode change 100644 => 100755 testautomation/global/sid/bars.sid mode change 100644 => 100755 testautomation/global/sid/e_all.sid diff --git a/testautomation/global/sid/all.sid b/testautomation/global/sid/all.sid old mode 100644 new mode 100755 index 7c8f6618b059..8639bfa0f0b6 --- a/testautomation/global/sid/all.sid +++ b/testautomation/global/sid/all.sid @@ -87,8 +87,6 @@ BearbeitenAllesAuswaehlen SID_SELECTALL BearbeitenSuchenErsetzen SID_SEARCH_DLG BearbeitenNavigator SID_NAVIGATOR BearbeitenAutoText FN_GLOSSARY_DLG -BearbeitenRahmendokument SID_EDIT_FRAMESET -BearbeitenFrameSet SID_EDIT_FRAMESET BearbeitenPlugIn SID_PLUGINS_ACTIVE BearbeitenImageMap SID_IMAP BearbeitenLiteraturdatenbank SID_COMP_BIBLIOGRAPHY diff --git a/testautomation/global/sid/bars.sid b/testautomation/global/sid/bars.sid old mode 100644 new mode 100755 index c22ff6975c02..ecb15a79aaf1 --- a/testautomation/global/sid/bars.sid +++ b/testautomation/global/sid/bars.sid @@ -13,7 +13,6 @@ ' ** ' ** f�r alle FL_URL SID_OPENURL -FL_StopBrowse SID_BROWSE_STOP FL_NeuLaden SID_RELOAD FL_Bearbeiten SID_EDITDOC FL_Speichern SID_SAVEDOC @@ -243,15 +242,6 @@ OL_KLEBE_VertikalUnten SID_GLUE_VERTALIGN_BOTTOM ' ** Frameset ' - normal -OL_FRAME_Bearbeiten SID_EDIT_FRAMESET -OL_FRAME_Name SID_FRAME_NAME -OL_FRAME_Inhalt SID_FRAME_CONTENT -OL_FRAME_HorizontalTeilen SID_SPLIT_HORIZONTAL -OL_FRAME_VertikalTeilen SID_SPLIT_VERTICAL -OL_FRAME_HorizontalEinfuegen SID_SPLIT_PARENT_HORIZONTAL -OL_FRAME_VertikalEinfuegen SID_SPLIT_PARENT_VERTICAL -OL_FRAME_Eigenschaften SID_MODIFY_FRAME -OL_FRAME_Zwischenraum SID_FRAMESPACING OL_FRAME_HTMLQuelltext SID_SOURCEVIEW ' ** Basicdokument diff --git a/testautomation/global/sid/e_all.sid b/testautomation/global/sid/e_all.sid old mode 100644 new mode 100755 index 82b161d7f51d..ffc64ab5c565 --- a/testautomation/global/sid/e_all.sid +++ b/testautomation/global/sid/e_all.sid @@ -67,7 +67,6 @@ EditPaste SID_PASTE EditDelete SID_DELETE EditSelectAll SID_SELECTALL EditSearchAndReplace SID_SEARCH_DLG -EditFrameSet SID_EDIT_FRAMESET EditPlugIn SID_PLUGINS_ACTIVE EditImageMap SID_IMAP EditObjectEdit .uno:ObjectMenue?VerbID:short=0 diff --git a/testautomation/global/win/bars.win b/testautomation/global/win/bars.win index 993ce8347d90..fb34b4548564 100755 --- a/testautomation/global/win/bars.win +++ b/testautomation/global/win/bars.win @@ -1055,7 +1055,6 @@ SortAscending .uno:SortAscending SortDescending .uno:SortDescending Speichern .uno:Save SpeichernAls .uno:SaveAs -StopBrowse SID_BROWSE_STOP URLEingabe .uno:OpenUrl Undo .uno:Undo DocumentAsEMail .uno:SendMail -- cgit v1.2.3 From 5bab3af95158025e439be06b9b9b4233c1f3c714 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 27 Jan 2010 15:50:07 +0100 Subject: native0: committing this file, because someone else changed it in this cws, and obviously forgot to commit it ((IS and CD) --- testautomation/global/system/includes/iniinfo.inc | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 testautomation/global/system/includes/iniinfo.inc diff --git a/testautomation/global/system/includes/iniinfo.inc b/testautomation/global/system/includes/iniinfo.inc old mode 100644 new mode 100755 index a5ef11521e5f..acb6d5ad337b --- a/testautomation/global/system/includes/iniinfo.inc +++ b/testautomation/global/system/includes/iniinfo.inc @@ -905,6 +905,7 @@ function getSofficeNative() as string sVendor(iVendorEntries) = "OpenOffice.org" : inc (iVendorEntries) iOfficeEntries = 1 + sOffice(iOfficeEntries) = "Oracle Open Office" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "StarOffice" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "StarSuite" : inc (iOfficeEntries) sOffice(iOfficeEntries) = "OpenOffice.org": inc (iOfficeEntries) -- cgit v1.2.3 From e5b5d2c23ba9f52e3d5ebed91a5d34fe109dde68 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 27 Jan 2010 15:57:47 +0100 Subject: native0: committing this file, because someone else changed it in this cws, and obviously forgot to commit it ((IS and CD) --- testautomation/global/system/includes/status.inc | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 testautomation/global/system/includes/status.inc diff --git a/testautomation/global/system/includes/status.inc b/testautomation/global/system/includes/status.inc old mode 100755 new mode 100644 -- cgit v1.2.3 From a6a2edbd30c81a506a970b115c27e9c9dea422ac Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Fri, 26 Mar 2010 16:24:15 +0100 Subject: native0: changes for Oracle products - transplanted from 70a54173d1a5@native0 --- instsetoo_native/util/openoffice.lst | 1 + solenv/bin/modules/installer/globals.pm | 2 +- solenv/bin/modules/installer/windows/directory.pm | 1 + solenv/bin/modules/installer/ziplist.pm | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index f42fde4960f7..03d96cf50070 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -36,6 +36,7 @@ Globals UPDATE_DATABASE_LISTNAME finals_instsetoo.txt PACKAGEMAP package_names.txt,package_names_ext.txt WINDOWSPATCHLEVEL 6 + OPENSOURCE 1 } } } diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 79cbd3a8cc80..aeeb172c8325 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -268,7 +268,7 @@ BEGIN $isopensourceproduct = 1; $manufacturer = ""; $longmanufacturer = ""; - $sundirname = "Sun"; + $sundirname = ""; $codefilename = "codes.txt"; $componentfilename = "components.txt"; $productcode = ""; diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 2ad207731b51..2a9463f508a1 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -320,6 +320,7 @@ sub add_root_directories if ( $allvariableshashref->{'SUNDIR'} ) { + if ( $allvariableshashref->{'SUNDIRNAME'} ) { $installer::globals::sundirname = $allvariableshashref->{'SUNDIRNAME'}; } $oneline = "sundirectory\t$installer::globals::programfilesfolder\t$installer::globals::sundirname$sourcediraddon\n"; push(@{$directorytableref}, $oneline); diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index a434163b0dd9..00de1709473b 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -644,7 +644,8 @@ sub set_manufacturer my ($allvariables) = @_; my $openofficeproductname = "OpenOffice.org"; - my $sunname = "Sun Microsystems"; + my $sunname = ""; + if ( $allvariables->{'OPENSOURCE'} && $allvariables->{'OPENSOURCE'} == 1 ) { @@ -655,6 +656,8 @@ sub set_manufacturer else { $installer::globals::isopensourceproduct = 0; + if (( $allvariables->{'DEFINEDMANUFACTURER'} ) && ( $allvariables->{'DEFINEDMANUFACTURER'} ne "" )) { $sunname = $allvariables->{'DEFINEDMANUFACTURER'}; } + else { installer::exiter::exit_program("ERROR: Property DEFINEDMANUFACTURER has to be set for this product!", "set_manufacturer"); } $installer::globals::manufacturer = $sunname; $installer::globals::longmanufacturer = $sunname . ", Inc."; } -- cgit v1.2.3 From 2bb00c56dafb09bc6d5166d366aa66a82ff17a3a Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 27 Jan 2010 19:03:33 +0100 Subject: native0: #161561# new products --- scp2/source/ooo/module_systemint.scp | 2 +- solenv/bin/modules/installer/setupscript.pm | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scp2/source/ooo/module_systemint.scp b/scp2/source/ooo/module_systemint.scp index ea9faa7e765c..152b75ec63a4 100644 --- a/scp2/source/ooo/module_systemint.scp +++ b/scp2/source/ooo/module_systemint.scp @@ -41,7 +41,7 @@ Module gid_Module_Optional_Systemintegration Styles = (SYSTEMMODULE,NOTRELOCATABLE,DONTSHOWINUSERINSTALL,INSTALLCANFAIL,USEFORCE); #endif #if (defined(LINUX)) || (defined(SOLARIS)) - PackageName = "%UNIXPRODUCTNAME-desktop-integration.tar.gz"; + PackageName = "%UNIXPACKAGENAME-desktop-integration.tar.gz"; #else PackageName = ""; #endif diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index 77bbe9b50fe9..727087a1956d 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -156,15 +156,24 @@ sub add_lowercase_productname_setupscriptvariable push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; - if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); + if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } + $newline = "\%UNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; - if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $value =~ s/\.//g; + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); + if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } + $newline = "\%WITHOUTDOTUNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); + $value = $original; } elsif ( $key eq "PRODUCTEXTENSION" ) { -- cgit v1.2.3 From 00c001d9db406540e59b635f4932ed719743052a Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 27 Jan 2010 19:03:33 +0100 Subject: native0: #161561# new products --- setup_native/source/packinfo/package_names.txt | 60 +++--- setup_native/source/packinfo/packinfo_brand.txt | 60 +++--- setup_native/source/packinfo/packinfo_office.txt | 242 +++++++++++------------ 3 files changed, 181 insertions(+), 181 deletions(-) diff --git a/setup_native/source/packinfo/package_names.txt b/setup_native/source/packinfo/package_names.txt index cb453b2e064c..094337689f1c 100644 --- a/setup_native/source/packinfo/package_names.txt +++ b/setup_native/source/packinfo/package_names.txt @@ -41,33 +41,33 @@ %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-testtool Testtool module for OpenOffice.org %OOOBASEVERSION %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer Writer module for OpenOffice.org %OOOBASEVERSION %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-xsltfilter XSLT filter samples module for OpenOffice.org %OOOBASEVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-af Af dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-cs Cs dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-da Da dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de De dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-en En dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-es Es dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-et Et dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-fr Fr dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-hu Hu dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-it It dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-lt Lt dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ne Ne dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-nl Nl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pl Pl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pt Pt dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ru Ru dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sk Sk dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sl Sl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sv Sv dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sw Sw dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-th Th dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-zu Zu dictionary for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION Brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-%LANGUAGESTRING Brand language module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-base Base brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-calc Calc brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-draw Draw brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-impress Impress brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-math Math brand module for %PRODUCTNAME %PRODUCTVERSION -%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-writer Writer brand module for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af Af dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs Cs dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da Da dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de De dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en En dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es Es dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et Et dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr Fr dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu Hu dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it It dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt Lt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne Ne dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl Nl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl Pl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt Pt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru Ru dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk Sk dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl Sl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv Sv dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw Sw dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th Th dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu Zu dictionary for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION Brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING Brand language module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-base Base brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-calc Calc brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-draw Draw brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-impress Impress brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-math Math brand module for %PRODUCTNAME %PRODUCTVERSION +%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-writer Writer brand module for %PRODUCTNAME %PRODUCTVERSION diff --git a/setup_native/source/packinfo/packinfo_brand.txt b/setup_native/source/packinfo/packinfo_brand.txt index c4fcd6ea6ed7..3c9a17a5cab1 100644 --- a/setup_native/source/packinfo/packinfo_brand.txt +++ b/setup_native/source/packinfo/packinfo_brand.txt @@ -28,8 +28,8 @@ Start module = "gid_Module_Root_Brand" # script = "shellscripts_brand.txt" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%BASISPACKAGEPREFIX%OOOBASEVERSION-images" solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-images (Name="Images module for %PRODUCTNAME %PRODUCTVERSION")" copyright = "1999-2009 by %PRODUCTNAME" @@ -42,10 +42,10 @@ End Start module = "gid_Module_Brand_Prg_Wrt" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-writer" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-writer" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-writer" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-writer" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-writer" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -56,10 +56,10 @@ End Start module = "gid_Module_Brand_Prg_Calc" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-calc" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-calc" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-calc" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-calc" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-calc" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-calc" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-calc" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -70,10 +70,10 @@ End Start module = "gid_Module_Brand_Prg_Impress" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-impress" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-impress" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-impress" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-impress" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-impress" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-impress" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -84,10 +84,10 @@ End Start module = "gid_Module_Brand_Prg_Draw" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-draw" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-draw" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-draw" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-draw" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-draw" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-draw" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-draw" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -98,10 +98,10 @@ End Start module = "gid_Module_Brand_Prg_Math" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-math" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-math" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-math" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-math" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-math" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-math" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-math" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -112,10 +112,10 @@ End Start module = "gid_Module_Brand_Prg_Base" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-base" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-base" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-base" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-base" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-base" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-base" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-base" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" @@ -126,10 +126,10 @@ End Start module = "gid_Module_Langpack_Brand" -solarispackagename = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" -requires = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-base,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-calc,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-draw,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-help,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-impress,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-math,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-res,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-writer" -solarisrequires = "%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING (Name="Language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base (Name="Base language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc (Name="Calc language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw (Name="Draw language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help (Name="Help language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress (Name="Impress language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math (Name="Math language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res (Name="Resource language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer (Name="Writer language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING")" +solarispackagename = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING" +requires = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-base,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-calc,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-draw,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-help,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-impress,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-math,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-res,%BASISPACKAGEPREFIX%OOOBASEVERSION-%LANGUAGESTRING-writer" +solarisrequires = "%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION,%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING (Name="Language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-base (Name="Base language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-calc (Name="Calc language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-draw (Name="Draw language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-help (Name="Help language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-impress (Name="Impress language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-math (Name="Math language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-res (Name="Resource language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING"),%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-%LANGUAGESTRING-writer (Name="Writer language module for %PRODUCTNAME %PRODUCTVERSION\, language %LANGUAGESTRING")" copyright = "1999-2009 by %PRODUCTNAME" solariscopyright = "solariscopyrightfile" vendor = "%PRODUCTNAME" diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index ffbcb3da15a6..a16c32f0e8df 100755 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -478,10 +478,10 @@ End Start module = "gid_Module_Root_Extension_Oooimprovement" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-oooimprovement" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-oooimprovement" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2008 by Sun Microsystems" solariscopyright = "solariscopyrightfile" @@ -494,10 +494,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Af" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-af" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-af" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -526,10 +526,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Cs" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-cs" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-cs" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -542,10 +542,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Da" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-da" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-da" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -558,15 +558,15 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_AT" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-AT" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-AT" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." -description = "De-AT dictionary for %PRODUCTNAME %PRODUCTVERSION" +vendor = "Oracle, Inc." +description = "De-AT dictionary for %PACKAGENAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" End @@ -574,15 +574,15 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_CH" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-CH" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-CH" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." -description = "De-CH dictionary for %PRODUCTNAME %PRODUCTVERSION" +vendor = "Oracle, Inc." +description = "De-CH dictionary for %PACKAGENAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" End @@ -590,15 +590,15 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_DE" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-DE" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-de-DE" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -copyright = "1999-2009 by Sun Microsystems" +copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -vendor = "Sun Microsystems, Inc." -description = "De-DE dictionary for %PRODUCTNAME %PRODUCTVERSION" +vendor = "Oracle, Inc." +description = "De-DE dictionary for %PACKAGENAME %PRODUCTVERSION" destpath = "/opt" packageversion = "%PACKAGEVERSION" End @@ -606,10 +606,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_En" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-en" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-en" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -622,10 +622,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Es" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-es" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-es" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -638,10 +638,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Et" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-et" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-et" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -654,10 +654,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Fr" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-fr" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-fr" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -671,9 +671,9 @@ Start module = "gid_Module_Root_Extension_Dictionary_Gl" script = "shellscripts_extensions.txt" solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-gl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-gl" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -686,10 +686,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_He" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-he" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-he" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -702,10 +702,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Hu" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-hu" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-hu" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -718,10 +718,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_It" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-it" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-it" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -734,10 +734,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Lt" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-lt" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-lt" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -750,10 +750,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ne" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ne" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ne" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -766,10 +766,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Nl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-nl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-nl" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -798,10 +798,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pl" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -814,10 +814,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pt" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pt" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-pt" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -846,10 +846,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ru" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ru" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-ru" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -862,10 +862,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sk" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sk" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sk" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -878,10 +878,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sl" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -894,10 +894,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sr" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sr" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION (Name="Brand module for %PRODUCTNAME %PRODUCTVERSION")" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sr" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION (Name="Brand module for %PRODUCTNAME %PRODUCTVERSION")" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2007 by Sun Microsystems" solariscopyright = "solariscopyrightfile" @@ -910,10 +910,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sv" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sv" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sv" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -926,10 +926,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sw" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sw" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-sw" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -942,10 +942,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Th" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-th" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-th" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -959,9 +959,9 @@ Start module = "gid_Module_Root_Extension_Dictionary_Vi" script = "shellscripts_extensions.txt" solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-vi" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-vi" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" @@ -974,10 +974,10 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Zu" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-zu" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPRODUCTNAME%BRANDPACKAGEVERSION" -packagename = "%UNIXPRODUCTNAME%BRANDPACKAGEVERSION-dict-zu" -requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPRODUCTNAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" +requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" copyright = "1999-2010 by Oracle" solariscopyright = "solariscopyrightfile" -- cgit v1.2.3 From bb091275da4ed1b2b6c0184ee9a2cf14e8d0df48 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 14:12:41 +0100 Subject: autorecovery: merged DocumentMacroConfirmationRequest2 into DocumentMacroConfirmationRequest - no need to have two types which are effectively the same, and both rarely used --- .../star/task/DocumentMacroConfirmationRequest.idl | 7 +- .../task/DocumentMacroConfirmationRequest2.idl | 83 ---------------------- offapi/com/sun/star/task/makefile.mk | 1 - 3 files changed, 6 insertions(+), 85 deletions(-) delete mode 100644 offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl index de6c5b3d070b..923d4433abfa 100644 --- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl +++ b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl @@ -51,7 +51,8 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest */ string DocumentURL; - /** refers to the storage which the document was last committed to. + /** refers to the storage related to the last commited version of the + document. This storage is necessary e.g. for displaying the existing signatures to the user, to allow him a decision whether or not to trust those signatures @@ -62,6 +63,10 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest ::com::sun::star::embed::XStorage DocumentStorage; + /** contains informations about the ODF version of the document + */ + string DocumentVersion; + /** contains informations about the signatures in the document */ sequence< ::com::sun::star::security::DocumentSignatureInformation > diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl deleted file mode 100644 index 422f1ab2a9d0..000000000000 --- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: DocumentMacroConfirmationRequest.idl,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __com_sun_star_task_DocumentMacroConfirmationRequest2_idl__ -#define __com_sun_star_task_DocumentMacroConfirmationRequest2_idl__ - -#include -#include -#include - - -//============================================================================= - -module com { module sun { module star { module task { - -//============================================================================= - -/** describes the request to approve or deny the execution of macros contained in - a document. - */ -exception DocumentMacroConfirmationRequest2 : ClassifiedInteractionRequest -{ - /** specifies the URL of the document which contains macros whose execution - should be approved or rejected. - */ - string DocumentURL; - - /** refers to the zip-storage related to the last commited version of the - document. - - This storage is necessary e.g. for displaying the existing signatures to - the user, to allow him a decision whether or not to trust those signatures - and thus the signed macros. - - @see ::com::sun::star::security::XDocumentDigitalSignatures::showScriptingContentSignatures - */ - ::com::sun::star::embed::XStorage - DocumentZipStorage; - - /** contains informations about the ODF version of the document - */ - string DocumentVersion; - - /** contains informations about the signatures in the document - */ - sequence< ::com::sun::star::security::DocumentSignatureInformation > - DocumentSignatureInformation; -}; - -//============================================================================= - -}; }; }; }; - -//============================================================================= - -#endif diff --git a/offapi/com/sun/star/task/makefile.mk b/offapi/com/sun/star/task/makefile.mk index dc54f6fd3883..a4695b0fd0ce 100644 --- a/offapi/com/sun/star/task/makefile.mk +++ b/offapi/com/sun/star/task/makefile.mk @@ -45,7 +45,6 @@ PACKAGE=com$/sun$/star$/task IDLFILES=\ ClassifiedInteractionRequest.idl\ DocumentMacroConfirmationRequest.idl\ - DocumentMacroConfirmationRequest2.idl\ DocumentPasswordRequest.idl\ DocumentMSPasswordRequest.idl\ ErrorCodeRequest.idl\ -- cgit v1.2.3 From c938e6a7c0ab54c8f5d9be9c1d45fc336a3f14a7 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 28 Jan 2010 14:40:57 +0100 Subject: native0: #161561# new product --- scp2/source/ooo/module_systemint.scp | 2 +- solenv/bin/make_installer.pl | 5 ++++ solenv/bin/modules/installer/setupscript.pm | 42 +++++++++++++++++++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/scp2/source/ooo/module_systemint.scp b/scp2/source/ooo/module_systemint.scp index 152b75ec63a4..f02b5be04368 100644 --- a/scp2/source/ooo/module_systemint.scp +++ b/scp2/source/ooo/module_systemint.scp @@ -41,7 +41,7 @@ Module gid_Module_Optional_Systemintegration Styles = (SYSTEMMODULE,NOTRELOCATABLE,DONTSHOWINUSERINSTALL,INSTALLCANFAIL,USEFORCE); #endif #if (defined(LINUX)) || (defined(SOLARIS)) - PackageName = "%UNIXPACKAGENAME-desktop-integration.tar.gz"; + PackageName = "${SYSTEMINTUNIXPACKAGENAME}-desktop-integration.tar.gz"; #else PackageName = ""; #endif diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index a2f552eceb8d..bde0763e4564 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -394,9 +394,14 @@ if ( $installer::globals::globallogging ) { installer::files::save_hash($logging installer::setupscript::add_forced_properties($allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_hash($loggingdir . "allvariables5.log", $allvariableshashref); } +# Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME) +installer::setupscript::replace_preset_properties($allvariableshashref); +if ( $installer::globals::globallogging ) { installer::files::save_hash($loggingdir . "allvariables6.log", $allvariableshashref); } + installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "setupscript3.log" ,$setupscriptref); } + installer::logger::log_hashref($allvariableshashref); installer::logger::print_message( "... analyzing directories ... \n" ); diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index 727087a1956d..9da5340f915f 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -159,7 +159,9 @@ sub add_lowercase_productname_setupscriptvariable # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); - if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + $newline = "\%SYSTEMINTUNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } $newline = "\%UNIXPACKAGENAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); @@ -169,10 +171,12 @@ sub add_lowercase_productname_setupscriptvariable # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); - if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } $newline = "\%WITHOUTDOTUNIXPACKAGENAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); + $newline = "\%SOLARISBRANDPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); $value = $original; } elsif ( $key eq "PRODUCTEXTENSION" ) @@ -493,4 +497,38 @@ sub add_forced_properties } } +##################################################################################### +# Some properties are created automatically. It should be possible to +# overwrite them, with PRESET properties. For example UNIXPRODUCTNAME +# with PRESETUNIXPRODUCTNAME, if this is defined and the automatic process +# does not deliver the desired results. +##################################################################################### + +sub replace_preset_properties +{ + my ($allvariables) = @_; + + # SOLARISBRANDPACKAGENAME + # needs to be replaced by + # PRESETSOLARISBRANDPACKAGENAME + + my @presetproperties = (); + push(@presetproperties, "SOLARISBRANDPACKAGENAME"); + push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); + # push(@presetproperties, "UNIXPACKAGENAME"); + # push(@presetproperties, "WITHOUTDOTUNIXPACKAGENAME"); + # push(@presetproperties, "UNIXPRODUCTNAME"); + # push(@presetproperties, "WITHOUTDOTUNIXPRODUCTNAME"); + + + foreach $property ( @presetproperties ) + { + my $presetproperty = "PRESET" . $property; + if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" )) + { + $allvariables->{$property} = $allvariables->{$presetproperty}; + } + } +} + 1; -- cgit v1.2.3 From a8a309cdce830e35fd995a1ed6407b1bfc8907ac Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 28 Jan 2010 14:40:57 +0100 Subject: native0: #161561# new product --- setup_native/source/packinfo/package_names.txt | 44 ++++----- setup_native/source/packinfo/packinfo_office.txt | 116 +++++++++++------------ 2 files changed, 80 insertions(+), 80 deletions(-) diff --git a/setup_native/source/packinfo/package_names.txt b/setup_native/source/packinfo/package_names.txt index 094337689f1c..7e7276c2fa40 100644 --- a/setup_native/source/packinfo/package_names.txt +++ b/setup_native/source/packinfo/package_names.txt @@ -41,28 +41,28 @@ %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-testtool Testtool module for OpenOffice.org %OOOBASEVERSION %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-writer Writer module for OpenOffice.org %OOOBASEVERSION %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-xsltfilter XSLT filter samples module for OpenOffice.org %OOOBASEVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af Af dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs Cs dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da Da dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de De dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en En dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es Es dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et Et dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr Fr dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu Hu dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it It dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt Lt dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne Ne dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl Nl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl Pl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt Pt dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru Ru dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk Sk dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl Sl dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv Sv dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw Sw dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th Th dictionary for %PRODUCTNAME %PRODUCTVERSION -%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu Zu dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-af Af dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-cs Cs dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-da Da dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de De dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-en En dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-es Es dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-et Et dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-fr Fr dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-hu Hu dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-it It dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-lt Lt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ne Ne dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-nl Nl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pl Pl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pt Pt dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ru Ru dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sk Sk dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sl Sl dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sv Sv dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sw Sw dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-th Th dictionary for %PRODUCTNAME %PRODUCTVERSION +%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-zu Zu dictionary for %PRODUCTNAME %PRODUCTVERSION %WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION Brand module for %PRODUCTNAME %PRODUCTVERSION %WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-%LANGUAGESTRING Brand language module for %PRODUCTNAME %PRODUCTVERSION %WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-base Base brand module for %PRODUCTNAME %PRODUCTVERSION diff --git a/setup_native/source/packinfo/packinfo_office.txt b/setup_native/source/packinfo/packinfo_office.txt index a16c32f0e8df..5d8bf717fc80 100755 --- a/setup_native/source/packinfo/packinfo_office.txt +++ b/setup_native/source/packinfo/packinfo_office.txt @@ -478,8 +478,8 @@ End Start module = "gid_Module_Root_Extension_Oooimprovement" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-oooimprovement" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -494,8 +494,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Af" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-af" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-af" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -526,8 +526,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Cs" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-cs" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -542,8 +542,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Da" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-da" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-da" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -558,8 +558,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_AT" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-AT" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -574,8 +574,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_CH" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-CH" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -590,8 +590,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_De_DE" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-de-DE" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -606,8 +606,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_En" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-en" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-en" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -622,8 +622,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Es" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-es" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-es" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -638,8 +638,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Et" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-et" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-et" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -654,8 +654,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Fr" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-fr" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -670,8 +670,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Gl" script = "shellscripts_extensions.txt" -solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-gl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-gl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-gl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -686,8 +686,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_He" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-he" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-he" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -702,8 +702,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Hu" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-hu" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -718,8 +718,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_It" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-it" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-it" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -734,8 +734,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Lt" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-lt" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -750,8 +750,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ne" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ne" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -766,8 +766,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Nl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-nl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -798,8 +798,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -814,8 +814,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Pt" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-pt" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -846,8 +846,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Ru" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-ru" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -862,8 +862,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sk" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sk" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -878,8 +878,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sl" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sl" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -894,8 +894,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sr" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION (Name="Brand module for %PRODUCTNAME %PRODUCTVERSION")" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure (Name="UNO Runtime Environment"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07 (Name="Core module for %PRODUCTNAME %PRODUCTVERSION"), %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION (Name="Brand module for %PRODUCTNAME %PRODUCTVERSION")" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sr" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -910,8 +910,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sv" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sv" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -926,8 +926,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Sw" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-sw" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -942,8 +942,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Th" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-th" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-th" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -958,8 +958,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Vi" script = "shellscripts_extensions.txt" -solarispackagename = "%BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-dict-vi" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-vi" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%BASISPACKAGEPREFIX%OOOBASEVERSION-dict-vi" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" @@ -974,8 +974,8 @@ End Start module = "gid_Module_Root_Extension_Dictionary_Zu" script = "shellscripts_extensions.txt" -solarispackagename = "%PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" -solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%WITHOUTDOTUNIXPACKAGENAME%BRANDPACKAGEVERSION" +solarispackagename = "%PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" +solarisrequires = "%SOLSUREPACKAGEPREFIX-ure, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core01, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core02, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core03, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core04, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core05, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core06, %BASISPACKAGEPREFIX%WITHOUTDOTOOOBASEVERSION-core07, %PACKAGEPREFIX%SOLARISBRANDPACKAGENAME%BRANDPACKAGEVERSION" packagename = "%UNIXPACKAGENAME%BRANDPACKAGEVERSION-dict-zu" requires = "%UREPACKAGEPREFIX-ure,%BASISPACKAGEPREFIX%OOOBASEVERSION-core01,%BASISPACKAGEPREFIX%OOOBASEVERSION-core02,%BASISPACKAGEPREFIX%OOOBASEVERSION-core03,%BASISPACKAGEPREFIX%OOOBASEVERSION-core04,%BASISPACKAGEPREFIX%OOOBASEVERSION-core05,%BASISPACKAGEPREFIX%OOOBASEVERSION-core06,%BASISPACKAGEPREFIX%OOOBASEVERSION-core07,%UNIXPACKAGENAME%BRANDPACKAGEVERSION" linuxpatchrequires = "" -- cgit v1.2.3 From c89b3d923e6bd28546ed2d4a444b6f6ed297d826 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx | 3 ++- sd/source/ui/slidesorter/view/SlsPageObject.cxx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx index 9769731ab52c..7b545de7d6d5 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObject.hxx @@ -57,7 +57,8 @@ public: private: model::SharedPageDescriptor mpDescriptor; - virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact (void); +protected: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); }; diff --git a/sd/source/ui/slidesorter/view/SlsPageObject.cxx b/sd/source/ui/slidesorter/view/SlsPageObject.cxx index 27bc2e131e9f..d4a139fc2cc7 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObject.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObject.cxx @@ -70,7 +70,7 @@ SharedPageDescriptor PageObject::GetDescriptor (void) const -sdr::contact::ViewContact* PageObject::CreateObjectSpecificViewContact (void) +sdr::contact::ViewContact* PageObject::CreateObjectSpecificViewContact() { if (mpDescriptor.get() != NULL) return mpDescriptor->GetPageObjectFactory().CreateViewContact(this, mpDescriptor); -- cgit v1.2.3 From 23ca8c9a0e372d14c83091e5d86dbb3affffc78c Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Thu, 28 Jan 2010 17:21:44 +0100 Subject: aw079: #i99147# corrected diverse aspects of invisible object visualisation and interaction --- sw/inc/dcontact.hxx | 2 +- sw/source/core/draw/dflyobj.cxx | 11 +++++------ sw/source/core/inc/dflyobj.hxx | 5 ++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index e1f20183deca..d035f6e70b47 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -305,7 +305,7 @@ class SwDrawVirtObj : public SdrVirtObj using SdrVirtObj::GetPlusHdl; - private: + protected: // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is // not used but something own (top left of new SnapRect minus top left // of original SnapRect) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 6346e920b206..964d597aa70e 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -72,8 +72,7 @@ using namespace ::com::sun::star; #include #include #include -#include -#include +#include using namespace ::com::sun::star; @@ -245,15 +244,15 @@ namespace drawinglayer if(!getOuterRange().isEmpty()) { // currently this SW object has no primitive representation. As long as this is the case, - // create an invisible HitTestPrimitive to allow hitting the object. Use a filled primitive - // to get a HitTest which uses 'inside' as default object hit. The special cases from + // create invisible geometry to allow corfect HitTest and BoundRect calculations for the + // object. Use a filled primitive to get 'inside' as default object hit. The special cases from // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj; // this removed the 'hack' to get a view from inside model data or to react on null-tolerance // as it was done in the old implementation const Primitive2DReference aHitTestReference( - createFallbackHitTestPrimitive( + createHiddenGeometryPrimitives2D( true, - basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(getOuterRange())))); + getOuterRange())); aRetval = Primitive2DSequence(&aHitTestReference, 1); } diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 292be49df7b4..018314756602 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -47,8 +47,10 @@ const UINT16 SwDrawFirst = 0x0001; class SwFlyDrawObj : public SdrObject { +private: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); +protected: // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence() // is called when RecalcBoundRect() is used virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); @@ -73,9 +75,10 @@ public: class SwVirtFlyDrawObj : public SdrVirtObj { +private: SwFlyFrm *pFlyFrm; -private: +protected: // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is // not used but something own (top left of new SnapRect minus top left // of original SnapRect) -- cgit v1.2.3 From 67f02ec2e2aea15b32883ee479457fcc1fdfc806 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 22:19:50 +0100 Subject: autorecovery: move the responsibility for calling attachResource into recoverFromFile. This saves us from some problems with SFX-based documents, which change there Args during the load process (during macro confirmation), so a later attachResource from outside would overwrite those changed args --- .../source/core/dataaccess/databasedocument.cxx | 23 ++++++++++++++++------ .../source/core/dataaccess/databasedocument.hxx | 17 ++++++++++++++++ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 67e97110ad0f..64b667e89d14 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -668,6 +668,11 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_Sourc // Without a controller, we are unable to recover the sub components, as they're always tied to a controller. // So, everything else is done when the first controller is connected. m_bHasBeenRecovered = true; + + // by definition (of XDocumentRecovery), we're responsible for delivering a fully-initialized document, + // which includes an attachResource call. + impl_attachResource( i_SourceLocation, aMediaDescriptor.getPropertyValues(), aGuard ); + // <- SYNCHRONIZED } catch( const Exception& ) { @@ -690,10 +695,16 @@ void SAL_CALL ODatabaseDocument::recoverFromFile( const ::rtl::OUString& i_Sourc sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rArguments ) throw (RuntimeException) { DocumentGuard aGuard( *this, DocumentGuard::MethodUsedDuringInit ); + return impl_attachResource( _rURL, _rArguments, aGuard ); +} - if ( ( _rURL == getURL() ) - && ( _rArguments.getLength() == 1 ) - && ( _rArguments[0].Name.compareToAscii( "BreakMacroSignature" ) == 0 ) +// ----------------------------------------------------------------------------- +sal_Bool ODatabaseDocument::impl_attachResource( const ::rtl::OUString& i_rURL, const Sequence< PropertyValue >& i_rMediaDescriptor, + DocumentGuard& _rDocGuard ) +{ + if ( ( i_rURL == getURL() ) + && ( i_rMediaDescriptor.getLength() == 1 ) + && ( i_rMediaDescriptor[0].Name.compareToAscii( "BreakMacroSignature" ) == 0 ) ) { // this is a BAD hack of the Basic importer code ... there should be a dedicated API for this, @@ -703,13 +714,13 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR } // if no URL has been provided, the caller was lazy enough to not call our getLocation/getURL - which is allowed ... - ::rtl::OUString sURL( _rURL ); + ::rtl::OUString sURL( i_rURL ); if ( !sURL.getLength() ) sURL = getLocation(); if ( !sURL.getLength() ) sURL = getURL(); - m_pImpl->attachResource( sURL, _rArguments ); + m_pImpl->attachResource( sURL, i_rMediaDescriptor ); if ( impl_isInitializing() ) { // this means we've just been loaded, and this is the attachResource call which follows @@ -721,7 +732,7 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR // should know this before anybody actually uses the object. m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros ); - aGuard.clear(); + _rDocGuard.clear(); // <- SYNCHRONIZED m_aEventNotifier.notifyDocumentEvent( "OnLoadFinished" ); } diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 446a344dfebc..f3206fbc15ae 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -609,6 +609,23 @@ private: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor, DocumentGuard& _rDocGuard ) const; + + + /** impl-version of attachResource + + @param i_rURL + denotes the URL the document was loaded from + @param i_rMediaDescriptor + denotes additional document parameters + @param _rDocGuard + is the guard which currently protects the document instance + + */ + sal_Bool impl_attachResource( + const ::rtl::OUString& i_rURL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rMediaDescriptor, + DocumentGuard& _rDocGuard + ); }; /** an extended version of the ModelMethodGuard, which also cares for the initialization state -- cgit v1.2.3 From 760fde3a707688c8803c4b5b69a1c117124654a1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 22:19:50 +0100 Subject: autorecovery: move the responsibility for calling attachResource into recoverFromFile. This saves us from some problems with SFX-based documents, which change there Args during the load process (during macro confirmation), so a later attachResource from outside would overwrite those changed args --- offapi/com/sun/star/document/XDocumentRecovery.idl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl index 1e9113201476..bed764957296 100644 --- a/offapi/com/sun/star/document/XDocumentRecovery.idl +++ b/offapi/com/sun/star/document/XDocumentRecovery.idl @@ -82,14 +82,19 @@ interface XDocumentRecovery ::com::sun::star::lang::WrappedTargetException ); - /** recovers the document after a previous emergency save. + /** recovers the document after a previous emergency or session save.

The document itself has previously been created, but not loaded (via XLoadable::load) or initialized (via XLoadable::initNew).

+

Upon successful return, the document must be fully initialized. In particular, the + caller is not responsible for calling XModel::attachResource. + Instead, the implementation is responsible to do so, if required.

+

A default implementation of this method could simply delegate this call to - XLodable::load.

+ XLodable::load, followed by + XModel::attachResource.

@param SourceLocation specifies the URL of the location to which the document was previously emergency-saved. -- cgit v1.2.3 From 630c4139a8be53e0ae6f214a8318765fb25cba44 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 22:34:45 +0100 Subject: autorecovery: creating dedicated core/recovery folder, taking current and future implementations regarding document recovery --- dbaccess/prj/build.lst | 3 +- .../source/core/dataaccess/databasedocument.cxx | 2 +- dbaccess/source/core/dataaccess/dbdocrecovery.cxx | 702 --------------------- dbaccess/source/core/dataaccess/dbdocrecovery.hxx | 90 --- .../source/core/inc/recovery/dbdocrecovery.hxx | 90 +++ dbaccess/source/core/recovery/dbdocrecovery.cxx | 702 +++++++++++++++++++++ dbaccess/source/core/recovery/makefile.mk | 52 ++ dbaccess/util/makefile.mk | 1 + 8 files changed, 848 insertions(+), 794 deletions(-) delete mode 100644 dbaccess/source/core/dataaccess/dbdocrecovery.cxx delete mode 100644 dbaccess/source/core/dataaccess/dbdocrecovery.hxx create mode 100644 dbaccess/source/core/inc/recovery/dbdocrecovery.hxx create mode 100644 dbaccess/source/core/recovery/dbdocrecovery.cxx create mode 100644 dbaccess/source/core/recovery/makefile.mk diff --git a/dbaccess/prj/build.lst b/dbaccess/prj/build.lst index c52076ffa4a6..f9ba2e4abd5f 100644 --- a/dbaccess/prj/build.lst +++ b/dbaccess/prj/build.lst @@ -4,6 +4,7 @@ ba dbaccess\inc nmake - all ba_inc NULL ba dbaccess\source\ui\inc nmake - all ba_uiinc ba_inc NULL ba dbaccess\source\core\api nmake - all ba_capi ba_inc NULL ba dbaccess\source\core\dataaccess nmake - all ba_cdaccess ba_capi ba_inc NULL +ba dbaccess\source\core\recovery nmake - all ba_crecovery ba_inc NULL ba dbaccess\source\core\misc nmake - all ba_cmisc ba_cdaccess ba_inc NULL ba dbaccess\source\core\resource nmake - all ba_cres ba_cmisc ba_inc NULL ba dbaccess\source\filter\xml nmake - all ba_ffilter ba_shared ba_util ba_inc NULL @@ -24,6 +25,6 @@ ba dbaccess\source\ui\relationdesign nmake - all ba_uirelationdesign ba_uiinc b ba dbaccess\source\ui\tabledesign nmake - all ba_uitabledesign ba_uiinc ba_inc NULL ba dbaccess\source\ui\uno nmake - all ba_uiuno ba_uimisc ba_inc NULL ba dbaccess\source\ui\imagelists nmake - all ba_uiimglst ba_inc NULL -ba dbaccess\util nmake - all ba_util ba_uiimglst ba_capi ba_shared ba_uibrowser ba_uiapp ba_uicontrol ba_uidlg ba_uimisc ba_uiquery ba_uitabledesign ba_uirelationdesign ba_uiuno ba_conntools ba_misctools ba_miscres ba_ext_adabasui NULL +ba dbaccess\util nmake - all ba_util ba_uiimglst ba_capi ba_crecovery ba_shared ba_uibrowser ba_uiapp ba_uicontrol ba_uidlg ba_uimisc ba_uiquery ba_uitabledesign ba_uirelationdesign ba_uiuno ba_conntools ba_misctools ba_miscres ba_ext_adabasui NULL ba dbaccess\win32\source\odbcconfig nmake - w ba_odbcconfig ba_inc NULL ba dbaccess\qa\complex\dbaccess nmake - all ba_complex_tests NULL diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 64b667e89d14..c6b6db11a20c 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -41,7 +41,7 @@ #include "databasecontext.hxx" #include "documentcontainer.hxx" #include "sdbcoretools.hxx" -#include "dbdocrecovery.hxx" +#include "recovery/dbdocrecovery.hxx" /** === begin UNO includes === **/ #include diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx deleted file mode 100644 index 2f2bdcd667d6..000000000000 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx +++ /dev/null @@ -1,702 +0,0 @@ -/************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* -* for a copy of the LGPLv3 License. -************************************************************************/ - -#include "precompiled_dbaccess.hxx" - -#include "dbdocrecovery.hxx" -#include "sdbcoretools.hxx" -#include "dbastrings.hrc" - -/** === begin UNO includes === **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -/** === end UNO includes === **/ - -#include -#include -#include -#include -#include - -#include -#include - -//........................................................................ -namespace dbaccess -{ -//........................................................................ - - /** === begin UNO using === **/ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::embed::XStorage; - using ::com::sun::star::frame::XController; - using ::com::sun::star::sdb::application::XDatabaseDocumentUI; - using ::com::sun::star::frame::XModuleManager; - using ::com::sun::star::lang::XComponent; - using ::com::sun::star::document::XStorageBasedDocument; - using ::com::sun::star::beans::PropertyValue; - using ::com::sun::star::beans::Pair; - using ::com::sun::star::io::XStream; - using ::com::sun::star::io::XOutputStream; - using ::com::sun::star::io::XTextOutputStream; - using ::com::sun::star::io::XActiveDataSource; - using ::com::sun::star::io::XTextInputStream; - using ::com::sun::star::io::XActiveDataSink; - using ::com::sun::star::frame::XModel; - using ::com::sun::star::util::XModifiable; - /** === end UNO using === **/ - - namespace ElementModes = ::com::sun::star::embed::ElementModes; - namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; - - //==================================================================== - //= helpers - //==================================================================== - namespace - { - // ......................................................................... - enum SubComponentType - { - TABLE = DatabaseObject::TABLE, - QUERY = DatabaseObject::QUERY, - FORM = DatabaseObject::FORM, - REPORT = DatabaseObject::REPORT, - - RELATION_DESIGN = 1000, - - UNKNOWN = 10001 - }; - - struct SubComponentDescriptor - { - ::rtl::OUString sName; - bool bForEditing; - - SubComponentDescriptor() - :sName() - ,bForEditing( false ) - { - } - - SubComponentDescriptor( const ::rtl::OUString& i_rName, const bool i_bForEditing ) - :sName( i_rName ) - ,bForEditing( i_bForEditing ) - { - } - }; - - // ......................................................................... - typedef ::std::hash_map< ::rtl::OUString, SubComponentDescriptor, ::rtl::OUStringHash > MapStringToCompDesc; - typedef ::std::map< SubComponentType, MapStringToCompDesc > MapCompTypeToCompDescs; - - // ......................................................................... - void lcl_getPersistentRepresentation( const MapStringToCompDesc::value_type& i_rComponentDesc, ::rtl::OUStringBuffer& o_rBuffer ) - { - o_rBuffer.append( i_rComponentDesc.first ); - o_rBuffer.append( sal_Unicode( '=' ) ); - o_rBuffer.append( i_rComponentDesc.second.sName ); - o_rBuffer.append( sal_Unicode( ',' ) ); - o_rBuffer.append( sal_Unicode( i_rComponentDesc.second.bForEditing ? '1' : '0' ) ); - } - - // ......................................................................... - bool lcl_extractCompDesc( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc ) - { - const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( sal_Unicode( '=' ) ); - if ( nEqualSignPos < 1 ) - { - OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of '='" ); - return false; - } - o_rStorName = i_rIniLine.copy( 0, nEqualSignPos ); - - const sal_Int32 nCommaPos = i_rIniLine.lastIndexOf( sal_Unicode( ',' ) ); - if ( nCommaPos != i_rIniLine.getLength() - 2 ) - { - OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of ','" ); - return false; - } - o_rCompDesc.sName = i_rIniLine.copy( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 ); - o_rCompDesc.bForEditing = ( i_rIniLine.getStr()[ nCommaPos + 1 ] == '1' ); - return true; - } - - // ......................................................................... - SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) - { - switch ( i_nObjectType ) - { - case DatabaseObject::TABLE: return TABLE; - case DatabaseObject::QUERY: return QUERY; - case DatabaseObject::FORM: return FORM; - case DatabaseObject::REPORT:return REPORT; - default: - break; - } - return UNKNOWN; - } - - // ......................................................................... - const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() - { - static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); - return s_sRecDataStorName; - } - - // ......................................................................... - const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType ) - { - static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); - static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); - static const ::rtl::OUString s_sTablesStorageName( RTL_CONSTASCII_USTRINGPARAM( "tables" ) ); - static const ::rtl::OUString s_sQueriesStorageName( RTL_CONSTASCII_USTRINGPARAM( "queries" ) ); - static const ::rtl::OUString s_sRelationsStorageName( RTL_CONSTASCII_USTRINGPARAM( "relations" ) ); - - switch ( i_eType ) - { - case FORM: - return s_sFormsStorageName; - case REPORT: - return s_sReportsStorageName; - case TABLE: - return s_sTablesStorageName; - case QUERY: - return s_sQueriesStorageName; - case RELATION_DESIGN: - return s_sRelationsStorageName; - default: - break; - } - - OSL_ENSURE( false, "lcl_getComponentsStorageName: unimplemented case!" ); - static const ::rtl::OUString s_sFallback; - return s_sFallback; - } - - // ......................................................................... - const ::rtl::OUString& lcl_getObjectMapStreamName() - { - static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); - return s_sObjectMapStreamName; - } - - // ......................................................................... - const ::rtl::OUString& lcl_getMapStreamEncodingName() - { - static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) ); - return s_sMapStreamEncodingName; - } - - // ......................................................................... - void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, - const MapStringToCompDesc& i_mapStorageToCompDesc ) - { - if ( i_mapStorageToCompDesc.empty() ) - // nothing to do - return; - - ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); - Reference< XStream > xIniStream( i_rStorage->openStreamElement( - lcl_getObjectMapStreamName(), ElementModes::WRITE | ElementModes::TRUNCATE ), UNO_SET_THROW ); - - Reference< XTextOutputStream > xTextOutput( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW ); - xTextOutput->setEncoding( lcl_getMapStreamEncodingName() ); - - Reference< XActiveDataSource > xDataSource( xTextOutput, UNO_QUERY_THROW ); - xDataSource->setOutputStream( xIniStream->getOutputStream() ); - - const ::rtl::OUString sLineFeed( sal_Unicode( '\n' ) ); - xTextOutput->writeString( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) ); - xTextOutput->writeString( sLineFeed ); - - for ( MapStringToCompDesc::const_iterator stor = i_mapStorageToCompDesc.begin(); - stor != i_mapStorageToCompDesc.end(); - ++stor - ) - { - ::rtl::OUStringBuffer aLine; - lcl_getPersistentRepresentation( *stor, aLine ); - aLine.append( sLineFeed ); - - xTextOutput->writeString( aLine.makeStringAndClear() ); - } - - xTextOutput->writeString( sLineFeed ); - } - - // ......................................................................... - bool lcl_isSectionStart( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rSectionName ) - { - const sal_Int32 nLen = i_rIniLine.getLength(); - if ( ( nLen > 0 ) && ( i_rIniLine.getStr()[0] == '[' ) && ( i_rIniLine.getStr()[ nLen - 1 ] == ']' ) ) - { - o_rSectionName = i_rIniLine.copy( 1, nLen -2 ); - return true; - } - return false; - } - - // ......................................................................... - void lcl_stripTrailingLineFeed( ::rtl::OUString& io_rLine ) - { - const sal_Int32 nLen = io_rLine.getLength(); - if ( ( nLen > 0 ) && ( io_rLine.getStr()[ nLen - 1 ] == '\n' ) ) - io_rLine = io_rLine.copy( 0, nLen - 1 ); - } - - // ......................................................................... - void lcl_readObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, - MapStringToCompDesc& o_mapStorageToObjectName ) - { - ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); - if ( !i_rStorage->hasByName( lcl_getObjectMapStreamName() ) ) - { // nothing to do, though suspicious - OSL_ENSURE( false, "lcl_readObjectMap_throw: if there's no map file, then there's expected to be no storage, too!" ); - return; - } - - Reference< XStream > xIniStream( i_rStorage->openStreamElement( - lcl_getObjectMapStreamName(), ElementModes::READ ), UNO_SET_THROW ); - - Reference< XTextInputStream > xTextInput( i_rContext.createComponent( "com.sun.star.io.TextInputStream" ), UNO_QUERY_THROW ); - xTextInput->setEncoding( lcl_getMapStreamEncodingName() ); - - Reference< XActiveDataSink > xDataSink( xTextInput, UNO_QUERY_THROW ); - xDataSink->setInputStream( xIniStream->getInputStream() ); - - ::rtl::OUString sCurrentSection; - bool bCurrentSectionIsKnownToBeUnsupported = true; - while ( !xTextInput->isEOF() ) - { - ::rtl::OUString sLine = xTextInput->readLine(); - lcl_stripTrailingLineFeed( sLine ); - - if ( sLine.getLength() == 0 ) - continue; - - if ( lcl_isSectionStart( sLine, sCurrentSection ) ) - { - bCurrentSectionIsKnownToBeUnsupported = false; - continue; - } - - if ( bCurrentSectionIsKnownToBeUnsupported ) - continue; - - // the only section we support so far is "storages" - if ( !sCurrentSection.equalsAscii( "storages" ) ) - { - bCurrentSectionIsKnownToBeUnsupported = true; - continue; - } - - ::rtl::OUString sStorageName; - SubComponentDescriptor aCompDesc; - if ( !lcl_extractCompDesc( sLine, sStorageName, aCompDesc ) ) - continue; - o_mapStorageToObjectName[ sStorageName ] = aCompDesc; - } - } - - // ......................................................................... - bool lcl_determineReadOnly( const Reference< XComponent >& i_rComponent ) - { - Reference< XModel > xDocument( i_rComponent, UNO_QUERY ); - if ( !xDocument.is() ) - { - Reference< XController > xController( i_rComponent, UNO_QUERY_THROW ); - xDocument = xController->getModel(); - } - - if ( !xDocument.is() ) - return false; - - ::comphelper::NamedValueCollection aDocArgs( xDocument->getArgs() ); - return aDocArgs.getOrDefault( "ReadOnly", false ); - } - - // ......................................................................... - void lcl_markModified( const Reference< XComponent >& i_rSubComponent ) - { - const Reference< XModifiable > xModify( i_rSubComponent, UNO_QUERY ); - if ( !xModify.is() ) - { - OSL_ENSURE( false, "lcl_markModified: unhandled case!" ); - return; - } - - xModify->setModified( sal_True ); - } - } - - //==================================================================== - //= DatabaseDocumentRecovery_Data - //==================================================================== - struct DatabaseDocumentRecovery_Data - { - const ::comphelper::ComponentContext aContext; - - DatabaseDocumentRecovery_Data( const ::comphelper::ComponentContext& i_rContext ) - :aContext( i_rContext ) - { - } - }; - - //==================================================================== - //= SubComponentRecovery - //==================================================================== - class SubComponentRecovery - { - public: - SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XDatabaseDocumentUI >& i_rController, - const Reference< XComponent >& i_rComponent ) - :m_rContext( i_rContext ) - ,m_xComponent( i_rComponent ) - ,m_eType( UNKNOWN ) - ,m_aCompDesc() - { - impl_identifyComponent_throw( i_rController ); - } - - void saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapCompTypeToCompDescs& io_mapCompDescs ); - - private: - void impl_saveSubDocument_throw( - const Reference< XStorage >& i_rRecoveryStorage, - MapStringToCompDesc& io_mapStorageToCompDesc - ); - - void impl_identifyComponent_throw( - const Reference< XDatabaseDocumentUI >& i_rController - ); - - private: - const ::comphelper::ComponentContext& m_rContext; - const Reference< XComponent > m_xComponent; - SubComponentType m_eType; - SubComponentDescriptor m_aCompDesc; - }; - - //-------------------------------------------------------------------- - void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, - MapCompTypeToCompDescs& io_mapCompDescs ) - { - - if ( m_eType == UNKNOWN ) - // quite fatal, but has already been reported (as assertion) before - return; - - switch ( m_eType ) - { - case FORM: - case REPORT: - impl_saveSubDocument_throw( i_rRecoveryStorage, io_mapCompDescs[ m_eType ] ); - break; - - default: - // TODO - OSL_ENSURE( false, "SubComponentRecoverys::saveToRecoveryStorage: unimplemented case!" ); - break; - } - } - - //-------------------------------------------------------------------- - void SubComponentRecovery::impl_identifyComponent_throw( const Reference< XDatabaseDocumentUI >& i_rController ) - { - ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); - - // ask the controller - Pair< sal_Int32, ::rtl::OUString > aComponentIdentity = i_rController->identifySubComponent( m_xComponent ); - m_eType = lcl_databaseObjectToSubComponentType( aComponentIdentity.First ); - m_aCompDesc.sName = aComponentIdentity.Second; - - // what the controller didn't give us is the information whether this is in edit mode or not ... - Reference< XModuleManager > xModuleManager( m_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); - const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( m_xComponent ); - - switch ( m_eType ) - { - case TABLE: - m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.TableDesign" ); - break; - - case QUERY: - m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.QueryDesign" ); - break; - - case REPORT: - if ( sModuleIdentifier.equalsAscii( "com.sun.star.report.ReportDefinition" ) ) - { - // it's an SRB report desginer - m_aCompDesc.bForEditing = true; - break; - } - // fall through - - case FORM: - m_aCompDesc.bForEditing = !lcl_determineReadOnly( m_xComponent ); - break; - - default: - if ( sModuleIdentifier.equalsAscii( "com.sun.star.sdb.RelationDesign" ) ) - { - m_eType = RELATION_DESIGN; - m_aCompDesc.bForEditing = true; - } - else - { - OSL_ENSURE( false, "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the given sub component!" ); - } - break; - } - - OSL_POSTCOND( m_eType != UNKNOWN, - "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the component!" ); - } - - //-------------------------------------------------------------------- - void SubComponentRecovery::impl_saveSubDocument_throw( const Reference< XStorage >& i_rRecoveryStorage, - MapStringToCompDesc& io_mapStorageToCompDesc ) - { - ENSURE_OR_THROW( ( m_eType == FORM ) || ( m_eType == REPORT ), "illegal sub component type" ); - ENSURE_OR_THROW( i_rRecoveryStorage.is(), "illegal storage" ); - - // open the sub storage for the given kind of documents - const ::rtl::OUString& rStorageName( lcl_getComponentsStorageName( m_eType ) ); - const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement( - rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); - - // find a free sub storage name, and create Yet Another Sub Storage - const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( m_eType == FORM ? "form" : "report" ) ); - const ::rtl::OUString sCompStorName = ::dbtools::createUniqueName( xDocsStor.get(), sBaseName, true ); - const Reference< XStorage > xCompStor( xDocsStor->openStorageElement( - sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW ); - - // store the document into the storage - Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW ); - xStorageDocument->storeToStorage( xCompStor, Sequence< PropertyValue >() ); - - // remember the relationship between the component name to the storage name - OSL_ENSURE( io_mapStorageToCompDesc.find( sCompStorName ) == io_mapStorageToCompDesc.end(), - "SubComponentRecoverys::impl_saveSubDocument_throw: object name already used!" ); - io_mapStorageToCompDesc[ sCompStorName ] = m_aCompDesc; - - // commit the storage for the documents collection - tools::stor::commitStorageIfWriteable( xDocsStor ); - } - - //==================================================================== - //= DatabaseDocumentRecovery - //==================================================================== - //-------------------------------------------------------------------- - DatabaseDocumentRecovery::DatabaseDocumentRecovery( const ::comphelper::ComponentContext& i_rContext ) - :m_pData( new DatabaseDocumentRecovery_Data( i_rContext ) ) - { - } - - //-------------------------------------------------------------------- - DatabaseDocumentRecovery::~DatabaseDocumentRecovery() - { - } - - //-------------------------------------------------------------------- - void DatabaseDocumentRecovery::saveModifiedSubComponents( const Reference< XStorage >& i_rTargetStorage, - const ::std::vector< Reference< XController > >& i_rControllers ) - { - ENSURE_OR_THROW( i_rTargetStorage.is(), "invalid document storage" ); - - // create a sub storage for recovery data - if ( i_rTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) - i_rTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); - Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); - - // store recovery data for open sub components of the given controller(s) - if ( !i_rControllers.empty() ) - { - ENSURE_OR_THROW( i_rControllers.size() == 1, "can't handle more than one controller" ); - // At the moment, there can be only one view to a database document. If we ever allow for more than this, - // then we need a concept for sub documents opened from different controllers (i.e. two document views, - // and the user opens the very same form in both views). And depending on this, we need a concept for - // how those are saved to the recovery file. - - MapCompTypeToCompDescs aMapCompDescs; - - for ( ::std::vector< Reference< XController > >::const_iterator ctrl = i_rControllers.begin(); - ctrl != i_rControllers.end(); - ++ctrl - ) - { - Reference< XDatabaseDocumentUI > xDatabaseUI( *ctrl, UNO_QUERY_THROW ); - Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); - - const Reference< XComponent >* component = aComponents.getConstArray(); - const Reference< XComponent >* componentEnd = aComponents.getConstArray() + aComponents.getLength(); - for ( ; component != componentEnd; ++component ) - { - SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, *component ); - aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapCompDescs ); - } - } - - for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); - map != aMapCompDescs.end(); - ++map - ) - { - Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( - lcl_getComponentsStorageName( map->first ), ElementModes::WRITE | ElementModes::NOCREATE ) ); - lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, map->second ); - tools::stor::commitStorageIfWriteable( xComponentsStor ); - } - } - - // commit the recovery storage - tools::stor::commitStorageIfWriteable( xRecoveryStorage ); - } - - //-------------------------------------------------------------------- - void DatabaseDocumentRecovery::recoverSubDocuments( const Reference< XStorage >& i_rDocumentStorage, - const Reference< XController >& i_rTargetController ) - { - ENSURE_OR_THROW( i_rDocumentStorage.is(), "illegal document storage" ); - Reference< XDatabaseDocumentUI > xDocumentUI( i_rTargetController, UNO_QUERY_THROW ); - - if ( !i_rDocumentStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) - // that's allowed - return; - - // the "recovery" sub storage - Reference< XStorage > xRecoveryStorage = i_rDocumentStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READ ); - - // read the map from sub storages to object names - MapCompTypeToCompDescs aMapCompDescs; - SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; - for ( size_t i = 0; i < sizeof( aKnownTypes ) / sizeof( aKnownTypes[0] ); ++i ) - { - if ( !xRecoveryStorage->hasByName( lcl_getComponentsStorageName( aKnownTypes[i] ) ) ) - continue; - - Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( - lcl_getComponentsStorageName( aKnownTypes[i] ), ElementModes::READ ) ); - lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownTypes[i] ] ); - xComponentsStor->dispose(); - } - - // recover all sub components as indicated by the map - for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); - map != aMapCompDescs.end(); - ++map - ) - { - const SubComponentType eComponentType = map->first; - if ( ( eComponentType != FORM ) && ( eComponentType != REPORT ) ) - { - // nobody saves tables/queries/relations at the moment, so encountering those is worth an assertion - OSL_ENSURE( false, "DatabaseDocumentRecovery::recoverSubDocuments: only embedded objects can be recovered currently!" ); - continue; - } - - // the storage for all components of the current type - Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( - lcl_getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_QUERY_THROW ); - - // loop thru all components of this type - for ( MapStringToCompDesc::const_iterator stor = map->second.begin(); - stor != map->second.end(); - ++stor - ) - { - const ::rtl::OUString sComponentName( stor->second.sName ); - if ( !xComponentsStor->hasByName( stor->first ) ) - { - #if OSL_DEBUG_LEVEL > 0 - ::rtl::OStringBuffer message; - message.append( "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" ); - message.append( ::rtl::OUStringToOString( stor->first, RTL_TEXTENCODING_ASCII_US ) ); - message.append( "' not found in '" ); - message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( eComponentType ), RTL_TEXTENCODING_ASCII_US ) ); - message.append( "', but required per map file!" ); - OSL_ENSURE( false, message.makeStringAndClear() ); - #endif - continue; - } - - // the controller needs to have a connection to be able to open sub components - if ( !xDocumentUI->isConnected() ) - xDocumentUI->connect(); - - // recover the single component - Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) ); - ::comphelper::NamedValueCollection aLoadArgs; - aLoadArgs.put( "RecoveryStorage", xCompStor ); - - try - { - Reference< XComponent > xSubComponent; - if ( sComponentName.getLength() ) - { - xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, - stor->second.bForEditing, aLoadArgs.getPropertyValues() ); - } - else - { - xSubComponent = xDocumentUI->createComponentWithArguments( eComponentType, aLoadArgs.getPropertyValues() ); - } - - // at the moment, we only store, during session save, sub components which are modified. So, set this - // recovered sub component to "modified", too. - lcl_markModified( xSubComponent ); - } - catch ( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - xComponentsStor->dispose(); - } - } - -//........................................................................ -} // namespace dbaccess -//........................................................................ diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.hxx b/dbaccess/source/core/dataaccess/dbdocrecovery.hxx deleted file mode 100644 index 0bf44e2bf3e8..000000000000 --- a/dbaccess/source/core/dataaccess/dbdocrecovery.hxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2009 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* -* for a copy of the LGPLv3 License. -************************************************************************/ - -#ifndef DBACCESS_DBDOCRECOVERY_HXX -#define DBACCESS_DBDOCRECOVERY_HXX - -/** === begin UNO includes === **/ -#include -#include -/** === end UNO includes === **/ - -#include -#include - -namespace comphelper -{ - class ComponentContext; -} - -//........................................................................ -namespace dbaccess -{ -//........................................................................ - - //==================================================================== - //= DatabaseDocumentRecovery - //==================================================================== - struct DatabaseDocumentRecovery_Data; - class DatabaseDocumentRecovery - { - public: - DatabaseDocumentRecovery( - const ::comphelper::ComponentContext& i_rContext - ); - ~DatabaseDocumentRecovery(); - - /** saves the modified sub components of the given controller(s) to the "recovery" sub storage of the document - storage. - - @throws ::com::sun::star::uno::Exception - in case of an error. - */ - void saveModifiedSubComponents( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rTargetStorage, - const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >& i_rControllers - ); - - /** recovery sub components from the given document storage, if applicable - - If the given document storage does not contain a recovery folder, the method silently returns. - - @throws ::com::sun::star::uno::Exception - in case of an error. - */ - void recoverSubDocuments( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentStorage, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& i_rTargetController - ); - - private: - const ::std::auto_ptr< DatabaseDocumentRecovery_Data > m_pData; - }; - -//........................................................................ -} // namespace dbaccess -//........................................................................ - -#endif // DBACCESS_DBDOCRECOVERY_HXX diff --git a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx new file mode 100644 index 000000000000..0bf44e2bf3e8 --- /dev/null +++ b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx @@ -0,0 +1,90 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef DBACCESS_DBDOCRECOVERY_HXX +#define DBACCESS_DBDOCRECOVERY_HXX + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include +#include + +namespace comphelper +{ + class ComponentContext; +} + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + //==================================================================== + //= DatabaseDocumentRecovery + //==================================================================== + struct DatabaseDocumentRecovery_Data; + class DatabaseDocumentRecovery + { + public: + DatabaseDocumentRecovery( + const ::comphelper::ComponentContext& i_rContext + ); + ~DatabaseDocumentRecovery(); + + /** saves the modified sub components of the given controller(s) to the "recovery" sub storage of the document + storage. + + @throws ::com::sun::star::uno::Exception + in case of an error. + */ + void saveModifiedSubComponents( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rTargetStorage, + const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >& i_rControllers + ); + + /** recovery sub components from the given document storage, if applicable + + If the given document storage does not contain a recovery folder, the method silently returns. + + @throws ::com::sun::star::uno::Exception + in case of an error. + */ + void recoverSubDocuments( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentStorage, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& i_rTargetController + ); + + private: + const ::std::auto_ptr< DatabaseDocumentRecovery_Data > m_pData; + }; + +//........................................................................ +} // namespace dbaccess +//........................................................................ + +#endif // DBACCESS_DBDOCRECOVERY_HXX diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx new file mode 100644 index 000000000000..b22c19a07b6d --- /dev/null +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -0,0 +1,702 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "precompiled_dbaccess.hxx" + +#include "recovery/dbdocrecovery.hxx" +#include "sdbcoretools.hxx" +#include "dbastrings.hrc" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include +#include +#include +#include +#include + +#include +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::embed::XStorage; + using ::com::sun::star::frame::XController; + using ::com::sun::star::sdb::application::XDatabaseDocumentUI; + using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::document::XStorageBasedDocument; + using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::beans::Pair; + using ::com::sun::star::io::XStream; + using ::com::sun::star::io::XOutputStream; + using ::com::sun::star::io::XTextOutputStream; + using ::com::sun::star::io::XActiveDataSource; + using ::com::sun::star::io::XTextInputStream; + using ::com::sun::star::io::XActiveDataSink; + using ::com::sun::star::frame::XModel; + using ::com::sun::star::util::XModifiable; + /** === end UNO using === **/ + + namespace ElementModes = ::com::sun::star::embed::ElementModes; + namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; + + //==================================================================== + //= helpers + //==================================================================== + namespace + { + // ......................................................................... + enum SubComponentType + { + TABLE = DatabaseObject::TABLE, + QUERY = DatabaseObject::QUERY, + FORM = DatabaseObject::FORM, + REPORT = DatabaseObject::REPORT, + + RELATION_DESIGN = 1000, + + UNKNOWN = 10001 + }; + + struct SubComponentDescriptor + { + ::rtl::OUString sName; + bool bForEditing; + + SubComponentDescriptor() + :sName() + ,bForEditing( false ) + { + } + + SubComponentDescriptor( const ::rtl::OUString& i_rName, const bool i_bForEditing ) + :sName( i_rName ) + ,bForEditing( i_bForEditing ) + { + } + }; + + // ......................................................................... + typedef ::std::hash_map< ::rtl::OUString, SubComponentDescriptor, ::rtl::OUStringHash > MapStringToCompDesc; + typedef ::std::map< SubComponentType, MapStringToCompDesc > MapCompTypeToCompDescs; + + // ......................................................................... + void lcl_getPersistentRepresentation( const MapStringToCompDesc::value_type& i_rComponentDesc, ::rtl::OUStringBuffer& o_rBuffer ) + { + o_rBuffer.append( i_rComponentDesc.first ); + o_rBuffer.append( sal_Unicode( '=' ) ); + o_rBuffer.append( i_rComponentDesc.second.sName ); + o_rBuffer.append( sal_Unicode( ',' ) ); + o_rBuffer.append( sal_Unicode( i_rComponentDesc.second.bForEditing ? '1' : '0' ) ); + } + + // ......................................................................... + bool lcl_extractCompDesc( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc ) + { + const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( sal_Unicode( '=' ) ); + if ( nEqualSignPos < 1 ) + { + OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of '='" ); + return false; + } + o_rStorName = i_rIniLine.copy( 0, nEqualSignPos ); + + const sal_Int32 nCommaPos = i_rIniLine.lastIndexOf( sal_Unicode( ',' ) ); + if ( nCommaPos != i_rIniLine.getLength() - 2 ) + { + OSL_ENSURE( false, "lcl_extractCompDesc: invalid map file entry - unexpected pos of ','" ); + return false; + } + o_rCompDesc.sName = i_rIniLine.copy( nEqualSignPos + 1, nCommaPos - nEqualSignPos - 1 ); + o_rCompDesc.bForEditing = ( i_rIniLine.getStr()[ nCommaPos + 1 ] == '1' ); + return true; + } + + // ......................................................................... + SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) + { + switch ( i_nObjectType ) + { + case DatabaseObject::TABLE: return TABLE; + case DatabaseObject::QUERY: return QUERY; + case DatabaseObject::FORM: return FORM; + case DatabaseObject::REPORT:return REPORT; + default: + break; + } + return UNKNOWN; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() + { + static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); + return s_sRecDataStorName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType ) + { + static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); + static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); + static const ::rtl::OUString s_sTablesStorageName( RTL_CONSTASCII_USTRINGPARAM( "tables" ) ); + static const ::rtl::OUString s_sQueriesStorageName( RTL_CONSTASCII_USTRINGPARAM( "queries" ) ); + static const ::rtl::OUString s_sRelationsStorageName( RTL_CONSTASCII_USTRINGPARAM( "relations" ) ); + + switch ( i_eType ) + { + case FORM: + return s_sFormsStorageName; + case REPORT: + return s_sReportsStorageName; + case TABLE: + return s_sTablesStorageName; + case QUERY: + return s_sQueriesStorageName; + case RELATION_DESIGN: + return s_sRelationsStorageName; + default: + break; + } + + OSL_ENSURE( false, "lcl_getComponentsStorageName: unimplemented case!" ); + static const ::rtl::OUString s_sFallback; + return s_sFallback; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getObjectMapStreamName() + { + static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); + return s_sObjectMapStreamName; + } + + // ......................................................................... + const ::rtl::OUString& lcl_getMapStreamEncodingName() + { + static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) ); + return s_sMapStreamEncodingName; + } + + // ......................................................................... + void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + const MapStringToCompDesc& i_mapStorageToCompDesc ) + { + if ( i_mapStorageToCompDesc.empty() ) + // nothing to do + return; + + ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); + Reference< XStream > xIniStream( i_rStorage->openStreamElement( + lcl_getObjectMapStreamName(), ElementModes::WRITE | ElementModes::TRUNCATE ), UNO_SET_THROW ); + + Reference< XTextOutputStream > xTextOutput( i_rContext.createComponent( "com.sun.star.io.TextOutputStream" ), UNO_QUERY_THROW ); + xTextOutput->setEncoding( lcl_getMapStreamEncodingName() ); + + Reference< XActiveDataSource > xDataSource( xTextOutput, UNO_QUERY_THROW ); + xDataSource->setOutputStream( xIniStream->getOutputStream() ); + + const ::rtl::OUString sLineFeed( sal_Unicode( '\n' ) ); + xTextOutput->writeString( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[storages]" ) ) ); + xTextOutput->writeString( sLineFeed ); + + for ( MapStringToCompDesc::const_iterator stor = i_mapStorageToCompDesc.begin(); + stor != i_mapStorageToCompDesc.end(); + ++stor + ) + { + ::rtl::OUStringBuffer aLine; + lcl_getPersistentRepresentation( *stor, aLine ); + aLine.append( sLineFeed ); + + xTextOutput->writeString( aLine.makeStringAndClear() ); + } + + xTextOutput->writeString( sLineFeed ); + } + + // ......................................................................... + bool lcl_isSectionStart( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rSectionName ) + { + const sal_Int32 nLen = i_rIniLine.getLength(); + if ( ( nLen > 0 ) && ( i_rIniLine.getStr()[0] == '[' ) && ( i_rIniLine.getStr()[ nLen - 1 ] == ']' ) ) + { + o_rSectionName = i_rIniLine.copy( 1, nLen -2 ); + return true; + } + return false; + } + + // ......................................................................... + void lcl_stripTrailingLineFeed( ::rtl::OUString& io_rLine ) + { + const sal_Int32 nLen = io_rLine.getLength(); + if ( ( nLen > 0 ) && ( io_rLine.getStr()[ nLen - 1 ] == '\n' ) ) + io_rLine = io_rLine.copy( 0, nLen - 1 ); + } + + // ......................................................................... + void lcl_readObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + MapStringToCompDesc& o_mapStorageToObjectName ) + { + ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); + if ( !i_rStorage->hasByName( lcl_getObjectMapStreamName() ) ) + { // nothing to do, though suspicious + OSL_ENSURE( false, "lcl_readObjectMap_throw: if there's no map file, then there's expected to be no storage, too!" ); + return; + } + + Reference< XStream > xIniStream( i_rStorage->openStreamElement( + lcl_getObjectMapStreamName(), ElementModes::READ ), UNO_SET_THROW ); + + Reference< XTextInputStream > xTextInput( i_rContext.createComponent( "com.sun.star.io.TextInputStream" ), UNO_QUERY_THROW ); + xTextInput->setEncoding( lcl_getMapStreamEncodingName() ); + + Reference< XActiveDataSink > xDataSink( xTextInput, UNO_QUERY_THROW ); + xDataSink->setInputStream( xIniStream->getInputStream() ); + + ::rtl::OUString sCurrentSection; + bool bCurrentSectionIsKnownToBeUnsupported = true; + while ( !xTextInput->isEOF() ) + { + ::rtl::OUString sLine = xTextInput->readLine(); + lcl_stripTrailingLineFeed( sLine ); + + if ( sLine.getLength() == 0 ) + continue; + + if ( lcl_isSectionStart( sLine, sCurrentSection ) ) + { + bCurrentSectionIsKnownToBeUnsupported = false; + continue; + } + + if ( bCurrentSectionIsKnownToBeUnsupported ) + continue; + + // the only section we support so far is "storages" + if ( !sCurrentSection.equalsAscii( "storages" ) ) + { + bCurrentSectionIsKnownToBeUnsupported = true; + continue; + } + + ::rtl::OUString sStorageName; + SubComponentDescriptor aCompDesc; + if ( !lcl_extractCompDesc( sLine, sStorageName, aCompDesc ) ) + continue; + o_mapStorageToObjectName[ sStorageName ] = aCompDesc; + } + } + + // ......................................................................... + bool lcl_determineReadOnly( const Reference< XComponent >& i_rComponent ) + { + Reference< XModel > xDocument( i_rComponent, UNO_QUERY ); + if ( !xDocument.is() ) + { + Reference< XController > xController( i_rComponent, UNO_QUERY_THROW ); + xDocument = xController->getModel(); + } + + if ( !xDocument.is() ) + return false; + + ::comphelper::NamedValueCollection aDocArgs( xDocument->getArgs() ); + return aDocArgs.getOrDefault( "ReadOnly", false ); + } + + // ......................................................................... + void lcl_markModified( const Reference< XComponent >& i_rSubComponent ) + { + const Reference< XModifiable > xModify( i_rSubComponent, UNO_QUERY ); + if ( !xModify.is() ) + { + OSL_ENSURE( false, "lcl_markModified: unhandled case!" ); + return; + } + + xModify->setModified( sal_True ); + } + } + + //==================================================================== + //= DatabaseDocumentRecovery_Data + //==================================================================== + struct DatabaseDocumentRecovery_Data + { + const ::comphelper::ComponentContext aContext; + + DatabaseDocumentRecovery_Data( const ::comphelper::ComponentContext& i_rContext ) + :aContext( i_rContext ) + { + } + }; + + //==================================================================== + //= SubComponentRecovery + //==================================================================== + class SubComponentRecovery + { + public: + SubComponentRecovery( const ::comphelper::ComponentContext& i_rContext, const Reference< XDatabaseDocumentUI >& i_rController, + const Reference< XComponent >& i_rComponent ) + :m_rContext( i_rContext ) + ,m_xComponent( i_rComponent ) + ,m_eType( UNKNOWN ) + ,m_aCompDesc() + { + impl_identifyComponent_throw( i_rController ); + } + + void saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, MapCompTypeToCompDescs& io_mapCompDescs ); + + private: + void impl_saveSubDocument_throw( + const Reference< XStorage >& i_rRecoveryStorage, + MapStringToCompDesc& io_mapStorageToCompDesc + ); + + void impl_identifyComponent_throw( + const Reference< XDatabaseDocumentUI >& i_rController + ); + + private: + const ::comphelper::ComponentContext& m_rContext; + const Reference< XComponent > m_xComponent; + SubComponentType m_eType; + SubComponentDescriptor m_aCompDesc; + }; + + //-------------------------------------------------------------------- + void SubComponentRecovery::saveToRecoveryStorage( const Reference< XStorage >& i_rRecoveryStorage, + MapCompTypeToCompDescs& io_mapCompDescs ) + { + + if ( m_eType == UNKNOWN ) + // quite fatal, but has already been reported (as assertion) before + return; + + switch ( m_eType ) + { + case FORM: + case REPORT: + impl_saveSubDocument_throw( i_rRecoveryStorage, io_mapCompDescs[ m_eType ] ); + break; + + default: + // TODO + OSL_ENSURE( false, "SubComponentRecoverys::saveToRecoveryStorage: unimplemented case!" ); + break; + } + } + + //-------------------------------------------------------------------- + void SubComponentRecovery::impl_identifyComponent_throw( const Reference< XDatabaseDocumentUI >& i_rController ) + { + ENSURE_OR_THROW( i_rController.is(), "illegal controller" ); + + // ask the controller + Pair< sal_Int32, ::rtl::OUString > aComponentIdentity = i_rController->identifySubComponent( m_xComponent ); + m_eType = lcl_databaseObjectToSubComponentType( aComponentIdentity.First ); + m_aCompDesc.sName = aComponentIdentity.Second; + + // what the controller didn't give us is the information whether this is in edit mode or not ... + Reference< XModuleManager > xModuleManager( m_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( m_xComponent ); + + switch ( m_eType ) + { + case TABLE: + m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.TableDesign" ); + break; + + case QUERY: + m_aCompDesc.bForEditing = sModuleIdentifier.equalsAscii( "com.sun.star.sdb.QueryDesign" ); + break; + + case REPORT: + if ( sModuleIdentifier.equalsAscii( "com.sun.star.report.ReportDefinition" ) ) + { + // it's an SRB report desginer + m_aCompDesc.bForEditing = true; + break; + } + // fall through + + case FORM: + m_aCompDesc.bForEditing = !lcl_determineReadOnly( m_xComponent ); + break; + + default: + if ( sModuleIdentifier.equalsAscii( "com.sun.star.sdb.RelationDesign" ) ) + { + m_eType = RELATION_DESIGN; + m_aCompDesc.bForEditing = true; + } + else + { + OSL_ENSURE( false, "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the given sub component!" ); + } + break; + } + + OSL_POSTCOND( m_eType != UNKNOWN, + "SubComponentRecovery::impl_identifyComponent_throw: couldn't classify the component!" ); + } + + //-------------------------------------------------------------------- + void SubComponentRecovery::impl_saveSubDocument_throw( const Reference< XStorage >& i_rRecoveryStorage, + MapStringToCompDesc& io_mapStorageToCompDesc ) + { + ENSURE_OR_THROW( ( m_eType == FORM ) || ( m_eType == REPORT ), "illegal sub component type" ); + ENSURE_OR_THROW( i_rRecoveryStorage.is(), "illegal storage" ); + + // open the sub storage for the given kind of documents + const ::rtl::OUString& rStorageName( lcl_getComponentsStorageName( m_eType ) ); + const Reference< XStorage > xDocsStor( i_rRecoveryStorage->openStorageElement( + rStorageName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + + // find a free sub storage name, and create Yet Another Sub Storage + const ::rtl::OUString sBaseName( ::rtl::OUString::createFromAscii( m_eType == FORM ? "form" : "report" ) ); + const ::rtl::OUString sCompStorName = ::dbtools::createUniqueName( xDocsStor.get(), sBaseName, true ); + const Reference< XStorage > xCompStor( xDocsStor->openStorageElement( + sCompStorName, ElementModes::READWRITE ), UNO_QUERY_THROW ); + + // store the document into the storage + Reference< XStorageBasedDocument > xStorageDocument( m_xComponent, UNO_QUERY_THROW ); + xStorageDocument->storeToStorage( xCompStor, Sequence< PropertyValue >() ); + + // remember the relationship between the component name to the storage name + OSL_ENSURE( io_mapStorageToCompDesc.find( sCompStorName ) == io_mapStorageToCompDesc.end(), + "SubComponentRecoverys::impl_saveSubDocument_throw: object name already used!" ); + io_mapStorageToCompDesc[ sCompStorName ] = m_aCompDesc; + + // commit the storage for the documents collection + tools::stor::commitStorageIfWriteable( xDocsStor ); + } + + //==================================================================== + //= DatabaseDocumentRecovery + //==================================================================== + //-------------------------------------------------------------------- + DatabaseDocumentRecovery::DatabaseDocumentRecovery( const ::comphelper::ComponentContext& i_rContext ) + :m_pData( new DatabaseDocumentRecovery_Data( i_rContext ) ) + { + } + + //-------------------------------------------------------------------- + DatabaseDocumentRecovery::~DatabaseDocumentRecovery() + { + } + + //-------------------------------------------------------------------- + void DatabaseDocumentRecovery::saveModifiedSubComponents( const Reference< XStorage >& i_rTargetStorage, + const ::std::vector< Reference< XController > >& i_rControllers ) + { + ENSURE_OR_THROW( i_rTargetStorage.is(), "invalid document storage" ); + + // create a sub storage for recovery data + if ( i_rTargetStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + i_rTargetStorage->removeElement( lcl_getRecoveryDataSubStorageName() ); + Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READWRITE ); + + // store recovery data for open sub components of the given controller(s) + if ( !i_rControllers.empty() ) + { + ENSURE_OR_THROW( i_rControllers.size() == 1, "can't handle more than one controller" ); + // At the moment, there can be only one view to a database document. If we ever allow for more than this, + // then we need a concept for sub documents opened from different controllers (i.e. two document views, + // and the user opens the very same form in both views). And depending on this, we need a concept for + // how those are saved to the recovery file. + + MapCompTypeToCompDescs aMapCompDescs; + + for ( ::std::vector< Reference< XController > >::const_iterator ctrl = i_rControllers.begin(); + ctrl != i_rControllers.end(); + ++ctrl + ) + { + Reference< XDatabaseDocumentUI > xDatabaseUI( *ctrl, UNO_QUERY_THROW ); + Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() ); + + const Reference< XComponent >* component = aComponents.getConstArray(); + const Reference< XComponent >* componentEnd = aComponents.getConstArray() + aComponents.getLength(); + for ( ; component != componentEnd; ++component ) + { + SubComponentRecovery aComponentRecovery( m_pData->aContext, xDatabaseUI, *component ); + aComponentRecovery.saveToRecoveryStorage( xRecoveryStorage, aMapCompDescs ); + } + } + + for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); + map != aMapCompDescs.end(); + ++map + ) + { + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( map->first ), ElementModes::WRITE | ElementModes::NOCREATE ) ); + lcl_writeObjectMap_throw( m_pData->aContext, xComponentsStor, map->second ); + tools::stor::commitStorageIfWriteable( xComponentsStor ); + } + } + + // commit the recovery storage + tools::stor::commitStorageIfWriteable( xRecoveryStorage ); + } + + //-------------------------------------------------------------------- + void DatabaseDocumentRecovery::recoverSubDocuments( const Reference< XStorage >& i_rDocumentStorage, + const Reference< XController >& i_rTargetController ) + { + ENSURE_OR_THROW( i_rDocumentStorage.is(), "illegal document storage" ); + Reference< XDatabaseDocumentUI > xDocumentUI( i_rTargetController, UNO_QUERY_THROW ); + + if ( !i_rDocumentStorage->hasByName( lcl_getRecoveryDataSubStorageName() ) ) + // that's allowed + return; + + // the "recovery" sub storage + Reference< XStorage > xRecoveryStorage = i_rDocumentStorage->openStorageElement( lcl_getRecoveryDataSubStorageName(), ElementModes::READ ); + + // read the map from sub storages to object names + MapCompTypeToCompDescs aMapCompDescs; + SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; + for ( size_t i = 0; i < sizeof( aKnownTypes ) / sizeof( aKnownTypes[0] ); ++i ) + { + if ( !xRecoveryStorage->hasByName( lcl_getComponentsStorageName( aKnownTypes[i] ) ) ) + continue; + + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( aKnownTypes[i] ), ElementModes::READ ) ); + lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownTypes[i] ] ); + xComponentsStor->dispose(); + } + + // recover all sub components as indicated by the map + for ( MapCompTypeToCompDescs::const_iterator map = aMapCompDescs.begin(); + map != aMapCompDescs.end(); + ++map + ) + { + const SubComponentType eComponentType = map->first; + if ( ( eComponentType != FORM ) && ( eComponentType != REPORT ) ) + { + // nobody saves tables/queries/relations at the moment, so encountering those is worth an assertion + OSL_ENSURE( false, "DatabaseDocumentRecovery::recoverSubDocuments: only embedded objects can be recovered currently!" ); + continue; + } + + // the storage for all components of the current type + Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( + lcl_getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_QUERY_THROW ); + + // loop thru all components of this type + for ( MapStringToCompDesc::const_iterator stor = map->second.begin(); + stor != map->second.end(); + ++stor + ) + { + const ::rtl::OUString sComponentName( stor->second.sName ); + if ( !xComponentsStor->hasByName( stor->first ) ) + { + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer message; + message.append( "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" ); + message.append( ::rtl::OUStringToOString( stor->first, RTL_TEXTENCODING_ASCII_US ) ); + message.append( "' not found in '" ); + message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( eComponentType ), RTL_TEXTENCODING_ASCII_US ) ); + message.append( "', but required per map file!" ); + OSL_ENSURE( false, message.makeStringAndClear() ); + #endif + continue; + } + + // the controller needs to have a connection to be able to open sub components + if ( !xDocumentUI->isConnected() ) + xDocumentUI->connect(); + + // recover the single component + Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) ); + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "RecoveryStorage", xCompStor ); + + try + { + Reference< XComponent > xSubComponent; + if ( sComponentName.getLength() ) + { + xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, + stor->second.bForEditing, aLoadArgs.getPropertyValues() ); + } + else + { + xSubComponent = xDocumentUI->createComponentWithArguments( eComponentType, aLoadArgs.getPropertyValues() ); + } + + // at the moment, we only store, during session save, sub components which are modified. So, set this + // recovered sub component to "modified", too. + lcl_markModified( xSubComponent ); + } + catch ( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + xComponentsStor->dispose(); + } + } + +//........................................................................ +} // namespace dbaccess +//........................................................................ diff --git a/dbaccess/source/core/recovery/makefile.mk b/dbaccess/source/core/recovery/makefile.mk new file mode 100644 index 000000000000..55c1211d80d4 --- /dev/null +++ b/dbaccess/source/core/recovery/makefile.mk @@ -0,0 +1,52 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.10.2.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJINC=$(PRJ)$/source +PRJNAME=dbaccess +TARGET=recovery + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/dba.pmk + +# --- Files ------------------------------------- + +SLOFILES= \ + $(SLO)$/dbdocrecovery.obj + +# --- Targets ---------------------------------- + +.INCLUDE : target.mk + diff --git a/dbaccess/util/makefile.mk b/dbaccess/util/makefile.mk index 7b6909992c53..622d6355b65d 100644 --- a/dbaccess/util/makefile.mk +++ b/dbaccess/util/makefile.mk @@ -50,6 +50,7 @@ LIB1TARGET=$(SLB)$/$(TARGET).lib LIB1FILES=\ $(SLB)$/api.lib \ $(SLB)$/dataaccess.lib \ + $(SLB)$/recovery.lib \ $(SLB)$/misc.lib \ $(SLB)$/core_resource.lib -- cgit v1.2.3 From 09af8ffba3b5311161092ae3d37087e001fa0e0d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 28 Jan 2010 22:36:35 +0100 Subject: autorecovery: removed a few IMO useless dependencies --- dbaccess/prj/build.lst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dbaccess/prj/build.lst b/dbaccess/prj/build.lst index f9ba2e4abd5f..0b6122d413ab 100644 --- a/dbaccess/prj/build.lst +++ b/dbaccess/prj/build.lst @@ -3,10 +3,10 @@ ba dbaccess usr1 - all ba_mkout NULL ba dbaccess\inc nmake - all ba_inc NULL ba dbaccess\source\ui\inc nmake - all ba_uiinc ba_inc NULL ba dbaccess\source\core\api nmake - all ba_capi ba_inc NULL -ba dbaccess\source\core\dataaccess nmake - all ba_cdaccess ba_capi ba_inc NULL +ba dbaccess\source\core\dataaccess nmake - all ba_cdaccess ba_inc NULL ba dbaccess\source\core\recovery nmake - all ba_crecovery ba_inc NULL -ba dbaccess\source\core\misc nmake - all ba_cmisc ba_cdaccess ba_inc NULL -ba dbaccess\source\core\resource nmake - all ba_cres ba_cmisc ba_inc NULL +ba dbaccess\source\core\misc nmake - all ba_cmisc ba_inc NULL +ba dbaccess\source\core\resource nmake - all ba_cres ba_inc NULL ba dbaccess\source\filter\xml nmake - all ba_ffilter ba_shared ba_util ba_inc NULL ba dbaccess\source\filter\migration nmake - all ba_fmigration ba_shared ba_inc NULL ba dbaccess\source\shared nmake - all ba_shared ba_cres ba_inc NULL @@ -23,8 +23,8 @@ ba dbaccess\source\ui\misc nmake - all ba_uimisc ba_inc NULL ba dbaccess\source\ui\querydesign nmake - all ba_uiquery ba_uiinc ba_inc NULL ba dbaccess\source\ui\relationdesign nmake - all ba_uirelationdesign ba_uiinc ba_inc NULL ba dbaccess\source\ui\tabledesign nmake - all ba_uitabledesign ba_uiinc ba_inc NULL -ba dbaccess\source\ui\uno nmake - all ba_uiuno ba_uimisc ba_inc NULL +ba dbaccess\source\ui\uno nmake - all ba_uiuno ba_inc NULL ba dbaccess\source\ui\imagelists nmake - all ba_uiimglst ba_inc NULL -ba dbaccess\util nmake - all ba_util ba_uiimglst ba_capi ba_crecovery ba_shared ba_uibrowser ba_uiapp ba_uicontrol ba_uidlg ba_uimisc ba_uiquery ba_uitabledesign ba_uirelationdesign ba_uiuno ba_conntools ba_misctools ba_miscres ba_ext_adabasui NULL +ba dbaccess\util nmake - all ba_util ba_uiimglst ba_capi ba_cdaccess ba_cmisc ba_crecovery ba_shared ba_uibrowser ba_uiapp ba_uicontrol ba_uidlg ba_uimisc ba_uiquery ba_uitabledesign ba_uirelationdesign ba_uiuno ba_conntools ba_misctools ba_miscres ba_ext_adabasui NULL ba dbaccess\win32\source\odbcconfig nmake - w ba_odbcconfig ba_inc NULL ba dbaccess\qa\complex\dbaccess nmake - all ba_complex_tests NULL -- cgit v1.2.3 From 7ffad11ac2936653802d2fbc4132ec98a396ac72 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:49:42 +0100 Subject: autorecovery: ENSURE_OR_RETURN => ENSURE_OR_RETURN_FALSE, added new ENSURE_OR_RETURN taking a return value --- slideshow/source/engine/animationfactory.cxx | 8 ++++---- .../source/engine/animationnodes/animationnodefactory.cxx | 12 ++++++------ slideshow/source/engine/animationnodes/basenode.cxx | 2 +- slideshow/source/engine/eventmultiplexer.cxx | 4 ++-- slideshow/source/engine/eventqueue.cxx | 6 +++--- slideshow/source/engine/shapeattributelayer.cxx | 2 +- slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2 +- slideshow/source/engine/shapes/drawshape.cxx | 4 ++-- slideshow/source/engine/shapes/gdimtftools.cxx | 4 ++-- slideshow/source/engine/shapes/viewappletshape.cxx | 2 +- slideshow/source/engine/shapes/viewbackgroundshape.cxx | 6 +++--- slideshow/source/engine/shapes/viewmediashape.cxx | 2 +- slideshow/source/engine/shapes/viewshape.cxx | 8 ++++---- slideshow/source/engine/slide/shapemanagerimpl.cxx | 2 +- slideshow/source/engine/slide/slideimpl.cxx | 12 ++++++------ slideshow/source/engine/slidebitmap.cxx | 2 +- slideshow/source/engine/slideshowimpl.cxx | 6 +++--- slideshow/source/engine/slideview.cxx | 4 ++-- .../source/engine/transitions/shapetransitionfactory.cxx | 2 +- slideshow/source/engine/usereventqueue.cxx | 2 +- 20 files changed, 46 insertions(+), 46 deletions(-) diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx index 61e65981f6ce..61c083db19f6 100644 --- a/slideshow/source/engine/animationfactory.cxx +++ b/slideshow/source/engine/animationfactory.cxx @@ -154,7 +154,7 @@ namespace slideshow virtual bool operator()( const ::basegfx::B2DTuple& rValue ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "TupleAnimation::operator(): Invalid ShapeAttributeLayer" ); ValueT aValue( rValue.getX(), @@ -317,7 +317,7 @@ namespace slideshow virtual bool operator()( double nValue ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "PathAnimation::operator(): Invalid ShapeAttributeLayer" ); ::basegfx::B2DPoint rOutPos = ::basegfx::tools::getPositionRelative( maPathPoly, @@ -537,7 +537,7 @@ namespace slideshow */ bool operator()( const ValueT& x ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "GenericAnimation::operator(): Invalid ShapeAttributeLayer" ); ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) ); @@ -552,7 +552,7 @@ namespace slideshow */ bool operator()( ValueT x ) { - ENSURE_OR_RETURN( mpAttrLayer && mpShape, + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "GenericAnimation::operator(): Invalid ShapeAttributeLayer" ); ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) ); diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx index e99a246f6bb6..584737807c33 100644 --- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx +++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx @@ -201,7 +201,7 @@ bool implCreateIteratedNodes( // ================================== // TODO(E1): I'm not too sure what to expect here... - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( xIterNode->getTarget().hasValue(), "implCreateIteratedNodes(): no target on ITERATE node" ); @@ -216,14 +216,14 @@ bool implCreateIteratedNodes( { // no shape provided. Maybe a ParagraphTarget? if( !(xIterNode->getTarget() >>= aTarget) ) - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): could not extract any " "target information" ); xTargetShape = aTarget.Shape; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( xTargetShape.is(), "implCreateIteratedNodes(): invalid shape in ParagraphTarget" ); @@ -254,7 +254,7 @@ bool implCreateIteratedNodes( // paragraph) if( bParagraphTarget ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( aTarget.Paragraph >= 0 && rTreeNodeSupplier.getNumberOfTreeNodes( DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) > aTarget.Paragraph, @@ -325,7 +325,7 @@ bool implCreateIteratedNodes( if( !::anim::for_each_childNode( xNode, aCreator ) ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): iterated child node creation failed" ); } @@ -448,7 +448,7 @@ bool implCreateIteratedNodes( if( !::anim::for_each_childNode( xNode, aCreator ) ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "implCreateIteratedNodes(): " "iterated child node creation failed" ); } diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx index 6ad15e43462f..ffc7c32f7298 100644 --- a/slideshow/source/engine/animationnodes/basenode.cxx +++ b/slideshow/source/engine/animationnodes/basenode.cxx @@ -674,7 +674,7 @@ bool BaseNode::registerDeactivatingListener( if (! checkValidNode()) return false; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rNotifee, "BaseNode::registerDeactivatingListener(): invalid notifee" ); maDeactivatingListeners.push_back( rNotifee ); diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index d62a7946d3c7..e64000a0b40f 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -616,7 +616,7 @@ bool EventMultiplexerImpl::notifyMouseHandlers( uno::Reference xView( e.Source, uno::UNO_QUERY ); - ENSURE_OR_RETURN( xView.is(), "EventMultiplexer::notifyHandlers(): " + ENSURE_OR_RETURN_FALSE( xView.is(), "EventMultiplexer::notifyHandlers(): " "event source is not an XSlideShowView" ); // find corresponding view (to map mouse position into user @@ -631,7 +631,7 @@ bool EventMultiplexerImpl::notifyMouseHandlers( boost::cref( xView ), boost::bind( &UnoView::getUnoView, _1 ) ) ) ) == aEnd) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( false, "EventMultiplexer::notifyHandlers(): " "event source not found under registered views" ); } diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx index 44e1cad2f45e..9b09fb7d60f9 100644 --- a/slideshow/source/engine/eventqueue.cxx +++ b/slideshow/source/engine/eventqueue.cxx @@ -112,7 +112,7 @@ namespace slideshow rEvent.get(), rEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( rEvent, + ENSURE_OR_RETURN_FALSE( rEvent, "EventQueue::addEvent: event ptr NULL" ); // prepare entry @@ -141,7 +141,7 @@ namespace slideshow rEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( rEvent.get() != NULL, + ENSURE_OR_RETURN_FALSE( rEvent.get() != NULL, "EventQueue::addEvent: event ptr NULL" ); maNextEvents.push_back( EventEntry( rEvent, rEvent->getActivationTime( @@ -161,7 +161,7 @@ namespace slideshow rpEvent->getActivationTime(0.0)); #endif - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rpEvent.get() != NULL, "EventQueue::addEvent: event ptr NULL"); diff --git a/slideshow/source/engine/shapeattributelayer.cxx b/slideshow/source/engine/shapeattributelayer.cxx index 294503a71b77..07566c09d05e 100644 --- a/slideshow/source/engine/shapeattributelayer.cxx +++ b/slideshow/source/engine/shapeattributelayer.cxx @@ -214,7 +214,7 @@ namespace slideshow bool ShapeAttributeLayer::revokeChildLayer( const ShapeAttributeLayerSharedPtr& rChildLayer ) { - ENSURE_OR_RETURN( rChildLayer, + ENSURE_OR_RETURN_FALSE( rChildLayer, "ShapeAttributeLayer::revokeChildLayer(): Will not remove NULL child" ); if( !haveChild() ) diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 3f1f6109e3f4..d25be17d002d 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -703,7 +703,7 @@ bool ActivityImpl::perform() if( !isActive() ) return false; - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( mpDrawShape, "ActivityImpl::perform(): still active, but NULL draw shape" ); diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 899804fe1896..09c79e01ad02 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -330,7 +330,7 @@ namespace slideshow mbForceUpdate = false; mbAttributeLayerRevoked = false; - ENSURE_OR_RETURN( !maViewShapes.empty(), + ENSURE_OR_RETURN_FALSE( !maViewShapes.empty(), "DrawShape::implRender(): render called on DrawShape without views" ); if( maBounds.isEmpty() ) @@ -1062,7 +1062,7 @@ namespace slideshow bool DrawShape::setIntrinsicAnimationFrame( ::std::size_t nCurrFrame ) { - ENSURE_OR_RETURN( nCurrFrame < maAnimationFrames.size(), + ENSURE_OR_RETURN_FALSE( nCurrFrame < maAnimationFrames.size(), "DrawShape::setIntrinsicAnimationFrame(): frame index out of bounds" ); if( mnCurrFrame != nCurrFrame ) diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx index 4817a131cddc..6c8acb6d552e 100644 --- a/slideshow/source/engine/shapes/gdimtftools.cxx +++ b/slideshow/source/engine/shapes/gdimtftools.cxx @@ -189,7 +189,7 @@ bool getMetaFile( const uno::Reference< lang::XComponent >& xSource, int mtfLoadFlags, const uno::Reference< uno::XComponentContext >& rxContext ) { - ENSURE_OR_RETURN( rxContext.is(), + ENSURE_OR_RETURN_FALSE( rxContext.is(), "getMetaFile(): Invalid context" ); // create dummy XGraphicRenderer, which receives the @@ -389,7 +389,7 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames& o_rFrames, break; default: - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "getAnimationFromGraphic(): Unexpected case" ); break; } diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx index 0889fd7654ed..876b22973225 100644 --- a/slideshow/source/engine/shapes/viewappletshape.cxx +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -141,7 +141,7 @@ namespace slideshow bool ViewAppletShape::startApplet( const ::basegfx::B2DRectangle& rBounds ) { - ENSURE_OR_RETURN( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), + ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), "ViewAppletShape::startApplet(): Invalid or disposed view" ); try { diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index 5826f752cbec..2c96d32e938c 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -71,7 +71,7 @@ namespace slideshow const GDIMetaFileSharedPtr& rMtf ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewBackgroundShape::prefetch()" ); - ENSURE_OR_RETURN( rMtf, + ENSURE_OR_RETURN_FALSE( rMtf, "ViewBackgroundShape::prefetch(): no valid metafile!" ); const ::basegfx::B2DHomMatrix& rCanvasTransform( @@ -131,7 +131,7 @@ namespace slideshow *rMtf.get(), ::cppcanvas::Renderer::Parameters() ) ); - ENSURE_OR_RETURN( pRenderer, + ENSURE_OR_RETURN_FALSE( pRenderer, "ViewBackgroundShape::prefetch(): Could not create Renderer" ); pRenderer->setTransformation( aShapeTransform ); @@ -172,7 +172,7 @@ namespace slideshow if( !prefetch( rDestinationCanvas, rMtf ) ) return false; - ENSURE_OR_RETURN( mxBitmap.is(), + ENSURE_OR_RETURN_FALSE( mxBitmap.is(), "ViewBackgroundShape::draw(): Invalid background bitmap" ); ::basegfx::B2DHomMatrix aTransform( mpViewLayer->getTransformation() ); diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index 03fdff737e7c..089e8aaf9708 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -275,7 +275,7 @@ namespace slideshow { if( !mxPlayer.is() && mxShape.is() ) { - ENSURE_OR_RETURN( mpViewLayer->getCanvas(), + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewMediaShape::update(): Invalid layer canvas" ); uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas()->getUNOCanvas() ); diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 4e9c255c86ea..c73c2ec85b5e 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -81,7 +81,7 @@ namespace slideshow const ShapeAttributeLayerSharedPtr& rAttr ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::prefetch()" ); - ENSURE_OR_RETURN( rMtf, + ENSURE_OR_RETURN_FALSE( rMtf, "ViewShape::prefetch(): no valid metafile!" ); if( rMtf != io_rCacheEntry.mpMtf || @@ -207,7 +207,7 @@ namespace slideshow ::cppcanvas::RendererSharedPtr pRenderer( getRenderer( rDestinationCanvas, rMtf, rAttr ) ); - ENSURE_OR_RETURN( pRenderer, "ViewShape::draw(): Invalid renderer" ); + ENSURE_OR_RETURN_FALSE( pRenderer, "ViewShape::draw(): Invalid renderer" ); pRenderer->setTransformation( rTransform ); #if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0 @@ -399,7 +399,7 @@ namespace slideshow mpSprite->resize( rSpriteSizePixel ); } - ENSURE_OR_RETURN( mpSprite, "ViewShape::renderSprite(): No sprite" ); + ENSURE_OR_RETURN_FALSE( mpSprite, "ViewShape::renderSprite(): No sprite" ); VERBOSE_TRACE( "ViewShape::renderSprite(): Rendering sprite 0x%X", mpSprite.get() ); @@ -873,7 +873,7 @@ namespace slideshow bool bIsVisible ) const { RTL_LOGFILE_CONTEXT( aLog, "::presentation::internal::ViewShape::update()" ); - ENSURE_OR_RETURN( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); // Shall we render to a sprite, or to a plain canvas? if( isBackgroundDetached() ) diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index b08241bf8fbb..7f009f5d2c44 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -342,7 +342,7 @@ bool ShapeManagerImpl::listenerAdded( if( (aIter = mrGlobalListenersMap.find( xShape )) == mrGlobalListenersMap.end() ) { - ENSURE_OR_RETURN(false, + ENSURE_OR_RETURN_FALSE(false, "ShapeManagerImpl::listenerAdded(): global " "shape listener map inconsistency!"); } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 84b6ad7b4305..7da1273d8ea3 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -795,9 +795,9 @@ bool SlideImpl::implPrefetchShow() if( mbShowLoaded ) return true; - ENSURE_OR_RETURN( mxDrawPage.is(), + ENSURE_OR_RETURN_FALSE( mxDrawPage.is(), "SlideImpl::implPrefetchShow(): Invalid draw page" ); - ENSURE_OR_RETURN( mpLayerManager, + ENSURE_OR_RETURN_FALSE( mpLayerManager, "SlideImpl::implPrefetchShow(): Invalid layer manager" ); // fetch desired page content @@ -908,7 +908,7 @@ bool SlideImpl::applyInitialShapeAttributes( try { - ENSURE_OR_RETURN( maContext.mxComponentContext.is(), + ENSURE_OR_RETURN_FALSE( maContext.mxComponentContext.is(), "SlideImpl::applyInitialShapeAttributes(): Invalid component context" ); uno::Reference xFac( @@ -936,7 +936,7 @@ bool SlideImpl::applyInitialShapeAttributes( // could not determine initial shape attributes - this // is an error, as some effects might then be plainly // invisible - ENSURE_OR_RETURN( false, + ENSURE_OR_RETURN_FALSE( false, "SlideImpl::applyInitialShapeAttributes(): " "couldn't create TargetPropertiesCreator." ); } @@ -1041,9 +1041,9 @@ bool SlideImpl::loadShapes() if( mbShapesLoaded ) return true; - ENSURE_OR_RETURN( mxDrawPage.is(), + ENSURE_OR_RETURN_FALSE( mxDrawPage.is(), "SlideImpl::loadShapes(): Invalid draw page" ); - ENSURE_OR_RETURN( mpLayerManager, + ENSURE_OR_RETURN_FALSE( mpLayerManager, "SlideImpl::loadShapes(): Invalid layer manager" ); // fetch desired page content diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index c06cc0786865..9c7c14f581bc 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -68,7 +68,7 @@ namespace slideshow bool SlideBitmap::draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const { - ENSURE_OR_RETURN( rCanvas && rCanvas->getUNOCanvas().is(), + ENSURE_OR_RETURN_FALSE( rCanvas && rCanvas->getUNOCanvas().is(), "SlideBitmap::draw(): Invalid canvas" ); // selectively only copy the transformation from current viewstate, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 109e64ca63c1..c1447b12efd8 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1324,8 +1324,8 @@ sal_Bool SlideShowImpl::addView( DBG_TESTSOLARMUTEX(); // first of all, check if view has a valid canvas - ENSURE_OR_RETURN( xView.is(), "addView(): Invalid view" ); - ENSURE_OR_RETURN( xView->getCanvas().is(), + ENSURE_OR_RETURN_FALSE( xView.is(), "addView(): Invalid view" ); + ENSURE_OR_RETURN_FALSE( xView->getCanvas().is(), "addView(): View does not provide a valid canvas" ); UnoViewSharedPtr const pView( createSlideView( @@ -1368,7 +1368,7 @@ sal_Bool SlideShowImpl::removeView( // precondition: must only be called from the main thread! DBG_TESTSOLARMUTEX(); - ENSURE_OR_RETURN( xView.is(), "removeView(): Invalid view" ); + ENSURE_OR_RETURN_FALSE( xView.is(), "removeView(): Invalid view" ); UnoViewSharedPtr const pView( maViewContainer.removeView( xView ) ); if( !pView ) diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index dcca4a51b4d7..ef1a8f98b6b2 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -855,7 +855,7 @@ bool SlideView::updateScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas.get(), "SlideView::updateScreen(): Disposed" ); return mpCanvas->updateScreen( false ); @@ -865,7 +865,7 @@ bool SlideView::paintScreen() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_RETURN( mpCanvas.get(), + ENSURE_OR_RETURN_FALSE( mpCanvas.get(), "SlideView::paintScreen(): Disposed" ); return mpCanvas->updateScreen( true ); diff --git a/slideshow/source/engine/transitions/shapetransitionfactory.cxx b/slideshow/source/engine/transitions/shapetransitionfactory.cxx index 43111f821a44..84c3ece93e46 100644 --- a/slideshow/source/engine/transitions/shapetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/shapetransitionfactory.cxx @@ -185,7 +185,7 @@ void ClippingAnimation::end_() bool ClippingAnimation::operator()( double nValue ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape, "ClippingAnimation::operator(): Invalid ShapeAttributeLayer" ); diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 4415599f84d8..c5d2f29cc578 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -181,7 +181,7 @@ public: virtual bool handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) { - ENSURE_OR_RETURN( + ENSURE_OR_RETURN_FALSE( rNode, "AllAnimationEventHandler::handleAnimationEvent(): Invalid node" ); -- cgit v1.2.3 From 0a8fa850daff277e2fe6aef3a483ee2817bcd3db Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 08:50:19 +0100 Subject: autorecovery: removed dbdocrecovery.obj, should have happened when the cxx file was moved --- dbaccess/source/core/dataaccess/makefile.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/dbaccess/source/core/dataaccess/makefile.mk b/dbaccess/source/core/dataaccess/makefile.mk index f74188527c6f..c48056ea836f 100644 --- a/dbaccess/source/core/dataaccess/makefile.mk +++ b/dbaccess/source/core/dataaccess/makefile.mk @@ -65,7 +65,6 @@ SLOFILES= \ $(SLO)$/documentevents.obj \ $(SLO)$/documenteventexecutor.obj \ $(SLO)$/documenteventnotifier.obj \ - $(SLO)$/dbdocrecovery.obj # --- Targets ---------------------------------- -- cgit v1.2.3 From e1e25bdd16958a72c952ccb9eb70f05636637e9d Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 10:12:25 +0100 Subject: dba33f: when re-activating an embedded object, do not reset its modified state (plus do not the other initializations which are needed for the first activation only) --- dbaccess/source/core/dataaccess/documentdefinition.cxx | 8 ++++---- dbaccess/source/core/dataaccess/documentdefinition.hxx | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 50f391c64afb..4687b7cfdd34 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -741,7 +741,7 @@ void ODocumentDefinition::impl_removeFrameFromDesktop_throw( const Reference< XF } // ----------------------------------------------------------------------------- -void ODocumentDefinition::impl_onActivateEmbeddedObject() +void ODocumentDefinition::impl_onActivateEmbeddedObject( const bool i_bReactivated ) { try { @@ -771,7 +771,7 @@ void ODocumentDefinition::impl_onActivateEmbeddedObject() LifetimeCoupler::couple( *this, Reference< XComponent >( xFrame, UNO_QUERY_THROW ) ); // init the edit view - if ( m_bOpenInDesign ) + if ( m_bOpenInDesign && !i_bReactivated ) impl_initObjectEditView( xController ); } catch( const RuntimeException& ) @@ -1085,7 +1085,7 @@ void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, con if ( _bActivate && !bOpenHidden ) { m_xEmbeddedObject->changeState( EmbedStates::ACTIVE ); - impl_onActivateEmbeddedObject(); + impl_onActivateEmbeddedObject( false ); } // LLA: Alle fillReportData() calls prfen, sollte es welche geben, die danach noch viel machen @@ -1126,7 +1126,7 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co if ( bIsActive && !bIsAliveNewStyleReport ) { - impl_onActivateEmbeddedObject(); + impl_onActivateEmbeddedObject( true ); return makeAny( getComponent() ); } } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 32ec2c68a083..9fc32364cb0a 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -217,10 +217,8 @@ public: private: /** does necessary initializations after our embedded object has been switched to ACTIVE - @param _bOpenedInDesignMode - determines whether the embedded object has been opened for designing it or for data display */ - void impl_onActivateEmbeddedObject(); + void impl_onActivateEmbeddedObject( const bool i_bReactivated ); /** initializes a newly created view/controller which is displaying our embedded object -- cgit v1.2.3 From b7b66e1606387cf439990274ce45b771085b4434 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 13:04:04 +0100 Subject: autorecovery: recover forms/reports hidden, and show them when the main window is shown --- .../source/core/dataaccess/documentdefinition.cxx | 89 ++++++++++- .../source/core/dataaccess/documentdefinition.hxx | 6 + .../source/core/inc/recovery/dbdocrecovery.hxx | 4 +- dbaccess/source/core/recovery/dbdocrecovery.cxx | 101 ++++++++++--- dbaccess/source/core/recovery/makefile.mk | 3 +- .../source/core/recovery/subcomponentloader.cxx | 165 +++++++++++++++++++++ .../source/core/recovery/subcomponentloader.hxx | 82 ++++++++++ 7 files changed, 424 insertions(+), 26 deletions(-) create mode 100644 dbaccess/source/core/recovery/subcomponentloader.cxx create mode 100644 dbaccess/source/core/recovery/subcomponentloader.hxx diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 4687b7cfdd34..61c0463f8ba4 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -252,6 +252,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace view; @@ -417,6 +418,40 @@ namespace dbaccess inline void resetClient(ODocumentDefinition* _pClient) { m_pClient = _pClient; } }; + //================================================================== + // LockModifiable + //================================================================== + class LockModifiable + { + public: + LockModifiable( const Reference< XInterface >& i_rModifiable ) + :m_xModifiable( i_rModifiable, UNO_QUERY ) + { + OSL_ENSURE( m_xModifiable.is(), "LockModifiable::LockModifiable: invalid component!" ); + if ( m_xModifiable.is() ) + { + if ( !m_xModifiable->isSetModifiedEnabled() ) + { + // somebody already locked that, no need to lock it, again, and no need to unlock it later + m_xModifiable.clear(); + } + else + { + m_xModifiable->disableSetModified(); + } + } + } + + ~LockModifiable() + { + if ( m_xModifiable.is() ) + m_xModifiable->enableSetModified(); + } + + private: + Reference< XModifiable2 > m_xModifiable; + }; + //================================================================== // LifetimeCoupler //================================================================== @@ -885,6 +920,9 @@ void ODocumentDefinition::impl_initObjectEditView( const Reference< XController Reference< XViewSettingsSupplier > xSettingsSupplier( _rxController, UNO_QUERY_THROW ); Reference< XPropertySet > xViewSettings( xSettingsSupplier->getViewSettings(), UNO_QUERY_THROW ); + // the below code could indirectly tamper with the "modified" flag of the model, temporarily disable this + LockModifiable aLockModify( _rxController->getModel() ); + // The visual area size can be changed by the setting of the following properties // so it should be restored later PreserveVisualAreaSize aPreserveVisAreaSize( _rxController->getModel() ); @@ -902,9 +940,6 @@ void ODocumentDefinition::impl_initObjectEditView( const Reference< XController xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")),makeAny(sal_True)); xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RasterSubdivisionX")),makeAny(sal_Int32(5))); xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RasterSubdivisionY")),makeAny(sal_Int32(5))); - - Reference< XModifiable > xModifiable( _rxController->getModel(), UNO_QUERY_THROW ); - xModifiable->setModified( sal_False ); } catch( const Exception& ) { @@ -912,6 +947,39 @@ void ODocumentDefinition::impl_initObjectEditView( const Reference< XController } } +// ----------------------------------------------------------------------------- +void ODocumentDefinition::impl_showOrHideComponent_throw( const bool i_bShow ) +{ + const sal_Int32 nCurrentState = m_xEmbeddedObject.is() ? m_xEmbeddedObject->getCurrentState() : EmbedStates::LOADED; + switch ( nCurrentState ) + { + default: + case EmbedStates::LOADED: + throw embed::WrongStateException( ::rtl::OUString(), *this ); + + case EmbedStates::RUNNING: + if ( !i_bShow ) + // fine, a running (and not yet active) object is never visible + return; + { + LockModifiable aLockModify( impl_getComponent_throw() ); + m_xEmbeddedObject->changeState( EmbedStates::ACTIVE ); + impl_onActivateEmbeddedObject( false ); + } + break; + + case EmbedStates::ACTIVE: + { + Reference< XModel > xEmbeddedDoc( impl_getComponent_throw( true ), UNO_QUERY_THROW ); + Reference< XController > xEmbeddedController( xEmbeddedDoc->getCurrentController(), UNO_SET_THROW ); + Reference< XFrame > xEmbeddedFrame( xEmbeddedController->getFrame(), UNO_SET_THROW ); + Reference< XWindow > xEmbeddedWindow( xEmbeddedFrame->getContainerWindow(), UNO_SET_THROW ); + xEmbeddedWindow->setVisible( i_bShow ); + } + break; + } +} + // ----------------------------------------------------------------------------- void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, const bool _bActivate, const Reference< XCommandEnvironment >& _rxEnvironment, Any& _out_rComponent, ::osl::ClearableMutexGuard & _aGuard ) @@ -1084,6 +1152,7 @@ void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, con if ( _bActivate && !bOpenHidden ) { + LockModifiable aLockModify( impl_getComponent_throw() ); m_xEmbeddedObject->changeState( EmbedStates::ACTIVE ); impl_onActivateEmbeddedObject( false ); } @@ -1131,12 +1200,17 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co } } - // m_bOpenInDesign = bOpenInDesign; - // onCommandOpenSomething( aCommand.Argument, !bOpenForMail, Environment, aRet, aGuard ); - m_bOpenInDesign = bOpenInDesign || bOpenForMail; onCommandOpenSomething( aCommand.Argument, bActivateObject, Environment, aRet, aGuard ); } + else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "show" ) ) ) + { + impl_showOrHideComponent_throw( true ); + } + else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "hide" ) ) ) + { + impl_showOrHideComponent_throw( false ); + } else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "copyTo" ) ) ) { Sequence aIni; @@ -1792,8 +1866,9 @@ void ODocumentDefinition::loadEmbeddedObject( const Reference< XConnection >& _x m_xEmbeddedObject->changeState(EmbedStates::RUNNING); if ( bSetSize ) { - awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); + LockModifiable aLockModify( impl_getComponent_throw( false ) ); + awt::Size aSize( DEFAULT_WIDTH, DEFAULT_HEIGHT ); m_xEmbeddedObject->setVisualAreaSize(Aspects::MSOLE_CONTENT,aSize); } } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 9fc32364cb0a..28cbc34710e6 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -253,6 +253,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > impl_getComponent_throw( const bool i_ForceCreate = true ); + /** shows or hides our component + + The embedded object must exist, and be in state LOADED, at least. + */ + void impl_showOrHideComponent_throw( const bool i_bShow ); + // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; diff --git a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx index 0bf44e2bf3e8..4aa124dc7015 100644 --- a/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx +++ b/dbaccess/source/core/inc/recovery/dbdocrecovery.hxx @@ -26,6 +26,8 @@ #ifndef DBACCESS_DBDOCRECOVERY_HXX #define DBACCESS_DBDOCRECOVERY_HXX +#include "dbaccessdllapi.h" + /** === begin UNO includes === **/ #include #include @@ -48,7 +50,7 @@ namespace dbaccess //= DatabaseDocumentRecovery //==================================================================== struct DatabaseDocumentRecovery_Data; - class DatabaseDocumentRecovery + class DBACCESS_DLLPRIVATE DatabaseDocumentRecovery { public: DatabaseDocumentRecovery( diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index b22c19a07b6d..bf2a68987bb1 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -27,6 +27,7 @@ #include "recovery/dbdocrecovery.hxx" #include "sdbcoretools.hxx" +#include "subcomponentloader.hxx" #include "dbastrings.hrc" /** === begin UNO includes === **/ @@ -40,6 +41,10 @@ #include #include #include +#include +#include +#include +#include /** === end UNO includes === **/ #include @@ -84,6 +89,10 @@ namespace dbaccess using ::com::sun::star::io::XActiveDataSink; using ::com::sun::star::frame::XModel; using ::com::sun::star::util::XModifiable; + using ::com::sun::star::sdb::XFormDocumentsSupplier; + using ::com::sun::star::sdb::XReportDocumentsSupplier; + using ::com::sun::star::ucb::XCommandProcessor; + using ::com::sun::star::container::XHierarchicalNameAccess; /** === end UNO using === **/ namespace ElementModes = ::com::sun::star::embed::ElementModes; @@ -107,7 +116,7 @@ namespace dbaccess UNKNOWN = 10001 }; - struct SubComponentDescriptor + struct DBACCESS_DLLPRIVATE SubComponentDescriptor { ::rtl::OUString sName; bool bForEditing; @@ -130,7 +139,7 @@ namespace dbaccess typedef ::std::map< SubComponentType, MapStringToCompDesc > MapCompTypeToCompDescs; // ......................................................................... - void lcl_getPersistentRepresentation( const MapStringToCompDesc::value_type& i_rComponentDesc, ::rtl::OUStringBuffer& o_rBuffer ) + static void lcl_getPersistentRepresentation( const MapStringToCompDesc::value_type& i_rComponentDesc, ::rtl::OUStringBuffer& o_rBuffer ) { o_rBuffer.append( i_rComponentDesc.first ); o_rBuffer.append( sal_Unicode( '=' ) ); @@ -140,7 +149,7 @@ namespace dbaccess } // ......................................................................... - bool lcl_extractCompDesc( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc ) + static bool lcl_extractCompDesc( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rStorName, SubComponentDescriptor& o_rCompDesc ) { const sal_Int32 nEqualSignPos = i_rIniLine.indexOf( sal_Unicode( '=' ) ); if ( nEqualSignPos < 1 ) @@ -162,7 +171,7 @@ namespace dbaccess } // ......................................................................... - SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) + static SubComponentType lcl_databaseObjectToSubComponentType( const sal_Int32 i_nObjectType ) { switch ( i_nObjectType ) { @@ -177,14 +186,14 @@ namespace dbaccess } // ......................................................................... - const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() + static const ::rtl::OUString& lcl_getRecoveryDataSubStorageName() { static const ::rtl::OUString s_sRecDataStorName( RTL_CONSTASCII_USTRINGPARAM( "recovery" ) ); return s_sRecDataStorName; } // ......................................................................... - const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType ) + static const ::rtl::OUString& lcl_getComponentsStorageName( const SubComponentType i_eType ) { static const ::rtl::OUString s_sFormsStorageName( RTL_CONSTASCII_USTRINGPARAM( "forms" ) ); static const ::rtl::OUString s_sReportsStorageName( RTL_CONSTASCII_USTRINGPARAM( "reports" ) ); @@ -214,21 +223,21 @@ namespace dbaccess } // ......................................................................... - const ::rtl::OUString& lcl_getObjectMapStreamName() + static const ::rtl::OUString& lcl_getObjectMapStreamName() { static const ::rtl::OUString s_sObjectMapStreamName( RTL_CONSTASCII_USTRINGPARAM( "storage-component-map.ini" ) ); return s_sObjectMapStreamName; } // ......................................................................... - const ::rtl::OUString& lcl_getMapStreamEncodingName() + static const ::rtl::OUString& lcl_getMapStreamEncodingName() { static const ::rtl::OUString s_sMapStreamEncodingName( RTL_CONSTASCII_USTRINGPARAM( "UTF-8" ) ); return s_sMapStreamEncodingName; } // ......................................................................... - void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + static void lcl_writeObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, const MapStringToCompDesc& i_mapStorageToCompDesc ) { if ( i_mapStorageToCompDesc.empty() ) @@ -265,7 +274,7 @@ namespace dbaccess } // ......................................................................... - bool lcl_isSectionStart( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rSectionName ) + static bool lcl_isSectionStart( const ::rtl::OUString& i_rIniLine, ::rtl::OUString& o_rSectionName ) { const sal_Int32 nLen = i_rIniLine.getLength(); if ( ( nLen > 0 ) && ( i_rIniLine.getStr()[0] == '[' ) && ( i_rIniLine.getStr()[ nLen - 1 ] == ']' ) ) @@ -277,7 +286,7 @@ namespace dbaccess } // ......................................................................... - void lcl_stripTrailingLineFeed( ::rtl::OUString& io_rLine ) + static void lcl_stripTrailingLineFeed( ::rtl::OUString& io_rLine ) { const sal_Int32 nLen = io_rLine.getLength(); if ( ( nLen > 0 ) && ( io_rLine.getStr()[ nLen - 1 ] == '\n' ) ) @@ -285,7 +294,7 @@ namespace dbaccess } // ......................................................................... - void lcl_readObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, + static void lcl_readObjectMap_throw( const ::comphelper::ComponentContext& i_rContext, const Reference< XStorage >& i_rStorage, MapStringToCompDesc& o_mapStorageToObjectName ) { ENSURE_OR_THROW( i_rStorage.is(), "invalid storage" ); @@ -339,7 +348,7 @@ namespace dbaccess } // ......................................................................... - bool lcl_determineReadOnly( const Reference< XComponent >& i_rComponent ) + static bool lcl_determineReadOnly( const Reference< XComponent >& i_rComponent ) { Reference< XModel > xDocument( i_rComponent, UNO_QUERY ); if ( !xDocument.is() ) @@ -356,7 +365,7 @@ namespace dbaccess } // ......................................................................... - void lcl_markModified( const Reference< XComponent >& i_rSubComponent ) + static void lcl_markModified( const Reference< XComponent >& i_rSubComponent ) { const Reference< XModifiable > xModify( i_rSubComponent, UNO_QUERY ); if ( !xModify.is() ) @@ -367,6 +376,36 @@ namespace dbaccess xModify->setModified( sal_True ); } + + // ......................................................................... + static Reference< XCommandProcessor > lcl_getSubComponentDef_nothrow( const Reference< XController >& i_rAppUI, + SubComponentType i_eType, const ::rtl::OUString& i_rName ) + { + ENSURE_OR_RETURN( i_rAppUI.is(), "lcl_getSubComponentDef_nothrow: illegal controller", NULL ); + ENSURE_OR_RETURN( ( i_eType == FORM ) || ( i_eType == REPORT ), "lcl_getSubComponentDef_nothrow: illegal controller", NULL ); + + Reference< XCommandProcessor > xCommandProcessor; + try + { + Reference< XHierarchicalNameAccess > xDefinitionContainer; + if ( i_eType == FORM ) + { + Reference< XFormDocumentsSupplier > xSuppForms( i_rAppUI->getModel(), UNO_QUERY_THROW ); + xDefinitionContainer.set( xSuppForms->getFormDocuments(), UNO_QUERY_THROW ); + } + else + { + Reference< XReportDocumentsSupplier > xSuppReports( i_rAppUI->getModel(), UNO_QUERY_THROW ); + xDefinitionContainer.set( xSuppReports->getReportDocuments(), UNO_QUERY_THROW ); + } + xCommandProcessor.set( xDefinitionContainer->getByHierarchicalName( i_rName ), UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xCommandProcessor; + } } //==================================================================== @@ -670,17 +709,45 @@ namespace dbaccess ::comphelper::NamedValueCollection aLoadArgs; aLoadArgs.put( "RecoveryStorage", xCompStor ); + // load/create the sub component hidden. We'll show it when the main app window is shown. + aLoadArgs.put( "Hidden", true ); + try { Reference< XComponent > xSubComponent; + Reference< XCommandProcessor > xDocDefinition; + if ( sComponentName.getLength() ) { - xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, - stor->second.bForEditing, aLoadArgs.getPropertyValues() ); + xDocDefinition = lcl_getSubComponentDef_nothrow( i_rTargetController, eComponentType, sComponentName ); + xSubComponent.set( xDocumentUI->loadComponentWithArguments( + eComponentType, + sComponentName, + stor->second.bForEditing, + aLoadArgs.getPropertyValues() + ), + UNO_SET_THROW + ); } else { - xSubComponent = xDocumentUI->createComponentWithArguments( eComponentType, aLoadArgs.getPropertyValues() ); + Reference< XComponent > xDocDefComponent; + xSubComponent.set( xDocumentUI->createComponentWithArguments( + eComponentType, + aLoadArgs.getPropertyValues(), + xDocDefComponent + ), + UNO_SET_THROW + ); + + xDocDefinition.set( xDocDefComponent, UNO_QUERY ); + OSL_ENSURE( xDocDefinition.is(), "DatabaseDocumentRecovery::recoverSubDocuments: loaded a form/report, but don't have a document definition?!" ); + } + + if ( xDocDefinition.is() ) + { + Reference< XInterface > xLoader( *new SubComponentLoader( i_rTargetController, xDocDefinition ) ); + (void)xLoader; } // at the moment, we only store, during session save, sub components which are modified. So, set this diff --git a/dbaccess/source/core/recovery/makefile.mk b/dbaccess/source/core/recovery/makefile.mk index 55c1211d80d4..2a69495c4044 100644 --- a/dbaccess/source/core/recovery/makefile.mk +++ b/dbaccess/source/core/recovery/makefile.mk @@ -44,7 +44,8 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= \ - $(SLO)$/dbdocrecovery.obj + $(SLO)$/dbdocrecovery.obj \ + $(SLO)$/subcomponentloader.obj # --- Targets ---------------------------------- diff --git a/dbaccess/source/core/recovery/subcomponentloader.cxx b/dbaccess/source/core/recovery/subcomponentloader.cxx new file mode 100644 index 000000000000..53d27bb93d47 --- /dev/null +++ b/dbaccess/source/core/recovery/subcomponentloader.cxx @@ -0,0 +1,165 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#include "precompiled_dbaccess.hxx" + +#include "subcomponentloader.hxx" + +/** === begin UNO includes === **/ +#include +#include +/** === end UNO includes === **/ + +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XController; + using ::com::sun::star::frame::XFrame; + using ::com::sun::star::awt::XWindow; + using ::com::sun::star::awt::WindowEvent; + using ::com::sun::star::lang::EventObject; + using ::com::sun::star::ucb::Command; + using ::com::sun::star::ucb::XCommandProcessor; + using ::com::sun::star::frame::XController2; + /** === end UNO using === **/ + + //==================================================================== + //= SubComponentLoader + //==================================================================== + struct DBACCESS_DLLPRIVATE SubComponentLoader_Data + { + const Reference< XCommandProcessor > xDocDefCommands; + Reference< XWindow > xAppComponentWindow; + + SubComponentLoader_Data( const Reference< XCommandProcessor >& i_rDocumentDefinition ) + :xDocDefCommands( i_rDocumentDefinition, UNO_SET_THROW ) + { + } + }; + + //==================================================================== + //= helper + //==================================================================== + namespace + { + //................................................................ + void lcl_onWindowShown_nothrow( const SubComponentLoader_Data& i_rData ) + { + try + { + Command aCommandOpen; + aCommandOpen.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "show" ) ); + + const sal_Int32 nCommandIdentifier = i_rData.xDocDefCommands->createCommandIdentifier(); + i_rData.xDocDefCommands->execute( aCommandOpen, nCommandIdentifier, NULL ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + + //==================================================================== + //= SubComponentLoader + //==================================================================== + //-------------------------------------------------------------------- + SubComponentLoader::SubComponentLoader( const Reference< XController >& i_rApplicationController, + const Reference< XCommandProcessor >& i_rSubDocumentDefinition ) + :m_pData( new SubComponentLoader_Data( i_rSubDocumentDefinition ) ) + { + // add as window listener to the controller's container window, so we get notified when it is shown + Reference< XController2 > xController( i_rApplicationController, UNO_QUERY_THROW ); + m_pData->xAppComponentWindow.set( xController->getComponentWindow(), UNO_SET_THROW ); + + osl_incrementInterlockedCount( &m_refCount ); + { + m_pData->xAppComponentWindow->addWindowListener( this ); + } + osl_decrementInterlockedCount( &m_refCount ); + } + + //-------------------------------------------------------------------- + SubComponentLoader::~SubComponentLoader() + { + delete m_pData, m_pData = NULL; + } + + //-------------------------------------------------------------------- + void SAL_CALL SubComponentLoader::windowResized( const WindowEvent& i_rEvent ) throw (RuntimeException) + { + // not interested in + (void)i_rEvent; + } + + //-------------------------------------------------------------------- + void SAL_CALL SubComponentLoader::windowMoved( const WindowEvent& i_rEvent ) throw (RuntimeException) + { + // not interested in + (void)i_rEvent; + } + + //-------------------------------------------------------------------- + void SAL_CALL SubComponentLoader::windowShown( const EventObject& i_rEvent ) throw (RuntimeException) + { + (void)i_rEvent; + + lcl_onWindowShown_nothrow( *m_pData ); + m_pData->xAppComponentWindow->removeWindowListener( this ); + } + + //-------------------------------------------------------------------- + void SAL_CALL SubComponentLoader::windowHidden( const EventObject& i_rEvent ) throw (RuntimeException) + { + // not interested in + (void)i_rEvent; + } + + //-------------------------------------------------------------------- + void SAL_CALL SubComponentLoader::disposing( const EventObject& i_rEvent ) throw (RuntimeException) + { + // not interested in + (void)i_rEvent; + } + +//........................................................................ +} // namespace dbaccess +//........................................................................ diff --git a/dbaccess/source/core/recovery/subcomponentloader.hxx b/dbaccess/source/core/recovery/subcomponentloader.hxx new file mode 100644 index 000000000000..7efaea016724 --- /dev/null +++ b/dbaccess/source/core/recovery/subcomponentloader.hxx @@ -0,0 +1,82 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef SUBCOMPONENTLOADER_HXX +#define SUBCOMPONENTLOADER_HXX + +#include "dbaccessdllapi.h" + +/** === begin UNO includes === **/ +#include +#include +#include +#include +/** === end UNO includes === **/ + +#include + +//........................................................................ +namespace dbaccess +{ +//........................................................................ + + //==================================================================== + //= SubComponentLoader + //==================================================================== + typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XWindowListener + > SubComponentLoader_Base; + struct SubComponentLoader_Data; + /** is a helper class which loads/opens a given sub component as soon as the main application + window becomes visible. + */ + class DBACCESS_DLLPRIVATE SubComponentLoader : public SubComponentLoader_Base + { + public: + SubComponentLoader( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& i_rApplicationController, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandProcessor >& i_rSubDocumentDefinition + ); + + // XWindowListener + virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ~SubComponentLoader(); + + private: + SubComponentLoader_Data* m_pData; + }; + +//........................................................................ +} // namespace dbaccess +//........................................................................ + +#endif // SUBCOMPONENTLOADER_HXX -- cgit v1.2.3 From 42adaa75b725911e79133406c61ae5bd9768357b Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 13:04:04 +0100 Subject: autorecovery: recover forms/reports hidden, and show them when the main window is shown --- offapi/com/sun/star/sdb/DocumentDefinition.idl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/offapi/com/sun/star/sdb/DocumentDefinition.idl b/offapi/com/sun/star/sdb/DocumentDefinition.idl index 2fc44f444f22..8ce0b9be262a 100644 --- a/offapi/com/sun/star/sdb/DocumentDefinition.idl +++ b/offapi/com/sun/star/sdb/DocumentDefinition.idl @@ -74,6 +74,12 @@ service DocumentDefinition the sub document could be closed. Reasons for not closing the document include vetos by third parties, for instance, because the user opened a dialog modal to the sub document, or a long-running task such as printing is currently running. +
  • show: shows the sub document. This is useful if you previously opened the + document hidden, or if you previously hide it using the hide command.
    + The open command is not available if the sub document has not been loaded, yet.
  • +
  • hide: hides the sub document. In opposite to the close command, + only the document window is hidden, but the document is kept loaded. A subsequent execution + of the show command will show the window, again.
  • */ service DefinitionContent; -- cgit v1.2.3 From f2478cdcebdb39d87e81f18d1bc3aa73198fc344 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 13:06:38 +0100 Subject: autorecovery: recover-hidden now also available for new (yet unsaved) forms/reports --- dbaccess/source/ui/app/AppController.cxx | 14 +++++++++----- dbaccess/source/ui/app/AppController.hxx | 10 +++++++--- dbaccess/source/ui/app/AppControllerGen.cxx | 9 +++++---- dbaccess/source/ui/misc/linkeddocuments.cxx | 23 +++++++++++++++++------ 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 9e6890f728eb..8af3a6692c53 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1374,7 +1374,10 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa if ( bAutoPilot ) getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) ); else - newElement( eType, aCreationArgs ); + { + Reference< XComponent > xDocDefinition; + newElement( eType, aCreationArgs, xDocDefinition ); + } } break; case SID_APP_NEW_FOLDER: @@ -2073,12 +2076,13 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) } // ----------------------------------------------------------------------------- -Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments ) +Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments, + Reference< XComponent >& o_rDocumentDefinition ) { OSL_ENSURE(getContainer(),"View is NULL! -> GPF"); Reference< XComponent > xComponent; - Reference< XComponent > xDefinition; + o_rDocumentDefinition.clear(); switch ( _eType ) { @@ -2089,7 +2093,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, if ( !aHelper->isConnected() ) break; - xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, xDefinition ); + xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, o_rDocumentDefinition ); } break; @@ -2121,7 +2125,7 @@ Reference< XComponent > OApplicationController::newElement( ElementType _eType, } if ( xComponent.is() ) - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); + onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition ); return xComponent; } diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index 16c13fad2e12..de0d6d6599f3 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -201,7 +201,11 @@ namespace dbaui Additional arguments to pass when creating the component */ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments ); + newElement( + ElementType _eType, + const ::comphelper::NamedValueCollection& i_rAdditionalArguments, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDocumentDefinition + ); /** creates a new database object, using an auto pilot @param _eType @@ -468,8 +472,8 @@ namespace dbaui virtual ::sal_Bool SAL_CALL closeSubComponents( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // XContextMenuInterception virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 6ae9d59c7eda..53a4440ee321 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -533,13 +533,13 @@ Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArgume } // ----------------------------------------------------------------------------- -Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType ) throw (IllegalArgumentException, SQLException, RuntimeException) +Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException) { - return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >() ); + return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >(), o_DocumentDefinition ); } // ----------------------------------------------------------------------------- -Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments ) throw (IllegalArgumentException, SQLException, RuntimeException) +Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::MutexGuard aGuard( getMutex() ); @@ -548,7 +548,8 @@ Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArgu Reference< XComponent > xComponent( newElement( lcl_objectType2ElementType( i_nObjectType ), - ::comphelper::NamedValueCollection( i_rArguments ) + ::comphelper::NamedValueCollection( i_rArguments ), + o_DocumentDefinition ) ); return xComponent; diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 70f297f621f4..9cb8f5b1745f 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -67,8 +67,8 @@ #ifndef _COM_SUN_STAR_UCB_XCOMMANDPROCESSOR_HPP_ #include #endif -#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ -#include +#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT_HPP_ +#include #endif #ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_ #include @@ -390,19 +390,30 @@ namespace dbaui aCreationArgs.put( "ClassID", aClassId ); aCreationArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, m_xConnection ); + // separate values which are real creation args from args relevant for opening the doc + ::comphelper::NamedValueCollection aCommandArgs; + if ( aCreationArgs.has( "Hidden" ) ) + { + aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) ); + aCreationArgs.remove( "Hidden" ); + } + Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aCreationArgs.getWrappedPropertyValues() ), UNO_QUERY_THROW ); - o_rDefinition.set( xContent, UNO_QUERY ); + + // put the OpenMode into the OpenArgs + OpenCommandArgument aOpenModeArg; + aOpenModeArg.Mode = OpenMode::DOCUMENT; + aCommandArgs.put( "OpenMode", aOpenModeArg ); + Command aCommand; aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "openDesign" ) ); - OpenCommandArgument2 aOpenCommand; - aOpenCommand.Mode = OpenMode::DOCUMENT; - aCommand.Argument <<= aOpenCommand; + aCommand.Argument <<= aCommandArgs.getPropertyValues(); WaitObject aWaitCursor( m_pDialogParent ); xNewDocument.set( xContent->execute( aCommand, xContent->createCommandIdentifier(), NULL ), UNO_QUERY ); } -- cgit v1.2.3 From f8ac972b4c8025d28ef577a6d41fa97b0a7296e7 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 13:06:38 +0100 Subject: autorecovery: recover-hidden now also available for new (yet unsaved) forms/reports --- .../star/sdb/application/XDatabaseDocumentUI.idl | 35 ++++++++++++++++------ 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl index ba68dbd79c48..938d98269d34 100644 --- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -276,21 +276,24 @@ interface XDatabaseDocumentUI ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException ); - /** creates a new sub cokmponent of the given type + /** creates a new sub component of the given type -

    In opposite to createComponent, this method allows you to specify - additional arguments which are passed to the to-be-loaded component.

    + @param ObjectType + specifies the type of the object, must be one of the DatabaseObject + constants. -

    The meaning of the the arguments is defined at the service which is effectively - created. See the above table for a list of those - services.

    + @param DocumentDefinition + Upon successful return, and if and only if ObjectType equals DatabaseObject::FORM + or DatabaseObject::REPORT, this will contain the DocumentDefinition + object which controls the sub component. */ ::com::sun::star::lang::XComponent createComponent( - [in] long ObjectType ) + [in] long ObjectType, + [out] ::com::sun::star::lang::XComponent DocumentDefinition ) raises ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException ); - /** creates a new sub cokmponent of the given type + /** creates a new sub component of the given type

    In opposite to createComponent, this method allows you to specify additional arguments which are passed to the to-be-loaded component.

    @@ -298,10 +301,24 @@ interface XDatabaseDocumentUI

    The meaning of the the arguments is defined at the service which is effectively created. See the above table for a list of those services.

    + + @param ObjectType + specifies the type of the object, must be one of the DatabaseObject + constants. + + @param DocumentDefinition + Upon successful return, and if and only if ObjectType equals DatabaseObject::FORM + or DatabaseObject::REPORT, this will contain the DocumentDefinition + object which controls the sub component.
    + You can use this object to control various aspects of the sub component. For instance, you could decide + to create the component hidden, by passing a Hidden flag (set to ) in Arguments, + manipulate the component, and then finally show it by invoking the show command at the + definition object. */ ::com::sun::star::lang::XComponent createComponentWithArguments( [in] long ObjectType, - [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments ) + [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments, + [out] ::com::sun::star::lang::XComponent DocumentDefinition ) raises ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException ); }; -- cgit v1.2.3 From 321086abdf8a3efaa161d7027d141bd3654b0dca Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 13:54:37 +0100 Subject: autorecovery: respect a media descriptor member "ForceRecovery". When set to , then an attempt to recover sub documents in the "recovery" folder is made. In this course, the m_aArgs member of the ModelImpl was replaced with m_aMediaDescriptor, being a NamedValueCollection, for easier access. --- dbaccess/source/core/dataaccess/ModelImpl.cxx | 36 ++++++-------------- dbaccess/source/core/dataaccess/ModelImpl.hxx | 9 ++--- .../source/core/dataaccess/databasedocument.cxx | 38 +++++++++++++--------- .../source/core/dataaccess/databasedocument.hxx | 2 +- .../source/core/dataaccess/documentdefinition.cxx | 2 +- 5 files changed, 39 insertions(+), 48 deletions(-) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 4095a608733c..cccea2f1821f 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -57,7 +57,6 @@ #include #include -#include #include #include #include @@ -840,13 +839,13 @@ void ODatabaseModelImpl::attachResource( const ::rtl::OUString& _rURL, const Seq } - m_aArgs = stripLoadArguments( aMediaDescriptor ); + m_aMediaDescriptor = stripLoadArguments( aMediaDescriptor ); switchToURL( sDocumentLocation, sDocumentURL ); } // ----------------------------------------------------------------------------- -Sequence< PropertyValue > ODatabaseModelImpl::stripLoadArguments( const ::comphelper::NamedValueCollection& _rArguments ) +::comphelper::NamedValueCollection ODatabaseModelImpl::stripLoadArguments( const ::comphelper::NamedValueCollection& _rArguments ) { OSL_ENSURE( !_rArguments.has( "Model" ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (1)!" ); OSL_ENSURE( !_rArguments.has( "ViewName" ), "ODatabaseModelImpl::stripLoadArguments: this is suspicious (2)!" ); @@ -854,7 +853,7 @@ Sequence< PropertyValue > ODatabaseModelImpl::stripLoadArguments( const ::comphe ::comphelper::NamedValueCollection aMutableArgs( _rArguments ); aMutableArgs.remove( "Model" ); aMutableArgs.remove( "ViewName" ); - return aMutableArgs.getPropertyValues(); + return aMutableArgs; } // ----------------------------------------------------------------------------- @@ -888,11 +887,9 @@ Reference< XStorage > ODatabaseModelImpl::getOrCreateRootStorage() if ( xStorageFactory.is() ) { Any aSource; - ::comphelper::NamedValueCollection aArgs( m_aArgs ); - - aSource = aArgs.get( "Stream" ); + aSource = m_aMediaDescriptor.get( "Stream" ); if ( !aSource.hasValue() ) - aSource = aArgs.get( "InputStream" ); + aSource = m_aMediaDescriptor.get( "InputStream" ); if ( !aSource.hasValue() && m_sDocFileLocation.getLength() ) aSource <<= m_sDocFileLocation; // TODO: shouldn't we also check URL? @@ -1048,7 +1045,7 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b // then nobody would call the doc's attachResource. So, we do it here, to ensure it's in a proper // state, fires all events, and so on. // #i105505# / 2009-10-02 / frank.schoenheit@sun.com - xModel->attachResource( ::rtl::OUString(), m_aArgs ); + xModel->attachResource( ::rtl::OUString(), m_aMediaDescriptor.getPropertyValues() ); } if ( _bInitialize ) @@ -1197,9 +1194,8 @@ bool ODatabaseModelImpl::adjustMacroMode_AutoReject() // ----------------------------------------------------------------------------- bool ODatabaseModelImpl::checkMacrosOnLoading() { - ::comphelper::NamedValueCollection aArgs( m_aArgs ); Reference< XInteractionHandler > xInteraction; - xInteraction = aArgs.getOrDefault( "InteractionHandler", xInteraction ); + xInteraction = m_aMediaDescriptor.getOrDefault( "InteractionHandler", xInteraction ); return m_aMacroMode.checkMacrosOnLoading( xInteraction ); } @@ -1377,8 +1373,7 @@ sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const sal_Int16 nCurrentMode = MacroExecMode::NEVER_EXECUTE; try { - ::comphelper::NamedValueCollection aArgs( m_aArgs ); - nCurrentMode = aArgs.getOrDefault( "MacroExecutionMode", nCurrentMode ); + nCurrentMode = m_aMediaDescriptor.getOrDefault( "MacroExecutionMode", nCurrentMode ); } catch( const Exception& ) { @@ -1390,19 +1385,8 @@ sal_Int16 ODatabaseModelImpl::getCurrentMacroExecMode() const // ----------------------------------------------------------------------------- sal_Bool ODatabaseModelImpl::setCurrentMacroExecMode( sal_uInt16 nMacroMode ) { - try - { - ::comphelper::NamedValueCollection aArgs( m_aArgs ); - aArgs.put( "MacroExecutionMode", nMacroMode ); - aArgs >>= m_aArgs; - return sal_True; - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return sal_False; + m_aMediaDescriptor.put( "MacroExecutionMode", nMacroMode ); + return sal_True; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index 8697bf1abdc3..12b3edbd115d 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -73,6 +73,7 @@ /** === end UNO includes === **/ #include +#include #include #include #include @@ -191,7 +192,7 @@ private: ODatabaseContext* m_pDBContext; DocumentEventsData m_aDocumentEvents; - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aArgs; + ::comphelper::NamedValueCollection m_aMediaDescriptor; /// the URL the document was loaded from ::rtl::OUString m_sDocFileLocation; @@ -302,14 +303,14 @@ public: DocumentEventsData& getDocumentEvents() { return m_aDocumentEvents; } - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& - getResource() const { return m_aArgs; } + const ::comphelper::NamedValueCollection& + getMediaDescriptor() const { return m_aMediaDescriptor; } void attachResource( const ::rtl::OUString& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArgs ); - static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + static ::comphelper::NamedValueCollection stripLoadArguments( const ::comphelper::NamedValueCollection& _rArguments ); // other stuff diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index c6b6db11a20c..09db7ccb2e82 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -378,15 +378,15 @@ namespace } // ----------------------------------------------------------------------------- - static Sequence< PropertyValue > lcl_appendFileNameToDescriptor( const Sequence< PropertyValue >& _rDescriptor, const ::rtl::OUString _rURL ) + static Sequence< PropertyValue > lcl_appendFileNameToDescriptor( const ::comphelper::NamedValueCollection& _rDescriptor, const ::rtl::OUString _rURL ) { - ::comphelper::NamedValueCollection aMediaDescriptor( _rDescriptor ); + ::comphelper::NamedValueCollection aMutableDescriptor( _rDescriptor ); if ( _rURL.getLength() ) { - aMediaDescriptor.put( "FileName", _rURL ); - aMediaDescriptor.put( "URL", _rURL ); + aMutableDescriptor.put( "FileName", _rURL ); + aMutableDescriptor.put( "URL", _rURL ); } - return aMediaDescriptor.getPropertyValues(); + return aMutableDescriptor.getPropertyValues(); } } @@ -428,9 +428,9 @@ void ODatabaseDocument::impl_reset_nothrow() void ODatabaseDocument::impl_import_nolck_throw( const ::comphelper::ComponentContext _rContext, const Reference< XInterface >& _rxTargetComponent, const ::comphelper::NamedValueCollection& _rResource ) { - Sequence< Any > aFilterArgs; + Sequence< Any > aFilterCreationArgs; Reference< XStatusIndicator > xStatusIndicator; - lcl_extractAndStartStatusIndicator( _rResource, xStatusIndicator, aFilterArgs ); + lcl_extractAndStartStatusIndicator( _rResource, xStatusIndicator, aFilterCreationArgs ); /** property map for import info set */ comphelper::PropertyMapEntry aExportInfoMap[] = @@ -443,19 +443,20 @@ void ODatabaseDocument::impl_import_nolck_throw( const ::comphelper::ComponentCo xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(_rResource.getOrDefault("URL",::rtl::OUString()))); xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml")))); - const sal_Int32 nCount = aFilterArgs.getLength(); - aFilterArgs.realloc(nCount + 1); - aFilterArgs[nCount] <<= xInfoSet; + const sal_Int32 nCount = aFilterCreationArgs.getLength(); + aFilterCreationArgs.realloc(nCount + 1); + aFilterCreationArgs[nCount] <<= xInfoSet; Reference< XImporter > xImporter( - _rContext.createComponentWithArguments( "com.sun.star.comp.sdb.DBFilter", aFilterArgs ), + _rContext.createComponentWithArguments( "com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs ), UNO_QUERY_THROW ); Reference< XComponent > xComponent( _rxTargetComponent, UNO_QUERY_THROW ); xImporter->setTargetDocument( xComponent ); Reference< XFilter > xFilter( xImporter, UNO_QUERY_THROW ); - xFilter->filter( ODatabaseModelImpl::stripLoadArguments( _rResource ) ); + Sequence< PropertyValue > aFilterArgs( ODatabaseModelImpl::stripLoadArguments( _rResource ).getPropertyValues() ); + xFilter->filter( aFilterArgs ); if ( xStatusIndicator.is() ) xStatusIndicator->end(); @@ -751,7 +752,7 @@ sal_Bool ODatabaseDocument::impl_attachResource( const ::rtl::OUString& i_rURL, Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs( ) throw (RuntimeException) { DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit ); - return m_pImpl->getResource(); + return m_pImpl->getMediaDescriptor().getPropertyValues(); } // ----------------------------------------------------------------------------- @@ -781,7 +782,12 @@ void SAL_CALL ODatabaseDocument::connectController( const Reference< XController m_pImpl->checkMacrosOnLoading(); // check if there are sub components to recover from our document storage - if ( !m_bHasBeenRecovered ) + bool bAttemptRecovery = m_bHasBeenRecovered; + if ( !bAttemptRecovery && m_pImpl->getMediaDescriptor().has( "ForceRecovery" ) ) + // do not use getOrDefault, it will throw for invalid types, which is not desired here + m_pImpl->getMediaDescriptor().get( "ForceRecovery" ) >>= bAttemptRecovery; + + if ( !bAttemptRecovery ) return; try @@ -921,11 +927,11 @@ void SAL_CALL ODatabaseDocument::store( ) throw (IOException, RuntimeException) if ( m_pImpl->m_bDocumentReadOnly ) throw IOException(); - impl_storeAs_throw( m_pImpl->getURL(), m_pImpl->getResource(), SAVE, aGuard ); + impl_storeAs_throw( m_pImpl->getURL(), m_pImpl->getMediaDescriptor(), SAVE, aGuard ); } // ----------------------------------------------------------------------------- -void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const Sequence< PropertyValue>& _rArguments, +void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const ::comphelper::NamedValueCollection& _rArguments, const StoreType _eType, DocumentGuard& _rGuard ) throw ( IOException, RuntimeException ) { OSL_PRECOND( ( _eType == SAVE ) || ( _eType == SAVE_AS ), diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index f3206fbc15ae..6df14398d7d1 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -227,7 +227,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe */ void impl_storeAs_throw( const ::rtl::OUString& _rURL, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rArguments, + const ::comphelper::NamedValueCollection& _rArguments, const StoreType _eType, DocumentGuard& _rGuard ) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 61c0463f8ba4..1cacaa802259 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -993,7 +993,7 @@ void ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, con // for the document, default to the interaction handler as used for loading the DB doc // This might be overwritten below, when examining _rOpenArgument. - ::comphelper::NamedValueCollection aDBDocArgs( m_pImpl->m_pDataSource->getResource() ); + const ::comphelper::NamedValueCollection& aDBDocArgs( m_pImpl->m_pDataSource->getMediaDescriptor() ); aDocumentArgs.put( "InteractionHandler", aDBDocArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) ); ::boost::optional< sal_Int16 > aDocumentMacroMode; -- cgit v1.2.3 From 893f3398cac0ce641ad60e049becd57e20d726b2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 15:38:20 +0100 Subject: autorecovery: saveToRecoveryFile => storeToRecoveryFile --- dbaccess/source/core/dataaccess/databasedocument.cxx | 2 +- dbaccess/source/core/dataaccess/databasedocument.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 09db7ccb2e82..8ab6fefa71e3 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -614,7 +614,7 @@ namespace } // ----------------------------------------------------------------------------- -void SAL_CALL ODatabaseDocument::saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +void SAL_CALL ODatabaseDocument::storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) { DocumentGuard aGuard( *this ); ModifyLock aLock( *this ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 6df14398d7d1..4fd0823774b9 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -430,7 +430,7 @@ public: // css.document.XDocumentRecovery virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() throw ( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); + virtual void SAL_CALL storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); virtual void SAL_CALL recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException ); // XTitle -- cgit v1.2.3 From 9df0e540cbb8058e5ec7d001437c9213ce85b37e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 29 Jan 2010 15:38:20 +0100 Subject: autorecovery: saveToRecoveryFile => storeToRecoveryFile --- offapi/com/sun/star/document/XDocumentRecovery.idl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl index bed764957296..e5bf521d07f0 100644 --- a/offapi/com/sun/star/document/XDocumentRecovery.idl +++ b/offapi/com/sun/star/document/XDocumentRecovery.idl @@ -41,13 +41,13 @@ module com { module sun { module star { module document { */ interface XDocumentRecovery { - /** determines whether the document has been modified since the last call to saveToRecoveryFile. + /** determines whether the document has been modified since the last call to storeToRecoveryFile. -

    If saveToRecoveryFile has not been called before, this method returns whether the document +

    If storeToRecoveryFile has not been called before, this method returns whether the document has been modified since it has been loaded respectively created.

    When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a - periodic session save as configured by the user, saveToRecoveryFile is called for every + periodic session save as configured by the user, storeToRecoveryFile is called for every document where wasModifiedSinceLastSave returns .

    It's allowed to implement this method sloppy, by returning in cases where it is not sure whether @@ -74,7 +74,7 @@ interface XDocumentRecovery @see MediaDescriptor */ - void saveToRecoveryFile( + void storeToRecoveryFile( [in] string TargetLocation, [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor ) -- cgit v1.2.3 From 526575b69666adc555ea14c7524e2ba8bf7834b0 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 29 Jan 2010 15:49:01 +0100 Subject: improve deflate recognition, fix debug output --- sdext/source/pdfimport/pdfparse/pdfentries.cxx | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 9374e20f12bc..b0e2132fdd9c 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -642,8 +642,17 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const m_pStream->m_pDict->m_aMap.find( "Filter" ); if( it != m_pStream->m_pDict->m_aMap.end() ) { - // is the (first) filter FlateDecode ? PDFName* pFilter = dynamic_cast(it->second); + if( ! pFilter ) + { + PDFArray* pArray = dynamic_cast(it->second); + if( pArray && ! pArray->m_aSubElements.empty() ) + { + pFilter = dynamic_cast(pArray->m_aSubElements.front()); + } + } + + // is the (first) filter FlateDecode ? if( pFilter && pFilter->m_aName.equals( "FlateDecode" ) ) { bIsDeflated = true; @@ -673,8 +682,6 @@ bool PDFObject::getDeflatedStream( char** ppStream, unsigned int* pBytes, const } else *ppStream = NULL, *pBytes = 0; - // FIXME: one could also deflate if FlateDecode ws the - // first filter in an array return bIsDeflated; } @@ -1200,7 +1207,7 @@ PDFFileImplData* PDFFile::impl_getData() const #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "DocId is <" ); for( int i = 0; i < m_pData->m_aDocID.getLength(); i++ ) - fprintf( stderr, "%.2x", sal_uInt32(sal_uInt8(m_pData->m_aDocID.getStr()[i])) ); + fprintf( stderr, "%.2x", (unsigned int)sal_uInt8(m_pData->m_aDocID.getStr()[i]) ); fprintf( stderr, ">\n" ); #endif } @@ -1262,9 +1269,9 @@ PDFFileImplData* PDFFile::impl_getData() const #if OSL_DEBUG_LEVEL > 1 else { - fprintf( stderr, "O entry has length %d, should be 32 <", aEnt.getLength() ); + fprintf( stderr, "O entry has length %d, should be 32 <", (int)aEnt.getLength() ); for( int i = 0; i < aEnt.getLength(); i++ ) - fprintf( stderr, " %.2X", sal_uInt32(sal_uInt8(aEnt.getStr()[i])) ); + fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) ); fprintf( stderr, ">\n" ); } #endif @@ -1281,9 +1288,9 @@ PDFFileImplData* PDFFile::impl_getData() const #if OSL_DEBUG_LEVEL > 1 else { - fprintf( stderr, "U entry has length %d, should be 32 <", aEnt.getLength() ); + fprintf( stderr, "U entry has length %d, should be 32 <", (int)aEnt.getLength() ); for( int i = 0; i < aEnt.getLength(); i++ ) - fprintf( stderr, " %.2X", sal_uInt32(sal_uInt8(aEnt.getStr()[i])) ); + fprintf( stderr, " %.2X", (unsigned int)sal_uInt8(aEnt.getStr()[i]) ); fprintf( stderr, ">\n" ); } #endif @@ -1301,13 +1308,13 @@ PDFFileImplData* PDFFile::impl_getData() const if( pNum ) m_pData->m_nPEntry = static_cast(static_cast(pNum->m_fValue)); #if OSL_DEBUG_LEVEL > 1 - fprintf( stderr, "p entry is 0x%x\n", m_pData->m_nPEntry ); + fprintf( stderr, "p entry is %p\n", m_pData->m_nPEntry ); #endif } #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "Encryption dict: sec handler: %s, version = %d, revision = %d, key length = %d\n", pFilter ? OUStringToOString( pFilter->getFilteredName(), RTL_TEXTENCODING_UTF8 ).getStr() : "", - m_pData->m_nAlgoVersion, m_pData->m_nStandardRevision, m_pData->m_nKeyLength ); + (int)m_pData->m_nAlgoVersion, (int)m_pData->m_nStandardRevision, m_pData->m_nKeyLength ); #endif break; } -- cgit v1.2.3 From cddec3b38e83480ba3d16644fb944c83134e5946 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 29 Jan 2010 10:59:04 -0500 Subject: koheicsvimport: #i108754# Call FreeResources() in the ctor & remove textimportoptions from LIB1OBJFILES. --- sc/source/ui/dbgui/makefile.mk | 3 +-- sc/source/ui/dbgui/textimportoptions.cxx | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/dbgui/makefile.mk b/sc/source/ui/dbgui/makefile.mk index bc08eb671fe0..88a1c9817d4c 100644 --- a/sc/source/ui/dbgui/makefile.mk +++ b/sc/source/ui/dbgui/makefile.mk @@ -117,8 +117,7 @@ LIB1OBJFILES = \ $(SLO)$/csvruler.obj \ $(SLO)$/csvgrid.obj \ $(SLO)$/csvtablebox.obj \ - $(SLO)$/asciiopt.obj \ - $(SLO)$/textimportoptions.obj + $(SLO)$/asciiopt.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/dbgui/textimportoptions.cxx b/sc/source/ui/dbgui/textimportoptions.cxx index d1e0f0949f64..be918d2a0fbd 100644 --- a/sc/source/ui/dbgui/textimportoptions.cxx +++ b/sc/source/ui/dbgui/textimportoptions.cxx @@ -56,6 +56,7 @@ ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) : maFlOption(this, ScResId(FL_OPTION)), maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) { + FreeResource(); init(); } -- cgit v1.2.3 From a381cd8160f05c527bdea880aabc3aea0ab1c6c9 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 29 Jan 2010 11:31:38 -0500 Subject: koheicsvimport: #i108755# Moved the new check boxes to the left by 9 pixels. They should be aligned with the "Separated by" radio button. --- sc/source/ui/dbgui/asciiopt.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/dbgui/asciiopt.src b/sc/source/ui/dbgui/asciiopt.src index 57c338f0f70d..63e17f0f60f0 100644 --- a/sc/source/ui/dbgui/asciiopt.src +++ b/sc/source/ui/dbgui/asciiopt.src @@ -214,7 +214,7 @@ ModalDialog RID_SCDLG_ASCII CheckBox CB_QUOTED_AS_TEXT { - Pos = MAP_APPFONT ( 20 , 158 ) ; + Pos = MAP_APPFONT ( 12 , 158 ) ; Size = MAP_APPFONT ( 130 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Quoted field as text" ; @@ -222,7 +222,7 @@ ModalDialog RID_SCDLG_ASCII CheckBox CB_DETECT_SPECIAL_NUMBER { - Pos = MAP_APPFONT ( 20 , 171 ) ; + Pos = MAP_APPFONT ( 12 , 171 ) ; Size = MAP_APPFONT ( 130 , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Detect special numbers" ; -- cgit v1.2.3 From 2ba4d305871115cbc710663c865af29beafa40bc Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 29 Jan 2010 12:19:10 -0500 Subject: koheicsvimport: #i108754# Make sure that the html options dialog won't get launched on export. BTW, with this change, the character set dialog gets launched on html export instead.... :-/ --- sc/source/ui/unoobj/filtuno.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 90c86bca0cfb..96b3d13322be 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -186,7 +186,9 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) delete pDlg; delete pInStream; } - else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) + else if ( !bExport && + (aFilterString == ScDocShell::GetWebQueryFilterName() || + aFilterString == ScDocShell::GetHtmlFilterName()) ) { // HTML import. ::std::auto_ptr pDlg( -- cgit v1.2.3 From 1cc1a271e652ccfc6078217b071a95db19b8a8fd Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 29 Jan 2010 13:14:30 -0500 Subject: koheicsvimport: #i108754# Follow up to my previous commit. We need to ignore the execute() call when exporting to an html document. My previous change caused the character set dialog to show up during html export, which was not correct. --- sc/source/ui/unoobj/filtuno.cxx | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 96b3d13322be..59f48c51dffa 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -186,24 +186,25 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException) delete pDlg; delete pInStream; } - else if ( !bExport && - (aFilterString == ScDocShell::GetWebQueryFilterName() || - aFilterString == ScDocShell::GetHtmlFilterName()) ) + else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || aFilterString == ScDocShell::GetHtmlFilterName() ) { - // HTML import. - ::std::auto_ptr pDlg( - pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS)); - - if (pDlg->Execute() == RET_OK) + if (!bExport) { - LanguageType eLang = pDlg->GetLanguageType(); - OUStringBuffer aBuf; + // HTML import. + ::std::auto_ptr pDlg( + pFact->CreateScTextImportOptionsDlg(NULL, RID_SCDLG_TEXT_IMPORT_OPTIONS)); - aBuf.append(String::CreateFromInt32(static_cast(eLang))); - aBuf.append(sal_Unicode(' ')); - aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0')); - aFilterOptions = aBuf.makeStringAndClear(); - nRet = ui::dialogs::ExecutableDialogResults::OK; + if (pDlg->Execute() == RET_OK) + { + LanguageType eLang = pDlg->GetLanguageType(); + OUStringBuffer aBuf; + + aBuf.append(String::CreateFromInt32(static_cast(eLang))); + aBuf.append(sal_Unicode(' ')); + aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0')); + aFilterOptions = aBuf.makeStringAndClear(); + nRet = ui::dialogs::ExecutableDialogResults::OK; + } } } else -- cgit v1.2.3 From 0deefb5d0a6eec79a49602fa02d3dce46231a90a Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 29 Jan 2010 13:21:33 -0500 Subject: koheicsvimport: #i108756# Fixed the tab order of controls in the CSV options dialog. --- sc/source/ui/dbgui/scuiasciiopt.cxx | 5 +++-- sc/source/ui/inc/scuiasciiopt.hxx | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 244b2e785a72..a2cf247fda84 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -239,11 +239,12 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,String aDatName, aCkbAsOnce ( this, ScResId( CB_ASONCE) ), aFlOtherOpt ( this, ScResId( FL_OTHER_OPTIONS ) ), - aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ), - aCkbDetectNumber( this, ScResId(CB_DETECT_SPECIAL_NUMBER) ), aFtTextSep ( this, ScResId( FT_TEXTSEP ) ), aCbTextSep ( this, ScResId( CB_TEXTSEP ) ), + aCkbQuotedAsText( this, ScResId(CB_QUOTED_AS_TEXT) ), + aCkbDetectNumber( this, ScResId(CB_DETECT_SPECIAL_NUMBER) ), + aFlWidth ( this, ScResId( FL_WIDTH ) ), aFtType ( this, ScResId( FT_TYPE ) ), aLbType ( this, ScResId( LB_TYPE1 ) ), diff --git a/sc/source/ui/inc/scuiasciiopt.hxx b/sc/source/ui/inc/scuiasciiopt.hxx index 73dac06a3ed8..1a8086488043 100644 --- a/sc/source/ui/inc/scuiasciiopt.hxx +++ b/sc/source/ui/inc/scuiasciiopt.hxx @@ -71,12 +71,12 @@ class ScImportAsciiDlg : public ModalDialog FixedLine aFlOtherOpt; - CheckBox aCkbQuotedAsText; - CheckBox aCkbDetectNumber; - FixedText aFtTextSep; ComboBox aCbTextSep; + CheckBox aCkbQuotedAsText; + CheckBox aCkbDetectNumber; + FixedLine aFlWidth; FixedText aFtType; ListBox aLbType; -- cgit v1.2.3 From 02c9c9960f61f53970f886558796ae87ee7a92cd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 11:43:40 +0100 Subject: autorecovery: recoverSubDocuments: propagate exceptions to the caller, this way aborting the complete recovery process --- dbaccess/source/core/recovery/dbdocrecovery.cxx | 77 +++++++++++-------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index bf2a68987bb1..7e102dd84eb4 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -712,52 +712,45 @@ namespace dbaccess // load/create the sub component hidden. We'll show it when the main app window is shown. aLoadArgs.put( "Hidden", true ); - try + Reference< XComponent > xSubComponent; + Reference< XCommandProcessor > xDocDefinition; + + if ( sComponentName.getLength() ) + { + xDocDefinition = lcl_getSubComponentDef_nothrow( i_rTargetController, eComponentType, sComponentName ); + xSubComponent.set( xDocumentUI->loadComponentWithArguments( + eComponentType, + sComponentName, + stor->second.bForEditing, + aLoadArgs.getPropertyValues() + ), + UNO_SET_THROW + ); + } + else { - Reference< XComponent > xSubComponent; - Reference< XCommandProcessor > xDocDefinition; - - if ( sComponentName.getLength() ) - { - xDocDefinition = lcl_getSubComponentDef_nothrow( i_rTargetController, eComponentType, sComponentName ); - xSubComponent.set( xDocumentUI->loadComponentWithArguments( - eComponentType, - sComponentName, - stor->second.bForEditing, - aLoadArgs.getPropertyValues() - ), - UNO_SET_THROW - ); - } - else - { - Reference< XComponent > xDocDefComponent; - xSubComponent.set( xDocumentUI->createComponentWithArguments( - eComponentType, - aLoadArgs.getPropertyValues(), - xDocDefComponent - ), - UNO_SET_THROW - ); - - xDocDefinition.set( xDocDefComponent, UNO_QUERY ); - OSL_ENSURE( xDocDefinition.is(), "DatabaseDocumentRecovery::recoverSubDocuments: loaded a form/report, but don't have a document definition?!" ); - } - - if ( xDocDefinition.is() ) - { - Reference< XInterface > xLoader( *new SubComponentLoader( i_rTargetController, xDocDefinition ) ); - (void)xLoader; - } - - // at the moment, we only store, during session save, sub components which are modified. So, set this - // recovered sub component to "modified", too. - lcl_markModified( xSubComponent ); + Reference< XComponent > xDocDefComponent; + xSubComponent.set( xDocumentUI->createComponentWithArguments( + eComponentType, + aLoadArgs.getPropertyValues(), + xDocDefComponent + ), + UNO_SET_THROW + ); + + xDocDefinition.set( xDocDefComponent, UNO_QUERY ); + OSL_ENSURE( xDocDefinition.is(), "DatabaseDocumentRecovery::recoverSubDocuments: loaded a form/report, but don't have a document definition?!" ); } - catch ( const Exception& ) + + if ( xDocDefinition.is() ) { - DBG_UNHANDLED_EXCEPTION(); + Reference< XInterface > xLoader( *new SubComponentLoader( i_rTargetController, xDocDefinition ) ); + (void)xLoader; } + + // at the moment, we only store, during session save, sub components which are modified. So, set this + // recovered sub component to "modified", too. + lcl_markModified( xSubComponent ); } xComponentsStor->dispose(); -- cgit v1.2.3 From dc9ce37f90da7f845e38547bd12d53bea646beae Mon Sep 17 00:00:00 2001 From: Malte Timmermann Date: Mon, 1 Feb 2010 16:39:07 +0100 Subject: mtaccfixes: #110498# Enable zoom in preview even if AT support is turned on --- sw/source/ui/uiview/pview.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 801a5fa68f6a..1daee9c89ec2 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -1569,7 +1569,8 @@ void SwPagePreView::GetState( SfxItemSet& rSet ) ASSERT(nWhich, leeres Set); SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout(); //#106746# zoom has to be disabled if Accessibility support is switched on - BOOL bZoomEnabled = !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); + // MT 2010/01, see #110498# + BOOL bZoomEnabled = TRUE; // !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport(); while(nWhich) { -- cgit v1.2.3 From 24221a00e3dcc7e72e7c7b66bd16042f85e1d684 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- .../sun/star/sdb/DatabaseInteractionHandler.idl | 71 ++++++++++++++++++++++ offapi/com/sun/star/sdb/InteractionHandler.idl | 55 ++--------------- offapi/com/sun/star/sdb/makefile.mk | 1 + 3 files changed, 77 insertions(+), 50 deletions(-) create mode 100644 offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl diff --git a/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl new file mode 100644 index 000000000000..c803434c9580 --- /dev/null +++ b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: InteractionHandler.idl,v $ + * $Revision: 1.12 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_sdb_InteractionHandler_idl__ +#define __com_sun_star_sdb_InteractionHandler_idl__ + +module com { module sun { module star { module task { + published interface XInteractionHandler; +}; }; }; }; + +module com { module sun { module star { module sdb { + +/** describes a service which is able to handle database-related interactions. + +

    Usually, you will not instantiate this service directly. Instead, you'll instantiate a generic + InteractionHandler service, and pass it your request. Based on + configuration data, this implementation will decide where to forward the request to.

    + +

    By default, the DatabaseInteractionHandler feels responsible (as per configuration) for the + following interaction types: +

      +
    • database related errors
      + The general structure to transport such errors is the SQLException, + and if your interaction request supplies such a SQLException (or an instance of any derived class), + the handler will display a generic error dialog, which is able to travel the object chain which may be contained + in the exception. +
    • +
    • parameter requests
      + If your interaction request supplies an ParametersRequest, + the handler will open a standard dialog asking the user to fill in parameter values. +
      + In the case you want to use this feature of the handler, you should supply a special continuation + (XInteractionSupplyParameters) as well, so the + handler can return the entered information. +
    • +
    +

    +*/ +service DatabaseInteractionHandler: com::sun::star::task::XInteractionHandler2; + +//============================================================================= + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/sdb/InteractionHandler.idl b/offapi/com/sun/star/sdb/InteractionHandler.idl index 62fe7ccbfa92..48c024b01eca 100644 --- a/offapi/com/sun/star/sdb/InteractionHandler.idl +++ b/offapi/com/sun/star/sdb/InteractionHandler.idl @@ -37,56 +37,11 @@ module com { module sun { module star { module task { module com { module sun { module star { module sdb { /** is a service for user interaction for databases. -

    - interaction requests that the handler can provide are: -

      -
    • database related errors
      - The general structure to transport such errors is the - SQLException - , and if your - XInteractionRequest - supplies such a - SQLException - (or an instance of any derived class), - the handler will display a generic error dialog, which is able - to travel the object chain which may be contained in the exception. -
    • -
    • authentication
      - If your - XInteractionRequest - (see - XInteractionHandler::handle() - ) supplies a - AuthenticationRequest - , the handler will open a standard login - dialog to allow user authentication. -
      - Besides the using the members of the AuthenticationRequest in the usual manner, the member Server - (if not empty) is interpreted as datasource name, thus leading to a slightly different message when - requesting the user to enter it's login data. -
      - In the case you want to use this authentication feature, you should supply a special authentication - continuation ( - XInteractionSupplyAuthentication - ) as well, so the - handler can return to you, the entered information. -
    • -
    • parameter requests
      - If your - XInteractionRequest - supplies an - ParametersRequest - , the handler will open a standard dialog asking - the user to fill in parameter values. -
      - In the case you want to use this feature of the handler, you should supply a special continuation - ( - XInteractionSupplyParameters - ) as well, so the - handler can return to you, the entered information. -
    • -
    -

    + @deprecated + Do not use this service anymore. Instead, create a generic InteractionHandler + instance, and pass it your request. It will determine, based on configuration data, which concrete interaction + handler implementation to use for a specific request. In particular, requests formerly server by this service here + are by default passed to a DatabaseInteractionHandler. */ published service InteractionHandler: com::sun::star::task::XInteractionHandler; diff --git a/offapi/com/sun/star/sdb/makefile.mk b/offapi/com/sun/star/sdb/makefile.mk index b535584fc4b8..ef7655c4abbf 100644 --- a/offapi/com/sun/star/sdb/makefile.mk +++ b/offapi/com/sun/star/sdb/makefile.mk @@ -62,6 +62,7 @@ IDLFILES=\ DatabaseContext.idl \ DatabaseDocument.idl \ DatabaseEnvironment.idl \ + DatabaseInteractionHandler.idl \ DataColumn.idl \ DataSettings.idl \ DataSource.idl \ -- cgit v1.2.3 From 13e8f2a69bb63c490d048005f0fb2ae35e62ee8a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- .../source/core/dataaccess/databasecontext.cxx | 2 +- .../source/core/dataaccess/documentdefinition.cxx | 4 +- dbaccess/source/filter/xml/dbloader2.cxx | 2 +- dbaccess/source/inc/stringconstants.hrc | 1 - dbaccess/source/inc/stringconstants.inc | 1 - dbaccess/source/ui/browser/brwctrlr.cxx | 2 +- dbaccess/source/ui/browser/unodatbr.cxx | 2 +- dbaccess/source/ui/dlg/dbwizsetup.cxx | 2 +- dbaccess/source/ui/misc/UITools.cxx | 4 +- dbaccess/source/ui/misc/datasourceconnector.cxx | 4 +- dbaccess/source/ui/uno/copytablewizard.cxx | 2 +- dbaccess/source/ui/uno/dbinteraction.cxx | 102 ++++++++++++--------- dbaccess/source/ui/uno/dbinteraction.hxx | 102 +++++++++++++++------ 13 files changed, 144 insertions(+), 86 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 84dbdff17d13..ca8fe4e0eda7 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -420,7 +420,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin ::comphelper::NamedValueCollection aArgs; aArgs.put( "URL", _sURL ); aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG ); - aArgs.put( "InteractionHandler", m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ) ); + aArgs.put( "InteractionHandler", m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ) ); Sequence< PropertyValue > aResource( aArgs.getPropertyValues() ); xLoad->load( aResource ); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 1cacaa802259..46b77e87b021 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1466,7 +1466,7 @@ sal_Bool ODocumentDefinition::save(sal_Bool _bApprove) pRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler( m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + Reference< XInteractionHandler > xHandler( m_aContext.createComponent( (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); if ( xHandler.is() ) xHandler->handle(xRequest); @@ -1541,7 +1541,7 @@ sal_Bool ODocumentDefinition::saveAs() pRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler(m_aContext.createComponent(::rtl::OUString(SERVICE_SDB_INTERACTION_HANDLER)), UNO_QUERY); + Reference< XInteractionHandler > xHandler(m_aContext.createComponent(::rtl::OUString(SERVICE_TASK_INTERACTION_HANDLER)), UNO_QUERY); if ( xHandler.is() ) xHandler->handle(xRequest); diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index d3ec0d3ed356..781531a0e2a8 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -448,7 +448,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: if ( !aMediaDesc.has( "InteractionHandler" ) ) { Reference< XInteractionHandler > xHandler; - if ( m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler", xHandler ) ) + if ( m_aContext.createComponent( "com.sun.star.task.InteractionHandler", xHandler ) ) aMediaDesc.put( "InteractionHandler", xHandler ); } diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index 02bb911ef287..384d669226dc 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -379,7 +379,6 @@ DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES); DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERIES); DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER); DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL); -DECLARE_CONSTASCII_USTRING(SERVICE_SDB_INTERACTION_HANDLER); DECLARE_CONSTASCII_USTRING(SERVICE_TASK_INTERACTION_HANDLER); DECLARE_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP); DECLARE_CONSTASCII_USTRING(SERVICE_SDB_ADABASCREATIONDIALOG); diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index 8803d0e0edc7..6d285e44564f 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -222,7 +222,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER, "com.sun.star.sdbc.Driv IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL, "com.sun.star.sdbc.ConnectionPool"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn"); -IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_INTERACTION_HANDLER, "com.sun.star.sdb.InteractionHandler"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_TASK_INTERACTION_HANDLER, "com.sun.star.task.InteractionHandler"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP, "com.sun.star.frame.Desktop"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_ADABASCREATIONDIALOG, "com.sun.star.sdb.AdabasCreationDialog"); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index a437c06812e2..68a8cbccd75f 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -1355,7 +1355,7 @@ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::for pParamRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); + Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); if (xHandler.is()) xHandler->handle(xParamRequest); diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 2dffccfc8148..f0e58fcccbd8 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3410,7 +3410,7 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo ) { Reference< XInteractionHandler > xInteractionHandler( getORB()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY ); OSL_ENSURE( xInteractionHandler.is(), "SbaTableQueryBrowser::implAdministrate: no interaction handler available!" ); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 149d0c2d2f7a..efca1883fd00 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -1121,7 +1121,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() m_xFrameLoader.set( m_xDesktop, UNO_QUERY_THROW ); m_xInteractionHandler.set( _rxORB->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.InteractionHandler" ) ) + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), UNO_QUERY_THROW ); } diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 55691d4164ff..b805b6f0daff 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -378,11 +378,11 @@ SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XP } else { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); + Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); if (!xHandler.is()) { OSL_ENSURE(sal_False, "createConnection: could not instantiate an interaction handler!"); - // ShowServiceNotAvailableError(NULL, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); + // ShowServiceNotAvailableError(NULL, String(SERVICE_TASK_INTERACTION_HANDLER), sal_True); // TODO: a real parent! } else diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index 409e86150843..1fc25a14702c 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -195,9 +195,9 @@ namespace dbaui if ( !xHandler.is() ) { // instantiate the default SDB interaction handler - xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); if ( !xHandler.is() ) - ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); + ShowServiceNotAvailableError(m_pErrorMessageParent, (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER, sal_True); } if ( xHandler.is() ) diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 26f859cf2045..0f656c7c372a 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -1511,7 +1511,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) ); } if ( !m_xInteractionHandler.is() ) - m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.sdb.InteractionHandler" ), UNO_QUERY_THROW ); + m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ), UNO_QUERY_THROW ); InteractionHandler xSourceDocHandler; Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx index b1290f9ee0be..12aee39f308a 100644 --- a/dbaccess/source/ui/uno/dbinteraction.cxx +++ b/dbaccess/source/ui/uno/dbinteraction.cxx @@ -100,7 +100,8 @@ extern "C" void SAL_CALL createRegistryInfo_OInteractionHandler() { - static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OInteractionHandler > aOInteractionHandler_AutoRegistration; + static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::SQLExceptionInteractionHandler > aSQLExceptionInteractionHandler_AutoRegistration; + static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::LegacyInteractionHandler > aLegacyInteractionHandler_AutoRegistration; } //......................................................................... @@ -116,62 +117,70 @@ namespace dbaui using namespace ::dbtools; //========================================================================= - //= OInteractionHandler + //= BasicInteractionHandler //========================================================================= //------------------------------------------------------------------------- - OInteractionHandler::OInteractionHandler(const Reference< XMultiServiceFactory >& _rxORB) - :m_xORB(_rxORB) + BasicInteractionHandler::BasicInteractionHandler( const Reference< XMultiServiceFactory >& _rxORB, const bool i_bFallbackToGeneric ) + :m_xORB( _rxORB ) + ,m_bFallbackToGeneric( i_bFallbackToGeneric ) { + OSL_ENSURE( !m_bFallbackToGeneric, + "BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" ); } //------------------------------------------------------------------------- - IMPLEMENT_SERVICE_INFO1_STATIC(OInteractionHandler, "com.sun.star.comp.dbu.OInteractionHandler", "com.sun.star.sdb.InteractionHandler"); + ::sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest ) throw (RuntimeException) + { + return impl_handle_throw( i_rRequest ); + } //------------------------------------------------------------------------- - void SAL_CALL OInteractionHandler::handle(const Reference< XInteractionRequest >& _rxRequest) throw(RuntimeException) + void SAL_CALL BasicInteractionHandler::handle( const Reference< XInteractionRequest >& i_rRequest ) throw(RuntimeException) { - Any aRequest; - if (_rxRequest.is()) - { - try { aRequest = _rxRequest->getRequest(); } - catch(RuntimeException&) { } - } - DBG_ASSERT(aRequest.hasValue(), "OInteractionHandler::handle: invalid request!"); - if (!aRequest.hasValue()) + impl_handle_throw( i_rRequest ); + } + + //------------------------------------------------------------------------- + sal_Bool BasicInteractionHandler::impl_handle_throw( const Reference< XInteractionRequest >& i_Request ) + { + Any aRequest( i_Request->getRequest() ); + DBG_ASSERT(aRequest.hasValue(), "BasicInteractionHandler::handle: invalid request!"); + if ( !aRequest.hasValue() ) // no request -> no handling - return; + return sal_False; - Sequence< Reference< XInteractionContinuation > > aContinuations; - try { aContinuations = _rxRequest->getContinuations(); } - catch(RuntimeException&) { } + Sequence< Reference< XInteractionContinuation > > aContinuations( i_Request->getContinuations() ); // try to extract an SQLException (or one of it's derived members - SQLExceptionInfo aInfo(aRequest); - if (aInfo.isValid()) + SQLExceptionInfo aInfo( aRequest ); + if ( aInfo.isValid() ) { - implHandle(aInfo, aContinuations); - return; + implHandle( aInfo, aContinuations ); + return sal_True; } ParametersRequest aParamRequest; - if (aRequest >>= aParamRequest) - { // it's an authentication request - implHandle(aParamRequest, aContinuations); - return; + if ( aRequest >>= aParamRequest ) + { + implHandle( aParamRequest, aContinuations ); + return sal_True; } DocumentSaveRequest aDocuRequest; - if (aRequest >>= aDocuRequest) - { // it's an document request - implHandle(aDocuRequest, aContinuations); - return; + if ( aRequest >>= aDocuRequest ) + { + implHandle( aDocuRequest, aContinuations ); + return sal_True; } - OSL_VERIFY( implHandleUnknown( _rxRequest ) ); + if ( m_bFallbackToGeneric ) + return implHandleUnknown( i_Request ); + + return sal_False; } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -182,7 +191,7 @@ namespace dbaui Reference< XInteractionSupplyParameters > xParamCallback; if (-1 != nParamPos) xParamCallback = Reference< XInteractionSupplyParameters >(_rContinuations[nParamPos], UNO_QUERY); - DBG_ASSERT(xParamCallback.is(), "OInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); + DBG_ASSERT(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); // determine the style of the dialog, dependent on the present continuation types WinBits nDialogStyle = WB_OK | WB_DEF_OK; @@ -215,7 +224,7 @@ namespace dbaui } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -257,14 +266,14 @@ namespace dbaui if ( nApprovePos != -1 ) _rContinuations[ nApprovePos ]->select(); else - OSL_ENSURE( nResult != RET_YES, "OInteractionHandler::implHandle: no handler for YES!" ); + OSL_ENSURE( nResult != RET_YES, "BasicInteractionHandler::implHandle: no handler for YES!" ); break; case RET_NO: if ( nDisapprovePos != -1 ) _rContinuations[ nDisapprovePos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: no handler for NO!" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for NO!" ); break; case RET_CANCEL: @@ -273,13 +282,13 @@ namespace dbaui else if ( nDisapprovePos != -1 ) _rContinuations[ nDisapprovePos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: no handler for CANCEL!" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for CANCEL!" ); break; case RET_RETRY: if ( nRetryPos != -1 ) _rContinuations[ nRetryPos ]->select(); else - OSL_ENSURE( false, "OInteractionHandler::implHandle: where does the RETRY come from?" ); + OSL_ENSURE( false, "BasicInteractionHandler::implHandle: where does the RETRY come from?" ); break; } } @@ -289,7 +298,7 @@ namespace dbaui } } //------------------------------------------------------------------------- - void OInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + void BasicInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { ::vos::OGuard aGuard(Application::GetSolarMutex()); // want to open a dialog .... @@ -318,7 +327,7 @@ namespace dbaui if (-1 != nDocuPos) { Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY); - DBG_ASSERT(xCallback.is(), "OInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); + DBG_ASSERT(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); // determine the style of the dialog, dependent on the present continuation types WinBits nDialogStyle = WB_OK | WB_DEF_OK; @@ -357,7 +366,7 @@ namespace dbaui } //------------------------------------------------------------------------- - bool OInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) + bool BasicInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) { Reference< XInteractionHandler > xFallbackHandler; if ( m_xORB.is() ) @@ -371,7 +380,7 @@ namespace dbaui } //------------------------------------------------------------------------- - sal_Int32 OInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) + sal_Int32 BasicInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) { const Reference< XInteractionContinuation >* pContinuations = _rContinuations.getConstArray(); for (sal_Int32 i=0; i<_rContinuations.getLength(); ++i, ++pContinuations) @@ -408,6 +417,15 @@ namespace dbaui return -1; } + //========================================================================== + //= SQLExceptionInteractionHandler + //========================================================================== + IMPLEMENT_SERVICE_INFO1_STATIC( SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler", "com.sun.star.sdb.DatabaseInteractionHandler" ); + + //========================================================================== + //= LegacyInteractionHandler + //========================================================================== + IMPLEMENT_SERVICE_INFO1_STATIC( LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler", "com.sun.star.sdb.InteractionHandler" ); //......................................................................... } // namespace dbaui diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx index 8c7bba539129..822a55a36a95 100644 --- a/dbaccess/source/ui/uno/dbinteraction.hxx +++ b/dbaccess/source/ui/uno/dbinteraction.hxx @@ -35,30 +35,17 @@ #include #endif -#ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" -#endif -#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include "apitools.hxx" + +/** === begin UNO includes === **/ #include -#endif -#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ -#include -#endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include #include -#endif -#ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_ #include -#endif -#ifndef _COM_SUN_STAR_SDB_DOCUMENTSAVEREQUEST_HPP_ #include -#endif -#ifndef _DBASHARED_APITOOLS_HXX_ -#include "apitools.hxx" -#endif +/** === end UNO includes === **/ namespace dbtools { @@ -71,11 +58,11 @@ namespace dbaui //......................................................................... //========================================================================= - //= OInteractionHandler + //= BasicInteractionHandler //========================================================================= typedef ::cppu::WeakImplHelper2 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::task::XInteractionHandler - > OInteractionHandler_Base; + , ::com::sun::star::task::XInteractionHandler2 + > BasicInteractionHandler_Base; /** implements an XInteractionHandler for database related interaction requests.

    @@ -87,22 +74,30 @@ namespace dbaui standard error dialog for the (maybe chained) exception given */ - class OInteractionHandler - :public OInteractionHandler_Base + class BasicInteractionHandler + :public BasicInteractionHandler_Base { - OModuleClient m_aModuleClient; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + const OModuleClient m_aModuleClient; + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + const bool m_bFallbackToGeneric; + public: - OInteractionHandler(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + BasicInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB, + const bool i_bFallbackToGeneric + ); - // XServiceInfo - DECLARE_SERVICE_INFO_STATIC(); + // XInteractionHandler2 + virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); - // XInteractionHandler + // XInteractionHandler virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw(::com::sun::star::uno::RuntimeException); protected: + sal_Bool + impl_handle_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& i_Request ); + /// handle SQLExceptions (and derived classes) void implHandle( const ::dbtools::SQLExceptionInfo& _rSqlInfo, @@ -141,6 +136,53 @@ namespace dbaui const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations); }; + //========================================================================= + //= SQLExceptionInteractionHandler + //========================================================================= + class SQLExceptionInteractionHandler : public BasicInteractionHandler + { + public: + SQLExceptionInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + ) + :BasicInteractionHandler( i_rORB, false ) + { + } + + // XServiceInfo + DECLARE_SERVICE_INFO_STATIC(); + }; + + //========================================================================= + //= SQLExceptionInteractionHandler + //========================================================================= + /** an implementation for the legacy css.sdb.InteractionHandler + + css.sdb.InteractionHandler is deprecated, as it does not only handle database related interactions, + but also delegates all kind of unknown requests to a css.task.InteractionHandler. + + In today's architecture, there's only one central css.task.InteractionHandler, which is to be used + for all requests. Depending on configuration information, it decides which handler implementation + to delegate a request to. + + SQLExceptionInteractionHandler is the delegatee which handles only database related interactions. + LegacyInteractionHandler is the version which first checks for a database related interaction, and + forwards everything else to the css.task.InteractionHandler. + */ + class LegacyInteractionHandler : public BasicInteractionHandler + { + public: + LegacyInteractionHandler( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_rORB + ) + :BasicInteractionHandler( i_rORB, true ) + { + } + + // XServiceInfo + DECLARE_SERVICE_INFO_STATIC(); + }; + //......................................................................... } // namespace dbaui //......................................................................... -- cgit v1.2.3 From bd711a0e5e5e0e94cc4cb78251f50de205aeb485 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- sw/source/ui/dbui/addresslistdialog.cxx | 2 +- sw/source/ui/dbui/dbmgr.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index ec8ad0dc1473..858a4b5a63b2 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -583,7 +583,7 @@ void SwAddressListDialog::DetectTablesAndQueries( uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); uno::Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY); + xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) ); } if(pUserData->xConnection.is()) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 1f72bbf1fe84..3d8eb202fbb4 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1949,7 +1949,7 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData { rxSource.set(xComplConnection,UNO_QUERY); Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.sdb.InteractionHandler" )), UNO_QUERY); + xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); xConnection = xComplConnection->connectWithCompletion( xHandler ); } } @@ -3100,7 +3100,7 @@ uno::Reference SwNewDBMgr::createCursor(const ::rtl::OUString& _sDat if ( xRowSet.is() ) { - uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.sdb.InteractionHandler")), UNO_QUERY); + uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")), UNO_QUERY); xRowSet->executeWithCompletion(xHandler); } xResultSet = uno::Reference(xRowSet, UNO_QUERY); -- cgit v1.2.3 From 6cc63dce715bb88fd9e2e5f07a1a16044baeda58 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- sc/source/core/data/dpsdbtab.cxx | 2 +- sc/source/ui/dbgui/dapidata.cxx | 2 +- sc/source/ui/docshell/dbdocimp.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index 01f63f0cbaa9..31f5d2fd8917 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -72,7 +72,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::uno::UNO_QUERY; #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet" -#define SC_SERVICE_INTHANDLER "com.sun.star.sdb.InteractionHandler" +#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" //! move to a header file? #define SC_DBPROP_DATASOURCENAME "DataSourceName" diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 1b44ef86c7d4..54dfa10de458 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -59,7 +59,7 @@ using namespace com::sun::star; //------------------------------------------------------------------------- #define DP_SERVICE_DBCONTEXT "com.sun.star.sdb.DatabaseContext" -#define SC_SERVICE_INTHANDLER "com.sun.star.sdb.InteractionHandler" +#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" // entries in the "type" ListBox #define DP_TYPELIST_TABLE 0 diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index b2c8335d6c11..e4902ae0d7c1 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -72,7 +72,7 @@ using namespace com::sun::star; #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet" -#define SC_SERVICE_INTHANDLER "com.sun.star.sdb.InteractionHandler" +#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" //! move to a header file? #define SC_DBPROP_DATASOURCENAME "DataSourceName" -- cgit v1.2.3 From 6a35ea7299d8c34e86a5ec69ccb064a51d27ae1a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 21:32:33 +0100 Subject: autorecovery: more sophisticated configuration data for interaction handlers The generic css.task.InteractionHandler implementation in module uui is now able to instantiate "sub handlers", i.e. components to delegate a request to, based on the type of the request, and some configuration data. The "old" (and now deprecated) configuration scheme at org.openoffice.ucb.InteractionHandler did not contain type information, so any handlers registered there were always called when no default implementation for a given request was available. The "new" configuration scheme at org.openoffice.Interaction contains UNO type information. That is, a given handler implementation can declare itself responsible for an arbitrary set of UNO types, and for each of those types, whether it is also responsible for sub types. The generic interaction handler implementation uses this configuration data, when it encounteres an interaction request it cannot fullfill itself, to instantiate a component to delegate the request to. As with the "old" data, such a component is required to support the css.task.XInteractionHandler2 interface. Also, if it supports css.lang.XInitialization, then it will be initialized with a name-value pair, the name being "Parent", the value being the XWindow interface of the parent window for any message boxes. As an examplary implementation for this feature, the css.sdb.InteractionHandler has been deprecated. Now the css.sdb.DatabaseInteractionHandler is reponsible for database-related interactions, and the new configuration scheme is pre-filled with data assigning this responsibility. Consequently, a lot of places previously creating an css.sdb.InteractionHandler have been modified to create the default css.task.InteractionHandler. --- odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs | 2 +- odk/examples/DevelopersGuide/Forms/GridFieldValidator.java | 2 +- odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs b/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs index 34ea967fe710..9b78a289fb21 100644 --- a/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs +++ b/odk/examples/CLI/CSharp/Spreadsheet/SpreadsheetSample.cs @@ -1084,7 +1084,7 @@ public class SpreadsheetSample : SpreadsheetDocHelper unoidl.com.sun.star.task.XInteractionHandler xHandler = (unoidl.com.sun.star.task.XInteractionHandler) xServiceManager.createInstance( - "com.sun.star.sdb.InteractionHandler" ); + "com.sun.star.task.InteractionHandler" ); unoidl.com.sun.star.sdbcx.XTablesSupplier xSupplier = (unoidl.com.sun.star.sdbcx.XTablesSupplier) xSource.connectWithCompletion( xHandler ); diff --git a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java index 1afd640fb413..0a924b100e97 100644 --- a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java +++ b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java @@ -118,7 +118,7 @@ class GridFieldValidator implements XUpdateListener XInteractionHandler xHandler = (XInteractionHandler)UnoRuntime.queryInterface( XInteractionHandler.class, m_xCtx.getServiceManager().createInstanceWithContext( - "com.sun.star.sdb.InteractionHandler", m_xCtx ) ); + "com.sun.star.task.InteractionHandler", m_xCtx ) ); // create a new request and execute it InteractionRequest aRequest = new InteractionRequest( aError ); diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java index 283f36fcbfd3..9a2253a9460f 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java @@ -1106,7 +1106,7 @@ public class SpreadsheetSample extends SpreadsheetDocHelper (com.sun.star.task.XInteractionHandler)UnoRuntime.queryInterface( com.sun.star.task.XInteractionHandler.class, xServiceManager.createInstanceWithContext( - "com.sun.star.sdb.InteractionHandler", getContext()) ); + "com.sun.star.task.InteractionHandler", getContext()) ); com.sun.star.sdbcx.XTablesSupplier xSupplier = (com.sun.star.sdbcx.XTablesSupplier)UnoRuntime.queryInterface( com.sun.star.sdbcx.XTablesSupplier.class, -- cgit v1.2.3 From 12e05fb5934ceb37b852cdc2f9473a7023c45581 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 1 Feb 2010 23:40:41 +0100 Subject: autorecovery: #i10000# --- offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl index c803434c9580..891929514826 100644 --- a/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl +++ b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl @@ -31,7 +31,7 @@ #define __com_sun_star_sdb_InteractionHandler_idl__ module com { module sun { module star { module task { - published interface XInteractionHandler; + interface XInteractionHandler2; }; }; }; }; module com { module sun { module star { module sdb { -- cgit v1.2.3 From 51d6afeb3776bab6ed0768e0bf088736a4eb110f Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 10:12:38 +0100 Subject: autorecovery: this slipped through my previous attempt to replace all instantiations of the deprecated sdb.InteractionHandler with task.InteractionHandler --- dbaccess/qa/complex/dbaccess/DatabaseDocument.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index 8ce063bcdb2a..4781bb5fc644 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -213,7 +213,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. try { m_defaultHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, - _factory.createInstance("com.sun.star.sdb.InteractionHandler")); + _factory.createInstance("com.sun.star.task.InteractionHandler")); } catch (Exception ex) { -- cgit v1.2.3 From 2d3fb08873366434e2b33888e6acd6a8a41c949e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 10:49:34 +0100 Subject: autorecovery: (caught by complex test) store: when we do not (yet) have an URL, store to storage, not to URL --- .../source/core/dataaccess/databasedocument.cxx | 65 +++++++++++++++------- .../source/core/dataaccess/databasedocument.hxx | 8 +++ 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 8ab6fefa71e3..fb265f93cb9b 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -923,11 +923,49 @@ void SAL_CALL ODatabaseDocument::store( ) throw (IOException, RuntimeException) { DocumentGuard aGuard( *this ); - if ( m_pImpl->getDocFileLocation() == m_pImpl->getURL() ) - if ( m_pImpl->m_bDocumentReadOnly ) - throw IOException(); + ::rtl::OUString sDocumentURL( m_pImpl->getURL() ); + if ( sDocumentURL.getLength() ) + { + if ( m_pImpl->getDocFileLocation() == m_pImpl->getURL() ) + if ( m_pImpl->m_bDocumentReadOnly ) + throw IOException(); + + impl_storeAs_throw( m_pImpl->getURL(), m_pImpl->getMediaDescriptor(), SAVE, aGuard ); + return; + } - impl_storeAs_throw( m_pImpl->getURL(), m_pImpl->getMediaDescriptor(), SAVE, aGuard ); + // if we have no URL, but did survive the DocumentGuard above, then we've been inited via XLoadable::initNew, + // i.e. we're based on a temporary storage + OSL_ENSURE( m_pImpl->getDocFileLocation().getLength() == 0, "ODatabaseDocument::store: unexpected URL inconsistency!" ); + + try + { + impl_storeToStorage_throw( m_pImpl->getRootStorage(), m_pImpl->getMediaDescriptor().getPropertyValues(), aGuard ); + } + catch( const Exception& ) + { + Any aError = ::cppu::getCaughtException(); + if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() ) + || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() ) + ) + { + // allowed to leave + throw; + } + impl_throwIOExceptionCausedBySave_throw( aError, ::rtl::OUString() ); + } +} + +// ----------------------------------------------------------------------------- +void ODatabaseDocument::impl_throwIOExceptionCausedBySave_throw( const Any& i_rError, const ::rtl::OUString& i_rTargetURL ) const +{ + ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, i_rError ); + sErrorMessage = ResourceManager::loadString( + RID_STR_ERROR_WHILE_SAVING, + "$location$", i_rTargetURL, + "$message$", sErrorMessage + ); + throw IOException( sErrorMessage, *const_cast< ODatabaseDocument* >( this ) ); } // ----------------------------------------------------------------------------- @@ -1010,13 +1048,7 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const throw; } - ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError ); - sErrorMessage = ResourceManager::loadString( - RID_STR_ERROR_WHILE_SAVING, - "$location$", _rURL, - "$message$", sErrorMessage - ); - throw IOException( sErrorMessage, *this ); + impl_throwIOExceptionCausedBySave_throw( aError, _rURL ); } // notify the document event @@ -1169,16 +1201,7 @@ void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& _rURL, const throw; } - Exception aExcept; - aError >>= aExcept; - - ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError ); - sErrorMessage = ResourceManager::loadString( - RID_STR_ERROR_WHILE_SAVING, - "$location$", _rURL, - "$message$", sErrorMessage - ); - throw IOException( sErrorMessage, *this ); + impl_throwIOExceptionCausedBySave_throw( aError, _rURL ); } m_aEventNotifier.notifyDocumentEventAsync( "OnSaveToDone", NULL, makeAny( _rURL ) ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 4fd0823774b9..8110b9ceee02 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -626,6 +626,14 @@ private: const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_rMediaDescriptor, DocumentGuard& _rDocGuard ); + + /** throws an IOException with the message as defined in the RID_STR_ERROR_WHILE_SAVING resource, wrapping + the given caught non-IOException error + */ + void impl_throwIOExceptionCausedBySave_throw( + const ::com::sun::star::uno::Any& i_rError, + const ::rtl::OUString& i_rTargetURL + ) const; }; /** an extended version of the ModelMethodGuard, which also cares for the initialization state -- cgit v1.2.3 From 25d525177127c0d75c1e68bc3ba0ea107794d13e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 13:53:13 +0100 Subject: autorecovery: execute(open*): do not call getComponent just for checking whether it is a report definition, this implicitly changes the state of the embedded object, which can have side effects --- dbaccess/source/core/dataaccess/documentdefinition.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 46b77e87b021..9d809cf83620 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1189,14 +1189,17 @@ Any SAL_CALL ODocumentDefinition::execute( const Command& aCommand, sal_Int32 Co sal_Int32 nCurrentState = m_xEmbeddedObject->getCurrentState(); bool bIsActive = ( nCurrentState == EmbedStates::ACTIVE ); - // exception: new-style reports always create a new document when "open" is executed - Reference< report::XReportDefinition > xReportDefinition( getComponent(), UNO_QUERY ); - bool bIsAliveNewStyleReport = ( xReportDefinition.is() && ( bOpen || bOpenForMail ) ); - - if ( bIsActive && !bIsAliveNewStyleReport ) + if ( bIsActive ) { - impl_onActivateEmbeddedObject( true ); - return makeAny( getComponent() ); + // exception: new-style reports always create a new document when "open" is executed + Reference< report::XReportDefinition > xReportDefinition( impl_getComponent_throw( false ), UNO_QUERY ); + bool bIsAliveNewStyleReport = ( xReportDefinition.is() && ( bOpen || bOpenForMail ) ); + + if ( !bIsAliveNewStyleReport ) + { + impl_onActivateEmbeddedObject( true ); + return makeAny( getComponent() ); + } } } -- cgit v1.2.3 From 7af941376a1c06ca8285fc67f92e545ddd62d0cd Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 13:57:03 +0100 Subject: autorecovery: allow the sub component manager to hold multiple objects of the same type, which are new and yet-unsaved (i.e. do not have a name, yet) --- dbaccess/source/ui/app/AppController.cxx | 15 +- dbaccess/source/ui/app/subcomponentmanager.cxx | 245 ++++++++++++------------- 2 files changed, 130 insertions(+), 130 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 8af3a6692c53..11e2b1115d8d 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1938,14 +1938,17 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const case E_REPORT: case E_FORM: { - ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType ); - if ( !aHelper->isConnected() ) - break; + if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode ) ) + { + ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType ); + if ( !aHelper->isConnected() ) + break; - Reference< XComponent > xDefinition; - xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments ); + Reference< XComponent > xDefinition; + xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments ); - onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition ); + onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition ); + } } break; diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index 3456ff75e232..dbc0f432efef 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -51,10 +51,10 @@ #include #include -//........................................................................ +//...................................................................................................................... namespace dbaui { -//........................................................................ +//...................................................................................................................... /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; @@ -85,13 +85,20 @@ namespace dbaui using ::com::sun::star::beans::PropertyChangeEvent; /** === end UNO using === **/ - //============================================================================== + //================================================================================================================== //= helper structs - //============================================================================== + //================================================================================================================== namespace { + //.............................................................................................................. struct SubComponentDescriptor { + /// the name of the sub component, empty if it is yet unsaved + ::rtl::OUString sName; + /// type of the component - an ElementType value, except for relation design + sal_Int32 nComponentType; + /// the mode in which the sub component has been opened + ElementOpenMode eOpenMode; /// the frame which the component resides in. Must not be Reference< XFrame > xFrame; /// the controller of the sub component. Must not be @@ -104,24 +111,31 @@ namespace dbaui Reference< XPropertySet > xDocumentDefinitionProperties; SubComponentDescriptor() - :xFrame() + :sName() + ,nComponentType( -1 ) + ,eOpenMode( E_OPEN_NORMAL ) + ,xFrame() ,xController() ,xModel() { } - SubComponentDescriptor( const Reference< XComponent >& _rxComponent ) + SubComponentDescriptor( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType, + const ElementOpenMode i_eOpenMode, const Reference< XComponent >& i_rComponent ) + :sName( i_rName ) + ,nComponentType( i_nComponentType ) + ,eOpenMode( i_eOpenMode ) { - if ( !impl_constructFrom( _rxComponent ) ) + if ( !impl_constructFrom( i_rComponent ) ) { - // _rxComponent is neither a model, nor a controller, nor a frame + // i_rComponent is neither a model, nor a controller, nor a frame // => it must be a css.sdb.DocumentDefinition - Reference< XComponentSupplier > xCompSupp( _rxComponent, UNO_QUERY_THROW ); + Reference< XComponentSupplier > xCompSupp( i_rComponent, UNO_QUERY_THROW ); Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW ); if ( !impl_constructFrom( xComponent ) ) throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal component type." ) ), NULL ); - xComponentCommandProcessor.set( _rxComponent, UNO_QUERY_THROW ); - xDocumentDefinitionProperties.set( _rxComponent, UNO_QUERY_THROW ); + xComponentCommandProcessor.set( i_rComponent, UNO_QUERY_THROW ); + xDocumentDefinitionProperties.set( i_rComponent, UNO_QUERY_THROW ); } } @@ -165,6 +179,7 @@ namespace dbaui } }; + //.............................................................................................................. struct SelectSubComponent : public ::std::unary_function< SubComponentDescriptor, Reference< XComponent > > { Reference< XComponent > operator()( const SubComponentDescriptor _desc ) const @@ -176,55 +191,37 @@ namespace dbaui } }; - struct SubComponentAccessor - { - /// the name of the sub component - ::rtl::OUString sName; - /// type of the component - usually an ElementType value - sal_Int32 nComponentType; - /// the mode in which the sub component has been opened - ElementOpenMode eOpenMode; - - SubComponentAccessor() - :sName() - ,nComponentType( sal_Int32( E_NONE ) ) - ,eOpenMode( E_OPEN_NORMAL ) - { - } + //.............................................................................................................. + typedef ::std::vector< SubComponentDescriptor > SubComponents; - SubComponentAccessor( const ::rtl::OUString& _rName, const sal_Int32 _nCompType, const ElementOpenMode _eMode ) - :sName( _rName ) - ,nComponentType( _nCompType ) - ,eOpenMode( _eMode ) - { - } - }; - - struct SubComponentAccessorHash : public ::std::unary_function< SubComponentAccessor, size_t > + //.............................................................................................................. + struct SubComponentMatch : public ::std::unary_function< SubComponentDescriptor, bool > { - size_t operator()( const SubComponentAccessor& _lhs ) const + public: + SubComponentMatch( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType, + const ElementOpenMode i_eOpenMode ) + :m_sName( i_rName ) + ,m_nComponentType( i_nComponentType ) + ,m_eOpenMode( i_eOpenMode ) { - return _lhs.sName.hashCode() + _lhs.nComponentType + size_t( _lhs.eOpenMode ); } - }; - struct SubComponentAccessorEqual : public ::std::binary_function< SubComponentAccessor, SubComponentAccessor, bool > - { - bool operator()( const SubComponentAccessor& _lhs, const SubComponentAccessor& _rhs ) const + + bool operator()( const SubComponentDescriptor& i_rCompareWith ) const { - return ( _lhs.sName == _rhs.sName ) - && ( _lhs.nComponentType == _rhs.nComponentType ) - && ( _lhs.eOpenMode == _rhs.eOpenMode ); + return ( m_sName == i_rCompareWith.sName ) + && ( m_nComponentType == i_rCompareWith.nComponentType ) + && ( m_eOpenMode == i_rCompareWith.eOpenMode ); } + private: + const ::rtl::OUString m_sName; + const sal_Int32 m_nComponentType; + const ElementOpenMode m_eOpenMode; }; - - typedef ::std::hash_map< SubComponentAccessor, SubComponentDescriptor, SubComponentAccessorHash, SubComponentAccessorEqual > - SubComponentMap; - } - //============================================================================== + //================================================================================================================== //= SubComponentManager_Data - //============================================================================== + //================================================================================================================== struct SubComponentManager_Data { SubComponentManager_Data( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ) @@ -235,35 +232,36 @@ namespace dbaui OApplicationController& m_rController; mutable ::comphelper::SharedMutex m_aMutex; - SubComponentMap m_aComponents; + SubComponents m_aComponents; ::osl::Mutex& getMutex() const { return m_aMutex; } }; - //==================================================================== + //================================================================================================================== //= SubComponentManager - //==================================================================== - //-------------------------------------------------------------------- + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ SubComponentManager::SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex ) :m_pData( new SubComponentManager_Data( _rController, _rMutex ) ) { } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ SubComponentManager::~SubComponentManager() { } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SubComponentManager::disposing() { ::osl::MutexGuard aGuard( m_pData->getMutex() ); m_pData->m_aComponents.clear(); } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ namespace { + //.............................................................................................................. bool lcl_fallbackToAnotherController( SubComponentDescriptor& _rCompDesc ) { Reference< XController > xFallback; @@ -301,7 +299,7 @@ namespace dbaui return false; } - //---------------------------------------------------------------- + //.............................................................................................................. bool lcl_closeComponent( const Reference< XCommandProcessor >& _rxCommandProcessor ) { bool bSuccess = false; @@ -322,7 +320,7 @@ namespace dbaui return bSuccess; } - //---------------------------------------------------------------- + //.............................................................................................................. bool lcl_closeComponent( const SubComponentDescriptor& _rComponent ) { if ( _rComponent.xComponentCommandProcessor.is() ) @@ -350,7 +348,7 @@ namespace dbaui return bSuccess; } - // ----------------------------------------------------------------------------- + //.............................................................................................................. void lcl_notifySubComponentEvent( const SubComponentManager_Data& _rData, const sal_Char* _pAsciiEventName, const SubComponentDescriptor& _rComponent ) { @@ -370,7 +368,7 @@ namespace dbaui } } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SubComponentManager::propertyChange( const PropertyChangeEvent& i_rEvent ) throw (RuntimeException) { if ( i_rEvent.PropertyName != PROPERTY_NAME ) @@ -378,76 +376,66 @@ namespace dbaui return; // find the sub component whose name changed - for ( SubComponentMap::iterator comp = m_pData->m_aComponents.begin(); + for ( SubComponents::iterator comp = m_pData->m_aComponents.begin(); comp != m_pData->m_aComponents.end(); ++comp ) { - if ( comp->second.xDocumentDefinitionProperties != i_rEvent.Source ) + if ( comp->xDocumentDefinitionProperties != i_rEvent.Source ) continue; ::rtl::OUString sNewName; OSL_VERIFY( i_rEvent.NewValue >>= sNewName ); - ::rtl::OUString sOldKnownName( comp->first.sName ); + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OUString sOldKnownName( comp->sName ); ::rtl::OUString sOldName; OSL_VERIFY( i_rEvent.OldValue >>= sOldName ); OSL_ENSURE( sOldName == sOldKnownName, "SubComponentManager::propertyChange: inconsistency in the old names!" ); + #endif - // obtain old values - SubComponentAccessor aKey( comp->first ); - SubComponentDescriptor aElement( comp->second ); - - // remove old values - m_pData->m_aComponents.erase( comp ); - - // re-insert under new name - aKey.sName = sNewName; - m_pData->m_aComponents.insert( SubComponentMap::value_type( - aKey, aElement - ) ) ; - + comp->sName = sNewName; break; } } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SAL_CALL SubComponentManager::disposing( const EventObject& _rSource ) throw (RuntimeException) { ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() ); SubComponentDescriptor aClosedComponent; - for ( SubComponentMap::iterator comp = m_pData->m_aComponents.begin(); + for ( SubComponents::iterator comp = m_pData->m_aComponents.begin(); comp != m_pData->m_aComponents.end(); ++comp ) { bool bRemove = false; - if ( comp->second.xController == _rSource.Source ) + if ( comp->xController == _rSource.Source ) { - if ( !comp->second.xModel.is() ) + if ( !comp->xModel.is() ) { bRemove = true; } else { // maybe this is just one view to the sub document, and only this view is closed - if ( !lcl_fallbackToAnotherController( comp->second ) ) + if ( !lcl_fallbackToAnotherController( *comp ) ) { bRemove = true; } } } - else if ( comp->second.xModel == _rSource.Source ) + else if ( comp->xModel == _rSource.Source ) { bRemove = true; } if ( bRemove ) { - aClosedComponent = comp->second; + aClosedComponent = *comp; m_pData->m_aComponents.erase( comp ); break; } @@ -460,7 +448,7 @@ namespace dbaui } } - //-------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ Sequence< Reference< XComponent> > SubComponentManager::getSubComponents() const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); @@ -470,12 +458,12 @@ namespace dbaui m_pData->m_aComponents.begin(), m_pData->m_aComponents.end(), aComponents.getArray(), - ::std::compose1( SelectSubComponent(), ::std::select2nd< SubComponentMap::value_type >() ) + SelectSubComponent() ); return aComponents; } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ sal_Bool SubComponentManager::closeSubComponents() { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); @@ -483,16 +471,13 @@ namespace dbaui try { - typedef ::std::vector< SubComponentAccessor > ComponentAccessors; - ComponentAccessors aClosedComponents; - - SubComponentMap aComponents( m_pData->m_aComponents ); - for ( SubComponentMap::const_iterator comp = aComponents.begin(); - comp != aComponents.end(); + SubComponents aWorkingCopy( m_pData->m_aComponents ); + for ( SubComponents::const_iterator comp = aWorkingCopy.begin(); + comp != aWorkingCopy.end(); ++comp ) { - lcl_closeComponent( comp->second ); + lcl_closeComponent( *comp ); } } catch ( const Exception& ) @@ -503,27 +488,35 @@ namespace dbaui return empty(); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ bool SubComponentManager::empty() const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); return m_pData->m_aComponents.empty(); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ void SubComponentManager::onSubComponentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType, const ElementOpenMode _eOpenMode, const Reference< XComponent >& _rxComponent ) { ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() ); - // put into map - SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode ); - SubComponentDescriptor aElement( _rxComponent ); +#if OSL_DEBUG_LEVEL > 0 + if ( _rName.getLength() ) + { + // check there does not already exist such a component + SubComponents::const_iterator existentPos = ::std::find_if( + m_pData->m_aComponents.begin(), + m_pData->m_aComponents.end(), + SubComponentMatch( _rName, _nComponentType, _eOpenMode ) + ); + OSL_ENSURE( existentPos == m_pData->m_aComponents.end(), "already existent!" ); + } +#endif + SubComponentDescriptor aElement( _rName, _nComponentType, _eOpenMode, _rxComponent ); ENSURE_OR_THROW( aElement.xModel.is() || aElement.xController.is(), "illegal component" ); - m_pData->m_aComponents.insert( SubComponentMap::value_type( - aKey, aElement - ) ) ; + m_pData->m_aComponents.push_back( aElement ); // add as listener if ( aElement.xController.is() ) @@ -538,73 +531,77 @@ namespace dbaui lcl_notifySubComponentEvent( *m_pData, "OnSubComponentOpened", aElement ); } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ bool SubComponentManager::activateSubFrame( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType, const ElementOpenMode _eOpenMode ) const { ::osl::MutexGuard aGuard( m_pData->getMutex() ); - SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode ); - SubComponentMap::const_iterator pos = m_pData->m_aComponents.find( aKey ); + SubComponents::const_iterator pos = ::std::find_if( + m_pData->m_aComponents.begin(), + m_pData->m_aComponents.end(), + SubComponentMatch( _rName, _nComponentType, _eOpenMode ) + ); if ( pos == m_pData->m_aComponents.end() ) // no component with this name/type/open mode return false; - const Reference< XFrame > xFrame( pos->second.xFrame, UNO_SET_THROW ); + const Reference< XFrame > xFrame( pos->xFrame, UNO_SET_THROW ); const Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW ); xTopWindow->toFront(); return true; } - // ----------------------------------------------------------------------------- - bool SubComponentManager::closeSubFrames( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType ) + //------------------------------------------------------------------------------------------------------------------ + bool SubComponentManager::closeSubFrames( const ::rtl::OUString& i_rName, const sal_Int32 _nComponentType ) { ::osl::MutexGuard aGuard( m_pData->getMutex() ); + ENSURE_OR_RETURN_FALSE( i_rName.getLength(), "SubComponentManager::closeSubFrames: illegal name!" ); - SubComponentMap aWorkingCopy( m_pData->m_aComponents ); - for ( SubComponentMap::const_iterator comp = aWorkingCopy.begin(); + SubComponents aWorkingCopy( m_pData->m_aComponents ); + for ( SubComponents::const_iterator comp = aWorkingCopy.begin(); comp != aWorkingCopy.end(); ++comp ) { - if ( ( comp->first.sName != _rName ) || ( comp->first.nComponentType != _nComponentType ) ) + if ( ( comp->sName != i_rName ) || ( comp->nComponentType != _nComponentType ) ) continue; - if ( !lcl_closeComponent( comp->second ) ) + if ( !lcl_closeComponent( *comp ) ) return false; } return true; } - // ----------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------------------------ bool SubComponentManager::lookupSubComponent( const Reference< XComponent >& i_rComponent, ::rtl::OUString& o_rName, sal_Int32& o_rComponentType ) { - for ( SubComponentMap::const_iterator comp = m_pData->m_aComponents.begin(); + for ( SubComponents::const_iterator comp = m_pData->m_aComponents.begin(); comp != m_pData->m_aComponents.end(); ++comp ) { - if ( ( comp->second.xModel.is() - && ( comp->second.xModel == i_rComponent ) + if ( ( comp->xModel.is() + && ( comp->xModel == i_rComponent ) ) - || ( comp->second.xController.is() - && ( comp->second.xController == i_rComponent ) + || ( comp->xController.is() + && ( comp->xController == i_rComponent ) ) - || ( comp->second.xFrame.is() - && ( comp->second.xFrame == i_rComponent ) + || ( comp->xFrame.is() + && ( comp->xFrame == i_rComponent ) ) ) { - o_rName = comp->first.sName; - o_rComponentType = comp->first.nComponentType; + o_rName = comp->sName; + o_rComponentType = comp->nComponentType; return true; } } return false; } -//........................................................................ +//...................................................................................................................... } // namespace dbaui -//........................................................................ +//...................................................................................................................... -- cgit v1.2.3 From 72a068ecf4ba9322a4453881addf319ff22129f6 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Fri, 26 Mar 2010 16:38:11 +0100 Subject: native0: #161580# make native intro progress optional - transplanted from 1070cbd32693@native0 --- instsetoo_native/util/openoffice.lst | 4 ++++ scp2/source/ooo/common_brand.scp | 9 +++++++++ scp2/source/ooo/profileitem_ooo.scp | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/instsetoo_native/util/openoffice.lst b/instsetoo_native/util/openoffice.lst index 03d96cf50070..30ede023a19f 100644 --- a/instsetoo_native/util/openoffice.lst +++ b/instsetoo_native/util/openoffice.lst @@ -29,6 +29,7 @@ Globals PROGRESSSIZE 412,7 PROGRESSPOSITION 14,230 PROGRESSFRAMECOLOR 58,159,232 + NATIVEPROGRESS true REGISTRYLAYERNAME Layers SERVICEPACK 1 UPDATE_DATABASE 1 @@ -399,6 +400,7 @@ BrOffice PROGRESSSIZE PROGRESSPOSITION PROGRESSFRAMECOLOR + NATIVEPROGRESS UPDATEURL http://update36.services.openoffice.org/ProductUpdateService/check.Update ODFNOTIFYURL http://odfnotify.services.openoffice.org/OOo3.0/notification.jsp?version=ODF ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,userland.txt @@ -467,6 +469,7 @@ BrOffice_wJRE PROGRESSSIZE PROGRESSPOSITION PROGRESSFRAMECOLOR + NATIVEPROGRESS UPDATEURL http://update36.services.openoffice.org/ProductUpdateService/check.Update ODFNOTIFYURL http://odfnotify.services.openoffice.org/OOo3.0/notification.jsp?version=ODF ADD_INCLUDE_FILES cliureversion.mk,clioootypesversion.mk,javaversion2.dat,userland.txt @@ -538,6 +541,7 @@ BrOffice_Dev PROGRESSSIZE PROGRESSPOSITION PROGRESSFRAMECOLOR + NATIVEPROGRESS BASISPACKAGEPREFIX ooobasis-dev UREPACKAGEPREFIX ooodev SOLSUREPACKAGEPREFIX ooodev diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index c96313ddb834..a3bd585363e6 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -818,6 +818,15 @@ ProfileItem gid_Brand_Profileitem_Soffice_ProgressFrameColor_So Value = "${PROGRESSFRAMECOLOR}"; End +ProfileItem gid_Brand_Profileitem_Soffice_NativeProgress_So + ProfileID = gid_Brand_Profile_Soffice_Ini; + ModuleID = gid_Module_Root_Brand; + Section = "Bootstrap"; + Order = 6; + Key = "NativeProgress"; + Value = "${NATIVEPROGRESS}"; +End + #ifdef WNT ProfileItem gid_Brand_Profileitem_Soffice_Hideeula ProfileID = gid_Brand_Profile_Soffice_Ini; diff --git a/scp2/source/ooo/profileitem_ooo.scp b/scp2/source/ooo/profileitem_ooo.scp index bb3a9ecd4126..ebd0b87fbabd 100644 --- a/scp2/source/ooo/profileitem_ooo.scp +++ b/scp2/source/ooo/profileitem_ooo.scp @@ -148,13 +148,22 @@ ProfileItem gid_Profileitem_Soffice_ProgressPosition Value = "-1,-1"; End +ProfileItem gid_Profileitem_Soffice_NativeProgress + ProfileID = gid_Profile_Soffice_Ini; + ModuleID = gid_Module_Root; + Section = "Bootstrap"; + Order = 6; + Key = "NativeProgress"; + Value = "true"; +End + #ifdef WNT ProfileItem gid_Profileitem_Soffice_Hideeula ProfileID = gid_Profile_Soffice_Ini; ModuleID = gid_Module_Root; Section = "Bootstrap"; - Order = 7; + Order = 8; Key = "HideEula"; Value = "[HIDEEULA]"; Inifiletablekey = "HideEula"; -- cgit v1.2.3 From 467e2f53daa467eba23f5c78b9cf75f361225c96 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 2 Feb 2010 17:11:31 +0100 Subject: native0 #161620# new size for cabinet files --- solenv/bin/modules/installer/windows/msiglobal.pm | 2 +- solenv/bin/modules/installer/windows/sign.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 66731f860092..9f2d21f8b7f8 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -58,7 +58,7 @@ sub write_ddf_file_header push(@{$ddffileref} ,$oneline); $oneline = ".Set ReservePerCabinetSize=128\n"; # This reserves space for a digital signature. push(@{$ddffileref} ,$oneline); - $oneline = ".Set MaxDiskSize=CDROM\n"; # This allows the .cab file to be as large as needed. + $oneline = ".Set MaxDiskSize=2147483648\n"; # This allows the .cab file to get a size of 2 GB. push(@{$ddffileref} ,$oneline); $oneline = ".Set CompressionType=LZX\n"; push(@{$ddffileref} ,$oneline); diff --git a/solenv/bin/modules/installer/windows/sign.pm b/solenv/bin/modules/installer/windows/sign.pm index 81ba78c8b218..70954bd9f5b1 100644 --- a/solenv/bin/modules/installer/windows/sign.pm +++ b/solenv/bin/modules/installer/windows/sign.pm @@ -929,7 +929,7 @@ sub get_ddf_file_header push(@{$ddffileref} ,$oneline); $oneline = ".Set ReservePerCabinetSize=128\n"; # This reserves space for a digital signature. push(@{$ddffileref} ,$oneline); - $oneline = ".Set MaxDiskSize=CDROM\n"; # This allows the .cab file to be as large as needed. + $oneline = ".Set MaxDiskSize=2147483648\n"; # This allows the .cab file to get a size of 2 GB. push(@{$ddffileref} ,$oneline); $oneline = ".Set CompressionType=LZX\n"; push(@{$ddffileref} ,$oneline); -- cgit v1.2.3 From 2937e95667b59e9e8920f3f0813b8c2ccb88fd20 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Tue, 2 Feb 2010 17:23:10 +0100 Subject: native0 #161620# increasing max lang length for 17 languages --- solenv/bin/modules/installer/globals.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index aeeb172c8325..81eaace26343 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -180,7 +180,7 @@ BEGIN $installertypedir = ""; $controlledmakecabversion = "5"; $saved_packages_path = ""; - $max_lang_length = 50; + $max_lang_length = 65; $globalblock = "Globals"; $rootmodulegid = ""; %alllangmodules = (); -- cgit v1.2.3 From 7de2856ae13e5d1b9f6c6a0d950ca163413b7584 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 23:05:16 +0100 Subject: autorecovery: let definition contents support the XHierarchicalName property, so clients can easily retrieve the hierarchical name of a content --- dbaccess/source/core/dataaccess/documentcontainer.cxx | 18 ++++++++++++++++++ dbaccess/source/core/dataaccess/documentcontainer.hxx | 14 +++++++++++--- dbaccess/source/core/dataaccess/documentdefinition.cxx | 16 ++++++++++++++++ dbaccess/source/core/dataaccess/documentdefinition.hxx | 12 +++++++++--- dbaccess/source/core/inc/ContentHelper.hxx | 8 +++++--- 5 files changed, 59 insertions(+), 9 deletions(-) diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 2fe62eb420a5..03cb9326809e 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -666,6 +666,24 @@ void SAL_CALL ODocumentContainer::replaceByHierarchicalName( const ::rtl::OUStri xNameContainer->replaceByName(sName,_aElement); } + +// ----------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODocumentContainer::getHierarchicalName() throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return impl_getHierarchicalName( false ); +} + +// ----------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const ::rtl::OUString& i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException) +{ + ::rtl::OUStringBuffer aBuffer; + aBuffer.append( getHierarchicalName() ); + aBuffer.append( sal_Unicode( '/' ) ); + aBuffer.append( i_rRelativeName ); + return aBuffer.makeStringAndClear(); +} + // ----------------------------------------------------------------------------- ::rtl::Reference ODocumentContainer::getContent(const ::rtl::OUString& _sName) const { diff --git a/dbaccess/source/core/dataaccess/documentcontainer.hxx b/dbaccess/source/core/dataaccess/documentcontainer.hxx index c4f4aa24642c..d6986d6c9f66 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.hxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.hxx @@ -34,8 +34,8 @@ #ifndef _DBA_CORE_DEFINITIONCONTAINER_HXX_ #include "definitioncontainer.hxx" #endif -#ifndef _CPPUHELPER_IMPLBASE4_HXX_ -#include +#ifndef _CPPUHELPER_IMPLBASE5_HXX_ +#include #endif #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include @@ -46,6 +46,9 @@ #ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMECONTAINER_HPP_ #include #endif +#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAME_HPP_ +#include +#endif #ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_ #include #endif @@ -63,9 +66,10 @@ namespace dbaccess { //........................................................................ -typedef ::cppu::ImplHelper4 < ::com::sun::star::frame::XComponentLoader +typedef ::cppu::ImplHelper5 < ::com::sun::star::frame::XComponentLoader , ::com::sun::star::lang::XMultiServiceFactory , ::com::sun::star::container::XHierarchicalNameContainer + , ::com::sun::star::container::XHierarchicalName , ::com::sun::star::embed::XTransactedObject > ODocumentContainer_Base; //========================================================================== @@ -114,6 +118,10 @@ public: virtual void SAL_CALL insertByHierarchicalName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL removeByHierarchicalName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XHierarchicalName + virtual ::rtl::OUString SAL_CALL getHierarchicalName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL composeHierarchicalName( const ::rtl::OUString& aRelativeName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + // XNameContainer virtual void SAL_CALL removeByName( const ::rtl::OUString& _rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 9d809cf83620..4a6813bee2af 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -2162,6 +2162,22 @@ void SAL_CALL ODocumentDefinition::store( ) throw (WrappedTargetException, Runt return bSuccess; } +// ----------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODocumentDefinition::getHierarchicalName() throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return impl_getHierarchicalName( false ); +} + +// ----------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ODocumentDefinition::composeHierarchicalName( const ::rtl::OUString& i_rRelativeName ) throw (IllegalArgumentException, NoSupportException, RuntimeException) +{ + ::rtl::OUStringBuffer aBuffer; + aBuffer.append( getHierarchicalName() ); + aBuffer.append( sal_Unicode( '/' ) ); + aBuffer.append( i_rRelativeName ); + return aBuffer.makeStringAndClear(); +} // ----------------------------------------------------------------------------- void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) throw (SQLException, ElementExistException, RuntimeException) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.hxx b/dbaccess/source/core/dataaccess/documentdefinition.hxx index 28cbc34710e6..2b561fa7edbd 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.hxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.hxx @@ -34,8 +34,8 @@ #ifndef _CPPUHELPER_PROPSHLP_HXX #include #endif -#ifndef _CPPUHELPER_IMPLBASE3_HXX_ -#include +#ifndef _CPPUHELPER_IMPLBASE4_HXX_ +#include #endif #ifndef DBA_CONTENTHELPER_HXX #include "ContentHelper.hxx" @@ -66,6 +66,7 @@ #endif #include #include +#include namespace comphelper { @@ -84,9 +85,10 @@ namespace dbaccess //= document //========================================================================== -typedef ::cppu::ImplHelper3 < ::com::sun::star::embed::XComponentSupplier +typedef ::cppu::ImplHelper4 < ::com::sun::star::embed::XComponentSupplier , ::com::sun::star::sdb::XSubDocument , ::com::sun::star::util::XCloseListener + , ::com::sun::star::container::XHierarchicalName > ODocumentDefinition_Base; class ODocumentDefinition @@ -152,6 +154,10 @@ public: virtual void SAL_CALL store( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL close( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + // XHierarchicalName + virtual ::rtl::OUString SAL_CALL getHierarchicalName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL composeHierarchicalName( const ::rtl::OUString& aRelativeName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); + // OPropertySetHelper virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx index 227110bd324d..367186dc4cb8 100644 --- a/dbaccess/source/core/inc/ContentHelper.hxx +++ b/dbaccess/source/core/inc/ContentHelper.hxx @@ -110,10 +110,12 @@ namespace dbaccess sal_Bool bAsTemplate; // AsTemplate ::rtl::OUString sPersistentName;// persistent name of the document - // @@@ Add other properties supported by your content. - ContentProperties() - : bIsDocument( sal_True ), bIsFolder( sal_False ), bAsTemplate( sal_False ) {} + :bIsDocument( sal_True ) + ,bIsFolder( sal_False ) + ,bAsTemplate( sal_False ) + { + } }; class OContentHelper_Impl -- cgit v1.2.3 From a98059194cf810aeee73088c588d4a91505340f2 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 23:05:16 +0100 Subject: autorecovery: let definition contents support the XHierarchicalName property, so clients can easily retrieve the hierarchical name of a content --- offapi/com/sun/star/sdb/DefinitionContent.idl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/offapi/com/sun/star/sdb/DefinitionContent.idl b/offapi/com/sun/star/sdb/DefinitionContent.idl index 1b987a3084cd..74444a7e55cf 100644 --- a/offapi/com/sun/star/sdb/DefinitionContent.idl +++ b/offapi/com/sun/star/sdb/DefinitionContent.idl @@ -30,9 +30,8 @@ #ifndef __com_sun_star_sdb_DefinitionContent_idl__ #define __com_sun_star_sdb_DefinitionContent_idl__ -#ifndef __com_sun_star_ucb_Content_idl__ #include -#endif +#include //============================================================================= @@ -63,6 +62,11 @@ service DefinitionContent

    Additional commands might be supported by derived services.

    */ service ::com::sun::star::ucb::Content; + + /** provides access to the complete name of the content within its hierarchy + @since OOo 3.3 + */ + interface ::com::sun::star::container::XHierarchicalName; }; //============================================================================= -- cgit v1.2.3 From aefb13e5d8ffb2835936a2af848005cfb6fe5b9a Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 2 Feb 2010 23:05:43 +0100 Subject: autorecovery: when creating a new form/report by wizard, ensure that our sub component manager knows it by its proper name --- dbaccess/source/ui/app/AppController.cxx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 11e2b1115d8d..076b4429abd4 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -78,6 +78,7 @@ #include #include #include +#include /** === end UNO includes === **/ #ifndef _TOOLS_DEBUG_HXX @@ -2046,14 +2047,27 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) if ( aHelper->isConnected() ) { sal_Int32 nCommandType = -1; - const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType)); + const ::rtl::OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) ); Reference< XComponent > xComponent,xDefinition; if ( E_REPORT == _eType ) - xComponent = aHelper->newReportWithPilot(xDefinition,nCommandType,sName); + xComponent = aHelper->newReportWithPilot( xDefinition, nCommandType, sCurrentSelected ); else - xComponent = aHelper->newFormWithPilot(xDefinition,nCommandType,sName); + xComponent = aHelper->newFormWithPilot( xDefinition, nCommandType, sCurrentSelected ); + OSL_POSTCOND( xComponent.is() && xDefinition.is(), "OApplicationController::newElementWithPilot:" + "invalid component/docdef!" ); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition ); + ::rtl::OUString sName; + try + { + Reference< XHierarchicalName > xName( xDefinition, UNO_QUERY_THROW ); + sName = xName->getHierarchicalName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + if ( xComponent.is() && xDefinition.is() ) + onDocumentOpened( sName, _eType, E_OPEN_DESIGN, xComponent, xDefinition ); } } break; -- cgit v1.2.3 From 28b38d73e582a9909be16101ec0bb93a41b86f13 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 11:46:23 +0100 Subject: autorecovery: when calling a pilot to create a database object, pass the XDatabaseDocumentUI, too --- dbaccess/source/ui/app/AppControllerDnD.cxx | 2 +- dbaccess/source/ui/inc/linkeddocuments.hxx | 19 +++++---- dbaccess/source/ui/misc/linkeddocuments.cxx | 65 ++++++++++++++--------------- 3 files changed, 42 insertions(+), 44 deletions(-) diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index ed8c5a15dd89..0e8b3c8d647c 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -613,7 +613,7 @@ void OApplicationController::getSelectionElementNames(::std::vector< ::rtl::OUSt } ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new OLinkedDocumentsAccess( - getView(), m_aCurrentFrame.getFrame(), getORB(), xDocContainer, xConnection, getDatabaseName() + getView(), this, getORB(), xDocContainer, xConnection, getDatabaseName() ) ); return pDocuments; } diff --git a/dbaccess/source/ui/inc/linkeddocuments.hxx b/dbaccess/source/ui/inc/linkeddocuments.hxx index e7030312cde6..b91aca78fff2 100644 --- a/dbaccess/source/ui/inc/linkeddocuments.hxx +++ b/dbaccess/source/ui/inc/linkeddocuments.hxx @@ -55,6 +55,7 @@ #ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_ #include #endif +#include #ifndef _LINK_HXX #include #endif @@ -83,8 +84,8 @@ namespace dbaui m_xDocumentContainer; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > - m_xParentFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI > + m_xDocumentUI; Window* m_pDialogParent; String m_sCurrentlyEditing; ::rtl::OUString @@ -92,13 +93,13 @@ namespace dbaui public: OLinkedDocumentsAccess( - Window* _pDialogParent - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB - ,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer - ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection - ,const ::rtl::OUString& _sDataSourceName - ); + Window* _pDialogParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rDocumentUI, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, + const ::rtl::OUString& _sDataSourceName + ); ~OLinkedDocumentsAccess(); inline sal_Bool isConnected() const { return m_xConnection.is(); } diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 9cb8f5b1745f..9dc35a684041 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -155,6 +155,7 @@ namespace dbaui using namespace ::com::sun::star::util; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::sdbc; + using namespace ::com::sun::star::sdb::application; using namespace ::com::sun::star::task; using namespace ::svt; @@ -192,17 +193,13 @@ namespace dbaui //================================================================== DBG_NAME(OLinkedDocumentsAccess) //------------------------------------------------------------------ - OLinkedDocumentsAccess::OLinkedDocumentsAccess(Window* _pDialogParent - , const Reference< XFrame >& _rxParentFrame - , const Reference< XMultiServiceFactory >& _rxORB - , const Reference< XNameAccess >& _rxContainer - , const Reference< XConnection>& _xConnection - , const ::rtl::OUString& _sDataSourceName - ) + OLinkedDocumentsAccess::OLinkedDocumentsAccess( Window* _pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI, + const Reference< XMultiServiceFactory >& _rxORB, const Reference< XNameAccess >& _rxContainer, + const Reference< XConnection>& _xConnection, const ::rtl::OUString& _sDataSourceName ) :m_xORB(_rxORB) ,m_xDocumentContainer(_rxContainer) ,m_xConnection(_xConnection) - ,m_xParentFrame(_rxParentFrame) + ,m_xDocumentUI( i_rDocumentUI ) ,m_pDialogParent(_pDialogParent) ,m_sDataSourceName(_sDataSourceName) { @@ -277,44 +274,44 @@ namespace dbaui Reference< XComponent> xRet; try { - ::svx::ODataAccessDescriptor aDesc; - aDesc.setDataSource(m_sDataSourceName); + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "DataSourceName", m_sDataSourceName ); + if ( _rObjectName.getLength() && ( _nCommandType != -1 ) ) { - aDesc[::svx::daCommandType] <<= _nCommandType; - aDesc[::svx::daCommand] <<= _rObjectName; + aArgs.put( "CommandType", _nCommandType ); + aArgs.put( "Command", _rObjectName ); } if ( m_xConnection.is() ) - aDesc[::svx::daConnection] <<= m_xConnection; + aArgs.put( "ActiveConnection", m_xConnection ); + + aArgs.put( "DocumentUI", m_xDocumentUI ); - Sequence aSeq = aDesc.createAnySequence(); - const sal_Int32 nLength = aSeq.getLength(); - aSeq.realloc(nLength + 1 ); - PropertyValue aVal; - aVal.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame")); - aVal.Value <<= m_xParentFrame; - aSeq[nLength] <<= aVal; + Reference< XController > xController( m_xDocumentUI, UNO_QUERY_THROW ); + aArgs.put( "ParentFrame", xController->getFrame() ); + // (legacy, 'til not all wizards migrated to the DocumentUI parameter) - Reference< XJobExecutor > xFormWizard; + Reference< XJobExecutor > xWizard; { WaitObject aWaitCursor( m_pDialogParent ); - xFormWizard.set(m_xORB->createInstanceWithArguments(::rtl::OUString::createFromAscii(_pWizardService),aSeq),UNO_QUERY); + xWizard.set( m_xORB->createInstanceWithArguments( + ::rtl::OUString::createFromAscii(_pWizardService), + aArgs.getWrappedPropertyValues() + ), UNO_QUERY ); } - if ( xFormWizard.is() ) + + if ( xWizard.is() ) { - xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); - Reference xProp(xFormWizard,UNO_QUERY); - if ( xProp.is() ) + xWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("start"))); + Reference xProp( xWizard, UNO_QUERY_THROW ); + Reference xInfo( xProp->getPropertySetInfo(), UNO_SET_THROW ); + if ( xInfo->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))) ) { - Reference xInfo = xProp->getPropertySetInfo(); - if ( xInfo->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))) ) - { - _xDefinition.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentDefinition"))),UNO_QUERY); - xRet.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))),UNO_QUERY); - } + _xDefinition.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentDefinition"))),UNO_QUERY); + xRet.set(xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Document"))),UNO_QUERY); } - xFormWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("end"))); - ::comphelper::disposeComponent(xFormWizard); + xWizard->trigger(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("end"))); + ::comphelper::disposeComponent(xWizard); } } catch(const Exception& e) -- cgit v1.2.3 From ed853a88ff6e0bfae048bb19615ab2cd255f07eb Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Wed, 3 Feb 2010 11:52:40 +0100 Subject: autorecovery: re-work the table wizard so that it does not open the table itself, but uses XDatabaseDocumentUI Consequently, it does not need to return the created model/controller anymore. This way, the application controller has full control over its sub components, which didn't work reliably before. Other wizards (query/form/report) are to follow. For this purpose, they're also to be based on the newly introduced DatabaseObjectWizard class. --- dbaccess/source/ui/app/AppController.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 076b4429abd4..cc040cabe11c 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2083,7 +2083,8 @@ void OApplicationController::newElementWithPilot( ElementType _eType ) else xComponent = aHelper->newTableWithPilot(); - onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL ); + // no need for onDocumentOpened, the table wizard opens the created table by using + // XDatabaseDocumentUI::loadComponent method. } } break; -- cgit v1.2.3 From c230fec7a7c2d7bd1073cae0b69c5ab334e270d6 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Wed, 3 Feb 2010 13:21:06 +0100 Subject: native0: #161619# fix in upgrade table --- solenv/bin/modules/installer/windows/upgrade.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/bin/modules/installer/windows/upgrade.pm b/solenv/bin/modules/installer/windows/upgrade.pm index d9d371fc1b56..49479b26bf49 100644 --- a/solenv/bin/modules/installer/windows/upgrade.pm +++ b/solenv/bin/modules/installer/windows/upgrade.pm @@ -47,7 +47,7 @@ sub create_upgrade_table # fix for problematic OOo 1.9 versions my $include_ooo_fix = 0; my $ooomaxnew = ""; - if (($installer::globals::product =~ /OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack )) + if (($installer::globals::product =~ /^\s*OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack )) { $include_ooo_fix = 1; $ooomaxnew = "34.0.0"; -- cgit v1.2.3 From 9c0fac6e822da4c775c69dab3dc2c6f7d45e5065 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Fri, 26 Mar 2010 17:21:42 +0100 Subject: #i107751# #i89119# flat image buttons - transplanted from 7854e4fde73a@native0 --- tools/inc/tools/wintypes.hxx | 1 + vcl/source/control/button.cxx | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx index c909ca3e37b0..48c7ea9cac50 100644 --- a/tools/inc/tools/wintypes.hxx +++ b/tools/inc/tools/wintypes.hxx @@ -205,6 +205,7 @@ typedef sal_Int64 WinBits; #define WB_SMALLSTYLE ((WinBits)0x04000000) #define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) #define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) +#define WB_FLATBUTTON ((WinBits)SAL_CONST_INT64(0x4000000000)) // Window-Bits for FixedText #define WB_PATHELLIPSIS ((WinBits)0x00100000) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 1cda2308aa9c..ea3807526a18 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1320,6 +1320,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( bNativeOK ) return; + bool bRollOver = (IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() )); if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE ) { PushButtonValue aPBVal; @@ -1334,7 +1335,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if ( ImplGetButtonState() & BUTTON_DRAW_DEFAULT ) nState |= CTRL_STATE_DEFAULT; if ( Window::IsEnabled() ) nState |= CTRL_STATE_ENABLED; - if ( IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() ) ) + if ( bRollOver ) nState |= CTRL_STATE_ROLLOVER; if( GetStyle() & WB_BEVELBUTTON ) @@ -1359,8 +1360,15 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); - bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, - aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); + if( (nState & CTRL_STATE_ROLLOVER) || ! (GetStyle() & WB_FLATBUTTON) ) + { + bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, + aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); + } + else + { + bNativeOK = true; + } // draw content using the same aInRect as non-native VCL would do ImplDrawPushButtonContent( this, @@ -1374,8 +1382,21 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if ( bNativeOK == FALSE ) { // draw PushButtonFrame, aInRect has content size afterwards - if( ! bLayout ) - ImplDrawPushButtonFrame( this, aInRect, nButtonStyle ); + if( (GetStyle() & WB_FLATBUTTON) ) + { + Rectangle aTempRect( aInRect ); + if( ! bLayout && bRollOver ) + ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle ); + aInRect.Left() += 2; + aInRect.Top() += 2; + aInRect.Right() -= 2; + aInRect.Bottom() -= 2; + } + else + { + if( ! bLayout ) + ImplDrawPushButtonFrame( this, aInRect, nButtonStyle ); + } // draw content ImplDrawPushButtonContent( this, 0, aInRect, bLayout ); -- cgit v1.2.3 From b959d55dea9b90a6972a1cdabcace529b520b320 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 3 Feb 2010 13:27:39 +0100 Subject: #i107751# #i89119# focused flat image buttons show as buttons --- vcl/source/control/button.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index ea3807526a18..1f45b5902381 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1191,7 +1191,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags else { Rectangle aSymbolRect; - ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, 1, nDrawFlags, + ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2; + if( nImageSep < 1 ) + nImageSep = 1; + ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags, nTextStyle, IsSymbol() ? &aSymbolRect : NULL ); if ( IsSymbol() && ! bLayout ) @@ -1360,7 +1363,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) ); aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() ); - if( (nState & CTRL_STATE_ROLLOVER) || ! (GetStyle() & WB_FLATBUTTON) ) + if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) ) { bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState, aControlValue, rtl::OUString()/*PushButton::GetText()*/ ); @@ -1385,7 +1388,7 @@ void PushButton::ImplDrawPushButton( bool bLayout ) if( (GetStyle() & WB_FLATBUTTON) ) { Rectangle aTempRect( aInRect ); - if( ! bLayout && bRollOver ) + if( ! bLayout && (bRollOver || HasFocus()) ) ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle ); aInRect.Left() += 2; aInRect.Top() += 2; -- cgit v1.2.3 From 7f40d36d4ab443d1152ec932784c7f0d3cdbaa46 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Wed, 3 Feb 2010 17:59:00 +0100 Subject: datapilotperf: manual migration of changes by Wang Xu Ming from svn to hg --- sc/inc/collect.hxx | 14 +- sc/inc/document.hxx | 23 + sc/inc/dpcachetable.hxx | 134 ++-- sc/inc/dpglobal.hxx | 208 ++++++ sc/inc/dpgroup.hxx | 52 +- sc/inc/dpobject.hxx | 40 +- sc/inc/dpsave.hxx | 20 +- sc/inc/dpsdbtab.hxx | 18 +- sc/inc/dpshttab.hxx | 33 +- sc/inc/dptabdat.hxx | 81 +-- sc/inc/dptablecache.hxx | 120 ++++ sc/inc/dptabres.hxx | 262 +++++--- sc/inc/dptabsrc.hxx | 52 +- sc/inc/global.hxx | 57 +- sc/inc/globstr.hrc | 5 +- sc/inc/pivot.hxx | 1 + sc/source/core/data/documen3.cxx | 118 ++++ sc/source/core/data/dpcachetable.cxx | 529 +++++----------- sc/source/core/data/dpglobal.cxx | 144 +++++ sc/source/core/data/dpgroup.cxx | 655 ++++++++++--------- sc/source/core/data/dpobject.cxx | 194 +++--- sc/source/core/data/dpoutput.cxx | 142 +++-- sc/source/core/data/dpsave.cxx | 323 ++++++++-- sc/source/core/data/dpsdbtab.cxx | 241 +++---- sc/source/core/data/dpshttab.cxx | 223 ++++--- sc/source/core/data/dptabdat.cxx | 194 +++--- sc/source/core/data/dptablecache.cxx | 1092 ++++++++++++++++++++++++++++++++ sc/source/core/data/dptabres.cxx | 697 +++++++++++++++----- sc/source/core/data/dptabresmember.cxx | 831 ++++++++++++++++++++++++ sc/source/core/data/dptabresmember.hxx | 161 +++++ sc/source/core/data/dptabsrc.cxx | 204 ++++-- sc/source/core/data/global2.cxx | 100 +-- sc/source/core/data/makefile.mk | 6 +- sc/source/core/data/scdpoutputimpl.cxx | 187 ++++++ sc/source/core/data/scdpoutputimpl.hxx | 79 +++ sc/source/core/tool/collect.cxx | 18 + sc/source/filter/excel/xepivot.cxx | 17 +- sc/source/ui/src/globstr.src | 12 + 38 files changed, 5486 insertions(+), 1801 deletions(-) create mode 100644 sc/inc/dpglobal.hxx create mode 100644 sc/inc/dptablecache.hxx create mode 100644 sc/source/core/data/dpglobal.cxx create mode 100644 sc/source/core/data/dptablecache.cxx create mode 100644 sc/source/core/data/dptabresmember.cxx create mode 100644 sc/source/core/data/dptabresmember.hxx create mode 100644 sc/source/core/data/scdpoutputimpl.cxx create mode 100644 sc/source/core/data/scdpoutputimpl.hxx diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index dc7778d12da3..baf9b6b1146b 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -187,20 +187,18 @@ private: BOOL bCaseSensitive; public: - TypedScStrCollection( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE ) - : ScSortedCollection( nLim, nDel, bDup ) { bCaseSensitive = FALSE; } + TypedScStrCollection( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE ); - TypedScStrCollection( const TypedScStrCollection& rCpy ) - : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } - ~TypedScStrCollection(); + TypedScStrCollection( const TypedScStrCollection& rCpy ) + : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } + ~TypedScStrCollection(); virtual ScDataObject* Clone() const; virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; - TypedStrData* operator[]( const USHORT nIndex) const - { return (TypedStrData*)At(nIndex); } + TypedStrData* operator[]( const USHORT nIndex) const; - void SetCaseSensitive( BOOL bSet ) { bCaseSensitive = bSet; } + void SetCaseSensitive( BOOL bSet ); BOOL FindText( const String& rStart, String& rResult, USHORT& rPos, BOOL bBack ) const; BOOL GetExactMatch( String& rString ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 67d36861d10a..c32b2d4ed82e 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -48,6 +48,13 @@ #include #include +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include +#include "dpobject.hxx" +#include "dptabdat.hxx" +// End Comments + class KeyEvent; class OutputDevice; class SdrObject; @@ -257,6 +264,11 @@ private: ScRangeName* pRangeName; ScDBCollection* pDBCollection; ScDPCollection* pDPCollection; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + std::list m_listDPObjectsInClip; + std::list m_listDPObjectsCaches; + // End Comments ScChartCollection* pChartCollection; std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; ScPatternAttr* pSelectionAttr; // Attribute eines Blocks @@ -489,6 +501,17 @@ public: SC_DLLPUBLIC ScDPCollection* GetDPCollection(); ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + SC_DLLPUBLIC ScDPTableDataCache* GetDPObjectCache( long nID ); + SC_DLLPUBLIC ScDPTableDataCache* GetUsedDPObjectCache ( ScRange rRange ); + SC_DLLPUBLIC long AddDPObjectCache( ScDPTableDataCache* pData ); + SC_DLLPUBLIC void RemoveDPObjectCache( long nID ); + SC_DLLPUBLIC void RemoveUnusedDPObjectCaches(); + SC_DLLPUBLIC void GetUsedDPObjectCache( std::list& usedlist ); + SC_DLLPUBLIC long GetNewDPObjectCacheId (); + // End Comments + SC_DLLPUBLIC ScChartCollection* GetChartCollection() const; void StopTemporaryChartLock(); diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index 2115eab7cc42..676ae1221cd8 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -59,32 +59,37 @@ class ScRange; class ScDPDimension; class ScDPCollection; struct ScDPCacheCell; -struct ScDPItemData; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments class Date; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPTableDataCache; +struct ScDPValueData; +// End Comments // ---------------------------------------------------------------------------- -class ScDPCacheTable +class SC_DLLPUBLIC ScDPCacheTable { public: - - struct Cell - { - SCROW mnCategoryRef; - ScDPCacheCell* mpContent; - - Cell(); - ~Cell(); - }; - /** individual filter item used in SingleFilter and GroupFilter. */ struct FilterItem { - sal_Int32 mnMatchStrId; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + String maString; + // End Comments double mfValue; bool mbHasValue; FilterItem(); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + bool match( const ScDPItemData& rCellData ) const; +// End Comments }; /** interface class used for filtering of rows. */ @@ -93,19 +98,26 @@ public: public: /** returns true if the matching condition is met for a single cell value, or false otherwise. */ - virtual bool match(const ScDPCacheCell& rCell) const = 0; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + virtual bool match( const ScDPItemData& rCellData ) const = 0; +// End Comments }; /** ordinary single-item filter. */ class SingleFilter : public FilterBase { public: - explicit SingleFilter(ScSimpleSharedString& rSharedString, - sal_Int32 nMatchStrId, double fValue, bool bHasValue); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + explicit SingleFilter(String aString, double fValue, bool bHasValue); + // End Comments virtual ~SingleFilter(){} - virtual bool match(const ScDPCacheCell& rCell) const; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual bool match(const ScDPItemData& rCellData) const; + // End Comments const String getMatchString(); double getMatchValue() const; bool hasValue() const; @@ -114,25 +126,27 @@ public: explicit SingleFilter(); FilterItem maItem; - ScSimpleSharedString mrSharedString; }; /** multi-item (group) filter. */ class GroupFilter : public FilterBase { public: - GroupFilter(ScSimpleSharedString& rSharedString); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + GroupFilter(); + // End Comments virtual ~GroupFilter(){} - virtual bool match(const ScDPCacheCell& rCell) const; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual bool match( const ScDPItemData& rCellData ) const; + // End Comments void addMatchItem(const String& rStr, double fVal, bool bHasValue); size_t getMatchItemCount() const; private: - GroupFilter(); ::std::vector maItems; - ScSimpleSharedString mrSharedString; }; /** single filtering criterion. */ @@ -143,22 +157,26 @@ public: Criterion(); }; - - ScDPCacheTable(ScDPCollection* pCollection); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPCacheTable( ScDocument* pDoc,long nId ); + // End Comments ~ScDPCacheTable(); sal_Int32 getRowSize() const; sal_Int32 getColSize() const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* GetCache() const; /** Fill the internal table from the cell range provided. This function - assumes that the first row is the column header. */ - void fillTable(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& rQuery, BOOL* pSpecial, - bool bIgnoreEmptyRows); - + assumes that the first row is the column header. */ + void fillTable( const ScQueryParam& rQuery, BOOL* pSpecial, + bool bIgnoreEmptyRows, bool bRepeatIfEmpty ); /** Fill the internal table from database connection object. This function assumes that the first row is the column header. */ - void fillTable(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xRowSet, - const Date& rNullDate); + void fillTable(); + // End Comments /** Check whether a specified row is active or not. When a row is active, it is used in calculation of the results data. A row becomes inactive @@ -172,15 +190,23 @@ public: /** Get the cell instance at specified location within the data grid. Note that the data grid doesn't include the header row. Don't delete the returned object! */ - const ScDPCacheCell* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; - - const String* getFieldName(sal_Int32 nIndex) const; - - /** Get the unique entries for a field specified by index. The caller must + const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; + void getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; + String getFieldName( SCCOL nIndex) const; + //End Comments + + /** Get the field index (i.e. column ID in the original data source) based + on the string value that corresponds with the column title. It returns + -1 if no field matching the string value exists. */ + sal_Int32 getFieldIndex(const String& rStr) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + /** Get the unique entries for a field specified by index. The caller must make sure that the table is filled before calling function, or it will get an empty collection. */ - const TypedScStrCollection& getFieldEntries(sal_Int32 nIndex) const; - + const ::std::vector& getFieldEntries( sal_Int32 nColumn ) const; + // End Comments /** Filter the table based on the specified criteria, and copy the result to rTabData. This method is used, for example, to generate a drill-down data table. */ @@ -189,6 +215,7 @@ public: const ::std::hash_set& rRepeatIfEmptyDims); void clear(); + void swap(ScDPCacheTable& rOther); bool empty() const; private: @@ -203,26 +230,23 @@ private: */ bool isRowQualified(sal_Int32 nRow, const ::std::vector& rCriteria, const ::std::hash_set& rRepeatIfEmptyDims) const; void getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void InitNoneCache( ScDocument* pDoc ); + // End Comments private: - typedef ::boost::shared_ptr TypedScStrCollectionPtr; - - /** main data table. */ - ::std::vector< ::std::vector< ::ScDPCacheTable::Cell > > maTable; - - /** header string IDs */ - ::std::vector maHeader; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance /** unique field entires for each field (column). */ - ::std::vector maFieldEntries; - + ::std::vector< ::std::vector > maFieldEntries; + // End Comments /** used to track visibility of rows. The first row below the header row has the index of 0. */ ::std::vector maRowsVisible; - - ScSimpleSharedString& mrSharedString; - ScDPCollection* mpCollection; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* mpCache; + ScDPTableDataCache* mpNoneCache; + // End Comments }; - - #endif diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx new file mode 100644 index 000000000000..c4089be762c0 --- /dev/null +++ b/sc/inc/dpglobal.hxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dpglobal.hxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +// Wang Xu Ming - DataPilot migration +// Buffer&&Performance +// +#ifndef _SC_DPGLOBAL_HXX +#define _SC_DPGLOBAL_HXX + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define MAX_LABELS (MAXCOL+1) + +#define MAX_PAGEFIELDS 10 // maximum count of fields for page area + +#define PIVOT_MAXFUNC 11 +#define PIVOT_FUNC_NONE 0x0000 +#define PIVOT_FUNC_SUM 0x0001 +#define PIVOT_FUNC_COUNT 0x0002 +#define PIVOT_FUNC_AVERAGE 0x0004 +#define PIVOT_FUNC_MAX 0x0008 +#define PIVOT_FUNC_MIN 0x0010 +#define PIVOT_FUNC_PRODUCT 0x0020 +#define PIVOT_FUNC_COUNT_NUM 0x0040 +#define PIVOT_FUNC_STD_DEV 0x0080 +#define PIVOT_FUNC_STD_DEVP 0x0100 +#define PIVOT_FUNC_STD_VAR 0x0200 +#define PIVOT_FUNC_STD_VARP 0x0400 +#define PIVOT_FUNC_AUTO 0x1000 + +#define DATA_RENAME_SEPARATOR "_" +#define __MAX_NUM_LEN 64 +#define __DECIMALPLACE 18 + +#define DP_PROP_COLUMNGRAND "ColumnGrand" +#define DP_PROP_FUNCTION "Function" +#define DP_PROP_IGNOREEMPTY "IgnoreEmptyRows" +#define DP_PROP_ISDATALAYOUT "IsDataLayoutDimension" +#define DP_PROP_ISVISIBLE "IsVisible" +#define DP_PROP_ORIENTATION "Orientation" +#define DP_PROP_REPEATIFEMPTY "RepeatIfEmpty" +#define DP_PROP_ROWGRAND "RowGrand" +#define DP_PROP_SHOWDETAILS "ShowDetails" +#define DP_PROP_SHOWEMPTY "ShowEmpty" +#define DP_PROP_SUBTOTALS "SubTotals" +#define DP_PROP_USEDHIERARCHY "UsedHierarchy" +#define DP_PROP_FILTER "Filter" +#define DP_PROP_POSITION "Position" + +#define DBG_TRACESTR( x ) \ + {\ + ByteString aTemp( x , RTL_TEXTENCODING_UTF8 ); \ + DBG_TRACE( aTemp.GetBuffer() );\ + } + +class TypedStrData; +class ScDPObject; + +class SC_DLLPUBLIC ScDPItemData +{ +public: + enum { MK_VAL = 0x01, MK_DATA = MK_VAL<<1, MK_ERR = MK_DATA<<1, MK_DATE = MK_ERR<<1, MK_DATEPART = MK_DATE<<1 }; +private: + union + { + ULONG nNumFormat; + sal_Int32 mnDatePart; + }; + + String aString; + double fValue; + BYTE mbFlag; + //BOOL bHasValue: 1 ; + //BOOL bHasData: 1; + //BOOL bErr: 1; + + friend class ScDPTableDataCache; +public: + ScDPItemData() : fValue(0.0), nNumFormat( 0 ), mbFlag( 0 ){} + ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){} + ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE, const ULONG nNumFormat = 0 , BOOL bData = TRUE) ; + ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ); + + void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; } +// void SetValue ( double value , ULONG nNumFormat = 0 ) { bHasValue = TRUE; nNumFormat = 0;bHasData = TRUE; bDate = FALSE; fValue = value ;} + BOOL IsCaseInsEqual( const ScDPItemData& r ) const; + + size_t Hash() const; + + // exact equality + BOOL operator==( const ScDPItemData& r ) const; + // case insensitive equality + static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB ); + +#ifdef DEBUG + void dump() const; +#endif + +public: + BOOL IsHasData() const ; + BOOL IsHasErr() const ; + BOOL IsValue() const; + String GetString() const ; + double GetValue() const ; + ULONG GetNumFormat() const ; + BOOL HasStringData() const ; + BOOL IsDate() const; + BOOL HasDatePart() const; + void SetDate( BOOL b ) ; + + TypedStrData* CreateTypeString( ); + sal_uInt8 GetType() const; + BYTE & GetFlag() throw() { return mbFlag; } + const BYTE & GetFlag() const throw() { return const_cast(this)->GetFlag(); } +}; + +class SC_DLLPUBLIC ScDPItemDataPool +{ +public: + // construct + ScDPItemDataPool(void); + ScDPItemDataPool(const ScDPItemDataPool& r); + + virtual ~ScDPItemDataPool(void); + virtual const ScDPItemData* getData( sal_Int32 nId ); + virtual sal_Int32 getDataId( const ScDPItemData& aData ); + virtual sal_Int32 insertData( const ScDPItemData& aData ); +protected: + struct DataHashFunc : public std::unary_function< const ScDPItemData &, size_t > + { + size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); } + }; + + typedef ::std::hash_multimap< ScDPItemData, sal_Int32, DataHashFunc > DataHash; + + ::std::vector< ScDPItemData > maItems; + DataHash maItemIds; +}; + +class ScDPInfoWnd; +class ScDocShell; +class ScTabViewShell; +namespace ScDPGlobal +{ +// used for core data + String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, BOOL bIsValue ); + String GetFuncString( const String &rString, const USHORT nIndex ); + com::sun::star::uno::Reference DP_GetMembers( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField ); +// common operation + String operator + ( const String & rL, const String &rR ); + Rectangle operator *( const Rectangle &rLeft, const std::pair & rRight ); +// used for DataPilot Panel + ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell ); + bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip = FALSE ); + +} +#endif diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx index 99dac0e517db..a0d14a361b95 100644 --- a/sc/inc/dpgroup.hxx +++ b/sc/inc/dpgroup.hxx @@ -36,7 +36,10 @@ #include "dptabdat.hxx" #include "scdllapi.h" - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +// End Comments class ScDocument; class SvNumberFormatter; @@ -75,8 +78,11 @@ public: sal_Int32 GetDatePart() const { return nDatePart; } const ScDPNumGroupInfo& GetNumInfo() const { return aNumInfo; } - void FillColumnEntries( TypedScStrCollection& rEntries, const TypedScStrCollection& rOriginal, - SvNumberFormatter* pFormatter ) const; + // Wang Xu Ming -- 2009-9-8 + // DataPilot Migration - Cache&&Performance + void FillColumnEntries( SCCOL nSourceDim, ScDPTableDataCache* pCahe , std::vector< SCROW >& rEntries, + const std::vector< SCROW >& rOriginal ) const; + // End Comments }; // -------------------------------------------------------------------- @@ -110,8 +116,10 @@ class ScDPGroupDimension String aGroupName; ScDPDateGroupHelper* pDateHelper; ScDPGroupItemVec aItems; - mutable TypedScStrCollection* pCollection; // collection of item names (cached) - + // Wang Xu Ming -- 2009-9-4 + // DataPilot Migration - Cache&&Performance + mutable ::std::vector< SCROW > maMemberEntries; + // End Comments public: ScDPGroupDimension( long nSource, const String& rNewName ); ScDPGroupDimension( const ScDPGroupDimension& rOther ); @@ -124,9 +132,12 @@ public: long GetSourceDim() const { return nSourceDim; } long GetGroupDim() const { return nGroupDim; } - const String& GetName() const { return aGroupName; } + const String& GetName() const { return aGroupName; } - const TypedScStrCollection& GetColumnEntries( const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const; +// Wang Xu Ming -- 2009-9-2 +// DataPilot Migration - Cache&&Performance + const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable, const std::vector< SCROW >& rOriginal ) const; +// End Comments const ScDPGroupItem* GetGroupForData( const ScDPItemData& rData ) const; // rData = entry in original dim. const ScDPGroupItem* GetGroupForName( const ScDPItemData& rName ) const; // rName = entry in group dim. const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const; @@ -148,7 +159,10 @@ class SC_DLLPUBLIC ScDPNumGroupDimension { ScDPNumGroupInfo aGroupInfo; // settings ScDPDateGroupHelper* pDateHelper; - mutable TypedScStrCollection* pCollection; // collection of item names (cached) +// Wang Xu Ming -- 2009-9-4 +// DataPilot Migration - Cache&&Performance + mutable ::std::vector< SCROW > maMemberEntries; +// End Comments mutable bool bHasNonInteger; // initialized in GetNumEntries mutable sal_Unicode cDecSeparator; // initialized in GetNumEntries @@ -160,14 +174,15 @@ public: ScDPNumGroupDimension& operator=( const ScDPNumGroupDimension& rOther ); - const TypedScStrCollection& GetNumEntries( const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const; - const ScDPNumGroupInfo& GetInfo() const { return aGroupInfo; } bool HasNonInteger() const { return bHasNonInteger; } sal_Unicode GetDecSeparator() const { return cDecSeparator; } const ScDPDateGroupHelper* GetDateHelper() const { return pDateHelper; } + const std::vector< SCROW >& GetNumEntries( SCCOL nSourceDim, ScDPTableDataCache* pCache, + const std::vector< SCROW >& rOriginal ) const; + void MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); void DisposeData(); @@ -189,7 +204,11 @@ class ScDPGroupTableData : public ScDPTableData ScDocument* pDoc; StringHashSet aGroupNames; - void FillGroupValues( ScDPItemData* pItemData, long nCount, const long* pDims ); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + void FillGroupValues( SCROW* pItemDataIndex, long nCount, const long* pDims ); + virtual long GetSourceDim( long nDim ); +// End Comments void CopyFields(const ::std::vector& rFieldDims, ::std::vector& rNewFieldDims); bool IsNumGroupDimension( long nDimension ) const; @@ -210,11 +229,18 @@ public: ScDocument* GetDocument() { return pDoc; } virtual long GetColumnCount(); - virtual const TypedScStrCollection& GetColumnEntries(long nColumn); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + virtual long GetMembersCount( long nDim ); + virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ; + virtual const ScDPItemData* GetMemberById( long nDim, long nId); + virtual long Compare( long nDim, long nDataId1, long nDataId2); + +// End Comments virtual String getDimensionName(long nColumn); virtual BOOL getIsDataLayoutDimension(long nColumn); virtual BOOL IsDateDimension(long nDim); - virtual UINT32 GetNumberFormat(long nDim); + virtual ULONG GetNumberFormat(long nDim); virtual void DisposeData(); virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 2dc8829485c8..40f8e75676d5 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -110,8 +110,18 @@ private: SC_DLLPRIVATE void CreateObjects(); SC_DLLPRIVATE void CreateOutput(); + BOOL bRefresh; + long mnCacheId; public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + inline void SetRefresh() { bRefresh = TRUE; } + const ScDPTableDataCache* GetCache() const; + long GetCacheId() const; + void SetCacheId( long nCacheId ); + ULONG RefreshCache(); + // End Comments ScDPObject( ScDocument* pD ); ScDPObject(const ScDPObject& r); virtual ~ScDPObject(); @@ -237,19 +247,6 @@ public: PivotField* pRefPageFields = NULL, SCSIZE nRefPageCount = 0 ); }; -// ============================================================================ - -struct ScDPCacheCell -{ - sal_Int32 mnStrId; - sal_uInt8 mnType; - double mfValue; - bool mbNumeric; - - ScDPCacheCell(); - ScDPCacheCell(const ScDPCacheCell& r); - ~ScDPCacheCell(); -}; // ============================================================================ @@ -257,20 +254,6 @@ class ScDPCollection : public ScCollection { private: ScDocument* pDoc; - ScSimpleSharedString maSharedString; - - struct CacheCellHash - { - size_t operator()(const ScDPCacheCell* pCell) const; - }; - struct CacheCellEqual - { - bool operator()(const ScDPCacheCell* p1, const ScDPCacheCell* p2) const; - }; - typedef ::std::hash_set CacheCellPoolType; - - CacheCellPoolType maCacheCellPool; - public: ScDPCollection(ScDocument* pDocument); ScDPCollection(const ScDPCollection& r); @@ -289,10 +272,7 @@ public: String CreateNewName( USHORT nMin = 1 ) const; - ScSimpleSharedString& GetSharedString(); - ScDPCacheCell* getCacheCellFromPool(const ScDPCacheCell& rCell); - void clearCacheCellPool(); }; diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx index d3d8d4354145..40bca2faaa6c 100644 --- a/sc/inc/dpsave.hxx +++ b/sc/inc/dpsave.hxx @@ -83,6 +83,9 @@ public: }; +bool operator == (const ::com::sun::star::sheet::DataPilotFieldSortInfo &l, const ::com::sun::star::sheet::DataPilotFieldSortInfo &r ); +bool operator == (const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &l, const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &r ); +bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, const ::com::sun::star::sheet::DataPilotFieldReference &r ); class ScDPSaveDimension { private: @@ -164,6 +167,9 @@ public: void WriteToSource( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface>& xDim ); + void Refresh( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource , + const std::list & deletedDims); }; @@ -178,7 +184,10 @@ private: USHORT nRepeatEmptyMode; BOOL bFilterButton; // not passed to DataPilotSource BOOL bDrillDown; // not passed to DataPilotSource - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + long mnCacheId; + // End Comments public: SC_DLLPUBLIC ScDPSaveData(); ScDPSaveData(const ScDPSaveData& r); @@ -222,10 +231,15 @@ public: BOOL GetDrillDown() const { return bDrillDown; } void WriteToSource( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void Refresh( const com::sun::star::uno::Reference< com::sun::star::sheet::XDimensionsSupplier>& xSource ); - BOOL IsEmpty() const; - + inline long GetCacheId() const{ return mnCacheId; } + inline void SetCacheId( long nCacheId ){ mnCacheId = nCacheId; } + // End Comments const ScDPDimensionSaveData* GetExistingDimensionData() const { return pDimensionData; } SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not there void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx index b837b5811aad..38ddc3380ab1 100644 --- a/sc/inc/dpsdbtab.hxx +++ b/sc/inc/dpsdbtab.hxx @@ -58,23 +58,25 @@ struct ScImportSourceDesc aObject == rOther.aObject && nType == rOther.nType && bNative == rOther.bNative; } -}; -class ScDatabaseDPData_Impl; + // Wang Xu Ming -- 2009-9-15 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* GetExistDPObjectCache( ScDocument* pDoc ) const; + ScDPTableDataCache* CreateCache( ScDocument* pDoc , long nID ) const; + ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const; + long GetCacheId( ScDocument* pDoc, long nID ) const; + // End Comments +}; class ScDatabaseDPData : public ScDPTableData { private: - ScDatabaseDPData_Impl* pImpl; - - BOOL OpenDatabase(); - + ScDPCacheTable aCacheTable; public: - ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport); + ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport, long nCacheId = -1); virtual ~ScDatabaseDPData(); virtual long GetColumnCount(); - virtual const TypedScStrCollection& GetColumnEntries(long nColumn); virtual String getDimensionName(long nColumn); virtual BOOL getIsDataLayoutDimension(long nColumn); virtual BOOL IsDateDimension(long nDim); diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx index 0bcdbeee517e..d90b1fdb6cf5 100644 --- a/sc/inc/dpshttab.hxx +++ b/sc/inc/dpshttab.hxx @@ -43,8 +43,10 @@ namespace com { namespace sun { namespace star { namespace sheet { }}}} class ScDPDimension; -struct ScDPItemData; - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments // -------------------------------------------------------------------- // // implementation of ScDPTableData with sheet data @@ -58,25 +60,38 @@ struct ScSheetSourceDesc BOOL operator== ( const ScSheetSourceDesc& rOther ) const { return aSourceRange == rOther.aSourceRange && aQueryParam == rOther.aQueryParam; } +// Wang Xu Ming - DataPilot migration +// Buffer&&Performance + ScDPTableDataCache* CreateCache( ScDocument* pDoc, long nID = -1) const; + ULONG CheckValidate( ScDocument* pDoc ) const; + ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const; + ScDPTableDataCache* GetExistDPObjectCache ( ScDocument* pDoc ) const; + long GetCacheId( ScDocument* pDoc, long nID ) const; + +// End Comments }; -class ScSheetDPData_Impl; - class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData { private: - ScSheetDPData_Impl* pImpl; + ScQueryParam aQuery; + BOOL* pSpecial; + BOOL bIgnoreEmptyRows; + BOOL bRepeatIfEmpty; + + ScDPCacheTable aCacheTable; public: - ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc, long nCacheId = -1 ); virtual ~ScSheetDPData(); - + // End Comments virtual long GetColumnCount(); - virtual const TypedScStrCollection& GetColumnEntries(long nColumn); virtual String getDimensionName(long nColumn); virtual BOOL getIsDataLayoutDimension(long nColumn); virtual BOOL IsDateDimension(long nDim); - virtual UINT32 GetNumberFormat(long nDim); + virtual ULONG GetNumberFormat(long nDim); virtual void DisposeData(); virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx index 46c26b3f0bbe..40114a64cacf 100644 --- a/sc/inc/dptabdat.hxx +++ b/sc/inc/dptabdat.hxx @@ -34,7 +34,10 @@ #include "address.hxx" #include "dpoutput.hxx" #include "dpcachetable.hxx" - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dptablecache.hxx" +// End Comments #include #include @@ -46,8 +49,6 @@ namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldFilter; }}}} -class TypedScStrCollection; -class ScSimpleSharedString; // ----------------------------------------------------------------------- @@ -74,28 +75,6 @@ class ScSimpleSharedString; // base class ScDPTableData to allow implementation with tabular data // by deriving only of this // - -struct ScDPItemData -{ - String aString; - double fValue; - BOOL bHasValue; - - ScDPItemData() : fValue(0.0), bHasValue(FALSE) {} - ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE ) : - aString(rS), fValue(fV), bHasValue( bHV ) {} - - void SetString( const String& rS ) { aString = rS; bHasValue = FALSE; } - BOOL IsCaseInsEqual( const ScDPItemData& r ) const; - - size_t Hash() const; - - // exact equality - BOOL operator==( const ScDPItemData& r ) const; - // case insensitive equality - static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB ); -}; - #define SC_VALTYPE_EMPTY 0 #define SC_VALTYPE_VALUE 1 #define SC_VALTYPE_STRING 2 @@ -116,15 +95,18 @@ class ScDPInitState; class ScDPResultMember; class ScDocument; -class ScDPTableData + class SC_DLLPUBLIC ScDPTableData { // cached data for GetDatePart long nLastDateVal; long nLastHier; long nLastLevel; long nLastRet; - ScSimpleSharedString& mrSharedString; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + long mnCacheId; + const ScDocument* mpDoc; + // End Comments public: /** This structure stores dimension information used when calculating @@ -150,7 +132,10 @@ public: CalcInfo(); }; - ScDPTableData(ScDocument* pDoc); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableData(ScDocument* pDoc, long nCacheId ); + // End Comments virtual ~ScDPTableData(); long GetDatePart( long nDateVal, long nHierarchy, long nLevel ); @@ -159,11 +144,16 @@ public: //! or separate Str and ValueCollection virtual long GetColumnCount() = 0; - virtual const TypedScStrCollection& GetColumnEntries(long nColumn) = 0; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ; + long GetCacheId() const; + // End Comments virtual String getDimensionName(long nColumn) = 0; virtual BOOL getIsDataLayoutDimension(long nColumn) = 0; virtual BOOL IsDateDimension(long nDim) = 0; - virtual UINT32 GetNumberFormat(long nDim); + virtual ULONG GetNumberFormat(long nDim); + virtual UINT32 GetNumberFormatByIdx( NfIndexTableOffset ); virtual void DisposeData() = 0; virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ) = 0; @@ -179,23 +169,33 @@ public: // overloaded in ScDPGroupTableData: virtual BOOL IsBaseForGroup(long nDim) const; - virtual long GetGroupBase(long nGroupDim) const; + virtual long GetGroupBase(long nGroupDim) const; virtual BOOL IsNumOrDateGroup(long nDim) const; virtual BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, const ScDPItemData& rBaseData, long nBaseIndex ) const; virtual BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, const ScDPItemData& rSecondData, long nSecondIndex ) const; - ScSimpleSharedString& GetSharedString(); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual long GetMembersCount( long nDim ); + virtual const ScDPItemData* GetMemberByIndex( long nDim, long nIndex ); + virtual const ScDPItemData* GetMemberById( long nDim, long nId); + virtual SCROW GetIdOfItemData( long nDim, const ScDPItemData& rData ); + virtual long GetSourceDim( long nDim ); + virtual long Compare( long nDim, long nDataId1, long nDataId2); + // End Comments protected: /** This structure stores vector arrays that hold intermediate data for each row during cache table iteration. */ struct CalcRowData { - ::std::vector aColData; - ::std::vector aRowData; - ::std::vector aPageData; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ::std::vector< SCROW > aColData; + ::std::vector< SCROW > aRowData; + ::std::vector< SCROW > aPageData; + // End Comments ::std::vector aValues; }; @@ -204,10 +204,11 @@ protected: void CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, CalcInfo& rInfo, bool bAutoShow); private: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance void GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, - const ::std::vector& rDims, ::std::vector& rItemData); + const ::std::vector& rDims, ::std::vector< SCROW >& rItemData); + // End Comments }; - - #endif diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx new file mode 100644 index 000000000000..a9449c573f8c --- /dev/null +++ b/sc/inc/dptablecache.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dptablecache.hxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef DPTABLECACHE_HXX +#define DPTABLECACHE_HXX +// Wang Xu Ming -- 12/21/2008 +// Add Data Cache Support. +#ifndef SC_SCGLOB_HXX +#include "global.hxx" +#endif +//Added by PengYunQuan for SODC_16015 +#include +//end +#include +#include "dpglobal.hxx" + +#include +#include +#include + +class ScDPTableDataCache; +class TypedStrData; +// -------------------------------------------------------------------- +// +// base class ScDPTableData to allow implementation with tabular data +// by deriving only of this +// + +class SC_DLLPUBLIC ScDPTableDataCache +{ + long mnID; + ScDocument* mpDoc; + + long mnColumnCount; // Column count + + std::vector* mpTableDataValues; //Data Pilot Table's index - value map + std::vector* mpSourceData; //Data Pilot Table's Source data + std::vector* mpGlobalOrder; //Sorted members index + std::vector* mpIndexOrder; //Index the sorted number + std::vector mrLabelNames; //Source Label data + std::vector mbEmptyRow; //If empty row? + mutable ScDPItemDataPool maAdditionalDatas; +public: + SCROW GetOrder( long nDim, SCROW nIndex ) const; + SCROW GetIdByItemData( long nDim, String sItemData ) const; + SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const; + + SCROW GetAdditionalItemID ( String sItemData ); + SCROW GetAdditionalItemID( const ScDPItemData& rData ); + + SCCOL GetDimensionIndex( String sName) const; + const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const; + ULONG GetNumType ( ULONG nFormat ) const; + ULONG GetNumberFormat( long nDim ) const; + BOOL IsDateDimension( long nDim ) const ; + ULONG GetDimNumType( SCCOL nDim) const; + SCROW GetDimMemberCount( SCCOL nDim ) const; + + SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const; + const std::vector& GetDimMemberValues( SCCOL nDim )const; + void SetId( long nId ){ mnID = nId;} + void AddRow( ScDPItemData* pRow, USHORT nCount ); + bool InitFromDoc( ScDocument* pDoc, const ScRange& rRange ); + bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate); + + SCROW GetRowCount() const; + SCROW GetItemDataId( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const; + String GetDimensionName( USHORT nColumn ) const; + bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const; + bool IsRowEmpty( SCROW nRow ) const; + bool IsValid() const; + bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial ); + + ScDocument* GetDoc() const;//ms-cache-core + long GetColumnCount() const; + long GetId() const; + + const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const; + + BOOL operator== ( const ScDPTableDataCache& r ) const; + +//construction + ScDPTableDataCache( ScDocument* pDoc ); +//deconstruction + virtual ~ScDPTableDataCache(); + +protected: +private: + void AddLabel( ScDPItemData* pData); + BOOL AddData( long nDim, ScDPItemData* itemData ); +}; + +#endif //DPTABLECACHE_HXX diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 6dfb782b2313..4b4756a04aeb 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -59,8 +59,10 @@ class ScDPResultMember; class ScDPResultVisibilityData; struct ScDPValueData; -struct ScDPItemData; - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments // // Member names that are being processed for InitFrom/LateInitFrom // (needed for initialization of grouped items) @@ -69,21 +71,26 @@ struct ScDPItemData; class ScDPInitState { long* pIndex; // array - ScDPItemData* pData; // array +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + SCROW* pData; // array + // End Comments long nCount; public: ScDPInitState(); ~ScDPInitState(); - void AddMember( long nSourceIndex, const ScDPItemData& rName ); + void AddMember( long nSourceIndex,SCROW nMember); void RemoveMember(); long GetCount() const { return nCount; } const long* GetSource() const { return pIndex; } - const ScDPItemData* GetNames() const { return pData; } - - const ScDPItemData* GetNameForIndex( long nIndexValue ) const; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + const SCROW* GetNameIds() const { return pData; } + const SCROW GetNameIdForIndex( long nIndexValue ) const; +// End Comments }; typedef ::std::vector ScMemberSortOrder; @@ -232,6 +239,68 @@ class ScDPDataMember; #define SC_DPMEASURE_ALL -1 #define SC_DPMEASURE_ANY -2 +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + +struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t > +{ + size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; } +}; + +class ScDPParentDimData +{ +public: + const SCROW mnOrder; //! Ref + const ScDPDimension* mpParentDim; //! Ref + const ScDPLevel* mpParentLevel; //! Ref + const ScDPMember* mpMemberDesc; //! Ref + + ScDPParentDimData():mnOrder(-1), mpParentDim( NULL), mpParentLevel( NULL ), mpMemberDesc( NULL ){} + ScDPParentDimData( const SCROW nIndex, ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember ): mnOrder( nIndex ), mpParentDim( pDim), mpParentLevel( pLev ), mpMemberDesc( pMember ){} +}; + +typedef std::vector DimMemberArray; +typedef std::hash_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash; + +class ResultMembers +{ + DimMemberHash maMemberHash; + BOOL mbHasHideDetailsMember; +public: + ScDPParentDimData* FindMember( const SCROW& nIndex ) const; + void InsertMember( ScDPParentDimData* pNew ); + BOOL IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; } + void SetHasHideDetailsMembers( BOOL b ) { mbHasHideDetailsMember=b; } + ResultMembers(); + virtual ~ResultMembers(); +}; + +class LateInitParams +{ +private: + const ::std::vector& mppDim; + const ::std::vector& mppLev; + + BOOL mbRow; + BOOL mbInitChild; + BOOL mbAllChildren; +public: + LateInitParams( const ::std::vector& ppDim, const ::std::vector& ppLev, + BOOL bRow, BOOL bInitChild = TRUE , BOOL bAllChildren = FALSE); + ~LateInitParams(); + + void SetInitChild( BOOL b ) { mbInitChild = b; } + void SetInitAllChildren( BOOL b ) { mbAllChildren = b; } + + inline ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];} + inline ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];} + + inline BOOL GetInitChild() const {return mbInitChild; } + inline BOOL GetInitAllChild() const { return mbAllChildren; } + inline BOOL IsRow() const { return mbRow; } + BOOL IsEnd( size_t nPos ) const ; +}; +// End Comments class ScDPResultData { @@ -249,7 +318,7 @@ private: BOOL bDataAtRow; //! add "displayed values" settings - + mutable std::vector< ResultMembers* > mpDimMembers; public: ScDPResultData( ScDPSource* pSrc ); //! Ref ~ScDPResultData(); @@ -280,10 +349,18 @@ public: BOOL IsBaseForGroup( long nDim ) const; // any group long GetGroupBase( long nGroupDim ) const; BOOL IsNumOrDateGroup( long nDim ) const; + // Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, - const ScDPItemData& rBaseData, long nBaseIndex ) const; - BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, + long nBaseDataId, long nBaseIndex ) const; + BOOL IsInGroup( SCROW nGroupDataId, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + BOOL HasCommonElement( SCROW nFirstDataId, long nFirstIndex, const ScDPItemData& rSecondData, long nSecondIndex ) const; + + ResultMembers* GetDimResultMembers( long nDim , ScDPDimension* pDim , ScDPLevel* pLevel) const ; + +// End Comments }; @@ -291,9 +368,10 @@ class ScDPResultMember { private: const ScDPResultData* pResultData; - const ScDPDimension* pParentDim; //! Ref - const ScDPLevel* pParentLevel; //! Ref - const ScDPMember* pMemberDesc; //! Ref + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPParentDimData aParentDimData; + // End Comments ScDPResultDimension* pChildDimension; ScDPDataMember* pDataRoot; BOOL bHasElements; @@ -303,21 +381,30 @@ private: BOOL bAutoHidden; ScDPAggData aColTotal; // to store column totals + USHORT nMemberStep; // step to show details public: - ScDPResultMember( const ScDPResultData* pData, const ScDPDimension* pDim, - const ScDPLevel* pLev, const ScDPMember* pDesc, - BOOL bForceSub ); //! Ref - ~ScDPResultMember(); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultMember( const ScDPResultData* pData, const ScDPParentDimData& rParentDimData, + BOOL bForceSub ); //! Ref + ScDPResultMember( const ScDPResultData* pData, BOOL bForceSub ); + // End Comments + ~ScDPResultMember(); + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance void InitFrom( const ::std::vector& ppDim, - const ::std::vector& ppLev, - size_t nPos, - ScDPInitState& rInitState ); - void LateInitFrom( const ::std::vector& ppDim, - const ::std::vector& ppLev, - const ::std::vector& pItemData, - size_t nPos, - ScDPInitState& rInitState ); + const ::std::vector& ppLev, + size_t nPos, + ScDPInitState& rInitState, + BOOL bInitChild = TRUE ); + void LateInitFrom( + LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState); + void CheckShowEmpty( BOOL bShow = FALSE ); + // End Comments String GetName() const; void FillItemData( ScDPItemData& rData ) const; BOOL IsValid() const; @@ -329,17 +416,22 @@ public: // BOOL SubTotalEnabled() const; long GetSubTotalCount( long* pUserSubStart = NULL ) const; - BOOL IsNamedItem( const ScDPItemData& r ) const; - bool IsValidEntry( const ::std::vector& aMembers ) const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + BOOL IsNamedItem( SCROW nIndex ) const; + bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const; + // End Comments void SetHasElements() { bHasElements = TRUE; } void SetAutoHidden() { bAutoHidden = TRUE; } - void ProcessData( const ::std::vector& aChildMembers, - const ScDPResultDimension* pDataDim, - const ::std::vector& aDataMembers, - const ::std::vector& aValues ); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector& aChildMembers, + const ScDPResultDimension* pDataDim, + const ::std::vector& aDataMembers, + const ::std::vector& aValues ); + // End Comments void FillMemberResults( com::sun::star::uno::Sequence< com::sun::star::sheet::MemberResult>* pSequences, long& rPos, long nMeasure, BOOL bRoot, @@ -369,9 +461,15 @@ public: ScDPDataMember* GetDataRoot() const { return pDataRoot; } - const ScDPDimension* GetParentDim() const { return pParentDim; } //! Ref - const ScDPLevel* GetParentLevel() const { return pParentLevel; } //! Ref - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref + const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref + const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref + inline SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref + inline BOOL IsRoot() const { return GetParentLevel() == NULL; } + SCROW GetDataId( ) const ; + // End Comments ScDPAggData* GetColTotal( long nMeasure ) const; void FillVisibilityData(ScDPResultVisibilityData& rData) const; @@ -397,13 +495,17 @@ public: BOOL IsVisible() const; BOOL HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const; - BOOL IsNamedItem( const ScDPItemData& r ) const; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + BOOL IsNamedItem( SCROW r ) const; + // End Comments BOOL HasHiddenDetails() const; - void ProcessData( const ::std::vector& aChildMembers, const ::std::vector& aValues, - const ScDPSubTotalState& rSubState ); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector& aValues, + const ScDPSubTotalState& rSubState ); + // End Comments BOOL HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const; double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const; const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const; @@ -443,15 +545,13 @@ SV_DECL_PTRARR_DEL(ScDPDataMembers, ScDPDataMemberPtr, SC_DP_RES_GROW, SC_DP_RES class ScDPResultDimension { public : - struct MemberHashFunc : public std::unary_function< const ScDPItemData &, size_t > - { - size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); } - }; - typedef std::vector MemberArray; - typedef std::hash_map MemberHash; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + typedef std::vector MemberArray; + typedef std::map < SCROW , ScDPResultMember *> MemberHash; + // End Comments private: - const ScDPResultData* pResultData; + const ScDPResultData* pResultData; MemberArray maMemberArray; MemberHash maMemberHash; BOOL bInitialized; @@ -466,31 +566,47 @@ private: long nAutoMeasure; long nAutoCount; - ScDPResultMember* FindMember( const ScDPItemData& rData ) const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultMember* FindMember( SCROW iData ) const; + ScDPResultMember* AddMember( const ScDPParentDimData& aData ); + ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData ); + ResultMembers* GetResultMember( ScDPDimension* pDim, ScDPLevel* pLevel ); + void InitWithMembers( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); + // End Comments public: - ScDPResultDimension( const ScDPResultData* pData ); - ~ScDPResultDimension(); + ScDPResultDimension( const ScDPResultData* pData ); + ~ScDPResultDimension(); // allocates new members + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance void InitFrom( const ::std::vector& ppDim, - const ::std::vector& ppLev, - size_t nPos, - ScDPInitState& rInitState ); - void LateInitFrom( const ::std::vector& ppDim, - const ::std::vector& ppLev, - const ::std::vector& pItemData, - size_t nPos, - ScDPInitState& rInitState ); - + const ::std::vector& ppLev, + size_t nPos, + ScDPInitState& rInitState , BOOL bInitChild = TRUE ); + void LateInitFrom( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); + void CheckShowEmpty( BOOL bShow = FALSE ); + + // End Comments long GetSize(long nMeasure) const; - bool IsValidEntry( const ::std::vector& aMembers ) const; - // modifies existing members, allocates data dimensions - void ProcessData( const ::std::vector& aMembers, + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + bool IsValidEntry( const ::std::vector& aMembers ) const; + + // modifies existing members, allocates data dimensions + void ProcessData( const ::std::vector& aMembers, const ScDPResultDimension* pDataDim, - const ::std::vector& aDataMembers, + const ::std::vector& aDataMembers, const ::std::vector& aValues ) const; //! Test - + // End Comments void FillMemberResults( com::sun::star::uno::Sequence< com::sun::star::sheet::MemberResult>* pSequences, long nStart, long nMeasure ); @@ -560,9 +676,11 @@ public: ~ScDPDataDimension(); void InitFrom( const ScDPResultDimension* pDim ); // recursive - void ProcessData( const ::std::vector& aDataMembers, const ::std::vector& aValues, - const ScDPSubTotalState& rSubState ); - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector& aValues, + const ScDPSubTotalState& rSubState ); + // End Comments void FillDataRow( const ScDPResultDimension* pRefDim, com::sun::star::uno::Sequence& rSequence, long nCol, long nMeasure, BOOL bIsSubTotalRow, @@ -596,7 +714,10 @@ public: class ScDPResultVisibilityData { public: - ScDPResultVisibilityData(ScSimpleSharedString& rSharedString, ScDPSource* pSource); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultVisibilityData( ScDPSource* pSource); + // End Comments ~ScDPResultVisibilityData(); void addVisibleMember(const String& rDimName, const ScDPItemData& rMemberItem); @@ -611,7 +732,6 @@ private: typedef ::std::hash_map DimMemberType; DimMemberType maDimensions; - ScSimpleSharedString& mrSharedString; ScDPSource* mpSource; }; diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 3b1d8e0e206e..3ed2f6a754a0 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -33,6 +33,10 @@ #include #include +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include +// End Comments #include #include #include "global.hxx" // enum ScSubTotalFunc @@ -59,7 +63,10 @@ #include #include #include - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +// End Comments #include "dptabdat.hxx" namespace com { namespace sun { namespace star { @@ -73,7 +80,10 @@ namespace com { namespace sun { namespace star { class ScDPResultMember; class ScDPResultData; -struct ScDPItemData; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments class ScDPTableData; // ------------------------------------------------------------------------ @@ -168,10 +178,18 @@ public: long GetDataDimensionCount(); String GetDataDimName(long nIndex); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* GetCache(); + const ScDPItemData* GetItemDataById( long nDim, long nId ); + long GetDataLayoutDim(){ return pData->GetColumnCount(); } + SCROW GetMemberId( long nDim, const ScDPItemData& rData ); + // End Comments BOOL IsDataLayoutDimension(long nDim); USHORT GetDataLayoutOrientation(); BOOL IsDateDimension(long nDim); + UINT32 GetNumberFormat(long nDim); BOOL SubTotalAllowed(long nColumn); //! move to ScDPResultData @@ -429,6 +447,10 @@ public: const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const; //UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData ); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + BOOL IsVisible( const ScDPItemData& rData ); +// End Comments }; class ScDPHierarchies : public cppu::WeakImplHelper2< @@ -722,6 +744,12 @@ public: long getMinMembers() const; sal_Int32 GetIndexFromName( const ::rtl::OUString& rName ) const; // <0 if not found + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + const std::vector& GetGlobalOrder(); + const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex); + SCROW GetSrcItemsCount(); + // End Comments }; class ScDPMember : public cppu::WeakImplHelper3< @@ -735,7 +763,10 @@ private: long nHier; long nLev; - ScDPItemData maData; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + SCROW mnDataId; + // End Comments // String aCaption; // visible name (changeable by user) sal_Int32 nPosition; // manual sorting @@ -743,14 +774,23 @@ private: BOOL bShowDet; public: - ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL, - const String& rN, double fV, BOOL bHV ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL, + SCROW nIndex /*const String& rN, double fV, BOOL bHV */); + // End Comments virtual ~ScDPMember(); BOOL IsNamedItem( const ScDPItemData& r ) const; String GetNameStr() const; void FillItemData( ScDPItemData& rData ) const; - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + // const ScDPItemData& GetItemData() const{ return maData; } + const ScDPItemData& GetItemData() const; + inline SCROW GetItemDataId() const { return mnDataId; } + BOOL IsNamedItem( SCROW nIndex ) const; + // End Comments sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order // XNamed diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 1f6dc13d04ce..0a694b2fe922 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -763,21 +763,6 @@ enum ScSubTotalFunc }; -#define PIVOT_MAXFUNC 11 -#define PIVOT_FUNC_NONE 0x0000 -#define PIVOT_FUNC_SUM 0x0001 -#define PIVOT_FUNC_COUNT 0x0002 -#define PIVOT_FUNC_AVERAGE 0x0004 -#define PIVOT_FUNC_MAX 0x0008 -#define PIVOT_FUNC_MIN 0x0010 -#define PIVOT_FUNC_PRODUCT 0x0020 -#define PIVOT_FUNC_COUNT_NUM 0x0040 -#define PIVOT_FUNC_STD_DEV 0x0080 -#define PIVOT_FUNC_STD_DEVP 0x0100 -#define PIVOT_FUNC_STD_VAR 0x0200 -#define PIVOT_FUNC_STD_VARP 0x0400 -#define PIVOT_FUNC_AUTO 0x1000 - // ----------------------------------------------------------------------- /* @@ -848,7 +833,7 @@ public: ~ScQueryParam(); SCSIZE GetEntryCount() const { return nEntryCount; } - ScQueryEntry& GetEntry(SCSIZE n) const { return pEntries[n]; } + ScQueryEntry& GetEntry(SCSIZE n) const; void Resize(SCSIZE nNew); ScQueryParam& operator= ( const ScQueryParam& r ); @@ -921,46 +906,6 @@ struct ScConsolidateParam void SetAreas ( ScArea* const* ppAreas, USHORT nCount ); }; -// ----------------------------------------------------------------------- - -class ScSimpleSharedString -{ -public: - static const sal_Int32 EMPTY = 0; - - ScSimpleSharedString(); - ScSimpleSharedString(const ScSimpleSharedString& r); - ~ScSimpleSharedString(); - - const String* getString(sal_Int32 nId); - sal_Int32 getStringId(const String& aStr); - sal_Int32 insertString(const String& aStr); - -private: - - /** internal shared string table implementation */ - class StringTable - { - public: - sal_Int32 insertString(const String& aStr); - sal_Int32 getStringId(const String& aStr); - const String* getString(sal_Int32 nId) const; - - StringTable(); - StringTable(const StringTable& r); - ~StringTable(); - - private: - typedef ::std::hash_map< String, sal_Int32, ScStringHashCode, ::std::equal_to< String > > SharedStrMap; - - ::std::vector maSharedStrings; - SharedStrMap maSharedStringIds; - sal_Int32 mnStrCount; - }; - - StringTable maStringTable; -}; - // ----------------------------------------------------------------------- extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001 extern const LocaleDataWrapper* GetScGlobalpLocaleData(); diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 97d77dc06fc5..b4547d8e7eab 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -573,7 +573,10 @@ #define STR_STYLE_FAMILY_CELL 433 #define STR_STYLE_FAMILY_PAGE 434 -#define STR_COUNT 435 +#define STR_ERR_DATAPILOTSOURCE 435 +#define STR_PIVOT_FIRSTROWEMPTYERR 436 +#define STR_PIVOT_ONLYONEROWERR 437 +#define STR_COUNT 438 #endif diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx index e77dd60f18bb..b192fc966f02 100644 --- a/sc/inc/pivot.hxx +++ b/sc/inc/pivot.hxx @@ -51,6 +51,7 @@ #include "global.hxx" #include "address.hxx" +#include "dpglobal.hxx" #include diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 4ba4a225c21f..90997d9bbbed 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -78,6 +78,11 @@ #include "drwlayer.hxx" #include "unoreflist.hxx" #include "listenercalls.hxx" +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpshttab.hxx" +#include "dptablecache.hxx" +// End Comments #include "tabprotection.hxx" #include "formulaparserpool.hxx" #include "clipparam.hxx" @@ -1906,6 +1911,119 @@ void ScDocument::DecSizeRecalcLevel( SCTAB nTab ) pTab[nTab]->DecRecalcLevel(); } +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +ScDPTableDataCache* ScDocument::GetDPObjectCache( long nID ) +{ + for ( std::list::iterator iter = m_listDPObjectsCaches.begin(); iter!=m_listDPObjectsCaches.end(); iter++ ) + { // + if ( nID == (*iter)->GetId() ) + return *iter; + } + return NULL; +} + +ScDPTableDataCache* ScDocument::GetUsedDPObjectCache ( ScRange rRange ) +{ + ScDPTableDataCache* pCache = NULL; + USHORT nCount = GetDPCollection()->GetCount(); + for ( short i=nCount-1; i>=0 ; i--) + { + if ( const ScSheetSourceDesc* pUsedSheetDesc = (*pDPCollection)[i]->GetSheetDesc() ) + if ( rRange == pUsedSheetDesc->aSourceRange ) + { + long nID = (*pDPCollection)[i]->GetCacheId(); + if ( nID >= 0 ) + pCache= GetDPObjectCache( nID ); + if ( pCache ) + return pCache; + } + } + return pCache; +} +long ScDocument::AddDPObjectCache( ScDPTableDataCache* pData ) +{ + if ( pData->GetId() < 0 ) + { //create a id for it + pData->SetId( GetNewDPObjectCacheId() ); + } + m_listDPObjectsCaches.push_back( pData ); + return pData->GetId(); +} +long ScDocument::GetNewDPObjectCacheId() +{ + long nID = 0; + bool bFound = false; + std::list::iterator iter; + do { + for ( iter = m_listDPObjectsCaches.begin(); iter!=m_listDPObjectsCaches.end(); iter++ ) + { //Get a new Id + if ( nID == (*iter)->GetId() ) + { + nID++; + bFound = true; + break; + } + } + if ( iter == m_listDPObjectsCaches.end() ) + bFound = false; + } while ( bFound ); + + return nID; +} + +void ScDocument::RemoveDPObjectCache( long nID ) +{ + for ( std::list::iterator iter = m_listDPObjectsCaches.begin(); iter!=m_listDPObjectsCaches.end(); iter++ ) + { + if ( nID == (*iter)->GetId() ) + { + ScDPTableDataCache* pCache = *iter; + m_listDPObjectsCaches.erase( iter ); + delete pCache; + break; + } + } + +} + +void ScDocument::RemoveUnusedDPObjectCaches() +{ + for ( std::list::iterator iter = m_listDPObjectsCaches.begin(); iter!=m_listDPObjectsCaches.end(); iter++ ) + { + long nID = (*iter)->GetId(); + USHORT nCount = GetDPCollection()->GetCount(); + USHORT i ; + for ( i=0; iGetCacheId() ) + break; + } + if ( i == nCount ) + { + ScDPTableDataCache* pCache = *iter; + m_listDPObjectsCaches.erase( iter ); + delete pCache; + continue; + } + } +} + +void ScDocument::GetUsedDPObjectCache( std::list& usedlist ) +{ + for ( std::list::iterator iter = m_listDPObjectsCaches.begin(); iter!=m_listDPObjectsCaches.end(); iter++ ) + { + long nID = (*iter)->GetId(); + USHORT nCount = GetDPCollection()->GetCount(); + USHORT i=0; + for ( i=0; iGetCacheId() ) + break; + if ( i != nCount ) + usedlist.push_back( *iter ); + } +} +// End Comments diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index dc9b6450ac75..50239828a9e4 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -68,7 +68,6 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::sheet::DataPilotFieldFilter; -const double D_TIMEFACTOR = 86400.0; static BOOL lcl_HasQueryEntry( const ScQueryParam& rParam ) { @@ -78,56 +77,35 @@ static BOOL lcl_HasQueryEntry( const ScQueryParam& rParam ) // ---------------------------------------------------------------------------- -static ScDPCacheCell EmptyCellContent = ScDPCacheCell(); - -// ---------------------------------------------------------------------------- - -ScDPCacheTable::Cell::Cell() : - mnCategoryRef(0), - mpContent(NULL) -{ -} - -ScDPCacheTable::Cell::~Cell() -{ -} - -// ---------------------------------------------------------------------------- - ScDPCacheTable::FilterItem::FilterItem() : - mnMatchStrId(ScSimpleSharedString::EMPTY), mfValue(0.0), mbHasValue(false) { } - +bool ScDPCacheTable::FilterItem::match( const ScDPItemData& rCellData ) const +{ + if (rCellData.GetString()!= maString && + (!rCellData.IsValue()|| rCellData.GetValue()!= mfValue)) + return false; + return true; +} // ---------------------------------------------------------------------------- -ScDPCacheTable::SingleFilter::SingleFilter(ScSimpleSharedString& rSharedString, - sal_Int32 nMatchStrId, double fValue, bool bHasValue) : - mrSharedString(rSharedString) +ScDPCacheTable::SingleFilter::SingleFilter(String aString, double fValue, bool bHasValue) { - maItem.mnMatchStrId = nMatchStrId; + maItem.maString = aString; maItem.mfValue = fValue; maItem.mbHasValue = bHasValue; } -bool ScDPCacheTable::SingleFilter::match(const ScDPCacheCell& rCell) const +bool ScDPCacheTable::SingleFilter::match( const ScDPItemData& rCellData ) const { - if (rCell.mnStrId != maItem.mnMatchStrId && - (!rCell.mbNumeric || rCell.mfValue != maItem.mfValue)) - return false; - - return true; + return maItem.match(rCellData); } const String ScDPCacheTable::SingleFilter::getMatchString() { - const String* pStr = mrSharedString.getString(maItem.mnMatchStrId); - if (pStr) - return *pStr; - - return String(); + return maItem.maString; } double ScDPCacheTable::SingleFilter::getMatchValue() const @@ -142,33 +120,26 @@ bool ScDPCacheTable::SingleFilter::hasValue() const // ---------------------------------------------------------------------------- -ScDPCacheTable::GroupFilter::GroupFilter(ScSimpleSharedString& rSharedString) : - mrSharedString(rSharedString) +ScDPCacheTable::GroupFilter::GroupFilter() { } -bool ScDPCacheTable::GroupFilter::match(const ScDPCacheCell& rCell) const +bool ScDPCacheTable::GroupFilter::match( const ScDPItemData& rCellData ) const { vector::const_iterator itrEnd = maItems.end(); - for (vector::const_iterator itr = maItems.begin(); itr != itrEnd; ++itr) - { - bool bMatch = false; - if (rCell.mbNumeric) - bMatch = (itr->mfValue == rCell.mfValue); - else - bMatch = (itr->mnMatchStrId == rCell.mnStrId); - - if (bMatch) - return true; - } - return false; + for (vector::const_iterator itr = maItems.begin(); itr != itrEnd; ++itr) + { + bool bMatch = itr->match( rCellData); + if (bMatch) + return true; + } + return false; } void ScDPCacheTable::GroupFilter::addMatchItem(const String& rStr, double fVal, bool bHasValue) { - sal_Int32 nStrId = mrSharedString.getStringId(rStr); FilterItem aItem; - aItem.mnMatchStrId = nStrId; + aItem.maString = rStr; aItem.mfValue = fVal; aItem.mbHasValue = bHasValue; maItems.push_back(aItem); @@ -189,10 +160,16 @@ ScDPCacheTable::Criterion::Criterion() : // ---------------------------------------------------------------------------- -ScDPCacheTable::ScDPCacheTable(ScDPCollection* pCollection) : - mrSharedString(pCollection->GetSharedString()), - mpCollection(pCollection) +ScDPCacheTable::ScDPCacheTable( ScDocument* pDoc,long nId ) : + mpCache( NULL ), + mpNoneCache( NULL ) { + if ( nId >= 0 ) + mpCache = pDoc->GetDPObjectCache( nId ); + else + { //create a temp cache object + InitNoneCache( NULL ); + } } ScDPCacheTable::~ScDPCacheTable() @@ -201,278 +178,117 @@ ScDPCacheTable::~ScDPCacheTable() sal_Int32 ScDPCacheTable::getRowSize() const { - return maTable.size(); + return GetCache()->GetRowCount(); } sal_Int32 ScDPCacheTable::getColSize() const { - return maTable.empty() ? 0 : maTable[0].size(); + return GetCache()->GetColumnCount(); } -void ScDPCacheTable::fillTable(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& rQuery, BOOL* pSpecial, - bool bIgnoreEmptyRows) +void ScDPCacheTable::fillTable( const ScQueryParam& rQuery, BOOL* pSpecial, + bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) { - SCTAB nTab = rRange.aStart.Tab(); - SCCOL nStartCol = rRange.aStart.Col(); - SCROW nStartRow = rRange.aStart.Row(); - SCCOL nColCount = rRange.aEnd.Col() - rRange.aStart.Col() + 1; - SCROW nRowCount = rRange.aEnd.Row() - rRange.aStart.Row() + 1; - if (nRowCount <= 1 || nColCount <= 0) + if ( mpCache == NULL ) + InitNoneCache( NULL ); +//check cache + const SCROW nRowCount = getRowSize(); + const SCCOL nColCount = (SCCOL) getColSize(); + if ( nRowCount <= 0 || nColCount <= 0) return; - maTable.clear(); - maTable.reserve(nRowCount); - maHeader.clear(); - maHeader.reserve(nColCount); maRowsVisible.clear(); maRowsVisible.reserve(nRowCount); - // Header row - for (SCCOL nCol = 0; nCol < nColCount; ++nCol) - { - String aStr; - pDoc->GetString(nCol + nStartCol, nStartRow, nTab, aStr); - sal_Int32 nStrId = mrSharedString.insertString(aStr); - maHeader.push_back(nStrId); - } // Initialize field entries container. maFieldEntries.clear(); maFieldEntries.reserve(nColCount); - for (SCCOL nCol = 0; nCol < nColCount; ++nCol) - { - TypedScStrCollectionPtr p(new TypedScStrCollection); - maFieldEntries.push_back(p); - } - - vector aLastNonEmptyRows(nColCount, 0); // Data rows - for (SCROW nRow = 1; nRow < nRowCount; ++nRow) + for (SCCOL nCol = 0; nCol < nColCount; ++nCol) { - if ( lcl_HasQueryEntry(rQuery) && !pDoc->ValidQuery(nRow + nStartRow, nTab, rQuery, pSpecial) ) - // filtered out by standard filter. - continue; - - if ( bIgnoreEmptyRows && - pDoc->IsBlockEmpty(nTab, nStartCol, nRow + nStartRow, - nStartCol + nColCount - 1, nRow + nStartRow) ) - // skip an empty row. - continue; - - // Insert a new row into cache table. - maRowsVisible.push_back(true); - maTable.push_back( vector() ); - maTable.back().reserve(nColCount); - - for (SCCOL nCol = 0; nCol < nColCount; ++nCol) + SCROW nMemCount = GetCache()->GetDimMemberCount( nCol ); + if ( nMemCount ) { - maTable.back().push_back( ScDPCacheTable::Cell() ); - Cell& rCell = maTable.back().back(); - rCell.mnCategoryRef = maTable.size()-1; + std::vector< SCROW > pAdded( nMemCount, -1 ); - String aCellStr; - bool bReadCell = nRow == 0 || pDoc->HasData(nStartCol + nCol, nStartRow + nRow, nTab); - if (bReadCell) + for (SCROW nRow = 0; nRow < nRowCount; ++nRow ) { - aLastNonEmptyRows[nCol] = maTable.size()-1; - ScDPCacheCell aCell; - pDoc->GetString(nStartCol + nCol, nStartRow + nRow, nTab, aCellStr); - aCell.mnStrId = mrSharedString.insertString(aCellStr); - aCell.mnType = SC_VALTYPE_STRING; - aCell.mbNumeric = false; - ScAddress aPos(nStartCol + nCol, nStartRow + nRow, nTab); - getValueData(pDoc, aPos, aCell); - rCell.mpContent = mpCollection->getCacheCellFromPool(aCell); + SCROW nIndex = GetCache()->GetItemDataId( nCol, nRow, bRepeatIfEmpty ); + SCROW nOrder = GetCache()->GetOrder( nCol, nIndex ); + + if ( nCol == 0 ) + maRowsVisible.push_back(false); + + if ( lcl_HasQueryEntry(rQuery) && + !GetCache()->ValidQuery( nRow , rQuery, pSpecial ) ) + continue; + if ( bIgnoreEmptyRows && GetCache()->IsRowEmpty( nRow ) ) + continue; + // Insert a new row into cache table. + if ( nCol == 0 ) + maRowsVisible.back() = true; + + pAdded[nOrder] = nIndex; + } + maFieldEntries.push_back( vector() ); + for ( SCROW nRow = 0; nRow < nMemCount; nRow++ ) + { + if ( pAdded[nRow] != -1 ) + maFieldEntries.back().push_back( pAdded[nRow] ); } - else - rCell.mnCategoryRef = aLastNonEmptyRows[nCol]; - - TypedStrData* pNew; - if (rCell.mpContent && rCell.mpContent->mbNumeric) - pNew = new TypedStrData(aCellStr, rCell.mpContent->mfValue, SC_STRTYPE_VALUE); - else - pNew = new TypedStrData(aCellStr); - - if (!maFieldEntries[nCol]->Insert(pNew)) - delete pNew; } } } -void lcl_GetCellValue(const Reference& xRow, sal_Int32 nType, long nCol, - const Date& rNullDate, ScDPCacheCell& rCell, String& rStr, - ScSimpleSharedString& rSharedString) +void ScDPCacheTable::fillTable() { - short nNumType = NUMBERFORMAT_NUMBER; - BOOL bEmptyFlag = FALSE; - try - { - rStr = xRow->getString(nCol); - rCell.mnStrId = rSharedString.getStringId(rStr); - rCell.mnType = SC_VALTYPE_STRING; - - switch (nType) - { - case sdbc::DataType::BIT: - case sdbc::DataType::BOOLEAN: - { - nNumType = NUMBERFORMAT_LOGICAL; - rCell.mfValue = xRow->getBoolean(nCol) ? 1 : 0; - bEmptyFlag = (rCell.mfValue == 0.0 && xRow->wasNull()); - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } - break; - - case sdbc::DataType::TINYINT: - case sdbc::DataType::SMALLINT: - case sdbc::DataType::INTEGER: - case sdbc::DataType::BIGINT: - case sdbc::DataType::FLOAT: - case sdbc::DataType::REAL: - case sdbc::DataType::DOUBLE: - case sdbc::DataType::NUMERIC: - case sdbc::DataType::DECIMAL: - { - //! do the conversion here? - rCell.mfValue = xRow->getDouble(nCol); - bEmptyFlag = (rCell.mfValue == 0.0 && xRow->wasNull()); - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } - break; - - case sdbc::DataType::CHAR: - case sdbc::DataType::VARCHAR: - case sdbc::DataType::LONGVARCHAR: - bEmptyFlag = (rStr.Len() == 0 && xRow->wasNull()); - break; + if ( mpCache == NULL ) + InitNoneCache( NULL ); +//check cache + const SCROW nRowCount = getRowSize(); + const SCCOL nColCount = (SCCOL) getColSize(); + if ( nRowCount <= 0 || nColCount <= 0) + return; - case sdbc::DataType::DATE: - { - nNumType = NUMBERFORMAT_DATE; + maRowsVisible.clear(); + maRowsVisible.reserve(nRowCount); - util::Date aDate = xRow->getDate(nCol); - rCell.mfValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate; - bEmptyFlag = xRow->wasNull(); - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } - break; - case sdbc::DataType::TIME: - { - nNumType = NUMBERFORMAT_TIME; - - util::Time aTime = xRow->getTime(nCol); - rCell.mfValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + - aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - bEmptyFlag = xRow->wasNull(); - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } - break; + // Initialize field entries container. + maFieldEntries.clear(); + maFieldEntries.reserve(nColCount); - case sdbc::DataType::TIMESTAMP: - { - nNumType = NUMBERFORMAT_DATETIME; - - util::DateTime aStamp = xRow->getTimestamp(nCol); - rCell.mfValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + - ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + - aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; - bEmptyFlag = xRow->wasNull(); - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } - break; - - case sdbc::DataType::SQLNULL: - case sdbc::DataType::BINARY: - case sdbc::DataType::VARBINARY: - case sdbc::DataType::LONGVARBINARY: - default: - break; - } - } - catch (uno::Exception&) + // Data rows + for (SCCOL nCol = 0; nCol < nColCount; ++nCol) { - } -} + SCROW nMemCount = GetCache()->GetDimMemberCount( nCol ); + if ( nMemCount ) + { + std::vector< SCROW > pAdded( nMemCount, -1 ); -void ScDPCacheTable::fillTable(const Reference& xRowSet, const Date& rNullDate) -{ - if (!xRowSet.is()) - // Dont' even waste time to go any further. - return; + for (SCROW nRow = 0; nRow < nRowCount; ++nRow ) + { + SCROW nIndex = GetCache()->GetItemDataId( nCol, nRow, false ); + SCROW nOrder = GetCache()->GetOrder( nCol, nIndex ); - try - { - Reference xMetaSupp(xRowSet, UNO_QUERY_THROW); - Reference xMeta = xMetaSupp->getMetaData(); - if (!xMeta.is()) - return; - - sal_Int32 nColCount = xMeta->getColumnCount(); - - // Get column titles and types. - vector aColTypes(nColCount); - maHeader.clear(); - maHeader.reserve(nColCount); - for (sal_Int32 nCol = 0; nCol < nColCount; ++nCol) - { - String aColTitle = xMeta->getColumnLabel(nCol+1); - aColTypes[nCol] = xMeta->getColumnType(nCol+1); - maHeader.push_back( mrSharedString.getStringId(aColTitle) ); - } + if ( nCol == 0 ) + maRowsVisible.push_back(true); - // Initialize field entries container. - maFieldEntries.clear(); - maFieldEntries.reserve(nColCount); - for (SCCOL nCol = 0; nCol < nColCount; ++nCol) - { - TypedScStrCollectionPtr p(new TypedScStrCollection); - maFieldEntries.push_back(p); - } - // Now get the data rows. - Reference xRow(xRowSet, UNO_QUERY_THROW); - xRowSet->first(); - maTable.clear(); - maRowsVisible.clear(); - do - { - maRowsVisible.push_back(true); - maTable.push_back( vector() ); - maTable.back().reserve(nColCount); - for (sal_Int32 nCol = 0; nCol < nColCount; ++nCol) + pAdded[nOrder] = nIndex; + } + maFieldEntries.push_back( vector() ); + for ( SCROW nRow = 0; nRow < nMemCount; nRow++ ) { - maTable.back().push_back( Cell() ); - Cell& rCell = maTable.back().back(); - ScDPCacheCell aCellContent; - String aStr; - lcl_GetCellValue(xRow, aColTypes[nCol], nCol+1, rNullDate, aCellContent, aStr, mrSharedString); - rCell.mpContent = mpCollection->getCacheCellFromPool(aCellContent); - - TypedStrData* pNew; - if (rCell.mpContent->mbNumeric) - pNew = new TypedStrData(aStr, rCell.mpContent->mfValue, SC_STRTYPE_VALUE); - else - pNew = new TypedStrData(aStr); - - if (!maFieldEntries[nCol]->Insert(pNew)) - delete pNew; + if ( pAdded[nRow] != -1 ) + maFieldEntries.back().push_back( pAdded[nRow] ); } } - while (xRowSet->next()); - - xRowSet->beforeFirst(); - } - catch (const Exception&) - { } + return; } bool ScDPCacheTable::isRowActive(sal_Int32 nRow) const @@ -497,41 +313,43 @@ void ScDPCacheTable::filterByPageDimension(const vector& rCriteria, c maRowsVisible[nRow] = isRowQualified(nRow, rCriteria, rRepeatIfEmptyDims); } -const ScDPCacheCell* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const +const ScDPItemData* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const { - if ( nRow >= static_cast(maTable.size()) ) - return NULL; - - const vector& rRow = maTable[nRow]; - if ( nCol < 0 || static_cast(nCol) >= rRow.size() ) - return NULL; + SCROW nId= GetCache()->GetItemDataId(nCol, nRow, bRepeatIfEmpty); + return GetCache()->GetItemDataById( nCol, nId ); +} - const Cell& rCell = rRow[nCol]; - const ScDPCacheCell* pCell = rCell.mpContent; - if (bRepeatIfEmpty && !pCell) - pCell = getCell(nCol, rCell.mnCategoryRef, false); +void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const +{ + const ScDPItemData* pData = getCell( nCol, nRow, bRepeatIfEmpty ); - return pCell ? pCell : &EmptyCellContent; + if (pData) + { + rVal.fValue = pData->IsValue() ? pData->GetValue() : 0.0; + rVal.nType = pData->GetType(); + } + else + rVal.Set(0.0, SC_VALTYPE_EMPTY); } - -const String* ScDPCacheTable::getFieldName(sal_Int32 nIndex) const +String ScDPCacheTable::getFieldName(SCCOL nIndex) const { - if (nIndex >= static_cast(maHeader.size())) - return NULL; + return (GetCache()->GetDimensionName( nIndex )); +} - return mrSharedString.getString(maHeader[nIndex]); +sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const +{ + return GetCache()->GetDimensionIndex( rStr ); } -const TypedScStrCollection& ScDPCacheTable::getFieldEntries(sal_Int32 nIndex) const +const ::std::vector& ScDPCacheTable::getFieldEntries( sal_Int32 nColumn ) const { - if (nIndex < 0 || static_cast(nIndex) >= maFieldEntries.size()) + if (nColumn < 0 || static_cast(nColumn) >= maFieldEntries.size()) { // index out of bound. Hopefully this code will never be reached. - static const TypedScStrCollection emptyCollection; - return emptyCollection; + static const ::std::vector emptyEntries; + return emptyEntries; } - - return *maFieldEntries[nIndex].get(); + return maFieldEntries[nColumn]; } void ScDPCacheTable::filterTable(const vector& rCriteria, Sequence< Sequence >& rTabData, @@ -550,13 +368,10 @@ void ScDPCacheTable::filterTable(const vector& rCriteria, Sequence< S // Header first. Sequence headerRow(nColSize); - for (sal_Int32 nCol = 0; nCol < nColSize; ++nCol) + for (SCCOL nCol = 0; nCol < nColSize; ++nCol) { OUString str; - const String* pStr = mrSharedString.getString(maHeader[nCol]); - if (pStr) - str = *pStr; - + str = getFieldName( nCol); Any any; any <<= str; headerRow[nCol] = any; @@ -580,26 +395,14 @@ void ScDPCacheTable::filterTable(const vector& rCriteria, Sequence< S { Any any; bool bRepeatIfEmpty = rRepeatIfEmptyDims.count(nCol) > 0; - const ScDPCacheCell* pCell = getCell(nCol, nRow, bRepeatIfEmpty); - if (!pCell) - { - // This should never happen, but in case this happens, just - // stick in an empty string. - OUString str; - any <<= str; - row[nCol] = any; - continue; - } - - if (pCell->mbNumeric) - any <<= pCell->mfValue; + // Wang Xu Ming - DataPilot migration + const ScDPItemData* pData= getCell(nCol, nRow, bRepeatIfEmpty); + if ( pData->IsValue() ) + any <<= pData->GetValue(); else { - OUString str; - const String* pStr = mrSharedString.getString(pCell->mnStrId); - if (pStr) - str = *pStr; - any <<= str; + OUString string (pData->GetString() ); + any <<= string; } row[nCol] = any; } @@ -615,15 +418,19 @@ void ScDPCacheTable::filterTable(const vector& rCriteria, Sequence< S void ScDPCacheTable::clear() { - maTable.clear(); - maHeader.clear(); maFieldEntries.clear(); maRowsVisible.clear(); } +void ScDPCacheTable::swap(ScDPCacheTable& rOther) +{ + maFieldEntries.swap(rOther.maFieldEntries); + maRowsVisible.swap(rOther.maRowsVisible); +} + bool ScDPCacheTable::empty() const { - return maTable.empty(); + return ( mpCache == NULL&& mpNoneCache == NULL ) || maFieldEntries.size()==0; } bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector& rCriteria, @@ -640,52 +447,26 @@ bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector& rCr // Check if the 'repeat if empty' flag is set for this field. bool bRepeatIfEmpty = rRepeatIfEmptyDims.count(itr->mnFieldIndex) > 0; - const ScDPCacheCell* pCell = getCell(static_cast(itr->mnFieldIndex), nRow, bRepeatIfEmpty); - if (!pCell) - // This should never happen, but just in case... - return false; - - if (!itr->mpFilter->match(*pCell)) + const ScDPItemData* pCellData = getCell(static_cast(itr->mnFieldIndex), nRow, bRepeatIfEmpty); + if (!itr->mpFilter->match(*pCellData)) return false; } return true; } -void ScDPCacheTable::getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell) -{ - ScBaseCell* pCell = pDoc->GetCell(rPos); - if (!pCell) - { - rCell.mnType = SC_VALTYPE_EMPTY; - return; - } - - CellType eType = pCell->GetCellType(); - if (eType == CELLTYPE_NOTE) - { - // note cell - rCell.mnType = SC_VALTYPE_EMPTY; - return; - } - if (eType == CELLTYPE_FORMULA && static_cast(pCell)->GetErrCode()) - { - // formula cell with error - rCell.mnType = SC_VALTYPE_ERROR; - return; - } - - if ( pCell->HasValueData() ) - { - if (eType == CELLTYPE_VALUE) - // value cell - rCell.mfValue = static_cast(pCell)->GetValue(); - else if (eType == CELLTYPE_FORMULA) - // formula cell - rCell.mfValue = static_cast(pCell)->GetValue(); - - rCell.mbNumeric = true; - rCell.mnType = SC_VALTYPE_VALUE; - } +void ScDPCacheTable::InitNoneCache( ScDocument* pDoc ) +{ + mpCache = NULL; + if ( mpNoneCache ) + delete mpNoneCache; + mpNoneCache = new ScDPTableDataCache( pDoc ); } +ScDPTableDataCache* ScDPCacheTable::GetCache() const +{ + if ( mpCache ) + return mpCache; + return mpNoneCache; +} +// End Comments diff --git a/sc/source/core/data/dpglobal.cxx b/sc/source/core/data/dpglobal.cxx new file mode 100644 index 000000000000..12e57e8ca0f2 --- /dev/null +++ b/sc/source/core/data/dpglobal.cxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dpglobal.cxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "dpglobal.hxx" +#include "document.hxx" + +namespace ScDPGlobal +{ + Rectangle operator *( const Rectangle &rLeft, const std::pair & rRight ) + { + Rectangle rcResult( rLeft ); + rcResult.Bottom() = rcResult.Top() + static_cast( rcResult.GetHeight() * rRight.second ); + rcResult.Right() = rcResult.Left() + static_cast( rcResult.GetWidth() * rRight.first); + return rcResult; + } + + String GetFuncString( const String &rString, const USHORT nIndex ) + { + if ( nIndex <= 1 ) return rString; + ULONG uch = rString.Len() ? rString.GetChar( rString.Len()-1 ) : (L'9'+1); + bool bEndWithDigital = ( L'0'<=uch && uch<=L'9'); + char szTemp[__MAX_NUM_LEN+1]; + int nLen = sprintf( szTemp, bEndWithDigital ? DATA_RENAME_SEPARATOR"%hu" : "%hu", nIndex ); + String strRet = rString; + strRet.Append( String::CreateFromAscii( szTemp, static_cast(nLen) )); + return strRet; + } + + bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip /*= FALSE*/ ) + { + if ( ScDPCollection* pDPCollection = pDestDoc->GetDPCollection() ) + { + USHORT nCount = pDPCollection->GetCount(); + SCsCOL nOffsetX = nStartCol - nClipStartCol; + SCsROW nOffsetY = nStartRow - nClipStartRow; + + for( std::list::iterator iter = rClipboard.begin(); iter!=rClipboard.end(); iter++ ) + { + ScRange aRange = iter->GetOutRange(); + + for( USHORT nCurrTab = nStartTab; nCurrTab<=nEndTab; nCurrTab++ ) + { + SCsTAB nOffsetZ = nCurrTab - aRange.aStart.Tab(); + aRange.Move( nOffsetX, nOffsetY, nOffsetZ ); + + for ( USHORT i = 0; iGetOutRange())) + { + if ( bExcludeClip && iter->GetOutRange() == (*pDPCollection)[i]->GetOutRange() ) + { + continue; + } + return false; + } + } + } + } + } + return true; +} +//end + +} +// -------------------------------------------------------------------- +// ScDPItemDataPool +// Construct +ScDPItemDataPool::ScDPItemDataPool(void) +{ +} +// +ScDPItemDataPool::ScDPItemDataPool(const ScDPItemDataPool& r): + maItemIds( r.maItemIds), + maItems( r.maItems ) +{ +} + +ScDPItemDataPool::~ScDPItemDataPool(void) +{ +} + + +const ScDPItemData* ScDPItemDataPool::getData( sal_Int32 nId ) +{ + if ( nId >= maItems.size() ) + return NULL; + else + return &(maItems[nId]); +} + +sal_Int32 ScDPItemDataPool::getDataId( const ScDPItemData& aData ) +{ + DataHash::const_iterator itr = maItemIds.find( aData), + itrEnd = maItemIds.end(); + if ( itr == itrEnd ) + // not exist + return -1; + + else //exist + return itr->second; + +} + +sal_Int32 ScDPItemDataPool::insertData( const ScDPItemData& aData ) +{ + sal_Int32 nResult = getDataId( aData ); + + if( nResult < 0 ) + { + maItemIds.insert( DataHash::value_type( aData, nResult = maItems.size() ) ); + maItems.push_back( aData ); + } + + return nResult; +} + + diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index a2d21079826d..6853f6f0dfef 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -50,6 +50,7 @@ #include "dptabsrc.hxx" #include "dptabres.hxx" #include "dpobject.hxx" +#include "dpglobal.hxx" #include #include @@ -80,6 +81,202 @@ const sal_Int32 SC_DP_DATE_FIRST = -1; const sal_Int32 SC_DP_DATE_LAST = 10000; // ============================================================================ +namespace +{ + BOOL lcl_Search( SCCOL nSourceDim, ScDPTableDataCache* pCache , const std::vector< SCROW >& vIdx, SCROW nNew , SCROW& rIndex) + { + rIndex = vIdx.size(); + BOOL bFound = FALSE; + SCROW nLo = 0; + SCROW nHi = vIdx.size() - 1; + SCROW nIndex; + long nCompare; + while (nLo <= nHi) + { + nIndex = (nLo + nHi) / 2; + + const ScDPItemData* pData = pCache->GetItemDataById( nSourceDim, vIdx[nIndex] ); + const ScDPItemData* pDataInsert = pCache->GetItemDataById( nSourceDim, nNew ); + + nCompare = ScDPItemData::Compare( *pData, *pDataInsert ); + if (nCompare < 0) + nLo = nIndex + 1; + else + { + nHi = nIndex - 1; + if (nCompare == 0) + { + bFound = TRUE; + nLo = nIndex; + } + } + } + rIndex = nLo; + return bFound; + } + + void lcl_Insert( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, SCROW nNew ) + { + SCROW nIndex = 0; + if ( !lcl_Search( nSourceDim, pCache, vIdx, nNew ,nIndex ) ) + vIdx.insert( vIdx.begin()+nIndex, nNew ); + } + + template + SCROW lcl_InsertValue( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, const ScDPItemData & rData ); + + template<> + SCROW lcl_InsertValue( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, const ScDPItemData & rData ) + { + SCROW nNewID = pCache->GetAdditionalItemID( rData ); + lcl_Insert( nSourceDim, pCache, vIdx, nNewID ); + return nNewID; + } + + template<> + SCROW lcl_InsertValue( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, const ScDPItemData & rData ) + { + SCROW nItemId = lcl_InsertValue( nSourceDim, pCache, vIdx, rData ); + + if( const ScDPItemData *pData = pCache->GetItemDataById( nSourceDim, nItemId ) ) + const_cast(*pData) = rData; + + return nItemId; + } + + template + void lcl_InsertValue ( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, const String& rString, const double& fValue ) + { + lcl_InsertValue( nSourceDim, pCache, vIdx, ScDPItemData( rString, fValue, TRUE ) ); + } + + template + void lcl_InsertValue ( SCCOL nSourceDim, ScDPTableDataCache* pCache , std::vector< SCROW >& vIdx, const String& rString, const double& fValue, sal_Int32 nDatePart ) + { + lcl_InsertValue( nSourceDim, pCache, vIdx, ScDPItemData( nDatePart, rString, fValue, ScDPItemData::MK_DATA|ScDPItemData::MK_VAL|ScDPItemData::MK_DATEPART ) ); + } + + void lcl_AppendDateStr( rtl::OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter ) + { + ULONG nFormat = pFormatter->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); + String aString; + pFormatter->GetInputLineString( fValue, nFormat, aString ); + rBuffer.append( aString ); + } + + String lcl_GetNumGroupName( double fStartValue, const ScDPNumGroupInfo& rInfo, + bool bHasNonInteger, sal_Unicode cDecSeparator, SvNumberFormatter* pFormatter ) + { + DBG_ASSERT( cDecSeparator != 0, "cDecSeparator not initialized" ); + + double fStep = rInfo.Step; + double fEndValue = fStartValue + fStep; + if ( !bHasNonInteger && ( rInfo.DateValues || !rtl::math::approxEqual( fEndValue, rInfo.End ) ) ) + { + // The second number of the group label is + // (first number + size - 1) if there are only integer numbers, + // (first number + size) if any non-integer numbers are involved. + // Exception: The last group (containing the end value) is always + // shown as including the end value (but not for dates). + + fEndValue -= 1.0; + } + + if ( fEndValue > rInfo.End && !rInfo.AutoEnd ) + { + // limit the last group to the end value + + fEndValue = rInfo.End; + } + + rtl::OUStringBuffer aBuffer; + if ( rInfo.DateValues ) + { + lcl_AppendDateStr( aBuffer, fStartValue, pFormatter ); + aBuffer.appendAscii( " - " ); // with spaces + lcl_AppendDateStr( aBuffer, fEndValue, pFormatter ); + } + else + { + rtl::math::doubleToUStringBuffer( aBuffer, fStartValue, rtl_math_StringFormat_Automatic, + rtl_math_DecimalPlaces_Max, cDecSeparator, true ); + aBuffer.append( (sal_Unicode) '-' ); + rtl::math::doubleToUStringBuffer( aBuffer, fEndValue, rtl_math_StringFormat_Automatic, + rtl_math_DecimalPlaces_Max, cDecSeparator, true ); + } + + return aBuffer.makeStringAndClear(); + } + + String lcl_GetSpecialNumGroupName( double fValue, bool bFirst, sal_Unicode cDecSeparator, + bool bDateValues, SvNumberFormatter* pFormatter ) + { + DBG_ASSERT( cDecSeparator != 0, "cDecSeparator not initialized" ); + + rtl::OUStringBuffer aBuffer; + aBuffer.append((sal_Unicode)( bFirst ? '<' : '>' )); + if ( bDateValues ) + lcl_AppendDateStr( aBuffer, fValue, pFormatter ); + else + rtl::math::doubleToUStringBuffer( aBuffer, fValue, rtl_math_StringFormat_Automatic, + rtl_math_DecimalPlaces_Max, cDecSeparator, true ); + return aBuffer.makeStringAndClear(); + } + + inline bool IsInteger( double fValue ) + { + return rtl::math::approxEqual( fValue, rtl::math::approxFloor(fValue) ); + } + + String lcl_GetNumGroupForValue( double fValue, const ScDPNumGroupInfo& rInfo, bool bHasNonInteger, + sal_Unicode cDecSeparator, double& rGroupValue, ScDocument* pDoc ) + { + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + + if ( fValue < rInfo.Start && !rtl::math::approxEqual( fValue, rInfo.Start ) ) + { + rGroupValue = rInfo.Start - rInfo.Step; + return lcl_GetSpecialNumGroupName( rInfo.Start, true, cDecSeparator, rInfo.DateValues, pFormatter ); + } + + if ( fValue > rInfo.End && !rtl::math::approxEqual( fValue, rInfo.End ) ) + { + rGroupValue = rInfo.End + rInfo.Step; + return lcl_GetSpecialNumGroupName( rInfo.End, false, cDecSeparator, rInfo.DateValues, pFormatter ); + } + + double fDiff = fValue - rInfo.Start; + double fDiv = rtl::math::approxFloor( fDiff / rInfo.Step ); + double fGroupStart = rInfo.Start + fDiv * rInfo.Step; + + if ( rtl::math::approxEqual( fGroupStart, rInfo.End ) && + !rtl::math::approxEqual( fGroupStart, rInfo.Start ) ) + { + if ( !rInfo.DateValues ) + { + // A group that would consist only of the end value is not created, + // instead the value is included in the last group before. So the + // previous group is used if the calculated group start value is the + // selected end value. + + fDiv -= 1.0; + fGroupStart = rInfo.Start + fDiv * rInfo.Step; + } + else + { + // For date values, the end value is instead treated as above the limit + // if it would be a group of its own. + + rGroupValue = rInfo.End + rInfo.Step; + return lcl_GetSpecialNumGroupName( rInfo.End, false, cDecSeparator, rInfo.DateValues, pFormatter ); + } + } + + rGroupValue = fGroupStart; + + return lcl_GetNumGroupName( fGroupStart, rInfo, bHasNonInteger, cDecSeparator, pFormatter ); + } +} class ScDPGroupDateFilter : public ScDPCacheTable::FilterBase { @@ -87,7 +284,10 @@ public: ScDPGroupDateFilter(double fMatchValue, sal_Int32 nDatePart, const Date* pNullDate, const ScDPNumGroupInfo* pNumInfo); - virtual bool match(const ScDPCacheCell &rCell) const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual bool match(const ScDPItemData & rCellData) const; + // End Comments private: ScDPGroupDateFilter(); // disabled @@ -110,26 +310,25 @@ ScDPGroupDateFilter::ScDPGroupDateFilter(double fMatchValue, sal_Int32 nDatePart // fprintf(stdout, "ScDPCacheTable:DateGroupFilter::DateGroupFilter: match value = %g; date part = %ld\n", // mfMatchValue, mnDatePart); } - -bool ScDPGroupDateFilter::match(const ScDPCacheCell& rCell) const +bool ScDPGroupDateFilter::match( const ScDPItemData & rCellData ) const { using namespace ::com::sun::star::sheet; using ::rtl::math::approxFloor; using ::rtl::math::approxEqual; - if (!rCell.mbNumeric) + if ( !rCellData.IsValue() ) return false; - +// ScDPCacheCell rCell( rCellData.fValue ); if (!mpNumInfo) return false; // Start and end dates are inclusive. (An end date without a time value // is included, while an end date with a time value is not.) - if ( rCell.mfValue < mpNumInfo->Start && !approxEqual(rCell.mfValue, mpNumInfo->Start) ) + if ( rCellData.GetValue() < mpNumInfo->Start && !approxEqual(rCellData.GetValue(), mpNumInfo->Start) ) return static_cast(mfMatchValue) == SC_DP_DATE_FIRST; - if ( rCell.mfValue > mpNumInfo->End && !approxEqual(rCell.mfValue, mpNumInfo->End) ) + if ( rCellData.GetValue() > mpNumInfo->End && !approxEqual(rCellData.GetValue(), mpNumInfo->End) ) return static_cast(mfMatchValue) == SC_DP_DATE_LAST; if (mnDatePart == DataPilotFieldGroupBy::HOURS || mnDatePart == DataPilotFieldGroupBy::MINUTES || @@ -138,7 +337,7 @@ bool ScDPGroupDateFilter::match(const ScDPCacheCell& rCell) const // handle time // (as in the cell functions, ScInterpreter::ScGetHour etc.: seconds are rounded) - double time = rCell.mfValue - approxFloor(rCell.mfValue); + double time = rCellData.GetValue() - approxFloor(rCellData.GetValue()); long seconds = static_cast(approxFloor(time*D_TIMEFACTOR + 0.5)); switch (mnDatePart) @@ -167,7 +366,7 @@ bool ScDPGroupDateFilter::match(const ScDPCacheCell& rCell) const return false; } - Date date = *mpNullDate + static_cast(approxFloor(rCell.mfValue)); + Date date = *mpNullDate + static_cast(approxFloor(rCellData.GetValue())); switch (mnDatePart) { case DataPilotFieldGroupBy::YEARS: @@ -206,17 +405,6 @@ bool ScDPGroupDateFilter::match(const ScDPCacheCell& rCell) const return false; } - -// ============================================================================ - -void lcl_AppendDateStr( rtl::OUStringBuffer& rBuffer, double fValue, SvNumberFormatter* pFormatter ) -{ - ULONG nFormat = pFormatter->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); - String aString; - pFormatter->GetInputLineString( fValue, nFormat, aString ); - rBuffer.append( aString ); -} - // ----------------------------------------------------------------------- ScDPDateGroupHelper::ScDPDateGroupHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ) : @@ -356,15 +544,18 @@ sal_Int32 lcl_GetDatePartValue( double fValue, sal_Int32 nDatePart, SvNumberForm BOOL lcl_DateContained( sal_Int32 nGroupPart, const ScDPItemData& rGroupData, sal_Int32 nBasePart, const ScDPItemData& rBaseData ) { - if ( !rGroupData.bHasValue || !rBaseData.bHasValue ) + if ( !rGroupData.IsValue() || !rBaseData.IsValue() ) { // non-numeric entries involved: only match equal entries return rGroupData.IsCaseInsEqual( rBaseData ); } // no approxFloor needed, values were created from integers - sal_Int32 nGroupValue = (sal_Int32) rGroupData.fValue; - sal_Int32 nBaseValue = (sal_Int32) rBaseData.fValue; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + sal_Int32 nGroupValue = (sal_Int32) rGroupData.GetValue(); + sal_Int32 nBaseValue = (sal_Int32) rBaseData.GetValue(); +// End Comments if ( nBasePart > nGroupPart ) { // switch, so the base part is the smaller (inner) part @@ -419,28 +610,25 @@ String lcl_GetSpecialDateName( double fValue, bool bFirst, SvNumberFormatter* pF return aBuffer.makeStringAndClear(); } -void ScDPDateGroupHelper::FillColumnEntries( TypedScStrCollection& rEntries, const TypedScStrCollection& rOriginal, - SvNumberFormatter* pFormatter ) const +void ScDPDateGroupHelper::FillColumnEntries( SCCOL nSourceDim, ScDPTableDataCache* pCache, std::vector< SCROW >& rEntries, const std::vector< SCROW >& rOriginal ) const { // auto min/max is only used for "Years" part, but the loop is always needed double fSourceMin = 0.0; double fSourceMax = 0.0; bool bFirst = true; - USHORT nOriginalCount = rOriginal.GetCount(); - for (USHORT nOriginalPos=0; nOriginalPosGetItemDataById( nSourceDim, rOriginal[nOriginalPos] ); + if ( pItemData->HasStringData() ) { // string data: just copy - TypedStrData* pNew = new TypedStrData( rStrData ); - if ( !rEntries.Insert( pNew ) ) - delete pNew; + lcl_Insert( nSourceDim, pCache , rEntries, rOriginal[nOriginalPos] ); } else { - double fSourceValue = rStrData.GetValue(); + double fSourceValue = pItemData->GetValue(); if ( bFirst ) { fSourceMin = fSourceMax = fSourceValue; @@ -464,6 +652,7 @@ void ScDPDateGroupHelper::FillColumnEntries( TypedScStrCollection& rEntries, con const_cast(this)->aNumInfo.End = rtl::math::approxFloor( fSourceMax ) + 1; //! if not automatic, limit fSourceMin/fSourceMax for list of year values? + SvNumberFormatter* pFormatter = pCache->GetDoc()->GetFormatTable(); long nStart = 0; long nEnd = 0; // including @@ -487,22 +676,15 @@ void ScDPDateGroupHelper::FillColumnEntries( TypedScStrCollection& rEntries, con for ( sal_Int32 nValue = nStart; nValue <= nEnd; nValue++ ) { String aName = lcl_GetDateGroupName( nDatePart, nValue, pFormatter ); - TypedStrData* pNew = new TypedStrData( aName, nValue, SC_STRTYPE_VALUE ); - if ( !rEntries.Insert( pNew ) ) - delete pNew; + lcl_InsertValue( nSourceDim, pCache, rEntries, aName, nValue, nDatePart ); } // add first/last entry (min/max) - String aFirstName = lcl_GetSpecialDateName( aNumInfo.Start, true, pFormatter ); - TypedStrData* pFirstEntry = new TypedStrData( aFirstName, SC_DP_DATE_FIRST, SC_STRTYPE_VALUE ); - if ( !rEntries.Insert( pFirstEntry ) ) - delete pFirstEntry; + lcl_InsertValue( nSourceDim, pCache, rEntries, aFirstName, SC_DP_DATE_FIRST, nDatePart ); String aLastName = lcl_GetSpecialDateName( aNumInfo.End, false, pFormatter ); - TypedStrData* pLastEntry = new TypedStrData( aLastName, SC_DP_DATE_LAST, SC_STRTYPE_VALUE ); - if ( !rEntries.Insert( pLastEntry ) ) - delete pLastEntry; + lcl_InsertValue( nSourceDim, pCache, rEntries, aLastName, SC_DP_DATE_LAST, nDatePart ); } // ----------------------------------------------------------------------- @@ -543,7 +725,10 @@ void ScDPGroupItem::FillGroupFilter( ScDPCacheTable::GroupFilter& rFilter ) cons { ScDPItemDataVec::const_iterator itrEnd = aElements.end(); for (ScDPItemDataVec::const_iterator itr = aElements.begin(); itr != itrEnd; ++itr) - rFilter.addMatchItem(itr->aString, itr->fValue, itr->bHasValue); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + rFilter.addMatchItem(itr->GetString(), itr->GetValue(), itr->IsValue()); +// End Comments } // ----------------------------------------------------------------------- @@ -552,15 +737,15 @@ ScDPGroupDimension::ScDPGroupDimension( long nSource, const String& rNewName ) : nSourceDim( nSource ), nGroupDim( -1 ), aGroupName( rNewName ), - pDateHelper( NULL ), - pCollection( NULL ) + pDateHelper( NULL )/*, + pCollection( NULL )*/ { } ScDPGroupDimension::~ScDPGroupDimension() { delete pDateHelper; - delete pCollection; + maMemberEntries.clear(); } ScDPGroupDimension::ScDPGroupDimension( const ScDPGroupDimension& rOther ) : @@ -568,8 +753,7 @@ ScDPGroupDimension::ScDPGroupDimension( const ScDPGroupDimension& rOther ) : nGroupDim( rOther.nGroupDim ), aGroupName( rOther.aGroupName ), pDateHelper( NULL ), - aItems( rOther.aItems ), - pCollection( NULL ) // collection isn't copied - allocated on demand + aItems( rOther.aItems ) { if ( rOther.pDateHelper ) pDateHelper = new ScDPDateGroupHelper( *rOther.pDateHelper ); @@ -588,8 +772,6 @@ ScDPGroupDimension& ScDPGroupDimension::operator=( const ScDPGroupDimension& rOt else pDateHelper = NULL; - delete pCollection; // collection isn't copied - allocated on demand - pCollection = NULL; return *this; } @@ -608,44 +790,42 @@ void ScDPGroupDimension::SetGroupDim( long nDim ) { nGroupDim = nDim; } - -const TypedScStrCollection& ScDPGroupDimension::GetColumnEntries( - const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const +// Wang Xu Ming -- 2009-9-2 +// DataPilot Migration - Cache&&Performance +const std::vector< SCROW >& ScDPGroupDimension::GetColumnEntries( const ScDPCacheTable& rCacheTable, const std::vector< SCROW >& rOriginal ) const { - if ( !pCollection ) + if ( maMemberEntries.empty() ) { - pCollection = new TypedScStrCollection(); if ( pDateHelper ) - pDateHelper->FillColumnEntries( *pCollection, rOriginal, pDoc->GetFormatTable() ); + { + pDateHelper->FillColumnEntries( (SCCOL)GetSourceDim(), rCacheTable.GetCache(), maMemberEntries, rOriginal ); + } else { - long nCount = aItems.size(); - for (long i=0; iInsert( pNew ) ) - delete pNew; - } - - USHORT nOriginalCount = rOriginal.GetCount(); - for (USHORT nOriginalPos=0; nOriginalPosGetItemDataById( (SCCOL)GetSourceDim(), rOriginal[i] ); + if ( !pItemData || !GetGroupForData( *pItemData ) ) { // not in any group -> add as its own group - TypedStrData* pNew = new TypedStrData( rStrData ); - if ( !pCollection->Insert( pNew ) ) - delete pNew; + maMemberEntries.push_back( rOriginal[i] ); } } + + long nCount = aItems.size(); + for (long i=0; iGetAdditionalItemID( aItems[i].GetName() ); + lcl_Insert ( (SCCOL)GetSourceDim(), rCacheTable.GetCache(), maMemberEntries, nNew ); + } } } - return *pCollection; + return maMemberEntries; } +// End Comments + + const ScDPGroupItem* ScDPGroupDimension::GetGroupForData( const ScDPItemData& rData ) const { for ( ScDPGroupItemVec::const_iterator aIter(aItems.begin()); aIter != aItems.end(); aIter++ ) @@ -674,15 +854,13 @@ const ScDPGroupItem* ScDPGroupDimension::GetGroupByIndex( size_t nIndex ) const void ScDPGroupDimension::DisposeData() { - delete pCollection; - pCollection = NULL; + maMemberEntries.clear(); } // ----------------------------------------------------------------------- ScDPNumGroupDimension::ScDPNumGroupDimension() : pDateHelper( NULL ), - pCollection( NULL ), bHasNonInteger( false ), cDecSeparator( 0 ) { @@ -691,7 +869,6 @@ ScDPNumGroupDimension::ScDPNumGroupDimension() : ScDPNumGroupDimension::ScDPNumGroupDimension( const ScDPNumGroupInfo& rInfo ) : aGroupInfo( rInfo ), pDateHelper( NULL ), - pCollection( NULL ), bHasNonInteger( false ), cDecSeparator( 0 ) { @@ -700,7 +877,6 @@ ScDPNumGroupDimension::ScDPNumGroupDimension( const ScDPNumGroupInfo& rInfo ) : ScDPNumGroupDimension::ScDPNumGroupDimension( const ScDPNumGroupDimension& rOther ) : aGroupInfo( rOther.aGroupInfo ), pDateHelper( NULL ), - pCollection( NULL ), // collection isn't copied - allocated on demand bHasNonInteger( false ), cDecSeparator( 0 ) { @@ -718,23 +894,19 @@ ScDPNumGroupDimension& ScDPNumGroupDimension::operator=( const ScDPNumGroupDimen else pDateHelper = NULL; - delete pCollection; // collection isn't copied - allocated on demand - pCollection = NULL; bHasNonInteger = false; return *this; } void ScDPNumGroupDimension::DisposeData() { - delete pCollection; - pCollection = NULL; bHasNonInteger = false; + maMemberEntries.clear(); } ScDPNumGroupDimension::~ScDPNumGroupDimension() { delete pDateHelper; - delete pCollection; } void ScDPNumGroupDimension::MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ) @@ -745,80 +917,15 @@ void ScDPNumGroupDimension::MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_I aGroupInfo.Enable = sal_True; //! or query both? } -String lcl_GetNumGroupName( double fStartValue, const ScDPNumGroupInfo& rInfo, - bool bHasNonInteger, sal_Unicode cDecSeparator, SvNumberFormatter* pFormatter ) -{ - DBG_ASSERT( cDecSeparator != 0, "cDecSeparator not initialized" ); - - double fStep = rInfo.Step; - double fEndValue = fStartValue + fStep; - if ( !bHasNonInteger && ( rInfo.DateValues || !rtl::math::approxEqual( fEndValue, rInfo.End ) ) ) - { - // The second number of the group label is - // (first number + size - 1) if there are only integer numbers, - // (first number + size) if any non-integer numbers are involved. - // Exception: The last group (containing the end value) is always - // shown as including the end value (but not for dates). - - fEndValue -= 1.0; - } - - if ( fEndValue > rInfo.End && !rInfo.AutoEnd ) - { - // limit the last group to the end value - - fEndValue = rInfo.End; - } - - rtl::OUStringBuffer aBuffer; - if ( rInfo.DateValues ) - { - lcl_AppendDateStr( aBuffer, fStartValue, pFormatter ); - aBuffer.appendAscii( " - " ); // with spaces - lcl_AppendDateStr( aBuffer, fEndValue, pFormatter ); - } - else - { - rtl::math::doubleToUStringBuffer( aBuffer, fStartValue, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, cDecSeparator, true ); - aBuffer.append( (sal_Unicode) '-' ); - rtl::math::doubleToUStringBuffer( aBuffer, fEndValue, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, cDecSeparator, true ); - } - - return aBuffer.makeStringAndClear(); -} - -String lcl_GetSpecialNumGroupName( double fValue, bool bFirst, sal_Unicode cDecSeparator, - bool bDateValues, SvNumberFormatter* pFormatter ) +const std::vector< SCROW >& ScDPNumGroupDimension::GetNumEntries( SCCOL nSourceDim, ScDPTableDataCache* pCache, + const std::vector< SCROW >& rOriginal ) const { - DBG_ASSERT( cDecSeparator != 0, "cDecSeparator not initialized" ); - - rtl::OUStringBuffer aBuffer; - aBuffer.append((sal_Unicode)( bFirst ? '<' : '>' )); - if ( bDateValues ) - lcl_AppendDateStr( aBuffer, fValue, pFormatter ); - else - rtl::math::doubleToUStringBuffer( aBuffer, fValue, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, cDecSeparator, true ); - return aBuffer.makeStringAndClear(); -} - -inline bool IsInteger( double fValue ) -{ - return rtl::math::approxEqual( fValue, rtl::math::approxFloor(fValue) ); -} - -const TypedScStrCollection& ScDPNumGroupDimension::GetNumEntries( - const TypedScStrCollection& rOriginal, ScDocument* pDoc ) const -{ - if ( !pCollection ) + if ( maMemberEntries.empty() ) { - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pFormatter = pCache->GetDoc()->GetFormatTable(); - pCollection = new TypedScStrCollection(); if ( pDateHelper ) - pDateHelper->FillColumnEntries( *pCollection, rOriginal, pFormatter ); + pDateHelper->FillColumnEntries( nSourceDim, pCache, maMemberEntries,rOriginal ); else { // Copy textual entries. @@ -837,39 +944,37 @@ const TypedScStrCollection& ScDPNumGroupDimension::GetNumEntries( double fSourceMax = 0.0; bool bFirst = true; - USHORT nOriginalCount = rOriginal.GetCount(); - for (USHORT nOriginalPos=0; nOriginalPosInsert( pNew ) ) - delete pNew; - } - else - { - double fSourceValue = rStrData.GetValue(); - if ( bFirst ) - { - fSourceMin = fSourceMax = fSourceValue; - bFirst = false; - } - else - { - if ( fSourceValue < fSourceMin ) - fSourceMin = fSourceValue; - if ( fSourceValue > fSourceMax ) - fSourceMax = fSourceValue; - } - if ( !bHasNonInteger && !IsInteger( fSourceValue ) ) - { - // if any non-integer numbers are involved, the group labels are - // shown including their upper limit - bHasNonInteger = true; - } - } + const ScDPItemData* pItemData = pCache->GetItemDataById( nSourceDim , rOriginal[nOriginalPos] ); + + if ( pItemData && pItemData ->HasStringData() ) + { + lcl_Insert( nSourceDim, pCache, maMemberEntries, rOriginal[nOriginalPos] ); + } + else + { + double fSourceValue = pItemData->GetValue(); + if ( bFirst ) + { + fSourceMin = fSourceMax = fSourceValue; + bFirst = false; + } + else + { + if ( fSourceValue < fSourceMin ) + fSourceMin = fSourceValue; + if ( fSourceValue > fSourceMax ) + fSourceMax = fSourceValue; + } + if ( !bHasNonInteger && !IsInteger( fSourceValue ) ) + { + // if any non-integer numbers are involved, the group labels are + // shown including their upper limit + bHasNonInteger = true; + } + } } if ( aGroupInfo.DateValues ) @@ -901,10 +1006,7 @@ const TypedScStrCollection& ScDPNumGroupDimension::GetNumEntries( String aName = lcl_GetNumGroupName( fLoop, aGroupInfo, bHasNonInteger, cDecSeparator, pFormatter ); // create a numerical entry to ensure proper sorting // (in FillMemberResults this needs special handling) - TypedStrData* pNew = new TypedStrData( aName, fLoop, SC_STRTYPE_VALUE ); - if ( !pCollection->Insert( pNew ) ) - delete pNew; - + lcl_InsertValue( nSourceDim, pCache, maMemberEntries, aName, fLoop ); ++nLoopCount; fLoop = aGroupInfo.Start + nLoopCount * aGroupInfo.Step; bFirstGroup = false; @@ -913,72 +1015,17 @@ const TypedScStrCollection& ScDPNumGroupDimension::GetNumEntries( } String aFirstName = lcl_GetSpecialNumGroupName( aGroupInfo.Start, true, cDecSeparator, aGroupInfo.DateValues, pFormatter ); - TypedStrData* pFirstEntry = new TypedStrData( aFirstName, aGroupInfo.Start - aGroupInfo.Step, SC_STRTYPE_VALUE ); - if ( !pCollection->Insert( pFirstEntry ) ) - delete pFirstEntry; + lcl_InsertValue( nSourceDim, pCache, maMemberEntries, aFirstName, aGroupInfo.Start - aGroupInfo.Step ); String aLastName = lcl_GetSpecialNumGroupName( aGroupInfo.End, false, cDecSeparator, aGroupInfo.DateValues, pFormatter ); - TypedStrData* pLastEntry = new TypedStrData( aLastName, aGroupInfo.End + aGroupInfo.Step, SC_STRTYPE_VALUE ); - if ( !pCollection->Insert( pLastEntry ) ) - delete pLastEntry; - } - } - return *pCollection; -} - -// ----------------------------------------------------------------------- - -String lcl_GetNumGroupForValue( double fValue, const ScDPNumGroupInfo& rInfo, bool bHasNonInteger, - sal_Unicode cDecSeparator, double& rGroupValue, ScDocument* pDoc ) -{ - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - - if ( fValue < rInfo.Start && !rtl::math::approxEqual( fValue, rInfo.Start ) ) - { - rGroupValue = rInfo.Start - rInfo.Step; - return lcl_GetSpecialNumGroupName( rInfo.Start, true, cDecSeparator, rInfo.DateValues, pFormatter ); - } - - if ( fValue > rInfo.End && !rtl::math::approxEqual( fValue, rInfo.End ) ) - { - rGroupValue = rInfo.End + rInfo.Step; - return lcl_GetSpecialNumGroupName( rInfo.End, false, cDecSeparator, rInfo.DateValues, pFormatter ); - } - - double fDiff = fValue - rInfo.Start; - double fDiv = rtl::math::approxFloor( fDiff / rInfo.Step ); - double fGroupStart = rInfo.Start + fDiv * rInfo.Step; - - if ( rtl::math::approxEqual( fGroupStart, rInfo.End ) && - !rtl::math::approxEqual( fGroupStart, rInfo.Start ) ) - { - if ( !rInfo.DateValues ) - { - // A group that would consist only of the end value is not created, - // instead the value is included in the last group before. So the - // previous group is used if the calculated group start value is the - // selected end value. - - fDiv -= 1.0; - fGroupStart = rInfo.Start + fDiv * rInfo.Step; - } - else - { - // For date values, the end value is instead treated as above the limit - // if it would be a group of its own. - - rGroupValue = rInfo.End + rInfo.Step; - return lcl_GetSpecialNumGroupName( rInfo.End, false, cDecSeparator, rInfo.DateValues, pFormatter ); + lcl_InsertValue( nSourceDim, pCache, maMemberEntries, aLastName, aGroupInfo.End + aGroupInfo.Step ); } } - - rGroupValue = fGroupStart; - - return lcl_GetNumGroupName( fGroupStart, rInfo, bHasNonInteger, cDecSeparator, pFormatter ); + return maMemberEntries; } ScDPGroupTableData::ScDPGroupTableData( ScDPTableData* pSource, ScDocument* pDocument ) : - ScDPTableData(pDocument), + ScDPTableData(pDocument, pSource->GetCacheId() ), pSourceData( pSource ), pDoc( pDocument ) { @@ -1018,7 +1065,6 @@ long ScDPGroupTableData::GetDimensionIndex( const String& rName ) for (long i=0; igetDimensionName(i) == rName ) //! ignore case? return i; - return -1; // none } @@ -1042,36 +1088,53 @@ void ScDPGroupTableData::GetNumGroupInfo( long nDimension, ScDPNumGroupInfo& rIn rDecimal = pNumGroups[nDimension].GetDecSeparator(); } } - -const TypedScStrCollection& ScDPGroupTableData::GetColumnEntries(long nColumn) +// Wang Xu Ming - DataPilot migration +long ScDPGroupTableData::GetMembersCount( long nDim ) +{ + const std::vector< SCROW >& members = GetColumnEntries( nDim ); + return members.size(); +} +const std::vector< SCROW >& ScDPGroupTableData::GetColumnEntries( long nColumn ) { - // date handling is in ScDPGroupDimension::GetColumnEntries / ScDPNumGroupDimension::GetNumEntries - // (to use the pCollection members) - if ( nColumn >= nSourceCount ) { - if ( nColumn == sal::static_int_cast( nSourceCount + aGroups.size() ) ) // data layout dimension? + if ( getIsDataLayoutDimension( nColumn) ) // data layout dimension? nColumn = nSourceCount; // index of data layout in source data else { const ScDPGroupDimension& rGroupDim = aGroups[nColumn - nSourceCount]; long nSourceDim = rGroupDim.GetSourceDim(); // collection is cached at pSourceData, GetColumnEntries can be called every time - const TypedScStrCollection& rOriginal = pSourceData->GetColumnEntries( nSourceDim ); - return rGroupDim.GetColumnEntries( rOriginal, pDoc ); + const std::vector< SCROW >& rOriginal = pSourceData->GetColumnEntries( nSourceDim ); + return rGroupDim.GetColumnEntries( GetCacheTable(), rOriginal ); } } if ( IsNumGroupDimension( nColumn ) ) { // dimension number is unchanged for numerical groups - const TypedScStrCollection& rOriginal = pSourceData->GetColumnEntries( nColumn ); - return pNumGroups[nColumn].GetNumEntries( rOriginal, pDoc ); + const std::vector< SCROW >& rOriginal = pSourceData->GetColumnEntries( nColumn ); + return pNumGroups[nColumn].GetNumEntries( (SCCOL)nColumn, GetCacheTable().GetCache(), rOriginal ); } return pSourceData->GetColumnEntries( nColumn ); } +const ScDPItemData* ScDPGroupTableData::GetMemberById( long nDim, long nId ) +{ + if ( nDim >= nSourceCount ) + { + if ( getIsDataLayoutDimension( nDim) ) + nDim = nSourceCount; + else + { + const ScDPGroupDimension& rGroupDim = aGroups[nDim - nSourceCount]; + nDim = rGroupDim.GetSourceDim(); + } + } + return pSourceData->GetMemberById( nDim, nId ); +} + String ScDPGroupTableData::getDimensionName(long nColumn) { if ( nColumn >= nSourceCount ) @@ -1104,7 +1167,7 @@ BOOL ScDPGroupTableData::IsDateDimension(long nDim) return pSourceData->IsDateDimension( nDim ); } -UINT32 ScDPGroupTableData::GetNumberFormat(long nDim) +ULONG ScDPGroupTableData::GetNumberFormat(long nDim) { if ( nDim >= nSourceCount ) { @@ -1223,16 +1286,19 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector& for (size_t i = 0; i < nGroupItemCount; ++i) { const ScDPGroupItem* pGrpItem = pGrpDim->GetGroupByIndex(i); - ScDPItemData aName; - aName.aString = pFilter->getMatchString(); + // Wang Xu Ming -- 2009-6-9 + // DataPilot Migration + ScDPItemData aName( pFilter->getMatchString(),pFilter->getMatchValue(),pFilter->hasValue()) ; + /*aName.aString = pFilter->getMatchString(); aName.fValue = pFilter->getMatchValue(); - aName.bHasValue = pFilter->hasValue(); - if (!pGrpItem || !pGrpItem->GetName().IsCaseInsEqual(aName)) + aName.bHasValue = pFilter->hasValue();*/ + // End Comments + if (!pGrpItem || !pGrpItem->GetName().IsCaseInsEqual(aName)) continue; ScDPCacheTable::Criterion aCri; aCri.mnFieldIndex = nSrcDim; - aCri.mpFilter.reset(new ScDPCacheTable::GroupFilter(GetSharedString())); + aCri.mpFilter.reset(new ScDPCacheTable::GroupFilter()); ScDPCacheTable::GroupFilter* pGrpFilter = static_cast(aCri.mpFilter.get()); @@ -1324,25 +1390,27 @@ void ScDPGroupTableData::CopyFields(const vector& rFieldDims, vector } } -void ScDPGroupTableData::FillGroupValues( ScDPItemData* pItemData, long nCount, const long* pDims ) +void ScDPGroupTableData::FillGroupValues( /*ScDPItemData* pItemData*/ SCROW* pItemDataIndex, long nCount, const long* pDims ) { long nGroupedColumns = aGroups.size(); + ScDPTableDataCache* pCache = GetCacheTable().GetCache(); for (long nDim=0; nDim= nSourceCount && nColumn < nSourceCount + nGroupedColumns ) { const ScDPGroupDimension& rGroupDim = aGroups[nColumn - nSourceCount]; + nSourceDim= rGroupDim.GetSourceDim(); pDateHelper = rGroupDim.GetDateHelper(); if ( !pDateHelper ) // date is handled below { - const ScDPGroupItem* pGroupItem = rGroupDim.GetGroupForData( pItemData[nDim] ); - if ( pGroupItem ) - pItemData[nDim] = pGroupItem->GetName(); - // if no group is found, keep the original name + const ScDPGroupItem* pGroupItem = rGroupDim.GetGroupForData( *GetMemberById( nSourceDim, pItemDataIndex[nDim] )); + if ( pGroupItem ) + pItemDataIndex[nDim] = pCache->GetAdditionalItemID( pGroupItem->GetName() ); } } else if ( IsNumGroupDimension( nColumn ) ) @@ -1350,18 +1418,18 @@ void ScDPGroupTableData::FillGroupValues( ScDPItemData* pItemData, long nCount, pDateHelper = pNumGroups[nColumn].GetDateHelper(); if ( !pDateHelper ) // date is handled below { - if ( pItemData[nDim].bHasValue ) + const ScDPItemData* pData = pCache->GetItemDataById( (SCCOL)nSourceDim, pItemDataIndex[nDim]); + if ( pData ->IsValue() ) { ScDPNumGroupInfo aNumInfo; bool bHasNonInteger = false; sal_Unicode cDecSeparator = 0; GetNumGroupInfo( nColumn, aNumInfo, bHasNonInteger, cDecSeparator ); double fGroupValue; - String aGroupName = lcl_GetNumGroupForValue( pItemData[nDim].fValue, - aNumInfo, bHasNonInteger, cDecSeparator, fGroupValue, pDoc ); - - // consistent with TypedStrData in GetNumEntries - pItemData[nDim] = ScDPItemData( aGroupName, fGroupValue, TRUE ); + String aGroupName = lcl_GetNumGroupForValue( pData->GetValue(), + aNumInfo, bHasNonInteger, cDecSeparator, fGroupValue, pDoc ); + ScDPItemData aItemData ( aGroupName, fGroupValue, TRUE ) ; + pItemDataIndex[nDim] = pCache->GetAdditionalItemID( aItemData ); } // else (textual) keep original value } @@ -1369,12 +1437,18 @@ void ScDPGroupTableData::FillGroupValues( ScDPItemData* pItemData, long nCount, if ( pDateHelper ) { - if ( pItemData[nDim].bHasValue ) + const ScDPItemData* pData = GetCacheTable().GetCache()->GetItemDataById( (SCCOL)nSourceDim, pItemDataIndex[nDim]); + if ( pData ->IsValue() ) { sal_Int32 nPartValue = lcl_GetDatePartValue( - pItemData[nDim].fValue, pDateHelper->GetDatePart(), pDoc->GetFormatTable(), - &pDateHelper->GetNumInfo() ); - pItemData[nDim] = ScDPItemData( String(), nPartValue, TRUE ); + pData->GetValue(), pDateHelper->GetDatePart(), pDoc->GetFormatTable(), + &pDateHelper->GetNumInfo() ); +// Wang Xu Ming -- 2009-9-7 +// DataPilot Migration - Cache&&Performance + //String aName = lcl_GetDateGroupName( pDateHelper, nPartValue, pDoc->GetFormatTable() ); + ScDPItemData aItemData( pDateHelper->GetDatePart(), String(), nPartValue, ScDPItemData::MK_DATA|ScDPItemData::MK_VAL|ScDPItemData::MK_DATEPART ); + pItemDataIndex[nDim] = GetCacheTable().GetCache()->GetAdditionalItemID( aItemData ); +// End Comments } } } @@ -1530,5 +1604,22 @@ BOOL ScDPGroupTableData::HasCommonElement( const ScDPItemData& rFirstData, long return TRUE; } +long ScDPGroupTableData::GetSourceDim( long nDim ) +{ + if ( getIsDataLayoutDimension( nDim ) ) + return nSourceCount; + if ( nDim >= nSourceCount && nDim < nSourceCount +(long) aGroups.size() ) + { + const ScDPGroupDimension& rGroupDim = aGroups[nDim - nSourceCount]; + return rGroupDim.GetSourceDim(); + } + return nDim; +} + long ScDPGroupTableData::Compare( long nDim, long nDataId1, long nDataId2) +{ + if ( getIsDataLayoutDimension(nDim) ) + return 0; + return ScDPItemData::Compare( *GetMemberById(nDim, nDataId1),*GetMemberById(nDim, nDataId2) ); +} // ----------------------------------------------------------------------- diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 787875fcb5ff..c318cd071db9 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -55,7 +55,11 @@ #include "attrib.hxx" #include "scitems.hxx" #include "unonames.hxx" - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +#include "globstr.hrc" +// End Comments #include #include #include @@ -87,9 +91,6 @@ using ::com::sun::star::sheet::DataPilotTablePositionData; using ::com::sun::star::beans::XPropertySet; using ::rtl::OUString; -// ----------------------------------------------------------------------- - -#define MAX_LABELS 256 //!!! from fieldwnd.hxx, must be moved to global.hxx // ----------------------------------------------------------------------- @@ -166,7 +167,9 @@ ScDPObject::ScDPObject( ScDocument* pD ) : bSettingsChanged( FALSE ), bAlive( FALSE ), bAllowMove( FALSE ), - nHeaderRows( 0 ) + bRefresh( FALSE ), // Wang Xu Ming - DataPilot migration + nHeaderRows( 0 ), + mnCacheId( -1) // Wang Xu Ming - DataPilot migration { } @@ -184,6 +187,8 @@ ScDPObject::ScDPObject(const ScDPObject& r) : bSettingsChanged( FALSE ), bAlive( FALSE ), bAllowMove( FALSE ), + bRefresh( r.bRefresh ), // Wang Xu Ming - DataPilot migration + mnCacheId ( r.mnCacheId ), // Wang Xu Ming - DataPilot migration nHeaderRows( r.nHeaderRows ) { if (r.pSaveData) @@ -204,6 +209,7 @@ ScDPObject::~ScDPObject() delete pSheetDesc; delete pImpDesc; delete pServDesc; + mnCacheId = -1; // Wang Xu Ming - DataPilot migration } ScDataObject* ScDPObject::Clone() const @@ -227,6 +233,13 @@ void ScDPObject::SetSaveData(const ScDPSaveData& rData) { delete pSaveData; pSaveData = new ScDPSaveData( rData ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + if ( rData.GetCacheId() >= 0 ) + mnCacheId = rData.GetCacheId(); + else if ( mnCacheId >= 0 ) + pSaveData->SetCacheId( mnCacheId ); + // End Comments } InvalidateData(); // re-init source from SaveData @@ -392,7 +405,7 @@ void ScDPObject::CreateObjects() if ( pImpDesc ) { // database data - pData = new ScDatabaseDPData( pDoc, *pImpDesc ); + pData = new ScDatabaseDPData( pDoc, *pImpDesc , GetCacheId() ); } else { @@ -402,7 +415,10 @@ void ScDPObject::CreateObjects() DBG_ERROR("no source descriptor"); pSheetDesc = new ScSheetSourceDesc; // dummy defaults } - pData = new ScSheetDPData( pDoc, *pSheetDesc ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + pData = new ScSheetDPData( pDoc, *pSheetDesc ,GetCacheId()); + // End Comments } // grouping (for cell or database data) @@ -413,11 +429,21 @@ void ScDPObject::CreateObjects() pData = pGroupData; } + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + if ( pData ) + SetCacheId( pData->GetCacheId()); + xSource = new ScDPSource( pData ); + if ( pSaveData && bRefresh ) + { + pSaveData->Refresh( xSource ); + bRefresh = FALSE; + } } - - if (pSaveData) + if (pSaveData ) pSaveData->WriteToSource( xSource ); + // End Comments } else if (bSettingsChanged) { @@ -2242,48 +2268,6 @@ uno::Reference ScDPObject::CreateSource( const ScDPS return xRet; } -// ============================================================================ - -ScDPCacheCell::ScDPCacheCell() : - mnStrId(ScSimpleSharedString::EMPTY), - mnType(SC_VALTYPE_EMPTY), - mfValue(0.0), - mbNumeric(false) -{ -} - -ScDPCacheCell::ScDPCacheCell(const ScDPCacheCell& r) : - mnStrId(r.mnStrId), - mnType(r.mnType), - mfValue(r.mfValue), - mbNumeric(r.mbNumeric) -{ -} - -ScDPCacheCell::~ScDPCacheCell() -{ -} - -// ============================================================================ - -size_t ScDPCollection::CacheCellHash::operator()(const ScDPCacheCell* pCell) const -{ - return pCell->mnStrId + static_cast(pCell->mnType) + - static_cast(pCell->mfValue) + static_cast(pCell->mbNumeric); -} - -bool ScDPCollection::CacheCellEqual::operator()(const ScDPCacheCell* p1, const ScDPCacheCell* p2) const -{ - if (!p1 && !p2) - return true; - - if ((!p1 && p2) || (p1 && !p2)) - return false; - - return p1->mnStrId == p2->mnStrId && p1->mfValue == p2->mfValue && - p1->mbNumeric == p2->mbNumeric && p1->mnType == p2->mnType; -} - // ---------------------------------------------------------------------------- ScDPCollection::ScDPCollection(ScDocument* pDocument) : @@ -2293,15 +2277,12 @@ ScDPCollection::ScDPCollection(ScDocument* pDocument) : ScDPCollection::ScDPCollection(const ScDPCollection& r) : ScCollection(r), - pDoc(r.pDoc), - maSharedString(r.maSharedString), - maCacheCellPool() // #i101725# don't copy hash_set with pointers from the other collection + pDoc(r.pDoc) { } ScDPCollection::~ScDPCollection() { - clearCacheCellPool(); } ScDataObject* ScDPCollection::Clone() const @@ -2406,59 +2387,74 @@ String ScDPCollection::CreateNewName( USHORT nMin ) const return String(); // should not happen } -ScSimpleSharedString& ScDPCollection::GetSharedString() + + +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +long ScDPObject::GetCacheId() const { - return maSharedString; + if ( GetSaveData() ) + return GetSaveData()->GetCacheId(); + else + return mnCacheId; } - -ScDPCacheCell* ScDPCollection::getCacheCellFromPool(const ScDPCacheCell& rCell) +ULONG ScDPObject::RefreshCache() { - ScDPCacheCell aCell(rCell); - CacheCellPoolType::iterator itr = maCacheCellPool.find(&aCell); - if (itr == maCacheCellPool.end()) + CreateObjects(); + ULONG nErrId = 0; + if ( pSheetDesc) + nErrId = pSheetDesc->CheckValidate( pDoc ); + if ( nErrId == 0 ) { - // Insert a new instance. - ScDPCacheCell* p = new ScDPCacheCell(rCell); - ::std::pair r = - maCacheCellPool.insert(p); - if (!r.second) - delete p; - - ScDPCacheCell* p2 = r.second ? *r.first : NULL; - DBG_ASSERT(p == p2, "ScDPCollection::getCacheCellFromPool: pointer addresses differ"); - return p2; - } - return *itr; -} + long nOldId = GetCacheId(); + long nNewId = pDoc->GetNewDPObjectCacheId(); + if ( nOldId >= 0 ) + pDoc->RemoveDPObjectCache( nOldId ); + + ScDPTableDataCache* pCache = NULL; + if ( pSheetDesc ) + pCache = pSheetDesc->CreateCache( pDoc, nNewId ); + else if ( pImpDesc ) + pCache = pImpDesc->CreateCache( pDoc, nNewId ); + + if ( pCache == NULL ) + { + //cache failed + DBG_ASSERT( pCache , " pCache == NULL" ); + return STR_ERR_DATAPILOTSOURCE; + } -namespace { + nNewId = pCache->GetId(); -class DeleteCacheCells : public ::std::unary_function + bRefresh = TRUE; + ScDPCollection* pDPCollection = pDoc->GetDPCollection(); + USHORT nCount = pDPCollection->GetCount(); + for (USHORT i=0; iGetCacheId() == nOldId ) + { + (*pDPCollection)[i]->SetCacheId( nNewId ); + (*pDPCollection)[i]->SetRefresh(); + + } + } + DBG_ASSERT( GetCacheId() >= 0, " GetCacheId() >= 0 " ); + } + return nErrId; +} +void ScDPObject::SetCacheId( long nCacheId ) { -public: - void operator()(ScDPCacheCell* p) const + if ( GetCacheId() != nCacheId ) { - delete p; - } -}; + InvalidateSource(); + if ( GetSaveData() ) + GetSaveData()->SetCacheId( nCacheId ); + mnCacheId = nCacheId; + } } - -void ScDPCollection::clearCacheCellPool() +const ScDPTableDataCache* ScDPObject::GetCache() const { - // Transferring all stored pointers to a vector first. For some unknown - // reason, deleting cell content instances by directly iterating through - // the hash set causes the iteration to return an identical pointer - // value twice, causing a double-delete. I have no idea why this happens. - - using ::std::copy; - using ::std::back_inserter; - - vector ps; - ps.reserve(maCacheCellPool.size()); - copy(maCacheCellPool.begin(), maCacheCellPool.end(), back_inserter(ps)); - maCacheCellPool.clear(); - // for correctness' sake, delete the elements after clearing the hash_set - for_each(ps.begin(), ps.end(), DeleteCacheCells()); + return pDoc->GetDPObjectCache( GetCacheId() ); } - +// End Comments diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index d1fad68f16a2..65dd3bb72088 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -59,22 +59,11 @@ #include "scresid.hxx" #include "unonames.hxx" #include "sc.hrc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "scdpoutputimpl.hxx" +#include "dpglobal.hxx" +// End Comments #include #include @@ -617,11 +606,21 @@ void ScDPOutput::HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab, if ( nFlags & sheet::MemberResultFlags::SUBTOTAL ) { // SvxWeightItem aItem( WEIGHT_BOLD ); // weight is in the style - + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + OutputImpl outputimp( pDoc, nTab, + nTabStartCol, nTabStartRow, nMemberStartCol, nMemberStartRow, + nDataStartCol, nDataStartRow, nTabEndCol, nTabEndRow ); + // End Comments //! limit frames to horizontal or vertical? if (bColHeader) { - lcl_SetFrame( pDoc,nTab, nCol,nMemberStartRow+(SCROW)nLevel, nCol,nTabEndRow, 20 ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + //lcl_SetFrame( pDoc,nTab, nCol,nMemberStartRow+(SCROW)nLevel, nCol,nTabEndRow, SC_DP_FRAME_INNER_BOLD ); + outputimp.OutputBlockFrame( nCol,nMemberStartRow+(SCROW)nLevel, nCol,nDataStartRow-1 ); + // End Comments + lcl_SetStyleById( pDoc,nTab, nCol,nMemberStartRow+(SCROW)nLevel, nCol,nDataStartRow-1, STR_PIVOT_STYLE_TITLE ); lcl_SetStyleById( pDoc,nTab, nCol,nDataStartRow, nCol,nTabEndRow, @@ -629,7 +628,11 @@ void ScDPOutput::HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab, } else { - lcl_SetFrame( pDoc,nTab, nMemberStartCol+(SCCOL)nLevel,nRow, nTabEndCol,nRow, 20 ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + //lcl_SetFrame( pDoc,nTab, nMemberStartCol+(USHORT)nLevel,nRow, nTabEndCol,nRow, SC_DP_FRAME_INNER_BOLD ); + outputimp.OutputBlockFrame( nMemberStartCol+(SCCOL)nLevel,nRow, nDataStartCol-1,nRow ); + // End Comments lcl_SetStyleById( pDoc,nTab, nMemberStartCol+(SCCOL)nLevel,nRow, nDataStartCol-1,nRow, STR_PIVOT_STYLE_TITLE ); lcl_SetStyleById( pDoc,nTab, nDataStartCol,nRow, nTabEndCol,nRow, @@ -768,6 +771,20 @@ void ScDPOutput::Output() if ( bDoFilter ) lcl_DoFilterButton( pDoc, aStartPos.Col(), aStartPos.Row(), nTab ); + // output data results: + + for (long nRow=0; nRow vbSetBorder; + vbSetBorder.resize( nTabEndRow - nDataStartRow + 1, FALSE ); for (nField=0; nField nMemberStartCol ) - lcl_SetFrame( pDoc,nTab, nMemberStartCol,nDataStartRow, nDataStartCol-1,nTabEndRow, 20 ); - if ( nDataStartRow > nMemberStartRow ) - lcl_SetFrame( pDoc,nTab, nDataStartCol,nMemberStartRow, nTabEndCol,nDataStartRow-1, 20 ); - - lcl_SetFrame( pDoc,nTab, nTabStartCol,nTabStartRow, nTabEndCol,nTabEndRow, 40 ); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + outputimp.OutputDataArea(); +// End Comments } ScRange ScDPOutput::GetOutputRange( sal_Int32 nRegionType ) diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 62798076afb9..0258008a70fa 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -57,7 +57,19 @@ #include #include #include - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dptabsrc.hxx" +#include "dpglobal.hxx" +using namespace ScDPGlobal; +#ifndef _COM_SUN_STAR_SHEET_DATAPILOTFIELDREFERENCETYPE_HPP_ +#include +#endif +#ifndef _COM_SUN_STAR_SHEET_DATAPILOTFIELDREFERENCEITEMTYPE_HPP_ +#include +#endif +using namespace com::sun::star::sheet; +// End Comments using namespace com::sun::star; // ----------------------------------------------------------------------- @@ -68,25 +80,6 @@ using namespace com::sun::star; // ----------------------------------------------------------------------- -//! move to a header file -//! use names from unonames.hxx? -#define DP_PROP_COLUMNGRAND "ColumnGrand" -#define DP_PROP_FUNCTION "Function" -#define DP_PROP_IGNOREEMPTY "IgnoreEmptyRows" -#define DP_PROP_ISDATALAYOUT "IsDataLayoutDimension" -#define DP_PROP_ISVISIBLE "IsVisible" -#define DP_PROP_ORIENTATION "Orientation" -#define DP_PROP_REPEATIFEMPTY "RepeatIfEmpty" -#define DP_PROP_ROWGRAND "RowGrand" -#define DP_PROP_SHOWDETAILS "ShowDetails" -#define DP_PROP_SHOWEMPTY "ShowEmpty" -#define DP_PROP_SUBTOTALS "SubTotals" -#define DP_PROP_USEDHIERARCHY "UsedHierarchy" -#define DP_PROP_FILTER "Filter" -#define DP_PROP_POSITION "Position" - -// ----------------------------------------------------------------------- - void lcl_SetBoolProperty( const uno::Reference& xProp, const rtl::OUString& rName, sal_Bool bValue ) { @@ -304,6 +297,51 @@ BOOL ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const if (!(**a == **b)) return FALSE; + if ( this->HasCurrentPage() && r.HasCurrentPage() ) + { + if ( this->GetCurrentPage() != r.GetCurrentPage() ) + { + return FALSE; + } + } + else if ( this->HasCurrentPage() || r.HasCurrentPage() ) + { + return FALSE; + } + if( pReferenceValue && r.pReferenceValue ) + { + if ( !(*pReferenceValue == *r.pReferenceValue) ) + { + return FALSE; + } + } + else if ( pReferenceValue || r.pReferenceValue ) + { + return FALSE; + } + if( this->pSortInfo && r.pSortInfo ) + { + if ( !(*this->pSortInfo == *r.pSortInfo) ) + { + return FALSE; + } + } + else if ( this->pSortInfo || r.pSortInfo ) + { + return FALSE; + } + if( this->pAutoShowInfo && r.pAutoShowInfo ) + { + if ( !(*this->pAutoShowInfo == *r.pAutoShowInfo) ) + { + return FALSE; + } + } + else if ( this->pAutoShowInfo || r.pAutoShowInfo ) + { + return FALSE; + } + return TRUE; } @@ -666,6 +704,10 @@ ScDPSaveData::ScDPSaveData() : nIgnoreEmptyMode( SC_DPSAVEMODE_DONTKNOW ), nRepeatEmptyMode( SC_DPSAVEMODE_DONTKNOW ), bFilterButton( TRUE ), + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + mnCacheId( -1), + // End Comments bDrillDown( TRUE ) { } @@ -676,7 +718,11 @@ ScDPSaveData::ScDPSaveData(const ScDPSaveData& r) : nIgnoreEmptyMode( r.nIgnoreEmptyMode ), nRepeatEmptyMode( r.nRepeatEmptyMode ), bFilterButton( r.bFilterButton ), - bDrillDown( r.bDrillDown ) + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + mnCacheId( r.mnCacheId ), + // End Comments + bDrillDown( r.bDrillDown ) { if ( r.pDimensionData ) pDimensionData = new ScDPDimensionSaveData( *r.pDimensionData ); @@ -695,36 +741,11 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r ) { if ( &r != this ) { - delete pDimensionData; - if ( r.pDimensionData ) - pDimensionData = new ScDPDimensionSaveData( *r.pDimensionData ); - else - pDimensionData = NULL; - - nColumnGrandMode = r.nColumnGrandMode; - nRowGrandMode = r.nRowGrandMode; - nIgnoreEmptyMode = r.nIgnoreEmptyMode; - nRepeatEmptyMode = r.nRepeatEmptyMode; - bFilterButton = r.bFilterButton; - bDrillDown = r.bDrillDown; - - // remove old dimensions - - long nCount = aDimList.Count(); - long i; - for (i=0; i~ScDPSaveData(); + new( this ) ScDPSaveData ( r ); + // End Comments } return *this; } @@ -736,6 +757,7 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const nIgnoreEmptyMode != r.nIgnoreEmptyMode || nRepeatEmptyMode != r.nRepeatEmptyMode || bFilterButton != r.bFilterButton || + mnCacheId != r.mnCacheId ||/// Wang Xu Ming -- 2009-6-18 DataPilot Migration bDrillDown != r.bDrillDown ) return FALSE; @@ -807,8 +829,8 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName) ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension() { - ULONG nCount = aDimList.Count(); - for (ULONG i=0; iIsDataLayout() ) @@ -990,6 +1012,7 @@ void ScDPSaveData::WriteToSource( const uno::ReferenceGetName(); + + DBG_TRACESTR(pDim->GetName()); + BOOL bData = pDim->IsDataLayout(); //! getByName for ScDPSource, including DataLayoutDimension !!!!!!!! @@ -1100,3 +1126,194 @@ void ScDPSaveData::SetDimensionData( const ScDPDimensionSaveData* pNew ) pDimensionData = NULL; } +void ScDPSaveData::Refresh( const uno::Reference& xSource ) +{ + try + { + long nCount = aDimList.Count(); + std::list deletedDims; + for (long i=nCount-1; i >=0 ; i--) + { + ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i); + + rtl::OUString aName = pDim->GetName(); + if ( pDim->IsDataLayout() ) + continue; + + uno::Reference xDimsName = xSource->getDimensions(); + uno::Reference xIntDims = new ScNameToIndexAccess( xDimsName ); + long nIntCount = xIntDims->getCount(); + BOOL bFound = FALSE; + for (long nIntDim=0; nIntDim xIntDim = ScUnoHelpFunctions::AnyToInterface( xIntDims->getByIndex(nIntDim) ); + uno::Reference xDimName( xIntDim, uno::UNO_QUERY ); + if ( xDimName.is() && xDimName->getName() == aName ) + bFound = TRUE; + } + if ( !bFound ) + { + deletedDims.push_back( aName ); + aDimList.Remove(i); + DBG_TRACE( "\n Remove dim: \t" ); + DBG_TRACESTR( String( aName ) ); + } + + } + + nCount = aDimList.Count(); + for (long i=nCount-1; i >=0 ; i--) //check every dimension ?? + { + ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i); + + rtl::OUString aName = pDim->GetName(); + if ( pDim->IsDataLayout() ) + continue; + pDim->Refresh( xSource, deletedDims ); + + } + } + catch(uno::Exception&) + { + DBG_ERROR("error in ScDPSaveData::Refresh"); + } + +} +void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource , + const std::list& deletedDims) +{ + if ( xSource.is() ) + { + ScDPSource* pTabSource = static_cast( xSource.get() ); + ScDPTableDataCache* pCache = pTabSource->GetCache(); + if ( pCache->GetId() == -1 ) + return; + + SCCOL nSrcDim = pCache->GetDimensionIndex( GetName() ); + + if ( nSrcDim == -1 ) + return; + if ( pSelectedPage ) + {//check pSelected page + DBG_TRACESTR( (*pSelectedPage) ); + if ( pCache->GetIdByItemData( nSrcDim, *pSelectedPage ) == -1 ) + { + delete pSelectedPage; + pSelectedPage = NULL; + } + + }; + + if ( pReferenceValue && pReferenceValue->ReferenceItemType == DataPilotFieldReferenceItemType::NAMED ) + {//check pReferenceValue +#ifdef DEBUG + switch( pReferenceValue->ReferenceType) + { + case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE: //both + DBG_TRACE( "\n sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE \n" ); + break; + case sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE: //both + DBG_TRACE( "\n sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE \n" ); + break; + case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE: //both + DBG_TRACE( "\n sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE \n" ); + break; + case sheet::DataPilotFieldReferenceType::RUNNING_TOTAL: + DBG_TRACE( "\n sheet::DataPilotFieldReferenceType::RUNNING_TOTAL \n" ); //enable name + break; + } +#endif + switch( pReferenceValue->ReferenceType) + { + case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE: + case sheet::DataPilotFieldReferenceType::ITEM_DIFFERENCE: + case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE: + case sheet::DataPilotFieldReferenceType::RUNNING_TOTAL: + { + if( pReferenceValue->ReferenceItemType == DataPilotFieldReferenceItemType::NAMED ) + { + const String& sReferenceFieldName = pReferenceValue->ReferenceField; + DBG_TRACESTR( sReferenceFieldName ); + SCCOL nRefDim = pCache->GetDimensionIndex( sReferenceFieldName ); + bool bValid = true; + if ( nRefDim == -1 ) + bValid = false; + else if ( pReferenceValue->ReferenceType != sheet::DataPilotFieldReferenceType::RUNNING_TOTAL ) + { //running total has not reference item + const String& sReferenceItemName = pReferenceValue->ReferenceItemName; + DBG_TRACESTR( sReferenceItemName ); + if ( pCache->GetIdByItemData( nRefDim, sReferenceItemName ) == -1 ) + bValid = false; + } + if ( !bValid ) + { + delete pReferenceValue; + pReferenceValue = NULL; + } + } + } + break; + } + + }; + + if ( pSortInfo ) + { //check sortinfo + if ( pSortInfo->Mode == DataPilotFieldSortMode::DATA ) + { + DBG_TRACE( "\n DataPilotFieldSortMode::DATA \n" ); + const String& sFieldDimName = pSortInfo->Field; + std::list::const_iterator iter = std::find( deletedDims.begin(), deletedDims.end(), sFieldDimName ); + if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1 ) + { + pSortInfo->Mode = DataPilotFieldSortMode::MANUAL; + pSortInfo->Field = GetName(); + } + } + + }; + + if ( pAutoShowInfo ) + { //check autoshow + const String& sFieldDimName = pAutoShowInfo->DataField; + std::list::const_iterator iter = std::find( deletedDims.begin(), deletedDims.end(), sFieldDimName ); + if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1 ) + { + delete pAutoShowInfo; + pAutoShowInfo = NULL; + } + + }; + + //remove unused members + //SODC_19124 + for (MemberList::iterator i=maMemberList.begin(); i != maMemberList.end() ; ) + { + rtl::OUString aMemberName = (*i)->GetName(); + if ( pCache->GetIdByItemData( nSrcDim, aMemberName ) == -1 ) + i = maMemberList.erase( i ); + else + i++; + } + } +} +// End Comments +bool operator == (const ::com::sun::star::sheet::DataPilotFieldSortInfo &l, const ::com::sun::star::sheet::DataPilotFieldSortInfo &r ) +{ + return l.Field == r.Field && l.IsAscending == r.IsAscending && l.Mode == r.Mode; +} +bool operator == (const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &l, const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &r ) +{ + return l.IsEnabled == r.IsEnabled && + l.ShowItemsMode == r.ShowItemsMode && + l.ItemCount == r.ItemCount && + l.DataField == r.DataField; +} +bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, const ::com::sun::star::sheet::DataPilotFieldReference &r ) +{ + return l.ReferenceType == r.ReferenceType && + l.ReferenceField == r.ReferenceField && + l.ReferenceItemType == r.ReferenceItemType && + l.ReferenceItemName == r.ReferenceItemName; +} diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index cfc98af5af99..696e7e38c4a7 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -78,163 +78,175 @@ using ::com::sun::star::uno::UNO_QUERY; #define SC_DBPROP_DATASOURCENAME "DataSourceName" #define SC_DBPROP_COMMAND "Command" #define SC_DBPROP_COMMANDTYPE "CommandType" - // ----------------------------------------------------------------------- - -class ScDatabaseDPData_Impl +// Wang Xu Ming -- 2009-9-15 +// DataPilot Migration - Cache&&Performance + ScDPTableDataCache* ScImportSourceDesc::GetExistDPObjectCache( ScDocument* pDoc ) const { -public: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; - ScImportSourceDesc aDesc; - long nColCount; - uno::Reference xRowSet; - sal_Int32* pTypes; - SvNumberFormatter* pFormatter; - - ScDPCacheTable aCacheTable; - - ScDatabaseDPData_Impl(ScDPCollection* p) : - aCacheTable(p) + ScDPTableDataCache* pCache = NULL; + ScDPCollection* pDPCollection= pDoc->GetDPCollection(); + USHORT nCount = pDPCollection->GetCount(); + + for ( short i=nCount-1; i>=0 ; i--) { + if ( const ScImportSourceDesc* pUsedDesc = (*pDPCollection)[i]->GetImportSourceDesc() ) + if ( *this == *pUsedDesc ) + { + long nID = (*pDPCollection)[i]->GetCacheId(); + if ( nID >= 0 ) + pCache= pDoc->GetDPObjectCache( nID ); + if ( pCache ) + return pCache; + } } -}; - -// ----------------------------------------------------------------------- - -ScDatabaseDPData::ScDatabaseDPData( - ScDocument* pDoc, - const ScImportSourceDesc& rImport ) : - ScDPTableData(pDoc) -{ - pImpl = new ScDatabaseDPData_Impl(pDoc->GetDPCollection()); - pImpl->xServiceManager = pDoc->GetServiceManager(); - pImpl->aDesc = rImport; - pImpl->nColCount = 0; - pImpl->pTypes = NULL; - pImpl->pFormatter = NULL; // created on demand - - OpenDatabase(); - CreateCacheTable(); -} - -ScDatabaseDPData::~ScDatabaseDPData() -{ - ::comphelper::disposeComponent( pImpl->xRowSet ); - - delete[] pImpl->pTypes; - delete pImpl->pFormatter; // NumberFormatter is local for this object - delete pImpl; + return NULL; } -void ScDatabaseDPData::DisposeData() +ScDPTableDataCache* ScImportSourceDesc::CreateCache( ScDocument* pDoc , long nID ) const { - //! use OpenDatabase here? - pImpl->aCacheTable.clear(); -} + if ( !pDoc ) + return NULL; -BOOL ScDatabaseDPData::OpenDatabase() -{ sal_Int32 nSdbType = -1; - switch ( pImpl->aDesc.nType ) + + switch ( nType ) { - case sheet::DataImportMode_SQL: nSdbType = sdb::CommandType::COMMAND; break; - case sheet::DataImportMode_TABLE: nSdbType = sdb::CommandType::TABLE; break; - case sheet::DataImportMode_QUERY: nSdbType = sdb::CommandType::QUERY; break; - default: - return FALSE; + case sheet::DataImportMode_SQL: nSdbType = sdb::CommandType::COMMAND; break; + case sheet::DataImportMode_TABLE: nSdbType = sdb::CommandType::TABLE; break; + case sheet::DataImportMode_QUERY: nSdbType = sdb::CommandType::QUERY; break; + default: + return NULL; } - BOOL bSuccess = FALSE; + + ScDPTableDataCache* pCache = GetExistDPObjectCache( pDoc ); + + if ( pCache && ( nID < 0 || nID == pCache->GetId() ) ) + return pCache; + + if ( pCache == NULL ) + pCache = new ScDPTableDataCache( pDoc ); + + uno::Reference xRowSet ; try { - pImpl->xRowSet = uno::Reference( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), - uno::UNO_QUERY); - uno::Reference xRowProp( pImpl->xRowSet, uno::UNO_QUERY ); + xRowSet = uno::Reference( + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), + uno::UNO_QUERY); + uno::Reference xRowProp( xRowSet, uno::UNO_QUERY ); DBG_ASSERT( xRowProp.is(), "can't get RowSet" ); if ( xRowProp.is() ) { // // set source parameters // - uno::Any aAny; - - aAny <<= rtl::OUString( pImpl->aDesc.aDBName ); + aAny <<= rtl::OUString( aDBName ); xRowProp->setPropertyValue( - rtl::OUString::createFromAscii(SC_DBPROP_DATASOURCENAME), aAny ); + rtl::OUString::createFromAscii(SC_DBPROP_DATASOURCENAME), aAny ); - aAny <<= rtl::OUString( pImpl->aDesc.aObject ); + aAny <<= rtl::OUString( aObject ); xRowProp->setPropertyValue( - rtl::OUString::createFromAscii(SC_DBPROP_COMMAND), aAny ); + rtl::OUString::createFromAscii(SC_DBPROP_COMMAND), aAny ); aAny <<= nSdbType; xRowProp->setPropertyValue( - rtl::OUString::createFromAscii(SC_DBPROP_COMMANDTYPE), aAny ); + rtl::OUString::createFromAscii(SC_DBPROP_COMMANDTYPE), aAny ); - uno::Reference xExecute( pImpl->xRowSet, uno::UNO_QUERY ); + uno::Reference xExecute( xRowSet, uno::UNO_QUERY ); if ( xExecute.is() ) { uno::Reference xHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString::createFromAscii( SC_SERVICE_INTHANDLER ) ), - uno::UNO_QUERY); + comphelper::getProcessServiceFactory()->createInstance( + rtl::OUString::createFromAscii( SC_SERVICE_INTHANDLER ) ), + uno::UNO_QUERY); xExecute->executeWithCompletion( xHandler ); } else - pImpl->xRowSet->execute(); - - // - // get column descriptions - // - - pImpl->nColCount = 0; - uno::Reference xMeta; - uno::Reference xMetaSupp( pImpl->xRowSet, uno::UNO_QUERY ); - if ( xMetaSupp.is() ) - xMeta = xMetaSupp->getMetaData(); - if ( xMeta.is() ) - pImpl->nColCount = xMeta->getColumnCount(); // this is the number of real columns - - uno::Reference xResSet( pImpl->xRowSet, uno::UNO_QUERY ); - if ( pImpl->nColCount > 0 && xResSet.is() ) - { - pImpl->pTypes = new sal_Int32[pImpl->nColCount]; - for (long nCol=0; nColnColCount; nCol++) - pImpl->pTypes[nCol] = xMeta->getColumnType( nCol+1 ); - - bSuccess = TRUE; - } + xRowSet->execute(); + SvNumberFormatter aFormat( pDoc->GetServiceManager(), ScGlobal::eLnge); + pCache->InitFromDataBase( xRowSet, *aFormat.GetNullDate() ); + pCache->SetId( nID ); + pDoc->AddDPObjectCache( pCache ); + DBG_TRACE1("Create a cache id = %d \n", pCache->GetId() ); } } catch ( sdbc::SQLException& rError ) { //! store error message + delete pCache; + pCache = NULL; InfoBox aInfoBox( 0, String(rError.Message) ); aInfoBox.Execute(); } catch ( uno::Exception& ) { + delete pCache; + pCache = NULL; DBG_ERROR("Unexpected exception in database"); } - if (!bSuccess) - ::comphelper::disposeComponent( pImpl->xRowSet ); + ::comphelper::disposeComponent( xRowSet ); + return pCache; +} - return bSuccess; +ScDPTableDataCache* ScImportSourceDesc::GetCache( ScDocument* pDoc, long nID ) const +{ + ScDPTableDataCache* pCache = pDoc->GetDPObjectCache( nID ); + if ( NULL == pCache && pDoc ) + pCache = GetExistDPObjectCache( pDoc); + if ( NULL == pCache ) + pCache = CreateCache( pDoc , nID ); + return pCache; } -long ScDatabaseDPData::GetColumnCount() +long ScImportSourceDesc:: GetCacheId( ScDocument* pDoc, long nID ) const +{ + ScDPTableDataCache* pCache = GetCache( pDoc, nID); + if ( NULL == pCache ) + return -1; + else + return pCache->GetId(); +} + +// ----------------------------------------------------------------------- + +ScDatabaseDPData::ScDatabaseDPData( + ScDocument* pDoc, + const ScImportSourceDesc& rImport, long nCacheId /*=-1 */ ) : + ScDPTableData(pDoc, rImport.GetCacheId( pDoc, nCacheId) ), + aCacheTable( pDoc, rImport.GetCacheId( pDoc, nCacheId)) +{ + +} + +ScDatabaseDPData::~ScDatabaseDPData() +{ +} + +void ScDatabaseDPData::DisposeData() { - return pImpl->nColCount; + //! use OpenDatabase here? + aCacheTable.clear(); } -const TypedScStrCollection& ScDatabaseDPData::GetColumnEntries(long nColumn) +long ScDatabaseDPData::GetColumnCount() { CreateCacheTable(); - return pImpl->aCacheTable.getFieldEntries(nColumn); + return GetCacheTable().getColSize(); +} + +// End Comments + +void lcl_Reset( const uno::Reference& xRowSet ) + throw(sdbc::SQLException, uno::RuntimeException) +{ + // isBeforeFirst / beforeFirst is not always available + //! query if it is allowed + + xRowSet->execute(); // restart } String ScDatabaseDPData::getDimensionName(long nColumn) @@ -247,17 +259,12 @@ String ScDatabaseDPData::getDimensionName(long nColumn) } CreateCacheTable(); - const String* pStr = pImpl->aCacheTable.getFieldName(nColumn); - if (pStr) - return *pStr; - - DBG_ERROR("getDimensionName: invalid dimension"); - return String(); + return aCacheTable.getFieldName((SCCOL)nColumn); } BOOL ScDatabaseDPData::getIsDataLayoutDimension(long nColumn) { - return ( nColumn == pImpl->nColCount ); + return ( nColumn == GetCacheTable().getColSize()); } BOOL ScDatabaseDPData::IsDateDimension(long /* nDim */) @@ -274,43 +281,39 @@ void ScDatabaseDPData::SetEmptyFlags( BOOL /* bIgnoreEmptyRows */, BOOL /* bRepe void ScDatabaseDPData::CreateCacheTable() { - if (!pImpl->aCacheTable.empty()) + if (!aCacheTable.empty()) return; - // Get null date. - if (!pImpl->pFormatter) - pImpl->pFormatter = new SvNumberFormatter(pImpl->xServiceManager, ScGlobal::eLnge); - - pImpl->aCacheTable.fillTable(pImpl->xRowSet, *pImpl->pFormatter->GetNullDate()); + aCacheTable.fillTable(); } void ScDatabaseDPData::FilterCacheTable(const vector& rCriteria, const hash_set& rCatDims) { CreateCacheTable(); - pImpl->aCacheTable.filterByPageDimension( + aCacheTable.filterByPageDimension( rCriteria, (IsRepeatIfEmpty() ? rCatDims : hash_set())); } void ScDatabaseDPData::GetDrillDownData(const vector& rCriteria, const hash_set& rCatDims, Sequence< Sequence >& rData) { CreateCacheTable(); - sal_Int32 nRowSize = pImpl->aCacheTable.getRowSize(); + sal_Int32 nRowSize = aCacheTable.getRowSize(); if (!nRowSize) return; - pImpl->aCacheTable.filterTable( + aCacheTable.filterTable( rCriteria, rData, IsRepeatIfEmpty() ? rCatDims : hash_set()); } void ScDatabaseDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) { CreateCacheTable(); - CalcResultsFromCacheTable(pImpl->aCacheTable, rInfo, bAutoShow); + CalcResultsFromCacheTable( aCacheTable, rInfo, bAutoShow); } const ScDPCacheTable& ScDatabaseDPData::GetCacheTable() const { - return pImpl->aCacheTable; + return aCacheTable; } // ----------------------------------------------------------------------- diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index 7956b68ad03f..14cafb1246f7 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -37,7 +37,6 @@ #include #include - #include "dpshttab.hxx" #include "dptabres.hxx" #include "document.hxx" @@ -46,7 +45,10 @@ #include "dpcachetable.hxx" #include "dpobject.hxx" #include "globstr.hrc" - +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +// End Comments #include #include @@ -61,55 +63,27 @@ using ::std::hash_set; // ----------------------------------------------------------------------- -class ScSheetDPData_Impl +ScSheetDPData::ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc , long nCacheId) : + ScDPTableData(pD, rDesc.GetCacheId( pD, nCacheId) ), // DataPilot Migration - Cache&&Performance + aQuery ( rDesc.aQueryParam ), + bIgnoreEmptyRows( FALSE ), + bRepeatIfEmpty(FALSE), + pSpecial(NULL), + aCacheTable( pD, rDesc.GetCacheId( pD, nCacheId)) { -public: - ScDocument* pDoc; - ScRange aRange; - ScQueryParam aQuery; - BOOL* pSpecial; // to flag special handling of query parameters in ValidQuery. - BOOL bIgnoreEmptyRows; - BOOL bRepeatIfEmpty; - BOOL* pDateDim; - SCROW nNextRow; // for iterator, within range - - ScDPCacheTable aCacheTable; - - ScSheetDPData_Impl(ScDPCollection* p) : - pSpecial(NULL), - aCacheTable(p) - { - } -}; - -// ----------------------------------------------------------------------- - -ScSheetDPData::ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc ) : - ScDPTableData(pD) -{ - pImpl = new ScSheetDPData_Impl(pD->GetDPCollection()); - pImpl->pDoc = pD; - pImpl->aRange = rDesc.aSourceRange; - pImpl->aQuery = rDesc.aQueryParam; - pImpl->bIgnoreEmptyRows = FALSE; - pImpl->bRepeatIfEmpty = FALSE; - pImpl->pDateDim = NULL; - - pImpl->nNextRow = pImpl->aRange.aStart.Row() + 1; - - SCSIZE nEntryCount(pImpl->aQuery.GetEntryCount()); - pImpl->pSpecial = new BOOL[nEntryCount]; + SCSIZE nEntryCount( aQuery.GetEntryCount()); + pSpecial = new BOOL[nEntryCount]; for (SCSIZE j = 0; j < nEntryCount; ++j ) { - ScQueryEntry& rEntry = pImpl->aQuery.GetEntry(j); + ScQueryEntry& rEntry = aQuery.GetEntry(j); if (rEntry.bDoQuery) { - pImpl->pSpecial[j] = false; + pSpecial[j] = false; if (!rEntry.bQueryByString) { if (*rEntry.pStr == EMPTY_STRING && ((rEntry.nVal == SC_EMPTYFIELDS) || (rEntry.nVal == SC_NONEMPTYFIELDS))) - pImpl->pSpecial[j] = true; + pSpecial[j] = true; } else { @@ -124,27 +98,24 @@ ScSheetDPData::ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc ) : ScSheetDPData::~ScSheetDPData() { - delete[] pImpl->pDateDim; - delete[] pImpl->pSpecial; - delete pImpl; + delete[] pSpecial; } void ScSheetDPData::DisposeData() { - pImpl->aCacheTable.clear(); + aCacheTable.clear(); } long ScSheetDPData::GetColumnCount() { CreateCacheTable(); - return pImpl->aCacheTable.getColSize(); + return aCacheTable.getColSize(); } -const TypedScStrCollection& ScSheetDPData::GetColumnEntries(long nColumn) +BOOL lcl_HasQuery( const ScQueryParam& rParam ) { - DBG_ASSERT(nColumn>=0 && nColumn < pImpl->aCacheTable.getColSize(), "ScSheetDPData: wrong column"); - CreateCacheTable(); - return pImpl->aCacheTable.getFieldEntries(nColumn); + return rParam.GetEntryCount() > 0 && + rParam.GetEntry(0).bDoQuery; } String ScSheetDPData::getDimensionName(long nColumn) @@ -156,35 +127,21 @@ String ScSheetDPData::getDimensionName(long nColumn) //return "Data"; return ScGlobal::GetRscString(STR_PIVOT_DATA); } - else if (nColumn >= pImpl->aCacheTable.getColSize()) + else if (nColumn >= aCacheTable.getColSize()) { DBG_ERROR("getDimensionName: invalid dimension"); return String(); } else { - const String* pStr = pImpl->aCacheTable.getFieldName(nColumn); - if (pStr) - return *pStr; - else return String(); + return aCacheTable.getFieldName((SCCOL)nColumn); } } -BOOL lcl_HasDateFormat( ScDocument* pDoc, const ScRange& rRange ) -{ - //! iterate formats in range? - - ScAddress aPos = rRange.aStart; - aPos.SetRow( aPos.Row() + 1 ); // below title - ULONG nFormat = pDoc->GetNumberFormat( aPos ); - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - return ( pFormatter->GetType(nFormat) & NUMBERFORMAT_DATE ) != 0; -} - BOOL ScSheetDPData::IsDateDimension(long nDim) { CreateCacheTable(); - long nColCount = pImpl->aCacheTable.getColSize(); + long nColCount = aCacheTable.getColSize(); if (getIsDataLayoutDimension(nDim)) { return FALSE; @@ -196,101 +153,165 @@ BOOL ScSheetDPData::IsDateDimension(long nDim) } else { - if (!pImpl->pDateDim) - { - pImpl->pDateDim = new BOOL[nColCount]; - ScRange aTestRange = pImpl->aRange; - for (long i = 0; i < nColCount; ++i) - { - SCCOL nCol = (SCCOL)( pImpl->aRange.aStart.Col() + i ); - aTestRange.aStart.SetCol(nCol); - aTestRange.aEnd.SetCol(nCol); - pImpl->pDateDim[i] = lcl_HasDateFormat( pImpl->pDoc, aTestRange ); - } - } - return pImpl->pDateDim[nDim]; + return aCacheTable.GetCache()->IsDateDimension( nDim); } } -UINT32 ScSheetDPData::GetNumberFormat(long nDim) +ULONG ScSheetDPData::GetNumberFormat(long nDim) { CreateCacheTable(); if (getIsDataLayoutDimension(nDim)) { return 0; } - else if (nDim >= pImpl->aCacheTable.getColSize()) + else if (nDim >= GetCacheTable().getColSize()) { DBG_ERROR("GetNumberFormat: invalid dimension"); return 0; } else { - // is queried only once per dimension from ScDPOutput -> no need to cache - - ScAddress aPos = pImpl->aRange.aStart; - aPos.SetCol( sal::static_int_cast( aPos.Col() + nDim ) ); - aPos.SetRow( aPos.Row() + 1 ); // below title - return pImpl->pDoc->GetNumberFormat( aPos ); + return GetCacheTable().GetCache()->GetNumberFormat( nDim ); } } +UINT32 ScDPTableData::GetNumberFormatByIdx( NfIndexTableOffset eIdx ) +{ + if( !mpDoc ) + return 0; + + if ( SvNumberFormatter* pFormatter = mpDoc->GetFormatTable() ) + return pFormatter->GetFormatIndex( eIdx, LANGUAGE_SYSTEM ); + + return 0; +} BOOL ScSheetDPData::getIsDataLayoutDimension(long nColumn) { CreateCacheTable(); - return (nColumn == pImpl->aCacheTable.getColSize()); + return (nColumn ==(long)( aCacheTable.getColSize())); } void ScSheetDPData::SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ) { - pImpl->bIgnoreEmptyRows = bIgnoreEmptyRows; - pImpl->bRepeatIfEmpty = bRepeatIfEmpty; + bIgnoreEmptyRows = bIgnoreEmptyRows; + bRepeatIfEmpty = bRepeatIfEmpty; } bool ScSheetDPData::IsRepeatIfEmpty() { - return pImpl->bRepeatIfEmpty; + return bRepeatIfEmpty; } void ScSheetDPData::CreateCacheTable() { // Scan and store the data from the source range. - if (!pImpl->aCacheTable.empty()) + if (!aCacheTable.empty()) // already cached. return; - pImpl->aCacheTable.fillTable(pImpl->pDoc, pImpl->aRange, pImpl->aQuery, pImpl->pSpecial, - pImpl->bIgnoreEmptyRows); + aCacheTable.fillTable( aQuery, pSpecial, + bIgnoreEmptyRows, bRepeatIfEmpty ); } void ScSheetDPData::FilterCacheTable(const vector& rCriteria, const hash_set& rCatDims) { CreateCacheTable(); - pImpl->aCacheTable.filterByPageDimension( + aCacheTable.filterByPageDimension( rCriteria, (IsRepeatIfEmpty() ? rCatDims : hash_set())); } void ScSheetDPData::GetDrillDownData(const vector& rCriteria, const hash_set& rCatDims, Sequence< Sequence >& rData) { CreateCacheTable(); - sal_Int32 nRowSize = pImpl->aCacheTable.getRowSize(); + sal_Int32 nRowSize = aCacheTable.getRowSize(); if (!nRowSize) return; - pImpl->aCacheTable.filterTable( + aCacheTable.filterTable( rCriteria, rData, IsRepeatIfEmpty() ? rCatDims : hash_set()); } void ScSheetDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) { CreateCacheTable(); - CalcResultsFromCacheTable(pImpl->aCacheTable, rInfo, bAutoShow); + CalcResultsFromCacheTable(aCacheTable, rInfo, bAutoShow); } const ScDPCacheTable& ScSheetDPData::GetCacheTable() const { - return pImpl->aCacheTable; + return aCacheTable; +} + + +// Wang Xu Ming -- 2009-8-5 +// DataPilot Migration - Cache&&Performance +ScDPTableDataCache* ScSheetSourceDesc::CreateCache( ScDocument* pDoc , long nID ) const +{ + if ( pDoc ) + { + ScDPTableDataCache* pCache = GetExistDPObjectCache( pDoc ); + if ( pCache && ( nID < 0 || nID == pCache->GetId() ) ) + return pCache; + + ULONG nErrId = CheckValidate( pDoc ); + if ( !nErrId ) + { + pCache = new ScDPTableDataCache( pDoc ); + + pCache->InitFromDoc( pDoc, aSourceRange ); + pCache->SetId( nID ); + pDoc->AddDPObjectCache( pCache ); + + DBG_TRACE1("Create a cache id = %d \n", pCache->GetId() ); + } + else + DBG_ERROR( "\n Error Create Cache" ); + return pCache; + } + return NULL; +} + +ScDPTableDataCache* ScSheetSourceDesc::GetExistDPObjectCache ( ScDocument* pDoc ) const +{ + return pDoc->GetUsedDPObjectCache( aSourceRange ); +} +ScDPTableDataCache* ScSheetSourceDesc::GetCache( ScDocument* pDoc, long nID ) const +{ + ScDPTableDataCache* pCache = pDoc->GetDPObjectCache( nID ); + if ( NULL == pCache && pDoc ) + pCache = GetExistDPObjectCache( pDoc ); + if ( NULL == pCache ) + pCache = CreateCache( pDoc ); + return pCache; +} + +long ScSheetSourceDesc:: GetCacheId( ScDocument* pDoc, long nID ) const +{ + ScDPTableDataCache* pCache = GetCache( pDoc, nID); + if ( NULL == pCache ) + return -1; + else + return pCache->GetId(); +} + +ULONG ScSheetSourceDesc::CheckValidate( ScDocument* pDoc ) const +{ + ScRange aSrcRange( aSourceRange); + if ( !pDoc ) + return STR_ERR_DATAPILOTSOURCE; + for(USHORT i= aSrcRange.aStart.Col();i <= aSrcRange.aEnd.Col();i++) + { + if ( pDoc->IsBlockEmpty( aSrcRange.aStart.Tab(), + i, aSrcRange.aStart.Row(),i, aSrcRange.aStart.Row())) + return STR_PIVOT_FIRSTROWEMPTYERR; + } + if( pDoc->IsBlockEmpty( aSrcRange.aStart.Tab(), aSrcRange.aStart.Col(), aSrcRange.aStart.Row()+1, aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row() ) ) + { + return STR_PIVOT_ONLYONEROWERR; + } + return 0; } +// End Comments // ----------------------------------------------------------------------- diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx index 41e44f84b647..a518dec5f52c 100644 --- a/sc/source/core/data/dptabdat.cxx +++ b/sc/source/core/data/dptabdat.cxx @@ -55,69 +55,6 @@ using namespace ::com::sun::star; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::std::vector; -using ::std::set; -using ::std::hash_map; - -// ----------------------------------------------------------------------- - -BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const -{ - //! pass Transliteration? - //! inline? - return bHasValue ? ( r.bHasValue && rtl::math::approxEqual( fValue, r.fValue ) ) : - ( !r.bHasValue && - ScGlobal::GetpTransliteration()->isEqual( aString, r.aString ) ); -} - -size_t ScDPItemData::Hash() const -{ - if ( bHasValue ) - return (size_t) rtl::math::approxFloor( fValue ); - else - // If we do unicode safe case insensitive hash we can drop - // ScDPItemData::operator== and use ::IsCasInsEqual - return rtl_ustr_hashCode_WithLength( aString.GetBuffer(), aString.Len() ); -} - -BOOL ScDPItemData::operator==( const ScDPItemData& r ) const -{ - if ( bHasValue ) - { - if ( r.bHasValue ) - return rtl::math::approxEqual( fValue, r.fValue ); - else - return FALSE; - } - else if ( r.bHasValue ) - return FALSE; - else - // need exact equality until we have a safe case insensitive string hash - return aString == r.aString; -} - -sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA, - const ScDPItemData& rB ) -{ - if ( rA.bHasValue ) - { - if ( rB.bHasValue ) - { - if ( rtl::math::approxEqual( rA.fValue, rB.fValue ) ) - return 0; - else if ( rA.fValue < rB.fValue ) - return -1; - else - return 1; - } - else - return -1; // values first - } - else if ( rB.bHasValue ) - return 1; // values first - else - return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString ); -} - // --------------------------------------------------------------------------- ScDPTableData::CalcInfo::CalcInfo() : @@ -127,8 +64,9 @@ ScDPTableData::CalcInfo::CalcInfo() : // --------------------------------------------------------------------------- -ScDPTableData::ScDPTableData(ScDocument* pDoc) : - mrSharedString(pDoc->GetDPCollection()->GetSharedString()) +ScDPTableData::ScDPTableData(ScDocument* pDoc, long nCacheId ) : + mpDoc ( pDoc ), + mnCacheId( nCacheId ) { nLastDateVal = nLastHier = nLastLevel = nLastRet = -1; // invalid @@ -189,7 +127,7 @@ bool ScDPTableData::IsRepeatIfEmpty() return false; } -UINT32 ScDPTableData::GetNumberFormat(long) +ULONG ScDPTableData::GetNumberFormat(long) { return 0; // default format } @@ -222,12 +160,6 @@ BOOL ScDPTableData::HasCommonElement( const ScDPItemData&, long, DBG_ERROR("HasCommonElement shouldn't be called for non-group data"); return FALSE; } - -ScSimpleSharedString& ScDPTableData::GetSharedString() -{ - return mrSharedString; -} - void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTable& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData) { @@ -246,25 +178,28 @@ void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTab long nDim = rInfo.aDataSrcCols[i]; rData.aValues.push_back( ScDPValueData() ); ScDPValueData& rVal = rData.aValues.back(); - const ScDPCacheCell* pCell = rCacheTable.getCell( - static_cast(nDim), static_cast(nRow), false); - if (pCell) - { - rVal.fValue = pCell->mbNumeric ? pCell->mfValue : 0.0; - rVal.nType = pCell->mnType; - } - else - rVal.Set(0.0, SC_VALTYPE_EMPTY); + rCacheTable.getValue( rVal, static_cast(nDim), static_cast(nRow), false); } } void ScDPTableData::ProcessRowData(CalcInfo& rInfo, CalcRowData& rData, bool bAutoShow) { + // Wang Xu Ming -- 2009-6-16 + // DataPilot Migration if (!bAutoShow) { - rInfo.pColRoot->LateInitFrom(rInfo.aColDims, rInfo.aColLevels, rData.aColData, 0, *rInfo.pInitState); - rInfo.pRowRoot->LateInitFrom(rInfo.aRowDims, rInfo.aRowLevels, rData.aRowData, 0, *rInfo.pInitState); + LateInitParams aColParams( rInfo.aColDims, rInfo.aColLevels, FALSE ); + LateInitParams aRowParams ( rInfo.aRowDims, rInfo.aRowLevels, TRUE ); + // root always init child + aColParams.SetInitChild( TRUE ); + aColParams.SetInitAllChildren( FALSE); + aRowParams.SetInitChild( TRUE ); + aRowParams.SetInitAllChildren( FALSE); + + rInfo.pColRoot->LateInitFrom( aColParams, rData.aColData,0, *rInfo.pInitState); + rInfo.pRowRoot->LateInitFrom( aRowParams, rData.aRowData, 0, *rInfo.pInitState); } + // End Comments if ( ( !rInfo.pColRoot->GetChildDimension() || rInfo.pColRoot->GetChildDimension()->IsValidEntry(rData.aColData) ) && ( !rInfo.pRowRoot->GetChildDimension() || rInfo.pRowRoot->GetChildDimension()->IsValidEntry(rData.aRowData) ) ) @@ -272,8 +207,11 @@ void ScDPTableData::ProcessRowData(CalcInfo& rInfo, CalcRowData& rData, bool bAu //! single process method with ColMembers, RowMembers and data !!! if (rInfo.pColRoot->GetChildDimension()) { - vector aEmptyData; +// Wang Xu Ming -- 2009-6-10 +// DataPilot Migration + vector aEmptyData; rInfo.pColRoot->GetChildDimension()->ProcessData(rData.aColData, NULL, aEmptyData, rData.aValues); +// End Comments } rInfo.pRowRoot->ProcessData(rData.aRowData, rInfo.pColRoot->GetChildDimension(), @@ -295,42 +233,94 @@ void ScDPTableData::CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, } } +// Wang Xu Ming -- 2009-6-10 +// DataPilot Migration void ScDPTableData::GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, - const vector& rDims, vector& rItemData) + const vector& rDims, vector< SCROW/*ScDPItemData*/>& rItemData) +// End Comments { sal_Int32 nDimSize = rDims.size(); for (sal_Int32 i = 0; i < nDimSize; ++i) { long nDim = rDims[i]; - rItemData.push_back( ScDPItemData() ); - ScDPItemData& rData = rItemData.back(); + if (getIsDataLayoutDimension(nDim)) { - rData.SetString(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("x"))); + rItemData.push_back( -1 ); continue; } - const ScDPCacheCell* pCell = rCacheTable.getCell( - static_cast(nDim), static_cast(nRow), IsRepeatIfEmpty()); - if (!pCell || pCell->mnType == SC_VALTYPE_EMPTY) - continue; + nDim = GetSourceDim( nDim ); + if ( nDim >= rCacheTable.GetCache()->GetColumnCount() ) + continue; - const String* pString = GetSharedString().getString(pCell->mnStrId); - if (!pString) - continue; + SCROW nId= rCacheTable.GetCache()->GetItemDataId( static_cast(nDim), static_cast(nRow), IsRepeatIfEmpty()); + rItemData.push_back( nId ); - rData.aString = *pString; - rData.bHasValue = false; - if (pCell->mbNumeric) - { - rData.bHasValue = true; - rData.fValue = pCell->mfValue; - } } } // ----------------------------------------------------------------------- +// Wang Xu Ming -- 2009-6-8 +// DataPilot Migration +long ScDPTableData::GetMembersCount( long nDim ) +{ + if ( nDim > MAXCOL ) + return 0; + return GetCacheTable().getFieldEntries( nDim ).size(); +} + +long ScDPTableData::GetCacheId() const +{ + return mnCacheId; +} + +const ScDPItemData* ScDPTableData::GetMemberByIndex( long nDim, long nIndex ) +{ + if ( nIndex >= GetMembersCount( nDim ) ) + return NULL; + + const ::std::vector& nMembers = GetCacheTable().getFieldEntries( nDim ); + + return GetCacheTable().GetCache()->GetItemDataById( (SCCOL) nDim, (SCROW)nMembers[nIndex] ); +} + +const ScDPItemData* ScDPTableData::GetMemberById( long nDim, long nId) +{ + + return GetCacheTable().GetCache()->GetItemDataById( (SCCOL) nDim, (SCROW)nId); +} +SCROW ScDPTableData::GetIdOfItemData( long nDim, const ScDPItemData& rData ) +{ + return GetCacheTable().GetCache()->GetIdByItemData((SCCOL) nDim, rData ); + } +const std::vector< SCROW >& ScDPTableData::GetColumnEntries( long nColumn ) +{ + return GetCacheTable().getFieldEntries( nColumn ); +} +long ScDPTableData::GetSourceDim( long nDim ) +{ + return nDim; + +} + + long ScDPTableData::Compare( long nDim, long nDataId1, long nDataId2) +{ + if ( getIsDataLayoutDimension(nDim) ) + return 0; + + long n1 = GetCacheTable().GetCache()->GetOrder( nDim, nDataId1); + long n2 = GetCacheTable().GetCache()->GetOrder( nDim, nDataId2); + if ( n1 > n2 ) + return 1; + else if ( n1 == n2 ) + return 0; + else + return -1; +} +// End Comments +// ----------------------------------------------------------------------- diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx new file mode 100644 index 000000000000..808e6afdd82a --- /dev/null +++ b/sc/source/core/data/dptablecache.cxx @@ -0,0 +1,1092 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dptablecache.cxx,v $ + * $Revision: 1.0 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" +// INCLUDE --------------------------------------------------------------- +#include "dptablecache.hxx" +#include "document.hxx" +#include "cell.hxx" +#include "globstr.hrc" + +#include +#include "dpglobal.hxx" + +#include "docoptio.hxx" //for ValidQuery +#include //for ValidQuery + +#include +#include +#include +#include +#include +const double D_TIMEFACTOR = 86400.0; + +using namespace ::com::sun::star; + +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +// ----------------------------------------------------------------------- +namespace +{ + BOOL lcl_isDate( ULONG nNumType ) + { + return ( (nNumType & NUMBERFORMAT_DATE) != 0 )? 1:0 ; + } + + BOOL lcl_Search( const std::vector& list, const ::std::vector& rOrder, const ScDPItemData& item, SCROW& rIndex) + { + rIndex = list.size(); + BOOL bFound = FALSE; + SCROW nLo = 0; + SCROW nHi = list.size() - 1; + SCROW nIndex; + long nCompare; + while (nLo <= nHi) + { + nIndex = (nLo + nHi) / 2; + nCompare = ScDPItemData::Compare( *list[rOrder[nIndex]], item ); + if (nCompare < 0) + nLo = nIndex + 1; + else + { + nHi = nIndex - 1; + if (nCompare == 0) + { + bFound = TRUE; + nLo = nIndex; + } + } + } + rIndex = nLo; + return bFound; + } + + ScDPItemData* lcl_GetItemValue(const Reference& xRow, sal_Int32 nType, long nCol, + const Date& rNullDate ) + { + short nNumType = NUMBERFORMAT_NUMBER; + try + { + String rStr = xRow->getString(nCol); + double fValue = 0.0; + switch (nType) + { + case sdbc::DataType::BIT: + case sdbc::DataType::BOOLEAN: + { + nNumType = NUMBERFORMAT_LOGICAL; + fValue = xRow->getBoolean(nCol) ? 1 : 0; + return new ScDPItemData( rStr, fValue,TRUE,nNumType); + } + break; + + case sdbc::DataType::TINYINT: + case sdbc::DataType::SMALLINT: + case sdbc::DataType::INTEGER: + case sdbc::DataType::BIGINT: + case sdbc::DataType::FLOAT: + case sdbc::DataType::REAL: + case sdbc::DataType::DOUBLE: + case sdbc::DataType::NUMERIC: + case sdbc::DataType::DECIMAL: + { + //! do the conversion here? + fValue = xRow->getDouble(nCol); + return new ScDPItemData( rStr, fValue,TRUE); + } + break; + + case sdbc::DataType::DATE: + { + nNumType = NUMBERFORMAT_DATE; + + util::Date aDate = xRow->getDate(nCol); + fValue = Date(aDate.Day, aDate.Month, aDate.Year) - rNullDate; + return new ScDPItemData( rStr, fValue, TRUE, nNumType ); + } + break; + + case sdbc::DataType::TIME: + { + nNumType = NUMBERFORMAT_TIME; + + util::Time aTime = xRow->getTime(nCol); + fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 + + aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + return new ScDPItemData( rStr,fValue, TRUE, nNumType ); + } + break; + + case sdbc::DataType::TIMESTAMP: + { + nNumType = NUMBERFORMAT_DATETIME; + + util::DateTime aStamp = xRow->getTimestamp(nCol); + fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - rNullDate ) + + ( aStamp.Hours * 3600 + aStamp.Minutes * 60 + + aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR; + return new ScDPItemData( rStr,fValue, TRUE, nNumType ); + } + break; + case sdbc::DataType::CHAR: + case sdbc::DataType::VARCHAR: + case sdbc::DataType::LONGVARCHAR: + case sdbc::DataType::SQLNULL: + case sdbc::DataType::BINARY: + case sdbc::DataType::VARBINARY: + case sdbc::DataType::LONGVARBINARY: + default: + return new ScDPItemData ( rStr ); + break; + } + } + catch (uno::Exception&) + { + } + catch ( ... ) + { + + } + return NULL; + } +} +// Wang Xu Ming -- 12/23/2008 +//Refactor cache data +ScDPItemData::ScDPItemData( const String& rS, double fV/* = 0.0*/, BOOL bHV/* = FALSE*/, const ULONG nNumFormatP /*= 0*/ , BOOL bData/* = TRUE*/) : +aString(rS), fValue(fV), nNumFormat( nNumFormatP ), +mbFlag( (MK_VAL*!!bHV) | (MK_DATA*!!bData) | (MK_ERR*!!FALSE) | (MK_DATE*!!lcl_isDate( nNumFormat ) ) ) +{ +} + +ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ): + fValue(0.0), nNumFormat( 0 ), mbFlag( 0 ) +{ + String aDocStr; + pDoc->GetString( nCol, nRow, nDocTab, aDocStr ); + + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + + ScAddress aPos( nCol, nRow, nDocTab ); + ScBaseCell* pCell = pDoc->GetCell( aPos ); + + if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() ) + SetString ( aDocStr ); //[SODC_19347] add liyi + //bErr = TRUE; //[SODC_19347] del liyi + else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) ) + { + double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nDocTab)); + ULONG nFormat = NUMBERFORMAT_NUMBER; + if ( pFormatter ) + nFormat = pFormatter->GetType( pDoc->GetNumberFormat( ScAddress( nCol, nRow, nDocTab ) ) ); + aString = aDocStr; + fValue = fVal; + mbFlag |= MK_VAL|MK_DATA; + nNumFormat = pDoc->GetNumberFormat( ScAddress( nCol, nRow, nDocTab ) ); + lcl_isDate( nFormat ) ? ( mbFlag |= MK_DATE ) : (mbFlag &= ~MK_DATE); + } + else if ( pDoc->HasData( nCol,nRow, nDocTab ) ) + SetString ( aDocStr ); +} +// End Comments + +BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const +{ //TODO: indified Date? + //! pass Transliteration? + //! inline? + return IsValue() ? ( r.IsValue() && rtl::math::approxEqual( fValue, r.fValue ) ) : + ( !r.IsValue() && + ScGlobal::GetpTransliteration()->isEqual( aString, r.aString ) ); +} + +size_t ScDPItemData::Hash() const +{ + if ( IsValue() ) + return (size_t) rtl::math::approxFloor( fValue ); + else + // If we do unicode safe case insensitive hash we can drop + // ScDPItemData::operator== and use ::IsCasInsEqual + return rtl_ustr_hashCode_WithLength( aString.GetBuffer(), aString.Len() ); +} + +BOOL ScDPItemData::operator==( const ScDPItemData& r ) const +{ + if ( IsValue() ) + { + if( HasDatePart() != r.HasDatePart() || HasDatePart() && mnDatePart != r.mnDatePart ) + return FALSE; + +// Wang Xu Ming -- 1/9/2009 +// Add Data Cache Support. +// Identify date + if ( IsDate() != r.IsDate() ) + return FALSE; + else + if ( r.IsValue() ) + return rtl::math::approxEqual( fValue, r.fValue ); + else + return FALSE; +// End Comments + } + else if ( r.IsValue() ) + return FALSE; + else + // need exact equality until we have a safe case insensitive string hash + return aString == r.aString; +} + +sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA, + const ScDPItemData& rB ) +{ + if ( rA.IsValue() ) + { + if ( rB.IsValue() ) + { + if ( rtl::math::approxEqual( rA.fValue, rB.fValue ) ) + { +// Wang Xu Ming -- 1/9/2009 +// Add Data Cache Support. +// Date > number + if ( rA.IsDate() == rB.IsDate() ) + return 0; + else + return rA.IsDate() ? 1: -1; +// End Comments + } + else if ( rA.fValue < rB.fValue ) + return -1; + else + return 1; + } + else + return -1; // values first + } + else if ( rB.IsValue() ) + return 1; // values first + else + return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString ); +} +// +//Wang Xu Ming SODC_17561 +#ifdef DEBUG +void ScDPItemData::dump() const +{ + DBG_TRACE1( "Numberformat= %o", nNumFormat ); + DBG_TRACESTR(aString ); + DBG_TRACE1( "fValue= %f", fValue ); + DBG_TRACE1( "bHasValue= %d", bHasValue ? 1:0); +} +#endif +//End + +TypedStrData* ScDPItemData::CreateTypeString( ) +{ + if ( IsValue() ) + return new TypedStrData( aString, fValue, SC_STRTYPE_VALUE ); + else + return new TypedStrData( aString ); +} + +sal_uInt8 ScDPItemData::GetType() const +{ + + if ( IsHasErr() ) + return SC_VALTYPE_ERROR; + else if ( !IsHasData() ) + return SC_VALTYPE_EMPTY; + else if ( IsValue()) + return SC_VALTYPE_VALUE; + else + return SC_VALTYPE_STRING; + +} + +BOOL ScDPItemData::IsHasData() const +{ + return !!(mbFlag&MK_DATA); +} + +BOOL ScDPItemData::IsHasErr() const +{ + return !!(mbFlag&MK_ERR); +} + +BOOL ScDPItemData::IsValue() const +{ + return !!(mbFlag&MK_VAL); +} + +String ScDPItemData::GetString() const +{ + + return aString; +} + +double ScDPItemData::GetValue() const +{ + return fValue; +} +ULONG ScDPItemData::GetNumFormat() const +{ + return nNumFormat; +} + +BOOL ScDPItemData::HasStringData() const + +{ + return IsHasData()&&!IsHasErr()&&!IsValue(); +} +BOOL ScDPItemData::IsDate() const +{ + return !!(mbFlag&MK_DATE); +} +BOOL ScDPItemData::HasDatePart() const +{ + return !!(mbFlag&MK_DATEPART); +} +void ScDPItemData::SetDate( BOOL b ) +{ + b ? ( mbFlag |= MK_DATE ) : ( mbFlag &= ~MK_DATE ); +} + +// ----------------------------------------------------------------------- +//class ScDPTableDataCache +//To cache the pivot table data source + +BOOL ScDPTableDataCache::operator== ( const ScDPTableDataCache& r ) const +{ + if ( GetColumnCount() == r.GetColumnCount() ) + { + for ( SCCOL i = 0 ; i < GetColumnCount(); i++ ) + { //check dim names + if ( GetDimensionName( i ) != r.GetDimensionName( i ) ) + return FALSE; + //check rows count + if ( GetRowCount() != r.GetRowCount() ) + return FALSE; + //check dim member values + size_t nMembersCount = GetDimMemberValues( i ).size(); + if ( GetDimMemberValues( i ).size() == r. GetDimMemberValues( i ).size() ) + { + for ( size_t j = 0; j < nMembersCount; j++ ) + { + if ( *( GetDimMemberValues( i )[j] ) == *( r.GetDimMemberValues( i )[j] ) ) + continue; + else + return FALSE; + } + } + else + return FALSE; + //check source table index + for ( SCROW k=0 ; k < GetRowCount(); k ++ ) + { + if ( GetItemDataId( i, k, FALSE ) == r.GetItemDataId( i,k,FALSE) ) + continue; + else + return FALSE; + } + } + } + return TRUE; +} + +ScDPTableDataCache::ScDPTableDataCache( ScDocument* pDoc ) : +mpDoc( pDoc ), +mpTableDataValues ( NULL ), +mpSourceData ( NULL ), +mpGlobalOrder( NULL ), +mpIndexOrder( NULL), +mnColumnCount ( 0 ) +{ + mnID = -1; +} + +ScDPTableDataCache::~ScDPTableDataCache() +{ + if ( IsValid() ) + { +// Wang Xu Ming -- 2/17/2009 +// Performance issue + USHORT nCol; + for ( nCol=0; nCol < GetColumnCount() ; nCol++ ) + { + for ( ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++ ) + delete mpTableDataValues[nCol][row]; + } + for ( nCol =0; nCol < mrLabelNames.size(); nCol++ ) + delete mrLabelNames[nCol]; +// End Comments + + mnColumnCount = 0; + delete [] mpTableDataValues; + mpTableDataValues = NULL; + delete [] mpSourceData; + mpSourceData = NULL; + delete [] mpGlobalOrder; + mpGlobalOrder = NULL; + delete [] mpIndexOrder; + mpIndexOrder = NULL; + } +} + +// ----------------------------------------------------------------------- +void ScDPTableDataCache::AddRow( ScDPItemData* pRow, USHORT nCount ) +{ + DBG_ASSERT( pRow , " empty pointer" ); + if ( !mrLabelNames.size() ) + { + mnColumnCount= nCount; + mpTableDataValues = new std::vector[ mnColumnCount ]; + mpSourceData = new std::vector[ mnColumnCount ]; + mpGlobalOrder = new std::vector[ mnColumnCount ]; + mpIndexOrder = new std::vector[ mnColumnCount ]; + + for ( USHORT i = 0; i < nCount ; i ++ ) + AddLabel( new ScDPItemData( pRow[i] ) ); + } + else + { + for ( USHORT i = 0; i < nCount && i < mnColumnCount; i ++ ) + AddData( i, new ScDPItemData( pRow[i] ) ); + } +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::IsValid() const +{ //TODO: continue check valid + return mpTableDataValues!=NULL && mpSourceData!= NULL && mnColumnCount>0; +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::InitFromDoc( ScDocument* pDoc, const ScRange& rRange ) +{ + // + SCROW nStartRow = rRange.aStart.Row(); // start of data + SCROW nEndRow = rRange.aEnd.Row(); + USHORT nStartCol = rRange.aStart.Col(); + USHORT nEndCol = rRange.aEnd.Col(); + USHORT nDocTab = rRange.aStart.Tab(); + + //init + long nOldColumCount = mnColumnCount; + mnColumnCount = nEndCol - nStartCol + 1; + if ( IsValid() ) + { + for ( USHORT nCol=0; nCol < nOldColumCount ; nCol++ ) + { + for ( ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++ ) + delete mpTableDataValues[nCol][row]; + delete mrLabelNames[nCol]; + } + delete [] mpTableDataValues; + delete [] mpSourceData; + delete [] mpGlobalOrder; + delete [] mpIndexOrder; + mrLabelNames.clear(); + } + + mpTableDataValues = new std::vector[ mnColumnCount ]; + mpSourceData = new std::vector[ mnColumnCount ]; + mpGlobalOrder = new std::vector[ mnColumnCount ]; + mpIndexOrder = new std::vector[ mnColumnCount ]; + //check valid + for ( SCROW nRow = nStartRow; nRow <= nEndRow; nRow ++ ) + { + for ( USHORT nCol = nStartCol; nCol <= nEndCol; nCol++ ) + { + if ( nRow == nStartRow ) + AddLabel( new ScDPItemData( pDoc, nRow, nCol, nDocTab ) ); + else + AddData( nCol - nStartCol, new ScDPItemData( pDoc, nRow, nCol, nDocTab ) ); + } + } + return TRUE; +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::InitFromDataBase (const Reference& xRowSet, const Date& rNullDate) +{ + if (!xRowSet.is()) + // Dont' even waste time to go any further. + return false; + try + { + Reference xMetaSupp(xRowSet, UNO_QUERY_THROW); + Reference xMeta = xMetaSupp->getMetaData(); + if (!xMeta.is()) + return false; + + long nOldColumCount = mnColumnCount; + mnColumnCount = xMeta->getColumnCount(); + if ( IsValid() ) + { + for ( USHORT nCol=0; nCol < nOldColumCount ; nCol++ ) + { + for ( ULONG row = 0 ; row < mpTableDataValues[nCol].size(); row++ ) + delete mpTableDataValues[nCol][row]; + delete mrLabelNames[nCol]; + } + delete [] mpTableDataValues; + delete [] mpSourceData; + delete [] mpGlobalOrder; + delete [] mpIndexOrder; + mrLabelNames.clear(); + } + // Get column titles and types. + mrLabelNames.reserve(mnColumnCount); + mpTableDataValues = new std::vector[ mnColumnCount ]; + mpSourceData = new std::vector[ mnColumnCount ]; + mpGlobalOrder = new std::vector[ mnColumnCount ]; + mpIndexOrder = new std::vector[ mnColumnCount ]; + + std::vector aColTypes(mnColumnCount); + + for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol) + { + String aColTitle = xMeta->getColumnLabel(nCol+1); + aColTypes[nCol] = xMeta->getColumnType(nCol+1); + AddLabel( new ScDPItemData( aColTitle) ); + } + + // Now get the data rows. + Reference xRow(xRowSet, UNO_QUERY_THROW); + xRowSet->first(); + do + { + for (sal_Int32 nCol = 0; nCol < mnColumnCount; ++nCol) + { + ScDPItemData * pNew = lcl_GetItemValue( xRow, aColTypes[nCol], nCol+1, rNullDate ); + if ( pNew ) + AddData( nCol , pNew ); + } + } + while (xRowSet->next()); + + xRowSet->beforeFirst(); + + return true; + } + catch (const Exception&) + { + return false; + } +} +// ----------------------------------------------------------------------- +ULONG ScDPTableDataCache::GetDimNumType( SCCOL nDim) const +{ + DBG_ASSERT( IsValid(), " IsValid() == false " ); + DBG_ASSERT( nDim < mnColumnCount && nDim >=0, " dimention out of bound " ); + if ( mpTableDataValues[nDim].size()==0 ) + return NUMBERFORMAT_UNDEFINED; + else + return GetNumType(mpTableDataValues[nDim][0]->nNumFormat); +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOOL *pSpecial) +{ //Copied and modified from ScTable::ValidQuery + if (!rParam.GetEntry(0).bDoQuery) + return TRUE; + BOOL bMatchWholeCell = mpDoc->GetDocOptions().IsMatchWholeCell(); + + //--------------------------------------------------------------- + + const SCSIZE nFixedBools = 32; + BOOL aBool[nFixedBools]; + BOOL aTest[nFixedBools]; + SCSIZE nEntryCount = rParam.GetEntryCount(); + BOOL* pPasst = ( nEntryCount <= nFixedBools ? &aBool[0] : new BOOL[nEntryCount] ); + BOOL* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new BOOL[nEntryCount] ); + + long nPos = -1; + SCSIZE i = 0; + CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() : + ScGlobal::GetCollator() ); + ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ? + ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration()); + + while ( (i < nEntryCount) && rParam.GetEntry(i).bDoQuery ) + { + ScQueryEntry& rEntry = rParam.GetEntry(i); + // we can only handle one single direct query + SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE ); + const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId); + + BOOL bOk = FALSE; + BOOL bTestEqual = FALSE; + + if ( pSpecial && pSpecial[i] ) + { + if (rEntry.nVal == SC_EMPTYFIELDS) + bOk = ! pCellData->IsHasData(); + else // if (rEntry.nVal == SC_NONEMPTYFIELDS) + bOk = pCellData->IsHasData(); + } + else if ( !rEntry.bQueryByString && pCellData->IsValue() ) + { // by Value + double nCellVal = pCellData->GetValue(); + + switch (rEntry.eOp) + { + case SC_EQUAL : + bOk = ::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + case SC_LESS : + bOk = (nCellVal < rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + case SC_GREATER : + bOk = (nCellVal > rEntry.nVal) && !::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + case SC_LESS_EQUAL : + bOk = (nCellVal < rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + case SC_GREATER_EQUAL : + bOk = (nCellVal > rEntry.nVal) || ::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + case SC_NOT_EQUAL : + bOk = !::rtl::math::approxEqual( nCellVal, rEntry.nVal ); + break; + default: + bOk= FALSE; + break; + } + } + else if ( (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) + || (rEntry.bQueryByString + && pCellData->HasStringData() ) + ) + { // by String + String aCellStr = pCellData->GetString(); + + BOOL bRealRegExp = (rParam.bRegExp && ((rEntry.eOp == SC_EQUAL) + || (rEntry.eOp == SC_NOT_EQUAL))); + BOOL bTestRegExp = FALSE; + if ( bRealRegExp || bTestRegExp ) + { + xub_StrLen nStart = 0; + xub_StrLen nEnd = aCellStr.Len(); + BOOL bMatch = (BOOL) rEntry.GetSearchTextPtr( rParam.bCaseSens ) + ->SearchFrwrd( aCellStr, &nStart, &nEnd ); + // from 614 on, nEnd is behind the found text + if ( bMatch && bMatchWholeCell + && (nStart != 0 || nEnd != aCellStr.Len()) ) + bMatch = FALSE; // RegExp must match entire cell string + if ( bRealRegExp ) + bOk = ((rEntry.eOp == SC_NOT_EQUAL) ? !bMatch : bMatch); + else + bTestEqual = bMatch; + } + if ( !bRealRegExp ) + { + if ( rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL ) + { + if ( bMatchWholeCell ) + { + bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr ); + //Added by zhaosz,for sodc_2702,20060808 + String aStr = *rEntry.pStr;//"f*" + //modified by weihuaw,for SODC_16698 + //use another way to find "*" in aStr + sal_Bool bHasStar = sal_False; + xub_StrLen nIndex; + if( ( nIndex = aStr.Search('*') ) != STRING_NOTFOUND ) + bHasStar = sal_True; + if(bHasStar && (nIndex>0)) + { + for(i=0;(i xOff; + String aCell( pTransliteration->transliterate( + aCellStr, ScGlobal::eLnge, 0, aCellStr.Len(), + &xOff ) ); + String aQuer( pTransliteration->transliterate( + *rEntry.pStr, ScGlobal::eLnge, 0, rEntry.pStr->Len(), + &xOff ) ); + bOk = (aCell.Search( aQuer ) != STRING_NOTFOUND); + } + if ( rEntry.eOp == SC_NOT_EQUAL ) + bOk = !bOk; + } + else + { // use collator here because data was probably sorted + sal_Int32 nCompare = pCollator->compareString( + aCellStr, *rEntry.pStr ); + switch (rEntry.eOp) + { + case SC_LESS : + bOk = (nCompare < 0); + break; + case SC_GREATER : + bOk = (nCompare > 0); + break; + case SC_LESS_EQUAL : + bOk = (nCompare <= 0); + break; + case SC_GREATER_EQUAL : + bOk = (nCompare >= 0); + break; + case SC_NOT_EQUAL: + DBG_ASSERT( false , "SC_NOT_EQUAL"); + break; + case SC_TOPVAL: + case SC_BOTVAL: + case SC_TOPPERC: + case SC_BOTPERC: + default: + break; + } + } + } + } + + if (nPos == -1) + { + nPos++; + pPasst[nPos] = bOk; + pTest[nPos] = bTestEqual; + } + else + { + if (rEntry.eConnect == SC_AND) + { + pPasst[nPos] = pPasst[nPos] && bOk; + pTest[nPos] = pTest[nPos] && bTestEqual; + } + else + { + nPos++; + pPasst[nPos] = bOk; + pTest[nPos] = bTestEqual; + } + } + i++; + } + + for ( long j=1; j <= nPos; j++ ) + { + pPasst[0] = pPasst[0] || pPasst[j]; + pTest[0] = pTest[0] || pTest[j]; + } + + BOOL bRet = pPasst[0]; + if ( pPasst != &aBool[0] ) + delete [] pPasst; + if ( pTest != &aTest[0] ) + delete [] pTest; + + return bRet; +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::IsRowEmpty( SCROW nRow ) const +{ + return mbEmptyRow[ nRow ]; + +} + +// ----------------------------------------------------------------------- +bool ScDPTableDataCache::IsEmptyMember( SCROW nRow, USHORT nColumn ) const +{ + return !GetItemDataById( nColumn, GetItemDataId( nColumn, nRow, FALSE ) )->IsHasData(); +} + +BOOL ScDPTableDataCache::AddData(long nDim, ScDPItemData* pitemData) +{ + DBG_ASSERT( IsValid(), " IsValid() == false " ); + DBG_ASSERT( nDim < mnColumnCount && nDim >=0 , "dimension out of bound" ); + SCROW nIndex = 0; + + BOOL bInserted = FALSE; + + pitemData->SetDate( lcl_isDate( GetNumType( pitemData->nNumFormat ) ) ); + + if ( !lcl_Search( mpTableDataValues[nDim], mpGlobalOrder[nDim], *pitemData, nIndex ) ) + { + mpTableDataValues[nDim].push_back( pitemData ); + mpGlobalOrder[nDim].insert( mpGlobalOrder[nDim].begin()+nIndex, mpTableDataValues[nDim].size()-1 ); + DBG_ASSERT( (size_t) mpGlobalOrder[nDim][nIndex] == mpTableDataValues[nDim].size()-1 ,"ScDPTableDataCache::AddData "); + mpSourceData[nDim].push_back( mpTableDataValues[nDim].size()-1 ); + bInserted = TRUE; + } + else + mpSourceData[nDim].push_back( mpGlobalOrder[nDim][nIndex] ); +//init empty row tag + size_t nCurRow = mpSourceData[nDim].size() -1 ; + + while ( mbEmptyRow.size() <= nCurRow ) + mbEmptyRow.push_back( TRUE ); + + if ( pitemData->IsHasData() ) + mbEmptyRow[ nCurRow ] = FALSE; + + if ( !bInserted ) + delete pitemData; + + return TRUE; +} + + +String ScDPTableDataCache::GetDimensionName( USHORT nColumn ) const +{ + DBG_ASSERT( nColumn>=0 && nColumn < mrLabelNames.size()-1 , "ScDPTableDataCache::GetDimensionName"); + DBG_ASSERT( mrLabelNames.size() == static_cast (mnColumnCount+1), "ScDPTableDataCache::GetDimensionName"); + if ( nColumn+1 < mrLabelNames.size() ) + { + return mrLabelNames[nColumn+1]->aString; + } + else + return String(); +} + +void ScDPTableDataCache::AddLabel(ScDPItemData *pData) +{ + DBG_ASSERT( IsValid(), " IsValid() == false " ); + + if ( mrLabelNames.size() == 0 ) + mrLabelNames.push_back( new ScDPItemData( ScGlobal::GetRscString(STR_PIVOT_DATA) ) ); + + + //reset name if needed + String strNewName = pData->aString; + BOOL bFound = FALSE; + long nIndex = 1; + do + { + for ( long i= mrLabelNames.size()-1; i>=0; i-- ) + { + if( mrLabelNames[i]->aString == strNewName ) + { + strNewName = pData->aString; + strNewName += String::CreateFromInt32( nIndex ); + nIndex ++ ; + bFound = TRUE; + } + } + bFound = !bFound; + } + while ( !bFound ); + + pData->aString = strNewName; + mrLabelNames.push_back( pData ); +} + +SCROW ScDPTableDataCache::GetItemDataId(USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty) const +{ // + DBG_ASSERT( IsValid(), " IsValid() == false " ); + DBG_ASSERT( nDim >= 0 && nDim < mnColumnCount, "ScDPTableDataCache::GetItemDataId " ); + + if ( bRepeatIfEmpty ) + { + while ( nRow >0 && !mpTableDataValues[nDim][ mpSourceData[nDim][nRow] ]->IsHasData() ) + --nRow; + } + + return mpSourceData[nDim][nRow]; +} + +const ScDPItemData* ScDPTableDataCache::GetItemDataById(long nDim, SCROW nId) const +{ + if ( nId >= GetRowCount() ) + return maAdditionalDatas.getData( nId - GetRowCount() ); + + if ( (size_t)nId >= mpTableDataValues[nDim].size() || nDim >= mnColumnCount || nId < 0 ) + return NULL; + else + return mpTableDataValues[nDim][nId]; +} + +SCROW ScDPTableDataCache::GetRowCount() const +{ + if ( IsValid() ) + return mpSourceData[0].size(); + else + return 0; +} + +const std::vector& ScDPTableDataCache::GetDimMemberValues(SCCOL nDim) const +{ + DBG_ASSERT( nDim>=0 && nDim < mnColumnCount ," nDim < mnColumnCount "); + return mpTableDataValues[nDim]; +} + +SCROW ScDPTableDataCache::GetSortedItemDataId(SCCOL nDim, SCROW nOrder) const +{ + DBG_ASSERT ( IsValid(), "IsValid"); + DBG_ASSERT( nDim>=0 && nDim < mnColumnCount, "nDim < mnColumnCount"); + DBG_ASSERT( nOrder >= 0 && (size_t) nOrder < mpGlobalOrder[nDim].size(), "nOrder < mpGlobalOrder[nDim].size()" ); + + return mpGlobalOrder[nDim][nOrder]; +} + +ULONG ScDPTableDataCache::GetNumType(ULONG nFormat) const +{ + SvNumberFormatter* pFormatter = mpDoc->GetFormatTable(); + ULONG nType = NUMBERFORMAT_NUMBER; + if ( pFormatter ) + nType = pFormatter->GetType( nFormat ); + return nType; +} + +ULONG ScDPTableDataCache::GetNumberFormat( long nDim ) const +{ + if ( nDim >= mnColumnCount ) + return 0; + if ( mpTableDataValues[nDim].size()==0 ) + return 0; + else + return mpTableDataValues[nDim][0]->nNumFormat; +} + +BOOL ScDPTableDataCache::IsDateDimension( long nDim ) const +{ + if ( nDim >= mnColumnCount ) + return false; + else if ( mpTableDataValues[nDim].size()==0 ) + return false; + else + return mpTableDataValues[nDim][0]->IsDate(); + +} + +SCROW ScDPTableDataCache::GetDimMemberCount( SCCOL nDim ) const +{ + DBG_ASSERT( nDim>=0 && nDim < mnColumnCount ," ScDPTableDataCache::GetDimMemberCount : out of bound "); + return mpTableDataValues[nDim].size(); +} + +const ScDPItemData* ScDPTableDataCache::GetSortedItemData(SCCOL nDim, SCROW nOrder) const +{ + SCROW n = GetSortedItemDataId( nDim, nOrder ); + return GetItemDataById( nDim, n ); +} + +SCCOL ScDPTableDataCache::GetDimensionIndex(String sName) const +{ + for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong SODC_17590, SODC_18932,SODC_18827,SODC_18960,SODC_18923 + { + if ( mrLabelNames[n]->GetString() == sName ) + return (SCCOL)(n-1); + } + return -1; +} + +SCROW ScDPTableDataCache::GetIdByItemData(long nDim, String sItemData ) const +{ + if ( nDim < mnColumnCount && nDim >=0 ) + { + for ( size_t n = 0; n< mpTableDataValues[nDim].size(); n++ ) + { + if ( mpTableDataValues[nDim][n]->GetString() == sItemData ) + return n; + } + } + + ScDPItemData rData ( sItemData ); + return GetRowCount() +maAdditionalDatas.getDataId(rData); +} + +SCROW ScDPTableDataCache::GetIdByItemData( long nDim, const ScDPItemData& rData ) const +{ + if ( nDim < mnColumnCount && nDim >=0 ) + { + for ( size_t n = 0; n< mpTableDataValues[nDim].size(); n++ ) + { + if ( *mpTableDataValues[nDim][n] == rData ) + return n; + } + } + return GetRowCount() + maAdditionalDatas.getDataId(rData); +} + +SCROW ScDPTableDataCache::GetAdditionalItemID ( String sItemData ) +{ + ScDPItemData rData ( sItemData ); + return GetAdditionalItemID( rData ); +} + +SCROW ScDPTableDataCache::GetAdditionalItemID( const ScDPItemData& rData ) +{ + return GetRowCount() + maAdditionalDatas.insertData( rData ); +} + + +SCROW ScDPTableDataCache::GetOrder(long nDim, SCROW nIndex) const +{ + DBG_ASSERT( IsValid(), " IsValid() == false " ); + DBG_ASSERT( nDim >=0 && nDim < mnColumnCount, "ScDPTableDataCache::GetOrder : out of bound" ); + + if ( mpIndexOrder[nDim].size() != mpGlobalOrder[nDim].size() ) + { //not inited + SCROW i = 0; + mpIndexOrder[nDim].resize( mpGlobalOrder[nDim].size(), 0 ); + for ( size_t n = 0 ; n< mpGlobalOrder[nDim].size(); n++ ) + { + i = mpGlobalOrder[nDim][n]; + mpIndexOrder[nDim][ i ] = n; + } + } + + DBG_ASSERT( nIndex>=0 && (size_t)nIndex < mpIndexOrder[nDim].size() , "ScDPTableDataCache::GetOrder"); + return mpIndexOrder[nDim][nIndex]; +} + +ScDocument* ScDPTableDataCache::GetDoc() const +{ + return mpDoc; +}; + +long ScDPTableDataCache::GetColumnCount() const +{ + return mnColumnCount; +} +long ScDPTableDataCache::GetId() const +{ + return mnID; +} + diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 398d4d1c7e01..f19444ad2a14 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -89,7 +89,44 @@ static USHORT nFuncStrIds[12] = // passend zum enum ScSubTotalFunc STR_FUN_TEXT_VAR, // SUBTOTAL_FUNC_VAR STR_FUN_TEXT_VAR // SUBTOTAL_FUNC_VARP }; +namespace { + template < typename T > + void lcl_ResizePointVector( T & vec, size_t nSize ) + { + for ( size_t i = 0 ; i < vec.size(); i++ ) + { + if ( vec[i] ) + delete vec[i]; + } + vec.resize( nSize, NULL ); + } + BOOL lcl_SearchMember( const std::vector & list, SCROW nOrder, SCROW& rIndex) + { + rIndex = list.size(); + BOOL bFound = FALSE; + SCROW nLo = 0; + SCROW nHi = list.size() - 1; + SCROW nIndex; + while (nLo <= nHi) + { + nIndex = (nLo + nHi) / 2; + if ( list[nIndex]->GetOrder() < nOrder ) + nLo = nIndex + 1; + else + { + nHi = nIndex - 1; + if ( list[nIndex]->GetOrder() == nOrder ) + { + bFound = TRUE; + nLo = nIndex; + } + } + } + rIndex = nLo; + return bFound; + } +} // ----------------------------------------------------------------------- // @@ -196,12 +233,16 @@ BOOL ScDPRowMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) con { const ScDPResultMember* pMember1 = rDimension.GetMember(nIndex1); const ScDPResultMember* pMember2 = rDimension.GetMember(nIndex2); - +// Wang Xu Ming -- 3/17/2009 + +// make the hide item to the largest order. + if ( !pMember1->IsVisible() || !pMember2->IsVisible() ) + return pMember1->IsVisible(); + const ScDPDataMember* pDataMember1 = pMember1->GetDataRoot() ; + const ScDPDataMember* pDataMember2 = pMember2->GetDataRoot(); +// End Comments // GetDataRoot can be NULL if there was no data. // IsVisible == FALSE can happen after AutoShow. - const ScDPDataMember* pDataMember1 = pMember1->IsVisible() ? pMember1->GetDataRoot() : NULL; - const ScDPDataMember* pDataMember2 = pMember2->IsVisible() ? pMember2->GetDataRoot() : NULL; - return lcl_IsLess( pDataMember1, pDataMember2, nMeasure, bAscending ); } @@ -209,12 +250,12 @@ BOOL ScDPColMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) con { ScDPDataMember* pDataMember1 = rDimension.GetMember(nIndex1); ScDPDataMember* pDataMember2 = rDimension.GetMember(nIndex2); - - if ( pDataMember1 && !pDataMember1->IsVisible() ) //! IsColVisible? - pDataMember1 = NULL; - if ( pDataMember2 && !pDataMember2->IsVisible() ) - pDataMember2 = NULL; - + // Wang Xu Ming -- 2009-6-17 + BOOL bHide1 = pDataMember1 && !pDataMember1->IsVisible(); + BOOL bHide2 = pDataMember2 && !pDataMember2->IsVisible(); + if ( bHide1 || bHide2 ) + return !bHide1; + // End Comments return lcl_IsLess( pDataMember1, pDataMember2, nMeasure, bAscending ); } @@ -224,7 +265,7 @@ ScDPInitState::ScDPInitState() : nCount( 0 ) { pIndex = new long[SC_DAPI_MAXFIELDS]; - pData = new ScDPItemData[SC_DAPI_MAXFIELDS]; + pData = new SCROW[SC_DAPI_MAXFIELDS]; } ScDPInitState::~ScDPInitState() @@ -233,13 +274,13 @@ ScDPInitState::~ScDPInitState() delete[] pData; } -void ScDPInitState::AddMember( long nSourceIndex, const ScDPItemData& rName ) +void ScDPInitState::AddMember( long nSourceIndex, SCROW nMember ) { DBG_ASSERT( nCount < SC_DAPI_MAXFIELDS, "too many InitState members" ); if ( nCount < SC_DAPI_MAXFIELDS ) { pIndex[nCount] = nSourceIndex; - pData[nCount] = rName; + pData[nCount] = nMember; ++nCount; } } @@ -251,13 +292,13 @@ void ScDPInitState::RemoveMember() --nCount; } -const ScDPItemData* ScDPInitState::GetNameForIndex( long nIndexValue ) const +const SCROW ScDPInitState::GetNameIdForIndex( long nIndexValue ) const { for (long i=0; iGetData()->IsInGroup( rGroupData, nGroupIndex, rBaseData, nBaseIndex ); + const ScDPItemData* pData = pSource->GetItemDataById( nGroupIndex , nBaseDataId); + if ( pData ) + return pSource->GetData()->IsInGroup( rGroupData, nGroupIndex, *pData , nBaseIndex ); + else + return FALSE; +} +BOOL ScDPResultData::IsInGroup( SCROW nGroupDataId, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const +{ + const ScDPItemData* pGroupData = pSource->GetItemDataById( nGroupIndex , nGroupDataId); + if ( pGroupData ) + return pSource->GetData()->IsInGroup( *pGroupData, nGroupIndex, rBaseData , nBaseIndex ); + else + return FALSE; } -BOOL ScDPResultData::HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, +BOOL ScDPResultData::HasCommonElement(/* const ScDPItemData& rFirstData*/SCROW nFirstDataId, long nFirstIndex, const ScDPItemData& rSecondData, long nSecondIndex ) const { - return pSource->GetData()->HasCommonElement( rFirstData, nFirstIndex, rSecondData, nSecondIndex ); + const ScDPItemData* pFirstData = pSource->GetItemDataById( nFirstIndex , nFirstDataId); + if ( pFirstData ) + return pSource->GetData()->HasCommonElement( *pFirstData, nFirstIndex, rSecondData, nSecondIndex ); + else + return FALSE; +} + +ResultMembers* ScDPResultData::GetDimResultMembers( long nDim , ScDPDimension* pDim, ScDPLevel* pLevel) const +{ + if ( mpDimMembers[ nDim ] == NULL ) + { + + long nDimSource = pDim->GetDimension(); + + ResultMembers* pResultMembers = new ResultMembers(); + // global order is used to initialize aMembers, so it doesn't have to be looked at later + const ScMemberSortOrder& rGlobalOrder = pLevel->GetGlobalOrder(); + + ScDPMembers* pMembers = pLevel->GetMembersObject(); + long nMembCount = pMembers->getCount(); + for ( long i=0; igetByIndex(nSorted); + if ( NULL == pResultMembers->FindMember( pMember->GetItemDataId() ) ) + { + ScDPParentDimData* pNew = new ScDPParentDimData( i, pDim, pLevel, pMember ); + pResultMembers->InsertMember( pNew ); + } + } + + mpDimMembers[ nDim ] = pResultMembers; + } + return mpDimMembers[ nDim ]; + } // ----------------------------------------------------------------------- -ScDPResultMember::ScDPResultMember( const ScDPResultData* pData, const ScDPDimension* pDim, - const ScDPLevel* pLev, const ScDPMember* pDesc, +ScDPResultMember::ScDPResultMember( const ScDPResultData* pData, const ScDPParentDimData& rParentDimData , BOOL bForceSub ) : pResultData( pData ), - pParentDim( pDim ), - pParentLevel( pLev ), - pMemberDesc( pDesc ), + aParentDimData( rParentDimData ), pChildDimension( NULL ), pDataRoot( NULL ), bHasElements( FALSE ), bForceSubTotal( bForceSub ), bHasHiddenDetails( FALSE ), bInitialized( FALSE ), + nMemberStep( 1 ), bAutoHidden( FALSE ) { // pParentLevel/pMemberDesc is 0 for root members } +ScDPResultMember::ScDPResultMember( const ScDPResultData* pData, + BOOL bForceSub ) : + pResultData( pData ), + pChildDimension( NULL ), + pDataRoot( NULL ), + bHasElements( FALSE ), + bForceSubTotal( bForceSub ), + bHasHiddenDetails( FALSE ), + bInitialized( FALSE ), + nMemberStep( 1 ), + bAutoHidden( FALSE ) +{ +} ScDPResultMember::~ScDPResultMember() { delete pChildDimension; @@ -925,6 +1028,7 @@ ScDPResultMember::~ScDPResultMember() String ScDPResultMember::GetName() const { + const ScDPMember* pMemberDesc = GetDPMember(); if (pMemberDesc) return pMemberDesc->GetNameStr(); else @@ -933,22 +1037,23 @@ String ScDPResultMember::GetName() const void ScDPResultMember::FillItemData( ScDPItemData& rData ) const { + const ScDPMember* pMemberDesc = GetDPMember(); if (pMemberDesc) pMemberDesc->FillItemData( rData ); else rData.SetString( ScGlobal::GetRscString(STR_PIVOT_TOTAL) ); // root member } -BOOL ScDPResultMember::IsNamedItem( const ScDPItemData& r ) const +BOOL ScDPResultMember::IsNamedItem( SCROW nIndex ) const { //! store ScDPMember pointer instead of ScDPMember ??? - + const ScDPMember* pMemberDesc = GetDPMember(); if (pMemberDesc) - return ((ScDPMember*)pMemberDesc)->IsNamedItem( r ); + return ((ScDPMember*)pMemberDesc)->IsNamedItem( nIndex ); return FALSE; } -bool ScDPResultMember::IsValidEntry( const vector& aMembers ) const +bool ScDPResultMember::IsValidEntry( const vector< SCROW >& aMembers ) const { if ( !IsValid() ) return false; @@ -959,8 +1064,8 @@ bool ScDPResultMember::IsValidEntry( const vector& aMembers ) cons if (aMembers.size() < 2) return false; - vector::const_iterator itr = aMembers.begin(); - vector aChildMembers(++itr, aMembers.end()); + vector::const_iterator itr = aMembers.begin(); + vector aChildMembers(++itr, aMembers.end()); return pChildDim->IsValidEntry(aChildMembers); } else @@ -968,7 +1073,8 @@ bool ScDPResultMember::IsValidEntry( const vector& aMembers ) cons } void ScDPResultMember::InitFrom( const vector& ppDim, const vector& ppLev, - size_t nPos, ScDPInitState& rInitState ) + size_t nPos, ScDPInitState& rInitState , + BOOL bInitChild /*= TRUE */) { // with LateInit, initialize only those members that have data if ( pResultData->IsLateInit() ) @@ -980,18 +1086,40 @@ void ScDPResultMember::InitFrom( const vector& ppDim, const vect return; // skip child dimension if details are not shown - if ( pMemberDesc && !pMemberDesc->getShowDetails() ) + if ( GetDPMember() && !GetDPMember()->getShowDetails() ) { + // Wang Xu Ming -- 2009-6-16 + // Show DataLayout dimention + nMemberStep = 1; + while ( nPos < ppDim.size() ) + { + if ( ppDim[nPos] ->getIsDataLayoutDimension() ) + { + if ( !pChildDimension ) + pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension->InitFrom( ppDim, ppLev, nPos, rInitState , FALSE ); + return; + } + else + { //find next dim + nPos ++; + nMemberStep ++; + } + } + // End Comments bHasHiddenDetails = TRUE; // only if there is a next dimension return; } - pChildDimension = new ScDPResultDimension( pResultData ); - pChildDimension->InitFrom( ppDim, ppLev, nPos, rInitState ); + if ( bInitChild ) + { + pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension->InitFrom( ppDim, ppLev, nPos, rInitState, TRUE ); + } } -void ScDPResultMember::LateInitFrom( const vector& ppDim, const vector& ppLev, - const vector& pItemData, size_t nPos, +void ScDPResultMember::LateInitFrom( LateInitParams& rParams/*const vector& ppDim, const vector& ppLev*/, + const vector< SCROW >& pItemData, size_t nPos, ScDPInitState& rInitState ) { // without LateInit, everything has already been initialized @@ -1000,29 +1128,52 @@ void ScDPResultMember::LateInitFrom( const vector& ppDim, const bInitialized = TRUE; - if (nPos >= ppDim.size()) + if ( rParams.IsEnd( nPos ) /*nPos >= ppDim.size()*/) // No next dimension. Bail out. return; // skip child dimension if details are not shown - if ( pMemberDesc && !pMemberDesc->getShowDetails() ) + if ( GetDPMember() && !GetDPMember()->getShowDetails() ) { + // Wang Xu Ming -- 2009-6-16 + // DataPilot Migration + // Show DataLayout dimention + nMemberStep = 1; + while ( !rParams.IsEnd( nPos ) ) + { + if ( rParams.GetDim( nPos ) ->getIsDataLayoutDimension() ) + { + if ( !pChildDimension ) + pChildDimension = new ScDPResultDimension( pResultData ); + rParams.SetInitChild( FALSE ); + pChildDimension->LateInitFrom( rParams, pItemData, nPos, rInitState ); + return; + } + else + { //find next dim + nPos ++; + nMemberStep ++; + } + } + // End Comments bHasHiddenDetails = TRUE; // only if there is a next dimension return; } // LateInitFrom is called several times... - if ( !pChildDimension ) - pChildDimension = new ScDPResultDimension( pResultData ); - - pChildDimension->LateInitFrom( ppDim, ppLev, pItemData, nPos, rInitState ); + if ( rParams.GetInitChild() ) + { + if ( !pChildDimension ) + pChildDimension = new ScDPResultDimension( pResultData ); + pChildDimension->LateInitFrom( rParams, pItemData, nPos, rInitState ); + } } BOOL ScDPResultMember::IsSubTotalInTitle(long nMeasure) const { BOOL bRet = FALSE; - if ( pChildDimension && pParentLevel && - pParentLevel->IsOutlineLayout() && pParentLevel->IsSubtotalsAtTop() ) + if ( pChildDimension && /*pParentLevel*/GetParentLevel() && + /*pParentLevel*/GetParentLevel()->IsOutlineLayout() && /*pParentLevel*/GetParentLevel()->IsSubtotalsAtTop() ) { long nUserSubStart; long nSubTotals = GetSubTotalCount( &nUserSubStart ); @@ -1044,7 +1195,7 @@ long ScDPResultMember::GetSize(long nMeasure) const { if ( !IsVisible() ) return 0; - + const ScDPLevel* pParentLevel = GetParentLevel(); long nExtraSpace = 0; if ( pParentLevel && pParentLevel->IsAddEmpty() ) ++nExtraSpace; @@ -1081,7 +1232,7 @@ BOOL ScDPResultMember::IsVisible() const { // not initialized -> shouldn't be there at all // (allocated only to preserve ordering) - + const ScDPLevel* pParentLevel = GetParentLevel(); return ( bHasElements || ( pParentLevel && pParentLevel->getShowEmpty() ) ) && IsValid() && bInitialized; } @@ -1090,6 +1241,7 @@ BOOL ScDPResultMember::IsValid() const // non-Valid members are left out of calculation // was member set no invisible at the DataPilotSource? + const ScDPMember* pMemberDesc =GetDPMember(); if ( pMemberDesc && !pMemberDesc->getIsVisible() ) return FALSE; @@ -1112,6 +1264,8 @@ long ScDPResultMember::GetSubTotalCount( long* pUserSubStart ) const if ( pUserSubStart ) *pUserSubStart = 0; // default + const ScDPLevel* pParentLevel = GetParentLevel(); + if ( bForceSubTotal ) // set if needed for root members return 1; // grand total is always "automatic" else if ( pParentLevel ) @@ -1135,8 +1289,8 @@ long ScDPResultMember::GetSubTotalCount( long* pUserSubStart ) const return 0; } -void ScDPResultMember::ProcessData( const vector& aChildMembers, const ScDPResultDimension* pDataDim, - const vector& aDataMembers, const vector& aValues ) +void ScDPResultMember::ProcessData( const vector< SCROW >& aChildMembers, const ScDPResultDimension* pDataDim, + const vector< SCROW >& aDataMembers, const vector& aValues ) { SetHasElements(); @@ -1159,6 +1313,8 @@ void ScDPResultMember::ProcessData( const vector& aChildMembers, c if ( !nUserSubCount || !pChildDimension ) nUserSubCount = 1; + const ScDPLevel* pParentLevel = GetParentLevel(); + for (long nUserPos=0; nUserPos