diff options
236 files changed, 4961 insertions, 1927 deletions
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index 359313e0de6d..23a6c92673e7 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.libreoffice.impressremote" - android:versionCode="6" - android:versionName="1.0.4+ Impress Remote" > + android:versionCode="8" + android:versionName="1.0.6+ Impress Remote" + android:installLocation="auto" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.BLUETOOTH" /> diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java index be82eeb99a7f..8f172e5dada4 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java @@ -75,7 +75,6 @@ public class BlankScreenFragment extends SherlockFragment { aListener); v.findViewById(R.id.blankscreen_return).setOnClickListener(aListener); mCommunicationService.getTransmitter().blankScreen(); - // TODO Auto-generated method stub return v; } diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java index d3a0352cea1c..51e590f1d3ab 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java @@ -529,12 +529,6 @@ public class PresentationActivity extends SherlockFragmentActivity { mActionBarManager.hidePopups(); return super.onInterceptTouchEvent(aEvent); } - - @Override - public boolean onTouchEvent(MotionEvent aEvent) { - return super.onTouchEvent(aEvent); - } - } private BroadcastReceiver mListener = new BroadcastReceiver() { diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index bb24d40a7ced..8f1ba7de6584 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -21,10 +21,7 @@ import android.content.IntentFilter; import android.content.ServiceConnection; import android.content.res.Configuration; import android.graphics.Bitmap; -import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.RectF; import android.os.Bundle; import android.os.IBinder; import android.support.v4.content.LocalBroadcastManager; @@ -38,7 +35,6 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ImageView; import android.widget.TextView; - import com.actionbarsherlock.app.SherlockFragment; public class PresentationFragment extends SherlockFragment { @@ -100,7 +96,7 @@ public class PresentationFragment extends SherlockFragment { mNotes = (WebView) v.findViewById(R.id.presentation_notes); String summary = "<html><body>This is just a test<br/><ul><li>And item</li><li>And again</li></ul>More text<br/>Blabla<br/>Blabla<br/>blabla<br/>Blabla</body></html>"; - mNotes.loadData(summary, "text/html", null); + mNotes.loadDataWithBaseURL(null, summary, "text/html", "UTF-8", null); mNotes.setBackgroundColor(Color.TRANSPARENT); mTopView = (CoverFlow) v.findViewById(R.id.presentation_coverflow); @@ -156,8 +152,8 @@ public class PresentationFragment extends SherlockFragment { // int aSlide = mCommunicationService.getSlideShow().getCurrentSlide(); mNumberText.setText((aPosition + 1) + "/" + mCommunicationService.getSlideShow().getSize()); - mNotes.loadData(mCommunicationService.getSlideShow() - .getNotes(aPosition), "text/html", null); + mNotes.loadDataWithBaseURL(null, mCommunicationService.getSlideShow() + .getNotes(aPosition), "text/html", "UTF-8", null); } // -------------------------------------------------- RESIZING LISTENER ---- @@ -281,8 +277,8 @@ public class PresentationFragment extends SherlockFragment { CommunicationService.MSG_SLIDE_NOTES)) { int aPosition = aIntent.getExtras().getInt("slide_number"); if ( aPosition == mTopView.getSelectedItemPosition() ) { - mNotes.loadData(mCommunicationService.getSlideShow() - .getNotes(aPosition), "text/html", null); + mNotes.loadDataWithBaseURL(null, mCommunicationService.getSlideShow() + .getNotes(aPosition), "text/html", "UTF-8", null); } } @@ -306,24 +302,7 @@ public class PresentationFragment extends SherlockFragment { @Override protected Bitmap createBitmap(int position) { - Bitmap aBitmap = mSlideShow.getImage(position); - final int borderWidth = 8; - - Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); - p.setShadowLayer(borderWidth, 0, 0, Color.BLACK); - - RectF aRect = new RectF(borderWidth, borderWidth, borderWidth - + aBitmap.getWidth(), borderWidth - + aBitmap.getHeight()); - Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 - * borderWidth, aBitmap.getHeight() + 2 - * borderWidth, aBitmap.getConfig()); - Canvas canvas = new Canvas(aOut); - canvas.drawColor(getResources().getColor(R.color.light_grey)); - canvas.drawRect(aRect, p); - canvas.drawBitmap(aBitmap, null, aRect, null); - - return aOut; + return mSlideShow.getImage(position); } } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java index 1b8c044fcc06..3b0f6842ba76 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/SelectorActivity.java @@ -171,7 +171,6 @@ public class SelectorActivity extends SherlockActivity { @Override protected void onPause() { - // TODO Auto-generated method stub super.onPause(); if (mCommunicationService != null) { mCommunicationService.stopSearching(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java index 56d5bad6ca3a..471e96bedcf6 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java @@ -18,7 +18,6 @@ public class SettingsActivity extends SherlockPreferenceActivity { // but build with sdk 15 @Override protected void onCreate(Bundle savedInstanceState) { - // TODO Auto-generated method stub super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); addPreferencesFromResource(R.xml.preferences); diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java index d1f248761454..c939973c106d 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java @@ -82,17 +82,6 @@ public class ThumbnailFragment extends SherlockFragment { mCurrentText = null; } - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - } - - @Override - public void onPause() { - super.onPause(); - } - private void setSelected(int position) { formatUnselected(mCurrentImage, mCurrentText); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java index ce5e3ad0e946..198b87332af6 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Client.java @@ -58,7 +58,7 @@ public abstract class Client { Thread t = new Thread() { public void run() { listen(); - }; + } }; t.start(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index 5b326612b313..8028f00ea956 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -33,7 +33,7 @@ public class CommunicationService extends Service implements Runnable { public enum State { DISCONNECTED, SEARCHING, CONNECTING, CONNECTED - }; + } /** * Get the publicly visible device name -- generally the bluetooth name, diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java index 5a6316ed237e..4ba252f406ea 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java @@ -99,13 +99,13 @@ public class Receiver { } } else if (aInstruction.equals("slide_notes")) { int aSlideNumber = Integer.parseInt(aCommand.get(1)); - String aNotes = new String(); + StringBuilder aNotes = new StringBuilder(); for (int i = 2; i < aCommand.size(); i++) { - aNotes += aCommand.get(i); + aNotes.append(aCommand.get(i)); } // Store image internally - mSlideShow.putNotes(aSlideNumber, aNotes); + mSlideShow.putNotes(aSlideNumber, aNotes.toString()); Intent aIntent = new Intent( CommunicationService.MSG_SLIDE_NOTES); diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java index 82172beb427b..77e6eb3fcc7f 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java @@ -12,7 +12,7 @@ public class Server { public enum Protocol { NETWORK, BLUETOOTH - }; + } private Protocol mProtocol; private String mAddress; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java index 703069ce0f31..f1726ad85474 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java @@ -63,7 +63,7 @@ public class ServerFinder { break; } } - if (i == aBuffer.length || !aCommand.equals("LOREMOTE_ADVERTISE")) { + if (i == aBuffer.length || !"LOREMOTE_ADVERTISE".equals(aCommand)) { return; } for (int j = i + 1; j < aBuffer.length; j++) { diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java index 2135dbfe9686..8b7a8e1979fc 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java @@ -13,11 +13,16 @@ import org.libreoffice.impressremote.R; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.RectF; import android.util.SparseArray; + public class SlideShow { - private SparseArray<byte[]> mPreviewImages = new SparseArray<byte[]>(); + private SparseArray<Bitmap> mPreviews = new SparseArray<Bitmap>(); private SparseArray<String> mNotes = new SparseArray<String>(); private int mSize = 0; @@ -45,21 +50,28 @@ public class SlideShow { } protected void putImage(int aSlide, byte[] aImage) { - mPreviewImages.put(aSlide, aImage); + Bitmap aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length); + final int borderWidth = 8; + + Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); + p.setShadowLayer(borderWidth, 0, 0, Color.BLACK); + + RectF aRect = new RectF(borderWidth, borderWidth, borderWidth + + aBitmap.getWidth(), borderWidth + + aBitmap.getHeight()); + Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 + * borderWidth, aBitmap.getHeight() + 2 + * borderWidth, aBitmap.getConfig()); + Canvas canvas = new Canvas(aOut); + canvas.drawColor(mContext.getResources().getColor(R.color.light_grey)); + canvas.drawRect(aRect, p); + canvas.drawBitmap(aBitmap, null, aRect, null); + + mPreviews.put(aSlide, aOut); } public Bitmap getImage(int aSlide) { - byte[] aImage = mPreviewImages.get(aSlide); - if (aImage == null) { - return BitmapFactory.decodeResource(mContext.getResources(), - R.drawable.image_loading); - } - Bitmap aBitmap = BitmapFactory.decodeByteArray(aImage, 0, aImage.length); - if (aBitmap == null) { - return BitmapFactory.decodeResource(mContext.getResources(), - R.drawable.image_loading); - } - return aBitmap; + return mPreviews.get(aSlide); } protected void putNotes(int aSlide, String aNotes) { diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index ffa93e407a2a..9bac160f06fb 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -745,6 +745,14 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { DoDelayedSyntaxHighlight( rTextHint.GetValue() ); } + else if( rTextHint.GetId() == TEXT_HINT_VIEWSELECTIONCHANGED ) + { + if (SfxBindings* pBindings = GetBindingsPtr()) + { + pBindings->Invalidate( SID_CUT ); + pBindings->Invalidate( SID_COPY ); + } + } } } diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index abb929f95889..65338a96697f 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -22,7 +22,7 @@ namespace VBATest() : BootstrapFixture(true, false) {} ~VBATest(){} void testMiscVBAFunctions(); - void testObjAssignWithDefaultMember(); + void testMiscOLEStuff(); // Adds code needed to register the test suite CPPUNIT_TEST_SUITE(VBATest); @@ -30,7 +30,7 @@ namespace CPPUNIT_TEST(testMiscVBAFunctions); // not much point even trying to run except on windows #if defined(WNT) - CPPUNIT_TEST(testObjAssignWithDefaultMember); + CPPUNIT_TEST(testMiscOLEStuff); #endif // End of test suite definition @@ -105,7 +105,7 @@ void VBATest::testMiscVBAFunctions() } } -void VBATest::testObjAssignWithDefaultMember() +void VBATest::testMiscOLEStuff() { bool bCanRunOleTests = hasOLEEnv(); if ( !bCanRunOleTests ) @@ -114,6 +114,7 @@ void VBATest::testObjAssignWithDefaultMember() const char* macroSource[] = { "ole_ObjAssignNoDflt.vb", "ole_ObjAssignToNothing.vb", + "ole_dfltObjDflMethod.vb", }; OUString sMacroPathURL = getURLFromSrc("/basic/qa/vba_tests/"); diff --git a/basic/qa/vba_tests/ole_dfltObjDflMethod.vb b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb new file mode 100644 index 000000000000..f24786098e48 --- /dev/null +++ b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb @@ -0,0 +1,24 @@ +Option VBASupport 1 +Option Explicit + +Rem Test accessing an object that has default object member +Rem which in turn has a default member that is a method +Function doUnitTest(TestData As String) As String +doUnitTest = "Begin" +Dim modifiedTimout As Long +Dim cnn1 As New ADODB.Connection +Dim rst1 As New ADODB.Recordset +Dim conStr As String +cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ +"Data Source=" & TestData & ";" & _ +"Extended Properties=""Excel 8.0;HDR=Yes"";" +rst1.Open "SELECT * FROM [Sheet1$];", cnn1, adOpenStatic, adLockReadOnly +Dim val +val = rst1("FirstName") +If val = "Paddy" Then + doUnitTest = "OK" +Else + doUnitTest = "Failed, expected 'Paddy' got " & val +End If + +End Function diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index d0b2c9a95f63..c39c7e69b785 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -22,6 +22,7 @@ #include <osl/process.h> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/sound.hxx> #include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <basic/sbx.hxx> @@ -1282,8 +1283,12 @@ RTLFUNC(Mid) else { aResultStr = aArgStr; - aResultStr.remove( nStartPos, nLen ); - aResultStr.insert( nStartPos, rPar.Get(4)->GetOUString().getStr(), nLen); + sal_Int32 nTmpStartPos = nStartPos; + if ( nTmpStartPos > aArgStr.getLength() ) + nTmpStartPos = aArgStr.getLength(); + else + aResultStr.remove( nTmpStartPos, nLen ); + aResultStr.insert( nTmpStartPos, rPar.Get(4)->GetOUString().getStr(), std::min(nLen, rPar.Get(4)->GetOUString().getLength())); } rPar.Get(1)->PutString( aResultStr.makeStringAndClear() ); @@ -4237,6 +4242,7 @@ RTLFUNC(Beep) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } + Sound::Beep(); } RTLFUNC(Load) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 122357733cae..ed1e5d190e1d 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -392,12 +392,14 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, case YMD: aDateStr = "JJJJ.MM.TT"; break; default: aDateStr = "MM.TT.JJJJ"; break; } - rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType, - rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); + OUString aStr( aDateStr ); // PutandConvertEntry() modifies string! + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, + rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); nCheckPos = 0; OUString aStrHHMMSS(" HH:MM:SS"); aDateStr += aStrHHMMSS; - rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType, + aStr = aDateStr; + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, rnStdDateTimeIdx, LANGUAGE_GERMAN, eLangType ); } diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index cc2fff502b01..464a6d950e60 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -617,16 +617,16 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) if ( pDflt ) { pDflt->Broadcast( SBX_HINT_DATAWANTED ); - SbxBaseRef pObj = (SbxBase*)pDflt->GetObject(); - if( pObj ) + SbxBaseRef pDfltObj = (SbxBase*)pDflt->GetObject(); + if( pDfltObj ) { - if( pObj->ISA(SbUnoObject) ) + if( pDfltObj->ISA(SbUnoObject) ) { - pUnoObj = (SbUnoObject*)(SbxBase*)pObj; - Any aAny = pUnoObj->getUnoAny(); + pUnoObj = (SbUnoObject*)(SbxBase*)pDfltObj; + Any aUnoAny = pUnoObj->getUnoAny(); - if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) - x = *(Reference< XInterface >*)aAny.getValue(); + if( aUnoAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) + x = *(Reference< XInterface >*)aUnoAny.getValue(); pElem = pDflt; } } diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index b725c95262a4..797a1dbe2f28 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -25,6 +25,7 @@ #include <cppuhelper/implbase3.hxx> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> @@ -278,6 +279,10 @@ Reference<XInterface> CanvasFactory::use( return m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( serviceName, args, xContext); } + catch (css::lang::IllegalArgumentException &) + { + return Reference<XInterface>(); + } catch (const RuntimeException &) { throw; diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index ca0e4f112bea..935bf33061c3 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -1415,10 +1415,14 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo aArgs[2].Value <<= xStream; } - xPersist->storeAsEntry( _xStorage, - xPersist->getEntryName(), - uno::Sequence< beans::PropertyValue >(), - aArgs ); + try + { + xPersist->storeAsEntry( _xStorage, xPersist->getEntryName(), uno::Sequence< beans::PropertyValue >(), aArgs ); + } + catch (const embed::WrongStateException& e) + { + SAL_WARN("comphelper", "failed to store '" << *pIter << "'"); + } } if ( bSwitchBackToLoaded ) @@ -1430,10 +1434,11 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo bResult = aCnt.CommitImageSubStorage(); } - catch (const uno::Exception&) + catch (const uno::Exception& e) { // TODO/LATER: error handling bResult = sal_False; + SAL_WARN("comphelper", "failed. Message: " << e.Message); } // the old SO6 format does not store graphical replacements diff --git a/configure.ac b/configure.ac index 5f291d2f3aec..326a2c698b90 100644 --- a/configure.ac +++ b/configure.ac @@ -9662,6 +9662,7 @@ else AC_MSG_RESULT([yes]) AC_CHECK_LIB([GL], [main], [:], [AC_MSG_ERROR(libGL not installed or functional)], []) + LDFLAGS="$LDFLAGS -lGL" AC_CHECK_LIB([GLU], [main], [:], [AC_MSG_ERROR(libGLU not installed or functional)], []) ENABLE_OPENGL=TRUE diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx index 28305287ebb8..e1a4401bf4f7 100644 --- a/connectivity/source/drivers/mozab/MDriver.cxx +++ b/connectivity/source/drivers/mozab/MDriver.cxx @@ -272,7 +272,10 @@ namespace if ( !_rFunction ) { // did not find the symbol - OSL_FAIL( ( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ).getStr() ); + rtl::OUStringBuffer aBuf; + aBuf.append( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ); + aBuf.append( sSymbolName ); + OSL_FAIL( aBuf.makeStringAndClear().getStr() ); osl_unloadModule( _rModule ); _rModule = NULL; } diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index d568b7f911fe..7165c4d1759a 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -424,11 +424,15 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, // we assume everyone (LibO & ODBC) uses UTF-16; see OPreparedStatement::setParameter BOOST_STATIC_ASSERT(sizeof(sal_Unicode) == 2); BOOST_STATIC_ASSERT(sizeof(SQLWCHAR) == 2); + BOOST_STATIC_ASSERT(sizeof(waCharArray) % 2 == 0); + // Size == number of bytes, Len == number of UTF-16 code units + const SQLLEN nMaxSize = sizeof(waCharArray); + const SQLLEN nMaxLen = sizeof(waCharArray) / sizeof(sal_Unicode); + BOOST_STATIC_ASSERT(nMaxLen * sizeof(sal_Unicode) == nMaxSize); + // read the unicode data - const SQLLEN nMaxLen = sizeof(waCharArray) / sizeof(sal_Unicode); SQLLEN pcbValue = SQL_NO_TOTAL; - - while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue >= nMaxLen) ) + while ((pcbValue == SQL_NO_TOTAL ) || (pcbValue >= nMaxSize) ) { OTools::ThrowException(_pConnection, (*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))( @@ -446,7 +450,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, SQLLEN nReadChars; OSL_ENSURE( (pcbValue < 0) || (pcbValue % 2 == 0), "ODBC: SQLGetData of SQL_C_WCHAR returned odd number of bytes"); - if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue >= nMaxLen) ) + if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue >= nMaxSize) ) { // we filled the buffer; remove the terminating null character nReadChars = nMaxLen-1; diff --git a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx index f6089cc01398..6d9abf94bd33 100644 --- a/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_resultsetmetadata.cxx @@ -407,16 +407,7 @@ sal_Int32 ResultSetMetaData::getScale( sal_Int32 column ) { (void) column; // LEM TODO This is very fishy.. Should probably return the table to which that column belongs! - rtl::OUString ret; - if( m_tableName.getLength() ) - { - OUStringBuffer buf( 128 ); - buf.append( m_schemaName ); - buf.appendAscii( "." ); - buf.append( m_tableName ); - ret = buf.makeStringAndClear(); - } - return ret; + return m_tableName; } ::rtl::OUString ResultSetMetaData::getCatalogName( sal_Int32 column ) diff --git a/connectivity/source/drivers/postgresql/pq_statement.cxx b/connectivity/source/drivers/postgresql/pq_statement.cxx index 7304b153bbe8..edf7dc3ab19b 100644 --- a/connectivity/source/drivers/postgresql/pq_statement.cxx +++ b/connectivity/source/drivers/postgresql/pq_statement.cxx @@ -654,7 +654,7 @@ bool executePostgresCommand( const rtl::OString & cmd, struct CommandData *data } } - else if( sourceTable.getLength() && -1 != sourceTable.indexOf( '.' ) ) + else if( sourceTable.getLength() > 0) { splitConcatenatedIdentifier( sourceTable, &schema, &table ); } diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx index 84d97417ab54..86872a7741cf 100644 --- a/connectivity/source/drivers/postgresql/pq_tools.cxx +++ b/connectivity/source/drivers/postgresql/pq_tools.cxx @@ -673,10 +673,20 @@ void splitConcatenatedIdentifier( const rtl::OUString & source, rtl::OUString *f { OStringVector vec; tokenizeSQL( rtl::OUStringToOString( source, RTL_TEXTENCODING_UTF8 ), vec ); - if( vec.size() == 3 ) + switch (vec.size()) { - *first = rtl::OStringToOUString( vec[0] , RTL_TEXTENCODING_UTF8 ); + case 1: + *first = OUString(); + *second = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); + break; + case 3: + *first = rtl::OStringToOUString( vec[0], RTL_TEXTENCODING_UTF8 ); *second = rtl::OStringToOUString( vec[2], RTL_TEXTENCODING_UTF8 ); + break; + default: + SAL_WARN("connectivity.drivers.postgresql", + "pq_tools::splitConcatenatedIdentifier unexpected number of tokens in identifier: " + << vec.size()); } } diff --git a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx index 3db0337c7498..0321fb9a105c 100644 --- a/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx +++ b/connectivity/source/drivers/postgresql/pq_updateableresultset.cxx @@ -450,8 +450,7 @@ void UpdateableResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) thr checkUpdate( columnIndex ); Statics &st = getStatics(); - if( x ) - m_updateableField[columnIndex-1].value <<= ( x ? st.TRUE : st.FALSE ); + m_updateableField[columnIndex-1].value <<= ( x ? st.TRUE : st.FALSE ); } diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 10ee48b1847f..0878db41159c 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -33,7 +33,7 @@ using namespace com::sun::star; /** Dialog that will allow the user to choose a Persona to use. So far there is no better possibility than just to paste the URL from -http://www.getpersona.com ... +https://addons.mozilla.org/firefox/themes ... */ class SelectPersonaDialog : public ModalDialog { @@ -59,34 +59,24 @@ SelectPersonaDialog::SelectPersonaDialog( Window *pParent ) pButton->SetClickHdl( LINK( this, SelectPersonaDialog, VisitPersonas ) ); get( m_pEdit, "persona_url" ); - m_pEdit->SetPlaceholderText( "http://www.getpersonas.com/persona/" ); + m_pEdit->SetPlaceholderText( "https://addons.mozilla.org/firefox/themes/" ); } OUString SelectPersonaDialog::GetPersonaURL() const { OUString aText( m_pEdit->GetText() ); - if ( !aText.startsWith( "http://www.getpersonas.com/" ) && - !aText.startsWith( "https://www.getpersonas.com/" ) ) - { - return OUString(); - } - - // canonicalize the URL - OUString aPersona( "persona/" ); - sal_Int32 nPersona = aText.lastIndexOf( aPersona ); - - if ( nPersona < 0 ) - return OUString(); + if ( aText.startsWith( "https://addons.mozilla.org/" ) ) + return aText; - return "http://www.getpersonas.com/persona/" + aText.copy( nPersona + aPersona.getLength() ); + return OUString(); } IMPL_LINK( SelectPersonaDialog, VisitPersonas, PushButton*, /*pButton*/ ) { uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( com::sun::star::system::SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) ); - xSystemShell->execute( "http://www.getpersonas.com", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); + xSystemShell->execute( "https://addons.mozilla.org/firefox/themes/", OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); return 0; } @@ -291,7 +281,7 @@ static OUString searchValue( const OString &rBuffer, sal_Int32 from, const OStri where += rIdentifier.getLength(); - sal_Int32 end = rBuffer.indexOf( """, where ); + sal_Int32 end = rBuffer.indexOf( """, where ); if ( end < 0 ) return OUString(); @@ -305,24 +295,24 @@ static OUString searchValue( const OString &rBuffer, sal_Int32 from, const OStri static bool parsePersonaInfo( const OString &rBuffer, OUString *pHeaderURL, OUString *pFooterURL, OUString *pTextColor, OUString *pAccentColor ) { // it is the first attribute that contains "persona=" - sal_Int32 persona = rBuffer.indexOf( "persona=\"{" ); + sal_Int32 persona = rBuffer.indexOf( "data-browsertheme=\"{" ); if ( persona < 0 ) return false; // now search inside - *pHeaderURL = searchValue( rBuffer, persona, ""headerURL":"" ); + *pHeaderURL = searchValue( rBuffer, persona, ""headerURL":"" ); if ( pHeaderURL->isEmpty() ) return false; - *pFooterURL = searchValue( rBuffer, persona, ""footerURL":"" ); + *pFooterURL = searchValue( rBuffer, persona, ""footerURL":"" ); if ( pFooterURL->isEmpty() ) return false; - *pTextColor = searchValue( rBuffer, persona, ""textcolor":"" ); + *pTextColor = searchValue( rBuffer, persona, ""textcolor":"" ); if ( pTextColor->isEmpty() ) return false; - *pAccentColor = searchValue( rBuffer, persona, ""accentcolor":"" ); + *pAccentColor = searchValue( rBuffer, persona, ""accentcolor":"" ); if ( pAccentColor->isEmpty() ) return false; diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 54cda9269439..8b8116a400de 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -38,6 +38,7 @@ #include "core_resource.hxx" #include "core_resource.hrc" #include <comphelper/namedvaluecollection.hxx> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <vcl/svapp.hxx> #include <osl/mutex.hxx> @@ -557,9 +558,9 @@ Reference< XComponent > SAL_CALL ODocumentContainer::loadComponentFromURL( const { throw IllegalArgumentException(); } - catch(const WrappedTargetException&) + catch(const WrappedTargetException &e) { - throw; + throw WrappedTargetRuntimeException(e.Message, e.Context, e.TargetException); } return xComp; } diff --git a/dictionaries b/dictionaries -Subproject e8ed1b39dd1d5911395bb70c8ea375bba96f417 +Subproject d5b2c697408bbdda73e67fc47e2793a2e6f0ec1 diff --git a/download.lst b/download.lst index 0420af96db11..36c4fe923936 100644 --- a/download.lst +++ b/download.lst @@ -1,9 +1,9 @@ -CDR_MD5SUM := 107a3d18f637b342684b3c21eb0fcd7d -export CDR_TARBALL := libcdr-0.0.11.tar.bz2 +CDR_MD5SUM := 6db2c96a4ae5977da8b84893c1441038 +export CDR_TARBALL := libcdr-0.0.12.tar.bz2 MSPUB_MD5SUM := 881c4628ec5f54d47f35d5d19e335662 export MSPUB_TARBALL := libmspub-0.0.5.tar.bz2 -VISIO_MD5SUM := 92bde158f249b9b27f76f48cc65a0242 -export VISIO_TARBALL := libvisio-0.0.25.tar.bz2 +VISIO_MD5SUM := 2f638cf6f92cec59c9205ac3cbf1702e +export VISIO_TARBALL := libvisio-0.0.26.tar.bz2 export AFMS_TARBALL := 1756c4fa6c616ae15973c104cd8cb256-Adobe-Core35_AFMs-314.tar.gz export APACHE_COMMONS_CODEC_TARBALL := af3c3acf618de6108d65fcdc92b492e1-commons-codec-1.3-src.tar.gz diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index d17476452f04..fa85105939c8 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -92,6 +92,9 @@ namespace drawinglayer void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); + /// Convert the fWidth to the same space as its coordinates. + double getTransformedLineWidth( double fWidth ) const; + /// the current clipping PolyPolygon from MaskPrimitive2D basegfx::B2DPolyPolygon maClipPolyPolygon; diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index f9d583d05fb8..ada69e6e29ed 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -378,6 +378,18 @@ namespace drawinglayer } } + double VclMetafileProcessor2D::getTransformedLineWidth( double fWidth ) const + { + // #i113922# the LineWidth is duplicated in the MetaPolylineAction, + // and also inside the SvtGraphicStroke and needs transforming into + // the same space as its co-ordinates here cf. fdo#61789 + // This is a partial fix. When a object transformation is used which + // e.g. contains a scaleX != scaleY, an unproportional scaling will happen. + const basegfx::B2DVector aDiscreteUnit( maCurrentTransformation * basegfx::B2DVector( fWidth, 0.0 ) ); + + return aDiscreteUnit.getLength(); + } + SvtGraphicStroke* VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke( const basegfx::B2DPolygon& rB2DPolygon, const basegfx::BColor* pColor, @@ -441,11 +453,7 @@ namespace drawinglayer if(pLineAttribute) { - // pre-fill fLineWidth - fLineWidth = pLineAttribute->getWidth(); - - // pre-fill fMiterLength - fMiterLength = fLineWidth; + fLineWidth = fMiterLength = getTransformedLineWidth( pLineAttribute->getWidth() ); // get Join switch(pLineAttribute->getLineJoin()) @@ -1233,11 +1241,8 @@ namespace drawinglayer mpOutputDevice->SetFillColor(); aHairLinePolyPolygon.transform(maCurrentTransformation); - // #i113922# LineWidth needs to be transformed, too - const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(rLine.getWidth(), 0.0)); - const double fDiscreteLineWidth(aDiscreteUnit.getLength()); - - LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth)); + // use the transformed line width + LineInfo aLineInfo(LINE_SOLID, basegfx::fround(getTransformedLineWidth(rLine.getWidth()))); aLineInfo.SetLineJoin(rLine.getLineJoin()); aLineInfo.SetLineCap(rLine.getLineCap()); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index aeb83c21ca86..1a50490e039a 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -268,8 +268,8 @@ namespace drawinglayer if(rTextCandidate.getFontAttribute().getRTL()) { - sal_uInt32 nRTLLayoutMode(nOldLayoutMode & ~(TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG)); - nRTLLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT; + sal_uInt32 nRTLLayoutMode(nOldLayoutMode & ~(TEXT_LAYOUT_COMPLEX_DISABLED)); + nRTLLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_TEXTORIGIN_LEFT; mpOutputDevice->SetLayoutMode(nRTLLayoutMode); } @@ -1350,7 +1350,7 @@ namespace drawinglayer { // #i101491# If the polygon complexity uses more than a given amount, do // use OuputDevice::DrawPolyLine directly; this will avoid buffering all - // decompositions in primtives (memory) and fallback to old line painting + // decompositions in primitives (memory) and fallback to old line painting // for very complex polygons, too for(sal_uInt32 a(0); a < nCount; a++) { diff --git a/editeng/inc/editeng/outliner.hxx b/editeng/inc/editeng/outliner.hxx index fcc90bb5007b..61e6a411fbe8 100644 --- a/editeng/inc/editeng/outliner.hxx +++ b/editeng/inc/editeng/outliner.hxx @@ -389,7 +389,7 @@ public: unsigned mbEndOfBullet : 1; sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; } - sal_Bool IsRTL() const; + sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; } DrawPortionInfo( const Point& rPos, diff --git a/editeng/inc/editeng/svxenum.hxx b/editeng/inc/editeng/svxenum.hxx index ff751b0a82f9..2759bebcd0ea 100644 --- a/editeng/inc/editeng/svxenum.hxx +++ b/editeng/inc/editeng/svxenum.hxx @@ -210,7 +210,21 @@ enum SvxExtNumType SVX_NUM_PAGEDESC, // Numbering from the page template SVX_NUM_BITMAP, SVX_NUM_CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz - SVX_NUM_CHARS_LOWER_LETTER_N + SVX_NUM_CHARS_LOWER_LETTER_N, + SVX_NUM_TRANSLITERATION, + SVX_NUM_NATIVE_NUMBERING, + SVX_NUM_FULL_WIDTH_ARABIC, + SVX_NUM_CIRCLE_NUMBER, + SVX_NUM_NUMBER_LOWER_ZH, + SVX_NUM_NUMBER_UPPER_ZH, + SVX_NUM_NUMBER_UPPER_ZH_TW, + SVX_NUM_TIAN_GAN_ZH, + SVX_NUM_DI_ZI_ZH, + SVX_NUM_NUMBER_TRADITIONAL_JA, + SVX_NUM_AIU_FULLWIDTH_JA, + SVX_NUM_AIU_HALFWIDTH_JA, + SVX_NUM_IROHA_FULLWIDTH_JA, + SVX_NUM_IROHA_HALFWIDTH_JA }; enum SvxCompareMode diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 740de3a76adb..0ae4491b1669 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -36,6 +36,7 @@ #include <editeng/flditem.hxx> #include <editeng/emphitem.hxx> #include <editeng/scriptspaceitem.hxx> +#include <editeng/numdef.hxx> #include <svl/itempool.hxx> #include <vcl/virdev.hxx> @@ -98,14 +99,15 @@ SfxPoolItem** GlobalEditData::GetDefItems() ppDefItems = new SfxPoolItem*[EDITITEMCOUNT]; // Paragraph attributes: - SvxNumRule aTmpNumRule( 0, 0, sal_False ); + SvxNumRule aDefaultNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, + SVX_MAX_NUM, sal_False ); ppDefItems[0] = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ); ppDefItems[1] = new SvXMLAttrContainerItem( EE_PARA_XMLATTRIBS ); ppDefItems[2] = new SfxBoolItem( EE_PARA_HANGINGPUNCTUATION, sal_False ); ppDefItems[3] = new SfxBoolItem( EE_PARA_FORBIDDENRULES, sal_True ); ppDefItems[4] = new SvxScriptSpaceItem( sal_True, EE_PARA_ASIANCJKSPACING ); - ppDefItems[5] = new SvxNumBulletItem( aTmpNumRule, EE_PARA_NUMBULLET ); + ppDefItems[5] = new SvxNumBulletItem( aDefaultNumRule, EE_PARA_NUMBULLET ); ppDefItems[6] = new SfxBoolItem( EE_PARA_HYPHENATE, sal_False ); ppDefItems[7] = new SfxBoolItem( EE_PARA_BULLETSTATE, sal_True ); ppDefItems[8] = new SvxLRSpaceItem( EE_PARA_OUTLLRSPACE ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b45c82661032..bcd3695b3da2 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4299,40 +4299,33 @@ void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, x void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex ) { - sal_Bool bCTL = sal_False; - sal_uInt8 bR2L = sal_False; + sal_Bool bR2L = sal_False; if ( nIndex == 0xFFFF ) { - bCTL = HasScriptType( nPara, i18n::ScriptType::COMPLEX ); bR2L = IsRightToLeft( nPara ); } else { - ContentNode* pNode = GetEditDoc().GetObject( nPara ); - short nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) ); - bCTL = nScriptType == i18n::ScriptType::COMPLEX; - bR2L = GetRightToLeft( nPara, nIndex + 1); // this change was discussed in issue 37190 - // it also works for issue 55927 + // this change was discussed in issue 37190 + bR2L = GetRightToLeft( nPara, nIndex + 1) % 2 ? sal_True : sal_False; + // it also works for issue 55927 } sal_uLong nLayoutMode = pOutDev->GetLayoutMode(); // We always use the left postion for DrawText() - nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL); + // Let VCL do CTL checking + nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_COMPLEX_DISABLED); - if ( !bCTL && !bR2L) + if ( !bR2L ) { // No CTL/Bidi checking neccessary nLayoutMode |= ( TEXT_LAYOUT_COMPLEX_DISABLED | TEXT_LAYOUT_BIDI_STRONG ); } else { - // CTL/Bidi checking neccessary - // Don't use BIDI_STRONG, VCL must do some checks. - nLayoutMode &= ~( TEXT_LAYOUT_COMPLEX_DISABLED | TEXT_LAYOUT_BIDI_STRONG ); - - if ( bR2L ) - nLayoutMode |= TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_TEXTORIGIN_LEFT; + //Use BIDI_STRONG, Stop VCL to perform ubidi algo on text. + nLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT | TEXT_LAYOUT_BIDI_STRONG; } pOutDev->SetLayoutMode( nLayoutMode ); diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 4fa52bded5fe..6ddec874ca97 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -950,7 +950,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, if ( !bRightToLeftPara ) aTextPos.X() = rStartPos.X() + aBulletArea.Left(); else - aTextPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Left(); + aTextPos.X() = rStartPos.X() + GetPaperSize().Width() - aBulletArea.Right(); } else { @@ -984,7 +984,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, sal_uLong nLayoutMode = pOutDev->GetLayoutMode(); nLayoutMode &= ~(TEXT_LAYOUT_BIDI_RTL|TEXT_LAYOUT_COMPLEX_DISABLED|TEXT_LAYOUT_BIDI_STRONG); if ( bRightToLeftPara ) - nLayoutMode |= TEXT_LAYOUT_BIDI_RTL; + nLayoutMode |= TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT | TEXT_LAYOUT_BIDI_STRONG; pOutDev->SetLayoutMode( nLayoutMode ); if(bStrippingPortions) @@ -1001,7 +1001,7 @@ void Outliner::PaintBullet( sal_uInt16 nPara, const Point& rStartPos, } DrawingText(aTextPos, pPara->GetText(), 0, pPara->GetText().getLength(), pBuf, - aSvxFont, nPara, 0xFFFF, 0xFF, 0, 0, false, false, true, 0, Color(), Color()); + aSvxFont, nPara, 0xFFFF, bRightToLeftPara, 0, 0, false, false, true, 0, Color(), Color()); delete[] pBuf; } @@ -2099,36 +2099,4 @@ bool Outliner::HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const return pPara && pPara->HasFlag( nFlag ); } - -sal_Bool DrawPortionInfo::IsRTL() const -{ - if(0xFF == mnBiDiLevel) - { - // Use Bidi functions from icu 2.0 to calculate if this portion - // is RTL or not. - UErrorCode nError(U_ZERO_ERROR); - UBiDi* pBidi = ubidi_openSized(mrText.Len(), 0, &nError); - nError = U_ZERO_ERROR; - - // I do not have this info here. Is it necessary? I'll have to ask MT. - const sal_uInt8 nDefaultDir = UBIDI_LTR; //IsRightToLeft( nPara ) ? UBIDI_RTL : UBIDI_LTR; - - ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(mrText.GetBuffer()), mrText.Len(), nDefaultDir, NULL, &nError); // UChar != sal_Unicode in MinGW - nError = U_ZERO_ERROR; - - int32_t nStart(0); - int32_t nEnd; - UBiDiLevel nCurrDir; - - ubidi_getLogicalRun(pBidi, nStart, &nEnd, &nCurrDir); - - ubidi_close(pBidi); - - // remember on-demand calculated state - ((DrawPortionInfo*)this)->mnBiDiLevel = nCurrDir; - } - - return (1 == (mnBiDiLevel % 2)); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 749dad5c75d2..52262c84f88e 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -34,6 +34,7 @@ #include <editeng/unofdesc.hxx> #include <editeng/unonrule.hxx> #include <editeng/editids.hrc> +#include <editeng/numdef.hxx> using ::rtl::OUString; using ::com::sun::star::util::XCloneable; @@ -494,7 +495,7 @@ com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCr } else { - SvxNumRule aDefaultRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False); + SvxNumRule aDefaultRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM , sal_False); return new SvxUnoNumberingRules( aDefaultRule ); } } diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 69b7b4c7a262..f38aeec06e95 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -978,6 +978,15 @@ void EscherPropertyContainer::CreateLineProperties( } AddOpt( ESCHER_Prop_lineJoinStyle, eLineJoin ); + if ( EscherPropertyValueHelper::GetPropertyValue( + aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LineTransparence" ) ), sal_True ) ) + { + sal_Int16 nTransparency = 0; + if ( aAny >>= nTransparency ) + AddOpt( ESCHER_Prop_lineOpacity, ( ( 100 - nTransparency ) << 16 ) / 100 ); + } + + if ( bEdge == sal_False ) { AddOpt( ESCHER_Prop_fFillOK, 0x1001 ); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 208d8b50c50e..beb774b52579 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -47,6 +47,7 @@ #include <svx/svdocapt.hxx> #include <svx/svdotable.hxx> #include <editeng/outlobj.hxx> +#include <editeng/numdef.hxx> #include <svx/svdattr.hxx> #include "svx/xattr.hxx" #include "svx/svditext.hxx" @@ -3529,6 +3530,63 @@ sal_Bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rM rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ); } break; + case 16: // Simplified Chinese. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH ); + } + break; + case 17: // Simplified Chinese with single-byte period. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH ); + rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ); + } + break; + case 18: // Double byte circle numbers. + case 19: // Wingdings white circle numbers. + case 20: // Wingdings black circle numbers. + { + rNumberFormat.SetNumberingType( SVX_NUM_CIRCLE_NUMBER ); + } + break; + case 21: // Traditional Chinese. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH_TW ); + } + break; + case 22: // Traditional Chinese with single-byte period. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_UPPER_ZH_TW ); + rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ); + } + break; + case 26: // Japanese/Korean. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH ); + } + break; + case 27: // Japanese/Korean with single-byte period. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH ); + rNumberFormat.SetSuffix( String( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ); + } + break; + case 28: // Double-byte Arabic numbers. + { + rNumberFormat.SetNumberingType( SVX_NUM_FULL_WIDTH_ARABIC ); + } + break; + case 29: // Double-byte Arabic numbers with double-byte period. + { + rNumberFormat.SetNumberingType( SVX_NUM_FULL_WIDTH_ARABIC ); + rNumberFormat.SetSuffix( OUString( sal_Unicode(0xff0e) ) ); + } + break; + case 38: // Japanese with double-byte period. + { + rNumberFormat.SetNumberingType( SVX_NUM_NUMBER_LOWER_ZH ); // No such type. Instead with Lower Chinese Number + rNumberFormat.SetSuffix( OUString( sal_Unicode(0xff0e) ) ); + } + break; } rStartNumbering = boost::optional< sal_Int16 >( nAnmScheme >> 16 ); } @@ -4226,20 +4284,20 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd eNumRuleType = SVX_RULETYPE_NUMBERING; break; case TSS_TYPE_SUBTITLE : - nLevels = 10; + nLevels = SVX_MAX_NUM; eNumRuleType = SVX_RULETYPE_NUMBERING; break; case TSS_TYPE_BODY : case TSS_TYPE_HALFBODY : case TSS_TYPE_QUARTERBODY : - nLevels = 10; + nLevels = SVX_MAX_NUM; eNumRuleType = SVX_RULETYPE_PRESENTATION_NUMBERING; break; default : case TSS_TYPE_NOTES : case TSS_TYPE_UNUSED : case TSS_TYPE_TEXT_IN_SHAPE : - nLevels = 10; + nLevels = SVX_MAX_NUM; eNumRuleType = SVX_RULETYPE_NUMBERING; break; } @@ -7272,12 +7330,8 @@ void ApplyCellAttributes( const SdrObject* pObj, Reference< XCell >& xCell ) if ( eFillStyle != XFILL_NONE ) { sal_Int16 nFillTransparence( ( (const XFillTransparenceItem&)pObj->GetMergedItem( XATTR_FILLTRANSPARENCE ) ).GetValue() ); - if ( nFillTransparence != 100 ) - { - nFillTransparence *= 100; - static const rtl::OUString sFillTransparence( String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparence" ) ) ); - xPropSet->setPropertyValue( sFillTransparence, Any( nFillTransparence ) ); - } + static const rtl::OUString sFillTransparence( String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparence" ) ) ); + xPropSet->setPropertyValue( sFillTransparence, Any( nFillTransparence ) ); } } catch( const Exception& ) diff --git a/helpcontent2 b/helpcontent2 -Subproject b182589dc00d4890dadb8a6c8d4d1901847fb0b +Subproject a2d98ee85fdba62d727c122bbcb9ca9c701f65c diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx index bb86b72262f0..1e0ae65c4b4a 100644 --- a/i18npool/inc/i18npool/languagetag.hxx +++ b/i18npool/inc/i18npool/languagetag.hxx @@ -204,10 +204,30 @@ public: */ LanguageTag & makeFallback(); - /* Test equality of two LangageTag. */ + /** Test equality of two LanguageTag, possibly resolving system locale. + + @param bResolveSystem + If TRUE, resolve empty language tags denoting the system + locale to the real locale used before comparing. + If FALSE, the behavior is identical to operator==(), system + locales are not resolved first. + */ + bool equals( const LanguageTag & rLanguageTag, bool bResolveSystem = false ) const; + + /** Test equality of two LanguageTag. + + Does NOT resolve system, i.e. if the system locale is en-US + LanguageTag("")==LanguageTag("en-US") returns false! Use + equals(...,true) instead if system locales shall be resolved. + */ bool operator==( const LanguageTag & rLanguageTag ) const; - /* Test inequality of two LangageTag. */ + /** Test inequality of two LanguageTag. + + Does NOT resolve system, i.e. if the system locale is en-US + LanguageTag("")!=LanguageTag("en-US") returns true! Use + !equals(,...true) instead if system locales shall be resolved. + */ bool operator!=( const LanguageTag & rLanguageTag ) const; private: diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index c26550b950ca..d7a6c3349146 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -101,7 +101,7 @@ void TestTextSearch::testSearches() sal_Int32 startPos = 2, endPos = 20 ; OUString searchStr( "(ab)*a(c|d)+" ); sal_Int32 fStartRes = 10, fEndRes = 18 ; - sal_Int32 bStartRes = 18, bEndRes = 14 ; + sal_Int32 bStartRes = 18, bEndRes = 10 ; // set options util::SearchOptions aOptions; diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx index bab244371063..9055d2b5dc20 100644 --- a/i18npool/source/languagetag/languagetag.cxx +++ b/i18npool/source/languagetag/languagetag.cxx @@ -995,6 +995,13 @@ LanguageTag & LanguageTag::makeFallback() } +bool LanguageTag::equals( const LanguageTag & rLanguageTag, bool bResolveSystem ) const +{ + // Compare full language tag strings. + return getBcp47( bResolveSystem) == rLanguageTag.getBcp47( bResolveSystem); +} + + bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const { // Compare full language tag strings but SYSTEM unresolved. diff --git a/i18npool/source/localedata/data/es_PE.xml b/i18npool/source/localedata/data/es_PE.xml index 2f75eb76d61d..a0a9bc44916f 100644 --- a/i18npool/source/localedata/data/es_PE.xml +++ b/i18npool/source/localedata/data/es_PE.xml @@ -34,10 +34,10 @@ <LC_CTYPE unoid="generic"> <Separators> <DateSeparator>/</DateSeparator> - <ThousandSeparator>.</ThousandSeparator> - <DecimalSeparator>,</DecimalSeparator> + <ThousandSeparator>,</ThousandSeparator> + <DecimalSeparator>.</DecimalSeparator> <TimeSeparator>:</TimeSeparator> - <Time100SecSeparator>,</Time100SecSeparator> + <Time100SecSeparator>.</Time100SecSeparator> <ListSeparator>;</ListSeparator> <LongDateDayOfWeekSeparator> </LongDateDayOfWeekSeparator> <LongDateDaySeparator> de </LongDateDaySeparator> @@ -136,10 +136,10 @@ <FormatCode>[HH]:MM:SS</FormatCode> </FormatElement> <FormatElement msgid="TimeFormatskey6" default="false" type="short" usage="TIME" formatindex="44"> - <FormatCode>MM:SS,00</FormatCode> + <FormatCode>MM:SS.00</FormatCode> </FormatElement> <FormatElement msgid="TimeFormatskey7" default="false" type="medium" usage="TIME" formatindex="45"> - <FormatCode>[HH]:MM:SS,00</FormatCode> + <FormatCode>[HH]:MM:SS.00</FormatCode> </FormatElement> <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> <FormatCode>DD/MM/AA HH:MM</FormatCode> @@ -154,46 +154,46 @@ <FormatCode>0</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> - <FormatCode>0,00</FormatCode> + <FormatCode>0.00</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> - <FormatCode>#.##0</FormatCode> + <FormatCode>#,##0</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> - <FormatCode>#.##0,00</FormatCode> + <FormatCode>#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> - <FormatCode>#.###,00</FormatCode> + <FormatCode>#,###.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey1" default="true" type="short" usage="CURRENCY" formatindex="12"> - <FormatCode>[CURRENCY]#.##0;[CURRENCY]-#.##0</FormatCode> + <FormatCode>[CURRENCY]#,##0;[CURRENCY]-#,##0</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey2" default="false" type="medium" usage="CURRENCY" formatindex="13"> - <FormatCode>[CURRENCY]#.##0,00;[CURRENCY]-#.##0,00</FormatCode> + <FormatCode>[CURRENCY]#,##0.00;[CURRENCY]-#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey3" default="false" type="medium" usage="CURRENCY" formatindex="14"> - <FormatCode>[CURRENCY]#.##0;[RED][CURRENCY]-#.##0</FormatCode> + <FormatCode>[CURRENCY]#,##0;[RED][CURRENCY]-#,##0</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey4" default="true" type="medium" usage="CURRENCY" formatindex="15"> - <FormatCode>[CURRENCY]#.##0,00;[RED][CURRENCY]-#.##0,00</FormatCode> + <FormatCode>[CURRENCY]#,##0.00;[RED][CURRENCY]-#,##0.00</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey5" default="false" type="medium" usage="CURRENCY" formatindex="16"> - <FormatCode>#.##0,00 CCC</FormatCode> + <FormatCode>#,##0.00 CCC</FormatCode> </FormatElement> <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> - <FormatCode>[CURRENCY]#.##0,--;[RED][CURRENCY]-#.##0,--</FormatCode> + <FormatCode>[CURRENCY]#,##0.--;[RED][CURRENCY]-#,##0.--</FormatCode> </FormatElement> <FormatElement msgid="PercentFormatskey1" default="true" type="short" usage="PERCENT_NUMBER" formatindex="8"> <FormatCode>0%</FormatCode> </FormatElement> <FormatElement msgid="PercentFormatskey2" default="true" type="long" usage="PERCENT_NUMBER" formatindex="9"> - <FormatCode>0,00%</FormatCode> + <FormatCode>0.00%</FormatCode> </FormatElement> <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> - <FormatCode>0,00E+000</FormatCode> + <FormatCode>0.00E+000</FormatCode> </FormatElement> <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> - <FormatCode>0,00E+00</FormatCode> + <FormatCode>0.00E+00</FormatCode> </FormatElement> </LC_FORMAT> <LC_COLLATION ref="en_US"/> diff --git a/i18npool/source/localedata/data/es_PY.xml b/i18npool/source/localedata/data/es_PY.xml index 89de1629e1fa..acbc1ecac3db 100644 --- a/i18npool/source/localedata/data/es_PY.xml +++ b/i18npool/source/localedata/data/es_PY.xml @@ -31,7 +31,7 @@ <PlatformID>generic</PlatformID> </Platform> </LC_INFO> - <LC_CTYPE ref="es_PE"/> + <LC_CTYPE ref="es_AR"/> <LC_FORMAT ref="es_AR" replaceTo="[$G-3C0A]"/> <LC_COLLATION ref="en_US"/> <LC_SEARCH ref="en_US"/> diff --git a/i18npool/source/localedata/data/es_VE.xml b/i18npool/source/localedata/data/es_VE.xml index a82138a77f47..532a3d8587f6 100644 --- a/i18npool/source/localedata/data/es_VE.xml +++ b/i18npool/source/localedata/data/es_VE.xml @@ -31,8 +31,8 @@ <PlatformID>generic</PlatformID> </Platform> </LC_INFO> - <LC_CTYPE ref="es_PY"/> - <LC_FORMAT ref="es_PE" replaceTo="[$Bs-200A]"/> + <LC_CTYPE ref="es_AR"/> + <LC_FORMAT ref="es_AR" replaceTo="[$Bs-200A]"/> <LC_COLLATION ref="en_US"/> <LC_SEARCH ref="en_US"/> <LC_INDEX ref="es_ES"/> diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 314dd5b0e0b5..997b01dd6afa 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -60,7 +60,7 @@ static sal_Int32 COMPLEX_TRANS_MASK_TMP = TransliterationModules_ignoreKiKuFollowedBySa_ja_JP | TransliterationModules_ignoreProlongedSoundMark_ja_JP; static const sal_Int32 COMPLEX_TRANS_MASK = COMPLEX_TRANS_MASK_TMP | TransliterationModules_IGNORE_KANA | TransliterationModules_FULLWIDTH_HALFWIDTH; -static const sal_Int32 SIMPLE_TRANS_MASK = ~COMPLEX_TRANS_MASK; +static const sal_Int32 SIMPLE_TRANS_MASK = ~(COMPLEX_TRANS_MASK | TransliterationModules_IGNORE_CASE | TransliterationModules_UPPERCASE_LOWERCASE | TransliterationModules_LOWERCASE_UPPERCASE); // Above 2 transliteration is simple but need to take effect in // complex transliteration @@ -124,14 +124,12 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep sSrchStr = aSrchPara.searchString; // use transliteration here - if ( xTranslit.is() && - aSrchPara.transliterateFlags & SIMPLE_TRANS_MASK ) + if ( xTranslit.is() && aSrchPara.transliterateFlags & SIMPLE_TRANS_MASK ) sSrchStr = xTranslit->transliterateString2String( - aSrchPara.searchString, 0, aSrchPara.searchString.getLength()); + aSrchPara.searchString, 0, aSrchPara.searchString.getLength()); - if ( xTranslit2.is() && - aSrchPara.transliterateFlags & COMPLEX_TRANS_MASK ) - sSrchStr2 = xTranslit2->transliterateString2String( + if ( xTranslit2.is() && aSrchPara.transliterateFlags & COMPLEX_TRANS_MASK ) + sSrchStr2 = xTranslit2->transliterateString2String( aSrchPara.searchString, 0, aSrchPara.searchString.getLength()); // When start or end of search string is a complex script type, we need to @@ -204,22 +202,32 @@ SearchResult TextSearch::searchForward( const OUString& searchStr, sal_Int32 sta newStartPos = FindPosInSeq_Impl( offset, startPos ); if( endPos < searchStr.getLength() ) - newEndPos = FindPosInSeq_Impl( offset, endPos ); + newEndPos = FindPosInSeq_Impl( offset, endPos ); else newEndPos = in_str.getLength(); sres = (this->*fnForward)( in_str, newStartPos, newEndPos ); - for ( int k = 0; k < sres.startOffset.getLength(); k++ ) + // Map offsets back to untransliterated string. + const sal_Int32 nOffsets = offset.getLength(); + if (nOffsets) { - if (sres.startOffset[k]) - sres.startOffset[k] = offset[sres.startOffset[k]]; - // JP 20.6.2001: end is ever exclusive and then don't return - // the position of the next character - return the - // next position behind the last found character! - // "a b c" find "b" must return 2,3 and not 2,4!!! - if (sres.endOffset[k]) - sres.endOffset[k] = offset[sres.endOffset[k]-1] + 1; + // For regex nGroups is the number of groups+1 with group 0 being + // the entire match. + const sal_Int32 nGroups = sres.startOffset.getLength(); + for ( sal_Int32 k = 0; k < nGroups; k++ ) + { + const sal_Int32 nStart = sres.startOffset[k]; + if (nStart > 0) + sres.startOffset[k] = (nStart < nOffsets ? offset[nStart] : (offset[nOffsets - 1] + 1)); + // JP 20.6.2001: end is ever exclusive and then don't return + // the position of the next character - return the + // next position behind the last found character! + // "a b c" find "b" must return 2,3 and not 2,4!!! + const sal_Int32 nStop = sres.endOffset[k]; + if (nStop > 0) + sres.endOffset[k] = offset[(nStop <= nOffsets ? nStop : nOffsets) - 1] + 1; + } } } else @@ -291,24 +299,34 @@ SearchResult TextSearch::searchBackward( const OUString& searchStr, sal_Int32 st // JP 20.6.2001: also the start and end positions must be corrected! if( startPos < searchStr.getLength() ) newStartPos = FindPosInSeq_Impl( offset, startPos ); - else - newStartPos = in_str.getLength(); + else + newStartPos = in_str.getLength(); if( endPos ) - newEndPos = FindPosInSeq_Impl( offset, endPos ); + newEndPos = FindPosInSeq_Impl( offset, endPos ); sres = (this->*fnBackward)( in_str, newStartPos, newEndPos ); - for ( int k = 0; k < sres.startOffset.getLength(); k++ ) + // Map offsets back to untransliterated string. + const sal_Int32 nOffsets = offset.getLength(); + if (nOffsets) { - if (sres.startOffset[k]) - sres.startOffset[k] = offset[sres.startOffset[k] - 1] + 1; - // JP 20.6.2001: end is ever exclusive and then don't return - // the position of the next character - return the - // next position behind the last found character! - // "a b c" find "b" must return 2,3 and not 2,4!!! - if (sres.endOffset[k]) - sres.endOffset[k] = offset[sres.endOffset[k]]; + // For regex nGroups is the number of groups+1 with group 0 being + // the entire match. + const sal_Int32 nGroups = sres.startOffset.getLength(); + for ( sal_Int32 k = 0; k < nGroups; k++ ) + { + const sal_Int32 nStart = sres.startOffset[k]; + if (nStart > 0) + sres.startOffset[k] = offset[(nStart <= nOffsets ? nStart : nOffsets) - 1] + 1; + // JP 20.6.2001: end is ever exclusive and then don't return + // the position of the next character - return the + // next position behind the last found character! + // "a b c" find "b" must return 2,3 and not 2,4!!! + const sal_Int32 nStop = sres.endOffset[k]; + if (nStop > 0) + sres.endOffset[k] = (nStop < nOffsets ? offset[nStop] : (offset[nOffsets - 1] + 1)); + } } } else @@ -675,21 +693,30 @@ void TextSearch::RESrchPrepare( const ::com::sun::star::util::SearchOptions& rOp // REG_NOSUB is not used anywhere => not implemented // NORM_WORD_ONLY is only used for SearchAlgorithm==Absolute // LEV_RELAXED is only used for SearchAlgorithm==Approximate - // why is even ALL_IGNORE_CASE deprecated in UNO? because of transliteration taking care of it??? - if( (rOptions.searchFlag & com::sun::star::util::SearchFlags::ALL_IGNORE_CASE) != 0) + // Note that the search flag ALL_IGNORE_CASE is deprecated in UNO + // probably because the transliteration flag IGNORE_CASE handles it as well. + if( (rOptions.searchFlag & com::sun::star::util::SearchFlags::ALL_IGNORE_CASE) != 0 + || (rOptions.transliterateFlags & TransliterationModules_IGNORE_CASE) != 0) nIcuSearchFlags |= UREGEX_CASE_INSENSITIVE; UErrorCode nIcuErr = U_ZERO_ERROR; // assumption: transliteration didn't mangle regexp control chars IcuUniString aIcuSearchPatStr( (const UChar*)rPatternStr.getStr(), rPatternStr.getLength()); #ifndef DISABLE_WORDBOUND_EMULATION // for conveniance specific syntax elements of the old regex engine are emulated - // by using regular word boundary matching \b to replace \< and \> - static const IcuUniString aChevronPattern( "\\\\<|\\\\>", -1, IcuUniString::kInvariant); - static const IcuUniString aChevronReplace( "\\\\b", -1, IcuUniString::kInvariant); - static RegexMatcher aChevronMatcher( aChevronPattern, 0, nIcuErr); - aChevronMatcher.reset( aIcuSearchPatStr); - aIcuSearchPatStr = aChevronMatcher.replaceAll( aChevronReplace, nIcuErr); - aChevronMatcher.reset(); + // - by replacing \< with "word-break followed by a look-ahead word-char" + static const IcuUniString aChevronPatternB( "\\\\<", -1, IcuUniString::kInvariant); + static const IcuUniString aChevronReplaceB( "\\\\b(?=\\\\w)", -1, IcuUniString::kInvariant); + static RegexMatcher aChevronMatcherB( aChevronPatternB, 0, nIcuErr); + aChevronMatcherB.reset( aIcuSearchPatStr); + aIcuSearchPatStr = aChevronMatcherB.replaceAll( aChevronReplaceB, nIcuErr); + aChevronMatcherB.reset(); + // - by replacing \> with "look-behind word-char followed by a word-break" + static const IcuUniString aChevronPatternE( "\\\\>", -1, IcuUniString::kInvariant); + static const IcuUniString aChevronReplaceE( "(?<=\\\\w)\\\\b", -1, IcuUniString::kInvariant); + static RegexMatcher aChevronMatcherE( aChevronPatternE, 0, nIcuErr); + aChevronMatcherE.reset( aIcuSearchPatStr); + aIcuSearchPatStr = aChevronMatcherE.replaceAll( aChevronReplaceE, nIcuErr); + aChevronMatcherE.reset(); #endif pRegexMatcher = new RegexMatcher( aIcuSearchPatStr, nIcuSearchFlags, nIcuErr); if( nIcuErr) @@ -725,6 +752,11 @@ SearchResult TextSearch::RESrchFrwrd( const OUString& searchStr, int nEndOfs = pRegexMatcher->end( nIcuErr); if( nStartOfs < nEndOfs) break; + // If the zero-length match is behind the string, do not match it again + // and again until startPos reaches there. A match behind the string is + // a "$" anchor. + if (nStartOfs == endPos) + break; // try at next position if there was a zero-length match if( ++startPos >= endPos) return aRet; @@ -769,12 +801,36 @@ SearchResult TextSearch::RESrchBkwrd( const OUString& searchStr, // find the last match int nLastPos = 0; + int nFoundEnd = 0; + int nGoodPos = 0, nGoodEnd = 0; + bool bFirst = true; do { nLastPos = pRegexMatcher->start( nIcuErr); - } while( pRegexMatcher->find( nLastPos + 1, nIcuErr)); + nFoundEnd = pRegexMatcher->end( nIcuErr); + if (nLastPos < nFoundEnd) + { + // remember last non-zero-length match + nGoodPos = nLastPos; + nGoodEnd = nFoundEnd; + } + if( nFoundEnd >= startPos) + break; + bFirst = false; + if( nFoundEnd == nLastPos) + ++nFoundEnd; + } while( pRegexMatcher->find( nFoundEnd, nIcuErr)); + + // Ignore all zero-length matches except "$" anchor on first match. + if (nGoodPos == nGoodEnd) + { + if (bFirst && nLastPos == startPos) + nGoodPos = nLastPos; + else + return aRet; + } // find last match again to get its details - pRegexMatcher->find( nLastPos, nIcuErr); + pRegexMatcher->find( nGoodPos, nIcuErr); // fill in the details of the last match const int nGroupCount = pRegexMatcher->groupCount(); diff --git a/libcdr/UnpackedTarball_cdr.mk b/libcdr/UnpackedTarball_cdr.mk index 1c77ebd1ec6b..be1e7d762a87 100644 --- a/libcdr/UnpackedTarball_cdr.mk +++ b/libcdr/UnpackedTarball_cdr.mk @@ -11,10 +11,4 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,cdr)) $(eval $(call gb_UnpackedTarball_set_tarball,cdr,$(CDR_TARBALL))) -$(eval $(call gb_UnpackedTarball_set_patchlevel,cdr,1)) - -$(eval $(call gb_UnpackedTarball_add_patches,cdr,\ - libcdr/libcdr-0.0.11-encoding.patch \ -)) - # vim: set noet sw=4 ts=4: diff --git a/libcdr/libcdr-0.0.11-encoding.patch b/libcdr/libcdr-0.0.11-encoding.patch deleted file mode 100644 index 73fa58a1a4c7..000000000000 --- a/libcdr/libcdr-0.0.11-encoding.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/src/lib/CDRParser.cpp -+++ b/src/lib/CDRParser.cpp -@@ -2415,7 +2415,8 @@ void libcdr::CDRParser::readStlt(WPXInputStream *input, unsigned length) - } - unsigned numFonts = readU32(input); - CDR_DEBUG_MSG(("CDRParser::readStlt numFonts 0x%x\n", numFonts)); -- std::map<unsigned,unsigned> fontIds; -+ std::map<unsigned,unsigned short> fontIds; -+ std::map<unsigned,unsigned short> fontEncodings; - std::map<unsigned,double> fontSizes; - for (i=0; i<numFonts; ++i) - { -@@ -2424,7 +2425,8 @@ void libcdr::CDRParser::readStlt(WPXInputStream *input, unsigned length) - input->seek(12, WPX_SEEK_CUR); - else - input->seek(20, WPX_SEEK_CUR); -- fontIds[fontStyleId] = readU32(input); -+ fontIds[fontStyleId] = readU16(input); -+ fontEncodings[fontStyleId] = readU16(input); - input->seek(8, WPX_SEEK_CUR); - fontSizes[fontStyleId] = readCoordinate(input); - if (m_version < 1000) -@@ -2578,9 +2580,12 @@ void libcdr::CDRParser::readStlt(WPXInputStream *input, unsigned length) - } - if (!fontRecordId) - continue; -- std::map<unsigned, unsigned>::const_iterator iterFontId = fontIds.find(fontRecordId); -+ std::map<unsigned, unsigned short>::const_iterator iterFontId = fontIds.find(fontRecordId); - if (iterFontId != fontIds.end()) - tmpCharStyle.m_fontId = iterFontId->second; -+ std::map<unsigned, unsigned short>::const_iterator iterCharSet = fontEncodings.find(fontRecordId); -+ if (iterCharSet != fontEncodings.end()) -+ tmpCharStyle.m_charSet = iterCharSet->second; - std::map<unsigned, double>::const_iterator iterFontSize = fontSizes.find(fontRecordId); - if (iterFontSize != fontSizes.end()) - tmpCharStyle.m_fontSize = iterFontSize->second; diff --git a/libvisio/ExternalProject_libvisio.mk b/libvisio/ExternalProject_libvisio.mk index 38627990d270..940d3cd7713d 100644 --- a/libvisio/ExternalProject_libvisio.mk +++ b/libvisio/ExternalProject_libvisio.mk @@ -31,6 +31,7 @@ $(call gb_ExternalProject_get_state_target,libvisio,build) : && export LIBWPG_INCLUDE_DIR=$(OUTDIR)/inc/external \ && export LIBXML_INCLUDE_DIR=$(OUTDIR)/inc/external \ && export ZLIB_INCLUDE_DIR=$(OUTDIR)/inc/external/zlib \ + && export ICU_INCLUDE_DIR=$(OUTDIR)/inc/external \ && $(COMPATH)/vcpackages/vcbuild.exe libvisio.vcproj "Release|Win32" \ && touch $@ else ifeq ($(VCVER),100) @@ -41,6 +42,7 @@ $(call gb_ExternalProject_get_state_target,libvisio,build) : && export LIBWPG_INCLUDE_DIR=$(OUTDIR)/inc/external \ && export LIBXML_INCLUDE_DIR=$(OUTDIR)/inc/extrenal \ && export ZLIB_INCLUDE_DIR=$(OUTDIR)/inc/external/zlib \ + && export ICU_INCLUDE_DIR=$(OUTDIR)/inc/external \ && msbuild.exe libvisio.vcxproj /p:Configuration=Release \ && touch $@ else @@ -51,6 +53,7 @@ $(call gb_ExternalProject_get_state_target,libvisio,build) : && export LIBWPG_INCLUDE_DIR=$(OUTDIR)/inc/external \ && export LIBXML_INCLUDE_DIR=$(OUTDIR)/inc/external \ && export ZLIB_INCLUDE_DIR=$(OUTDIR)/inc/external/zlib \ + && export ICU_INCLUDE_DIR=$(OUTDIR)/inc/external \ && msbuild.exe libvisio.vcxproj /p:PlatformToolset=v110 /p:Configuration=Release \ && touch $@ endif @@ -59,8 +62,11 @@ else $(call gb_ExternalProject_get_state_target,libvisio,build) : cd $(EXTERNAL_WORKDIR) \ - && PKG_CONFIG="" \ - ./configure \ + && export PKG_CONFIG="" \ + && export ICU_LIBS=" " \ + $(if $(filter NO,$(SYSTEM_ICU)),&& export ICU_CFLAGS="-I$(OUTDIR)/inc/external") \ + $(if $(filter YES,$(SYSTEM_ICU)),&& export ICU_CFLAGS=" ") \ + && ./configure \ --with-pic \ --enable-static \ --disable-shared \ diff --git a/libvisio/UnpackedTarball_visio.mk b/libvisio/UnpackedTarball_visio.mk index 98313c170441..492f857f3ed7 100644 --- a/libvisio/UnpackedTarball_visio.mk +++ b/libvisio/UnpackedTarball_visio.mk @@ -11,7 +11,7 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,visio)) $(eval $(call gb_UnpackedTarball_set_tarball,visio,$(VISIO_TARBALL))) -$(eval $(call gb_UnpackedTarball_set_patchlevel,visio,1)) + $(eval $(call gb_UnpackedTarball_add_patches,visio,\ libvisio/libvisio-0.0.25.patch \ diff --git a/libvisio/prj/build.lst b/libvisio/prj/build.lst index 5fdc953e050f..3bb2b3e01818 100644 --- a/libvisio/prj/build.lst +++ b/libvisio/prj/build.lst @@ -1,2 +1,2 @@ -vsd libvisio : LIBWPD:libwpd LIBWPD:libwpg BOOST:boost LIBXML2:libxml2 ZLIB:zlib soltools NULL +vsd libvisio : LIBWPD:libwpd LIBWPD:libwpg BOOST:boost ICU:icu LIBXML2:libxml2 ZLIB:zlib soltools NULL vsd libvisio\prj nmake - all vsd_libvisio NULL diff --git a/odk/pack/copying/makefile.mk b/odk/pack/copying/makefile.mk index ec5f1723bc3d..a786c1f231de 100644 --- a/odk/pack/copying/makefile.mk +++ b/odk/pack/copying/makefile.mk @@ -76,7 +76,7 @@ LIBLIST = \ $(DESTDIRLIB)/icppu.lib \ $(DESTDIRLIB)/icppuhelper.lib \ $(DESTDIRLIB)/irmcxt.lib \ - $(DESTDIRLIB)/ipurpenvhelper3MSC.lib + $(DESTDIRLIB)/ipurpenvhelper.lib .ENDIF .IF "$(OS)"=="LINUX" diff --git a/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu index 5333926f54ec..4dee1419087b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu @@ -43,7 +43,7 @@ </node> <node oor:name="private:resource/toolbar/toolbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> - <value>0,0</value> + <value>1,0</value> </prop> <prop oor:name="Docked" oor:type="xs:boolean"> <value>true</value> diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index ee5c5138e0d3..d77c26053943 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -1558,7 +1558,7 @@ </info> </enumeration> </constraints> - <value>1</value> + <value>0</value> </prop> </group> </group> diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 1119652fb155..3256f3b8c7f7 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -111,13 +111,14 @@ void TextParagraph::insertAt( TextParagraphProperties aParaProp; aParaProp.apply( *pTextParagraphStyle ); aParaProp.apply( maProperties ); - aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize, true ); fCharacterSize = pTextParagraphStyle->getCharHeightPoints( fCharacterSize ); // bullets have same color as following texts by default if( !aioBulletList.hasProperty( PROP_BulletColor ) && maRuns.size() > 0 && (*maRuns.begin())->getTextCharacterProperties().maCharColor.isUsed() ) aioBulletList[ PROP_BulletColor ] <<= (*maRuns.begin())->getTextCharacterProperties().maCharColor.getColor( rFilterBase.getGraphicHelper() ); + + aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize, true ); } // empty paragraphs do not have bullets in ppt diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 89b3f2f4e8dc..f0bff6ef42f1 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -385,7 +385,7 @@ void ZipPackage::parseManifest() if ( !bManifestParsed ) { // the manifest.xml could not be successfuly parsed, this is an inconsistent package - if ( aPackageMediatype.compareToAscii("application/vnd.") == 0 ) + if ( aPackageMediatype.startsWith("application/vnd.") ) { // accept only types that look similar to own mediatypes m_pRootFolder->SetMediaType( aPackageMediatype ); diff --git a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java index d0168a645db1..d9407185ef6a 100644 --- a/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java +++ b/reportbuilder/java/com/sun/star/report/SDBCReportDataFactory.java @@ -253,7 +253,15 @@ public class SDBCReportDataFactory implements DataSourceFactory try { column = UnoRuntime.queryInterface(XPropertySet.class, columns.getByName(expression)); - expression = quote + column.getPropertyValue("TableName") + quote + "." + quote + expression + quote; + String prefix; + prefix = (String)column.getPropertyValue("TableName"); + if (prefix == null) + prefix = ""; + if (prefix.length() > 0) + { + prefix = quote + prefix + quote + "."; + } + expression = prefix + quote + expression + quote; } catch (Exception ex) { 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 99ff3e5fcf27..8c9e986d4555 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -126,9 +126,10 @@ public class FormatValueUtility } else if (value instanceof java.sql.Date) { - if ("float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954 + if ("float".equals(valueType) || valueType == null) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); + // This is to work around fdo#63478 + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 0).toString()); } else { @@ -137,8 +138,12 @@ public class FormatValueUtility } else if (value instanceof Date) { + // This is what we *should* do, but see fdo#63478 + // variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date"); + // variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); + // so we do that instead to work around: variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString()); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 0).toString()); } else if (value instanceof BigDecimal) { @@ -189,7 +194,8 @@ public class FormatValueUtility { variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); } - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); + // work around fdo#62147 + //variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } else { diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 8059b178790a..e7afd5d1ca95 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1134,13 +1134,38 @@ bool ScAttrArray::ApplyFrame( const SvxBoxItem* pBoxItem, nDistBottom = 0; SvxBoxItem aNewFrame( *pOldFrame ); - - if ( bLeft ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) ) - aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), - BOX_LINE_LEFT ); - if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) ) - aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), - BOX_LINE_RIGHT ); + bool bRTL=pDocument->IsLayoutRTL(nTab); + // fdo#37464 check if the sheet are RTL then replace right <=> left + if (bRTL) + { + if( bLeft && nDistRight==0) + { + if ( bLeft ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), + BOX_LINE_RIGHT ); + if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), + BOX_LINE_LEFT ); + } + else + { + if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), + BOX_LINE_RIGHT ); + if ( bLeft ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( bLeft ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), + BOX_LINE_LEFT ); + } + } + else + { + if ( bLeft ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( bLeft ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), + BOX_LINE_LEFT ); + if ( (nDistRight==0) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) ) + aNewFrame.SetLine( (nDistRight==0) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), + BOX_LINE_RIGHT ); + } if ( bTop ? pBoxInfoItem->IsValid(VALID_TOP) : pBoxInfoItem->IsValid(VALID_HORI) ) aNewFrame.SetLine( bTop ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), BOX_LINE_TOP ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 2bdb401c45b7..c782f89ed53b 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1347,7 +1347,7 @@ SCROW ScColumn::FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const bool bThere = Search( nRow, nIndex ); if( bThere && !maItems[nIndex].pCell->IsBlank()) return nRow; - else if(nIndex >= maItems.size()) + else if((bThere ? nIndex+1 : nIndex) >= maItems.size()) return MAXROW; else { diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index a6ba7363048d..d37891adb483 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -526,6 +526,15 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, { bool bInsertTab = ( eUpdateRefMode == URM_INSDEL && nDz >= 1 ); bool bDeleteTab = ( eUpdateRefMode == URM_INSDEL && nDz <= -1 ); + if(pCondFormat) + aSrcPos = pCondFormat->GetRange().Combine().aStart; + ScAddress aOldSrcPos = aSrcPos; + bool bChangedPos = false; + if(eUpdateRefMode == URM_INSDEL && rRange.In(aSrcPos)) + { + aSrcPos.Move(nDx, nDy, nDz); + bChangedPos = aSrcPos != aOldSrcPos; + } bool bChanged1 = false; bool bChanged2 = false; @@ -533,7 +542,7 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, if (pFormula1) { if ( bInsertTab ) - lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged1, nDz ); + lcl_CondUpdateInsertTab( *pFormula1, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged1, nDz ); else { ScCompiler aComp( mpDoc, aSrcPos, *pFormula1 ); @@ -543,18 +552,18 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, else { bool bSizeChanged; - aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx, + aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx, nDy, nDz, bChanged1, bSizeChanged ); } } - if (bChanged1) + if (bChanged1 || bChangedPos) DELETEZ(pFCell1); // is created again in IsValid } if (pFormula2) { if ( bInsertTab ) - lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aSrcPos.Tab(), bChanged2, nDz ); + lcl_CondUpdateInsertTab( *pFormula2, rRange.aStart.Tab(), aOldSrcPos.Tab(), bChanged2, nDz ); else { ScCompiler aComp( mpDoc, aSrcPos, *pFormula2); @@ -564,12 +573,12 @@ void ScConditionEntry::UpdateReference( UpdateRefMode eUpdateRefMode, else { bool bSizeChanged; - aComp.UpdateReference( eUpdateRefMode, aSrcPos, rRange, nDx, + aComp.UpdateReference( eUpdateRefMode, aOldSrcPos, rRange, nDx, nDy, nDz, bChanged2, bSizeChanged ); } } - if (bChanged2) + if (bChanged2 || bChangedPos) DELETEZ(pFCell2); // is created again in IsValid } } diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index be2518c0fae1..72fe4ded9503 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1292,6 +1292,23 @@ void lcl_GetTableVars( sal_Int32& rGrandTotalCols, sal_Int32& rGrandTotalRows, s rtl::OUString aSourceName; rtl::OUString aGivenName; ScDPOutput::GetDataDimensionNames( aSourceName, aGivenName, xDim ); + try + { + uno::Any aValue = xDimProp->getPropertyValue( + rtl::OUString::createFromAscii(SC_UNO_DP_LAYOUTNAME) ); + + if( aValue.hasValue() ) + { + OUString strLayoutName; + + if( aValue >>= strLayoutName ) + if ( strLayoutName.getLength() > 0 ) + aGivenName = strLayoutName; + } + } + catch(uno::Exception&) + { + } rDataNames.push_back( aSourceName ); rGivenNames.push_back( aGivenName ); @@ -1690,11 +1707,19 @@ void lcl_FilterInclude( std::vector<bool>& rResult, std::vector< sal_Int32 >& rS { // grand total is always automatic sal_Int32 nDataPos = j - ( nSize - nGrandTotals ); - OSL_ENSURE( nDataPos < (sal_Int32)rDataNames.size(), "wrong data count" ); - rtl::OUString aSourceName( rDataNames[nDataPos] ); // vector contains source names - rtl::OUString aGivenName( rGivenNames[nDataPos] ); + if (nDataPos >= 0 && nDataPos < (sal_Int32)rDataNames.size() && + nDataPos < (sal_Int32)rGivenNames.size()) + { + OUString aSourceName( rDataNames[nDataPos] ); // vector contains source names + OUString aGivenName( rGivenNames[nDataPos] ); - rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ); + rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ); + } + else + { + OSL_FAIL( "wrong data count for grand total" ); + rResult[j] = false; + } } } @@ -1730,27 +1755,49 @@ void lcl_FilterInclude( std::vector<bool>& rResult, std::vector< sal_Int32 >& rS rtl::OUString aSourceName( rDataNames[nDataPos] ); // vector contains source names rtl::OUString aGivenName( rGivenNames[nDataPos] ); - OSL_ENSURE( nFuncPos < aSubTotals.getLength(), "wrong subtotal count" ); - rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ) && + if (nFuncPos < aSubTotals.getLength()) + { + rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ) && aSubTotals[nFuncPos] == aFilter.meFunction; + } + else + { + OSL_FAIL( "wrong subtotal count for manual subtotals and several data fields" ); + rResult[j] = false; + } } else { // manual subtotals for a single data field - OSL_ENSURE( nSubTotalCount < aSubTotals.getLength(), "wrong subtotal count" ); - rResult[j] = ( aSubTotals[nSubTotalCount] == aFilter.meFunction ); + if (nSubTotalCount < aSubTotals.getLength()) + { + rResult[j] = ( aSubTotals[nSubTotalCount] == aFilter.meFunction ); + } + else + { + OSL_FAIL( "wrong subtotal count for manual subtotals for a single data field" ); + rResult[j] = false; + } } } else // automatic subtotals { if ( rBeforeDataLayout ) { - OSL_ENSURE( nSubTotalCount < (sal_Int32)rDataNames.size(), "wrong data count" ); - rtl::OUString aSourceName( rDataNames[nSubTotalCount] ); // vector contains source names - rtl::OUString aGivenName( rGivenNames[nSubTotalCount] ); + if (nSubTotalCount < (sal_Int32)rDataNames.size() && + nSubTotalCount < (sal_Int32)rGivenNames.size()) + { + OUString aSourceName( rDataNames[nSubTotalCount] ); // vector contains source names + OUString aGivenName( rGivenNames[nSubTotalCount] ); - rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ); + rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName ); + } + else + { + OSL_FAIL( "wrong data count for automatic subtotals" ); + rResult[j] = false; + } } // if a function was specified, automatic subtotals never match @@ -1805,6 +1852,8 @@ void lcl_StripSubTotals( std::vector<bool>& rResult, const std::vector<sal_Int32 // if a subtotal is included, clear the result flag for the columns/rows that the subtotal includes sal_Int32 nStart = nPos - rSubtotal[nPos]; OSL_ENSURE( nStart >= 0, "invalid subtotal count" ); + if (nStart < 0) + nStart = 0; for (sal_Int32 nPrev = nStart; nPrev < nPos; nPrev++) rResult[nPrev] = false; diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index e18d241ba54b..74ba29bb6331 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -38,6 +38,7 @@ #include <sal/macros.h> #include <tools/rcid.h> #include <unotools/charclass.hxx> +#include <unotools/securityoptions.hxx> #include <stdlib.h> #include <time.h> #include <ctype.h> @@ -925,13 +926,25 @@ void ScGlobal::OpenURL( const String& rURL, const String& rTarget ) { // OpenURL wird immer ueber irgendwelche Umwege durch Mausklicks im GridWindow // aufgerufen, darum stimmen pScActiveViewShell und nScClickMouseModifier. + //SvtSecurityOptions to access Libreoffice global security parameters + SvtSecurityOptions aSecOpt; + bool bProceedHyperlink = false; + if ( (nScClickMouseModifier & KEY_MOD1) && aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK )) // control-click -> into new window + { + //Ctrl key is pressed and ctrl+click hyperlink security control is set + bProceedHyperlink = true; + } + else if( !aSecOpt.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ) ) + { + //ctrl+click hyperlink security control is disabled just click will do + bProceedHyperlink = true; + } + if ( !bProceedHyperlink ) + return; SfxStringItem aUrl( SID_FILE_NAME, rURL ); SfxStringItem aTarget( SID_TARGETNAME, rTarget ); - - if ( nScClickMouseModifier & KEY_MOD1 ) // control-click -> into new window - aTarget.SetValue(rtl::OUString("_blank")); - + aTarget.SetValue(rtl::OUString("_blank")); SfxViewFrame* pFrame = NULL; String aReferName; if ( pScActiveViewShell ) diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 8f637815581a..6c92d4cd3f29 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -291,6 +291,7 @@ void ScUnoAddInCollection::Initialize() { uno::Any aAddInAny = xEnum->nextElement(); + try { uno::Reference<uno::XInterface> xIntFac; aAddInAny >>= xIntFac; @@ -321,6 +322,8 @@ void ScUnoAddInCollection::Initialize() } } } + } catch ( const uno::Exception& ) { + SAL_WARN ( "sc", "Failed to initialize create instance of sheet.AddIn" ); } } } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 1553a9b3e631..3ed918933666 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4591,6 +4591,13 @@ void ScInterpreter::ScColumn() SCCOL nCols; SCROW nRows; pMyFormulaCell->GetMatColsRows( nCols, nRows); + if (nCols == 0) + { + // Happens if called via ScViewFunc::EnterMatrix() + // ScFormulaCell::GetResultDimensions() as of course a + // matrix result is not available yet. + nCols = 1; + } ScMatrixRef pResMat = GetNewMat( static_cast<SCSIZE>(nCols), 1); if (pResMat) { @@ -4667,6 +4674,13 @@ void ScInterpreter::ScRow() SCCOL nCols; SCROW nRows; pMyFormulaCell->GetMatColsRows( nCols, nRows); + if (nRows == 0) + { + // Happens if called via ScViewFunc::EnterMatrix() + // ScFormulaCell::GetResultDimensions() as of course a + // matrix result is not available yet. + nRows = 1; + } ScMatrixRef pResMat = GetNewMat( 1, static_cast<SCSIZE>(nRows)); if (pResMat) { diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 0a92ffc2721a..e6c22408609d 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -1128,17 +1128,26 @@ size_t ScMatrixImpl::Count(bool bCountStrings) const void ScMatrixImpl::CalcPosition(SCSIZE nIndex, SCSIZE& rC, SCSIZE& rR) const { SCSIZE nRowSize = maMat.size().row; - rC = nIndex / nRowSize; + SAL_WARN_IF( !nRowSize, "sc", "ScMatrixImpl::CalcPosition: 0 rows!"); + rC = nRowSize > 1 ? nIndex / nRowSize : nIndex; rR = nIndex - rC*nRowSize; } // ============================================================================ ScMatrix::ScMatrix( SCSIZE nC, SCSIZE nR) : - pImpl(new ScMatrixImpl(nC, nR)), nRefCnt(0) {} + pImpl(new ScMatrixImpl(nC, nR)), nRefCnt(0) +{ + SAL_WARN_IF( !nC, "sc", "ScMatrix with 0 columns!"); + SAL_WARN_IF( !nR, "sc", "ScMatrix with 0 rows!"); +} ScMatrix::ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) : - pImpl(new ScMatrixImpl(nC, nR, fInitVal)), nRefCnt(0) {} + pImpl(new ScMatrixImpl(nC, nR, fInitVal)), nRefCnt(0) +{ + SAL_WARN_IF( !nC, "sc", "ScMatrix with 0 columns!"); + SAL_WARN_IF( !nR, "sc", "ScMatrix with 0 rows!"); +} ScMatrix::~ScMatrix() { diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index b7cc8db178a2..703fc8b1c36a 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1782,7 +1782,9 @@ BorderLineModel* Border::getBorderLine( sal_Int32 nElement ) switch( nElement ) { case XLS_TOKEN( left ): return &maModel.maLeft; + case XLS_TOKEN( start ): return &maModel.maLeft; case XLS_TOKEN( right ): return &maModel.maRight; + case XLS_TOKEN( end ): return &maModel.maRight; case XLS_TOKEN( top ): return &maModel.maTop; case XLS_TOKEN( bottom ): return &maModel.maBottom; case XLS_TOKEN( diagonal ): return &maModel.maDiagonal; diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx index 035004ae60f4..8490572dfe96 100644 --- a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx @@ -259,7 +259,7 @@ void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex) AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::CHILD; aEvent.Source = uno::Reference< XAccessibleContext >(this); - aEvent.NewValue <<= xTempAcc; + aEvent.OldValue <<= xTempAcc; CommitChange(aEvent); // gone child - event @@ -270,25 +270,41 @@ void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex) void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex) { - OSL_ENSURE(static_cast<size_t>(nOldIndex) < maChildren.size() && - static_cast<size_t>(nNewIndex) < maChildren.size(), "did not recognize a child count change"); - - uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc; - if (xTempAcc.is() && maChildren[nOldIndex].pAcc) - maChildren[nOldIndex].pAcc->ResetFocused(); + if (0 <= nOldIndex && static_cast<size_t>(nOldIndex) < maChildren.size()) + { + uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc; + if (xTempAcc.is() && maChildren[nOldIndex].pAcc) + maChildren[nOldIndex].pAcc->ResetFocused(); + } + else + { + SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldFocusChange() old index out of bounds: " << nOldIndex); + } - xTempAcc = maChildren[nNewIndex].xWeakAcc; - if (xTempAcc.is() && maChildren[nNewIndex].pAcc) - maChildren[nNewIndex].pAcc->SetFocused(); + if (0 <= nNewIndex && static_cast<size_t>(nNewIndex) < maChildren.size()) + { + uno::Reference < XAccessible > xTempAcc = maChildren[nNewIndex].xWeakAcc; + if (xTempAcc.is() && maChildren[nNewIndex].pAcc) + maChildren[nNewIndex].pAcc->SetFocused(); + } + else + { + SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldFocusChange() new index out of bounds: " << nNewIndex); + } } void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex) { - OSL_ENSURE(static_cast<size_t>(nIndex) < maChildren.size(), "did not recognize a child count change"); - - uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; - if (xTempAcc.is() && maChildren[nIndex].pAcc) - maChildren[nIndex].pAcc->ChangeName(); + if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size()) + { + uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; + if (xTempAcc.is() && maChildren[nIndex].pAcc) + maChildren[nIndex].pAcc->ChangeName(); + } + else + { + SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldNameChange() index out of bounds: " << nIndex); + } } void ScAccessibleDataPilotControl::GotFocus() @@ -298,9 +314,16 @@ void ScAccessibleDataPilotControl::GotFocus() OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); sal_Int32 nIndex(mpFieldWindow->GetSelectedField()); - uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; - if (xTempAcc.is() && maChildren[nIndex].pAcc) - maChildren[nIndex].pAcc->SetFocused(); + if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size()) + { + uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; + if (xTempAcc.is() && maChildren[nIndex].pAcc) + maChildren[nIndex].pAcc->SetFocused(); + } + else + { + SAL_WARN( "sc", "ScAccessibleDataPilotControl::GotFocus() field index out of bounds: " << nIndex); + } } } @@ -311,9 +334,21 @@ void ScAccessibleDataPilotControl::LostFocus() OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); sal_Int32 nIndex(mpFieldWindow->GetSelectedField()); - uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; - if (xTempAcc.is() && maChildren[nIndex].pAcc) - maChildren[nIndex].pAcc->ResetFocused(); + if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size()) + { + uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; + if (xTempAcc.is() && maChildren[nIndex].pAcc) + maChildren[nIndex].pAcc->ResetFocused(); + } + else + { + // This may actually happen if the last field is dropped somewhere + // and was already removed from the pane by dragging it away. This + // is odd.. looks like all LostFocus() are called for the previous + // field of the same original pane in the remove case? + SAL_WARN_IF( nIndex != -1 || !maChildren.empty(), "sc", + "ScAccessibleDataPilotControl::LostFocus() field index out of bounds: " << nIndex); + } } } @@ -390,10 +425,7 @@ sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getAccessibleChildCount(void) { SolarMutexGuard aGuard; IsObjectValid(); - if (mpFieldWindow) - return mpFieldWindow->GetFieldCount(); - else - return 0; + return static_cast<sal_Int32>(maChildren.size()); } uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibleChild(sal_Int32 nIndex) @@ -404,14 +436,19 @@ uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibl uno::Reference<XAccessible> xAcc; if (mpFieldWindow) { - if (nIndex < 0 || static_cast< size_t >( nIndex ) >= mpFieldWindow->GetFieldCount()) + if (nIndex < 0 || static_cast< size_t >( nIndex ) >= maChildren.size()) throw lang::IndexOutOfBoundsException(); - OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); + OSL_ENSURE( mpFieldWindow->GetFieldCount() == maChildren.size() // all except ... + || mpFieldWindow->GetFieldCount() == maChildren.size() + 1, // in CommitChange during RemoveField + "did not recognize a child count change"); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (!xTempAcc.is()) { + if (static_cast< size_t >( nIndex ) >= mpFieldWindow->GetFieldCount()) + throw lang::IndexOutOfBoundsException(); + maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpFieldWindow, nIndex); xTempAcc = maChildren[nIndex].pAcc; maChildren[nIndex].xWeakAcc = xTempAcc; diff --git a/sc/source/ui/dbgui/dapitype.cxx b/sc/source/ui/dbgui/dapitype.cxx index cad35323de62..e17d1e06103e 100644 --- a/sc/source/ui/dbgui/dapitype.cxx +++ b/sc/source/ui/dbgui/dapitype.cxx @@ -62,6 +62,10 @@ ScDataPilotSourceTypeDlg::ScDataPilotSourceTypeDlg( Window* pParent, sal_Bool bE aBtnNamedRange.Disable(); FreeResource(); + + // Intentionally hide this to see if someone complains. Eventually we'll + // remove this option. + aBtnExternal.Show(false); } ScDataPilotSourceTypeDlg::~ScDataPilotSourceTypeDlg() diff --git a/sc/source/ui/dbgui/dapitype.src b/sc/source/ui/dbgui/dapitype.src index 569023d6881e..4a388d6f7725 100644 --- a/sc/source/ui/dbgui/dapitype.src +++ b/sc/source/ui/dbgui/dapitype.src @@ -26,7 +26,7 @@ ModalDialog RID_SCDLG_DAPITYPE OutputSize = TRUE ; HelpId = HID_DATAPILOT_TYPE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 241 , 76 ) ; + Size = MAP_APPFONT ( 241 , 63 ) ; Moveable = TRUE ; Closeable = FALSE ; diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 78d04ac16a0d..4ee9d1109307 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -168,9 +168,19 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) // ListBox selection: if ( aSortData.maKeyState[0].bDoSort ) { + // Make sure that the all sort keys are reset + for ( sal_uInt16 i=nSortKeyCount; i<aSortData.maKeyState.size(); i++ ) + { + maSortKeyCtrl.AddSortKey(i+1); + maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this, + ScTabPageSortFields, SelectHdl ) ); + } + nSortKeyCount = aSortData.maKeyState.size(); + FillFieldLists(0); + for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) { - if ( i < aSortData.maKeyState.size() && aSortData.maKeyState[i].bDoSort ) + if (aSortData.maKeyState[i].bDoSort ) { maSortKeyItems[i].m_pLbSort->SelectEntryPos( GetFieldSelPos( aSortData.maKeyState[i].nField ) ); @@ -193,7 +203,6 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) maSortKeyItems[i].DisableField(); else maSortKeyItems[i].EnableField(); - } else { diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 67b02abd950f..d39b45f54afd 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -1384,6 +1384,21 @@ void SAL_CALL ScVbaApplication::Undo() throw (uno::RuntimeException) dispatchExecute( pViewShell, SID_UNDO ); } +void SAL_CALL ScVbaApplication::OnKey( const ::rtl::OUString& Key, const uno::Any& Procedure ) throw (uno::RuntimeException) +{ + try + { + // Perhaps we can catch some excel specific + // related behaviour here + VbaApplicationBase::OnKey( Key, Procedure ); + } + catch( container::NoSuchElementException& ) + { + // #TODO special handling for unhandled + // bindings + } +} + rtl::OUString ScVbaApplication::getServiceImplName() { diff --git a/sc/source/ui/vba/vbavalidation.cxx b/sc/source/ui/vba/vbavalidation.cxx index 7431370625ed..b318c8d2c556 100644 --- a/sc/source/ui/vba/vbavalidation.cxx +++ b/sc/source/ui/vba/vbavalidation.cxx @@ -369,6 +369,9 @@ ScVbaValidation::getType() throw (uno::RuntimeException) case sheet::ValidationType_TEXT_LEN: nExcelType = excel::XlDVType::xlValidateTextLength; break; + case sheet::ValidationType_MAKE_FIXED_SIZE: + default: + break; }; } return nExcelType; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f67717d69954..e51a33afe31b 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1261,32 +1261,63 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pDlg->SetOtherDoc( bOtherDoc ); // if ChangeTrack MoveMode disable pDlg->SetChangeTrack( pDoc->GetChangeTrack() != NULL ); - // cut/move references may disable shift - // directions if source and destination ranges intersect - if ( !bOtherDoc ) + // fdo#56098 disable shift if necessary + if ( !bOtherDoc && pOwnClip ) { - if ( pOwnClip && pOwnClip->GetDocument()->IsCutMode() ) + ScViewData* pData = GetViewData(); + if ( pData->GetMarkData().GetTableSelect( pData->GetTabNo() ) ) { - ScViewData* pData = GetViewData(); - if ( pData->GetMarkData().GetTableSelect( - pData->GetTabNo() ) ) + SCCOL nStartX, nEndX, nClipStartX, nClipSizeX, nRangeSizeX; + SCROW nStartY, nEndY, nClipStartY, nClipSizeY, nRangeSizeY; + SCTAB nStartTab, nEndTab; + pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY ); + pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, sal_True ); + + if ( !( pData->GetSimpleArea( nStartX, nStartY, nStartTab, + nEndX, nEndY, nEndTab ) == SC_MARK_SIMPLE && + nStartTab == nEndTab ) ) { - SCCOL nPosX = pData->GetCurX(); - SCROW nPosY = pData->GetCurY(); - SCCOL nClipStartX, nClipSizeX; - SCROW nClipStartY, nClipSizeY; - pOwnClip->GetDocument()->GetClipStart( nClipStartX, nClipStartY ); - // for CutMode, filtered rows can always be included - pOwnClip->GetDocument()->GetClipArea( nClipSizeX, nClipSizeY, sal_True ); - int nDisableShift = 0; - if ( nClipStartX <= nPosX + nClipSizeX && - nPosX <= nClipStartX + nClipSizeX ) - nDisableShift |= SC_CELL_SHIFT_DISABLE_DOWN; - if ( nClipStartY <= nPosY + nClipSizeY && - nPosY <= nClipStartY + nClipSizeY ) - nDisableShift |= SC_CELL_SHIFT_DISABLE_RIGHT; - if ( nDisableShift ) - pDlg->SetCellShiftDisabled( nDisableShift ); + // the destination is not a simple range, + // assume the destination as the current cell + nStartX = nEndX = pData->GetCurX(); + nStartY = nEndY = pData->GetCurY(); + nStartTab = pData->GetTabNo(); + } + // we now have clip- and range dimensions + // the size of the destination area is the larger of the two + nRangeSizeX = nClipSizeX >= nEndX - nStartX ? nClipSizeX : nEndX - nStartX; + nRangeSizeY = nClipSizeY >= nEndY - nStartY ? nClipSizeY : nEndY - nStartY; + // When the source and destination areas intersect things may go wrong, + // especially if the area contains references. This may produce data loss + // (e.g. formulas that get wrong references), this scenario _must_ be avoided. + ScRange aSource( nClipStartX, nClipStartY, nStartTab, + nClipStartX + nClipSizeX, nClipStartY + nClipSizeY, nStartTab ); + ScRange aDest( nStartX, nStartY, nStartTab, + nStartX + nRangeSizeX, nStartY + nRangeSizeY, nStartTab ); + if ( aSource.Intersects( aDest ) ) + pDlg->SetCellShiftDisabled( SC_CELL_SHIFT_DISABLE_DOWN | SC_CELL_SHIFT_DISABLE_RIGHT ); + else + { + //no conflict with intersecting ranges, + //check if paste plus shift will fit on sheet + //and disable shift-option if no fit + int nDisableShiftX = 0; + int nDisableShiftY = 0; + + //check if horizontal shift will fit + if ( !pData->GetDocument()->IsBlockEmpty( nStartTab, + MAXCOL - nRangeSizeX, nStartY, + MAXCOL, nStartY + nRangeSizeY, false ) ) + nDisableShiftX = SC_CELL_SHIFT_DISABLE_RIGHT; + + //check if vertical shift will fit + if ( !pData->GetDocument()->IsBlockEmpty( nStartTab, + nStartX, MAXROW - nRangeSizeY, + nStartX + nRangeSizeX, MAXROW, false ) ) + nDisableShiftY = SC_CELL_SHIFT_DISABLE_DOWN; + + if ( nDisableShiftX || nDisableShiftY ) + pDlg->SetCellShiftDisabled( nDisableShiftX | nDisableShiftY ); } } } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 1ab57f6d665c..0e4a72036d44 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -178,7 +178,7 @@ namespace { long DelayDeleteAbstractDialog( void *pAbstractDialog, void * /*pArg*/ ) { - delete reinterpret_cast<VclAbstractDialog*>( pAbstractDialog ); + delete reinterpret_cast<SfxAbstractTabDialog*>( pAbstractDialog ); return 0; } } diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index adf45ee6de17..fb9f27540737 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -292,10 +292,13 @@ void getChartSourceRanges(ScDocument* pDoc, const SdrMarkList& rObjs, std::vecto std::vector<OUString>::const_iterator it = aRangeReps.begin(), itEnd = aRangeReps.end(); for (; it != itEnd; ++it) { - ScRange aRange; + ScRangeList aRange; ScAddress aAddr; if (aRange.Parse(*it, pDoc, pDoc->GetAddressConvention()) & SCA_VALID) - rRanges.push_back(aRange); + { + for(size_t i = 0; i < aRange.size(); ++i) + rRanges.push_back(*aRange[i]); + } else if (aAddr.Parse(*it, pDoc, pDoc->GetAddressConvention()) & SCA_VALID) rRanges.push_back(aAddr); } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 45e9f026cbac..543c70c5fd78 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -482,7 +482,24 @@ void ScTabViewShell::ExecuteCellFormatDlg( SfxRequest& rReq, sal_uInt16 nTabPage // Umrandungs-Items holen und in den Set packen: GetSelectionFrame( aLineOuter, aLineInner ); - pOldSet->Put( aLineOuter ); + //Fix border incorrect for RTL fdo#62399 + if( pDoc->IsLayoutRTL( GetViewData()->GetTabNo() ) ) + { + SvxBoxItem aNewFrame( aLineOuter ); + if ( aLineInner.IsValid(VALID_LEFT) ) + aNewFrame.SetLine( aLineOuter.GetLeft(), BOX_LINE_RIGHT ); + if ( aLineInner.IsValid(VALID_RIGHT) ) + aNewFrame.SetLine( aLineOuter.GetRight(), BOX_LINE_LEFT ); + if ( aLineInner.IsValid(VALID_TOP) ) + aNewFrame.SetLine( aLineOuter.GetTop(), BOX_LINE_TOP ); + if ( aLineInner.IsValid(VALID_BOTTOM) ) + aNewFrame.SetLine( aLineOuter.GetBottom() , BOX_LINE_BOTTOM ); + + pOldSet->Put( aNewFrame ); + } + else + pOldSet->Put( aLineOuter ); + pOldSet->Put( aLineInner ); // NumberFormat Value aus Value und Language erzeugen und eintueten diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 8fddc7bd2d0a..b540a8829677 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -333,78 +333,6 @@ sal_Int32 GetDaysInYears( sal_uInt16 nYear1, sal_uInt16 nYear2 ) } -void GetDiffParam( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode, - sal_uInt16& rYears, sal_Int32& rDayDiffPart, sal_Int32& rDaysInYear ) THROWDEF_RTE_IAE -{ - if( nStartDate > nEndDate ) - { - sal_Int32 n = nEndDate; - nEndDate = nStartDate; - nStartDate = n; - } - - sal_Int32 nDate1 = nStartDate + nNullDate; - sal_Int32 nDate2 = nEndDate + nNullDate; - - sal_uInt16 nDay1, nDay2; - sal_uInt16 nMonth1, nMonth2; - sal_uInt16 nYear1, nYear2; - - DaysToDate( nDate1, nDay1, nMonth1, nYear1 ); - DaysToDate( nDate2, nDay2, nMonth2, nYear2 ); - - sal_uInt16 nYears; - - sal_Int32 nDayDiff, nDaysInYear; - - switch( nMode ) - { - case 0: // 0=USA (NASD) 30/360 - case 4: // 4=Europe 30/360 - nDaysInYear = 360; - nYears = nYear2 - nYear1; - nDayDiff = GetDiffDate360( nDay1, nMonth1, nYear1, IsLeapYear( nYear1 ), - nDay2, nMonth2, nYear2, nMode == 0 ) - nYears * nDaysInYear; - break; - case 1: // 1=exact/exact - nYears = nYear2 - nYear1; - - nDaysInYear = IsLeapYear( nYear1 )? 366 : 365; - - if( nYears && ( nMonth1 > nMonth2 || ( nMonth1 == nMonth2 && nDay1 > nDay2 ) ) ) - nYears--; - - if( nYears ) - nDayDiff = nDate2 - DateToDays( nDay1, nMonth1, nYear2 ); - else - nDayDiff = nDate2 - nDate1; - - if( nDayDiff < 0 ) - nDayDiff += nDaysInYear; - - break; - case 2: // 2=exact/360 - nDaysInYear = 360; - nYears = sal_uInt16( ( nDate2 - nDate1 ) / nDaysInYear ); - nDayDiff = nDate2 - nDate1; - nDayDiff %= nDaysInYear; - break; - case 3: //3=exact/365 - nDaysInYear = 365; - nYears = sal_uInt16( ( nDate2 - nDate1 ) / nDaysInYear ); - nDayDiff = nDate2 - nDate1; - nDayDiff %= nDaysInYear; - break; - default: - THROW_IAE; - } - - rYears = nYears; - rDayDiffPart = nDayDiff; - rDaysInYear = nDaysInYear; -} - - sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode, sal_Int32* pOptDaysIn1stYear ) THROWDEF_RTE_IAE { @@ -509,17 +437,143 @@ sal_Int32 GetDaysInYear( sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nMode ) } -double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) THROWDEF_RTE_IAE +//fdo40100 toDo: make function fully compliant with ODFF1.2 +/** + * Function GetYearFrac implements YEARFRAC as defined in: + * Open Document Format for Office Applications version 1.2 Part 2, par. 6.10.24 + * The calculations are defined in: + * Open Document Format for Office Applications version 1.2 Part 2, par. 4.11.7 + */ +double GetYearFrac( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException ) { if( nStartDate == nEndDate ) return 0.0; // nothing to do... - sal_uInt16 nYears; - sal_Int32 nDayDiff, nDaysInYear; + if( nStartDate > nEndDate ) + { + sal_Int32 n = nEndDate; + nEndDate = nStartDate; + nStartDate = n; + } + + sal_Int32 nDate1 = nStartDate + nNullDate; + sal_Int32 nDate2 = nEndDate + nNullDate; + + sal_uInt16 nDay1, nDay2; + sal_uInt16 nMonth1, nMonth2; + sal_uInt16 nYear1, nYear2; + + DaysToDate( nDate1, nDay1, nMonth1, nYear1 ); + DaysToDate( nDate2, nDay2, nMonth2, nYear2 ); + + // calculate days between nDate1 and nDate2 + sal_Int32 nDayDiff; + switch( nMode ) + { + case 0: // 0=USA (NASD) 30/360 + if ( nDay1 == 31 ) + { + nDay1--; + } + if ( nDay1 == 30 && nDay2 == 31 ) + { + nDay2--; + } + else + { + if ( nMonth1 == 2 && nDay1 == ( IsLeapYear( nYear1 ) ? 29 : 28 ) ) + { + nDay1 = 30; + if ( nMonth2 == 2 && nDay2 == ( IsLeapYear( nYear2 ) ? 29 : 28 ) ) + { + nDay2 = 30; + } + } + } + nDayDiff = ( nYear2 - nYear1 ) * 360 + ( nMonth2 - nMonth1 ) * 30 + ( nDay2 - nDay1 ); + break; + case 1: // 1=exact/exact + case 2: // 2=exact/360 + case 3: // 3=exact/365 + nDayDiff = nDate2 - nDate1; + break; + case 4: // 4=Europe 30/360 + if ( nDay1 == 31 ) + { + nDay1--; + } + if ( nDay2 == 31 ) + { + nDay2--; + } + nDayDiff = ( nYear2 - nYear1 ) * 360 + ( nMonth2 - nMonth1 ) * 30 + ( nDay2 - nDay1 ); + break; + default: + throw lang::IllegalArgumentException(); + } - GetDiffParam( nNullDate, nStartDate, nEndDate, nMode, nYears, nDayDiff, nDaysInYear ); + //calculate days in year + double nDaysInYear; + switch( nMode ) + { + case 0: // 0=USA (NASD) 30/360 + case 2: // 2=exact/360 + case 4: // 4=Europe 30/360 + nDaysInYear = 360; + break; + case 1: // 1=exact/exact + { + bool isYearDifferent = ( nYear1 != nYear2 ); + if ( isYearDifferent && + ( ( nYear2 != nYear1 + 1 ) || + ( nMonth1 < nMonth2 ) || + ( nMonth1 == nMonth2 && nDay1 < nDay2 ) ) ) + { + // return average of days in year between nDate1 and nDate2, inclusive + sal_Int32 nDayCount = 0; + for ( sal_Int16 i = nYear1; i <= nYear2; i++ ) + nDayCount += ( IsLeapYear( i ) ? 366 : 365 ); + + nDaysInYear = ( double ) nDayCount / ( double ) ( nYear2 - nYear1 + 1 ); + } + else + { + if ( isYearDifferent && IsLeapYear( nYear1 ) ) + { + nDaysInYear = 366; + } + else + { + //if Feb 29 is between nDate1 and ndate2, inclusive + if ( ( IsLeapYear( nYear1 ) && nMonth1 <= 2 && nDay1 <= 29 ) || + ( IsLeapYear( nYear2 ) && ( nMonth2 > 3 || ( nMonth2 == 2 && nDay1 == 29 ) ) ) ) + { + nDaysInYear = 366; + } + else + { + nDaysInYear = 365; + for ( sal_Int16 i = nYear1; i <= nYear2; i++ ) + { + if ( IsLeapYear( i ) ) + { + nDaysInYear = 366; + break; + } + } + } + } + } + } + break; + case 3: // 3=exact/365 + nDaysInYear = 365; + break; + default: + throw lang::IllegalArgumentException(); + } - return double( nYears ) + double( nDayDiff ) / double( nDaysInYear ); + return double( nDayDiff ) / nDaysInYear; } double BinomialCoefficient( double n, double k ) diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index 395348cc5781..ceb3fe213d8f 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -79,11 +79,6 @@ sal_Int32 GetDiffDate360( sal_Int32 nNullDate, sal_Int32 nDate1, sal_I sal_Int32 GetDaysInYears( sal_uInt16 nYear1, sal_uInt16 nYear2 ); inline sal_Int16 GetDayOfWeek( sal_Int32 nDate ); -void GetDiffParam( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode, - sal_uInt16& rYears, sal_Int32& rDayDiffPart, sal_Int32& rDaysInYear ) THROWDEF_RTE_IAE; - // rYears = full num of years - // rDayDiffPart = num of days for last year - // rDaysInYear = num of days in first year sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode, sal_Int32* pOptDaysIn1stYear = NULL ) THROWDEF_RTE_IAE; double GetYearDiff( sal_Int32 nNullDate, sal_Int32 nStartDate, sal_Int32 nEndDate, sal_Int32 nMode ) diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index 267105189160..b3d1919f9a0b 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -744,6 +744,14 @@ Module gid_Module_Root_Fonts_OOo_Hidden gid_File_Fnt_DejaVuSerifCondensed_BoldItalic, gid_File_Fnt_DejaVuSerifCondensed_Italic, gid_File_Fnt_DejaVuSerifCondensed, + gid_File_Fnt_GentiumBasicRegular, + gid_File_Fnt_GentiumBasicBold, + gid_File_Fnt_GentiumBasicItalic, + gid_File_Fnt_GentiumBasicBoldItalic, + gid_File_Fnt_GentiumBookBasicRegular, + gid_File_Fnt_GentiumBookBasicBold, + gid_File_Fnt_GentiumBookBasicItalic, + gid_File_Fnt_GentiumBookBasicBoldItalic, gid_File_Fnt_LibSansNarrow_Regular, gid_File_Fnt_LibSansNarrow_Bold, gid_File_Fnt_LibSansNarrow_BoldItalic, @@ -759,21 +767,31 @@ Module gid_Module_Root_Fonts_OOo_Hidden gid_File_Fnt_LiberationSerif_Bold, gid_File_Fnt_LiberationSerif_BoldItalic, gid_File_Fnt_LiberationSerif_Italic, - gid_File_Fnt_LiberationSerif_Regular - gid_File_Fnt_PtSerif_Regular - gid_File_Fnt_PtSerif_Bold - gid_File_Fnt_PtSerif_Italic - gid_File_Fnt_PtSerif_BoldItalic - gid_File_Fnt_OpenSans_Regular - gid_File_Fnt_OpenSans_Bold - gid_File_Fnt_OpenSans_Italic - gid_File_Fnt_OpenSans_BoldItalic - gid_File_Fnt_SourceSans_Regular - gid_File_Fnt_SourceSans_Bold - gid_File_Fnt_SourceSans_Italic - gid_File_Fnt_SourceSans_BoldItalic - gid_File_Fnt_SourceCode_Regular - gid_File_Fnt_SourceCode_Bold); + gid_File_Fnt_LiberationSerif_Regular, + gid_File_Fnt_LinuxLibertineG_Regular, + gid_File_Fnt_LinuxLibertineG_Semibold, + gid_File_Fnt_LinuxLibertineG_Bold, + gid_File_Fnt_LinuxLibertineG_Italic, + gid_File_Fnt_LinuxLibertineG_SemiboldItalic, + gid_File_Fnt_LinuxLibertineG_BoldItalic, + gid_File_Fnt_LinuxBiolinumG_Regular, + gid_File_Fnt_LinuxBiolinumG_Bold, + gid_File_Fnt_LinuxBiolinumG_Italic, + gid_File_Fnt_PtSerif_Regular, + gid_File_Fnt_PtSerif_Bold, + gid_File_Fnt_PtSerif_Italic, + gid_File_Fnt_PtSerif_BoldItalic, + gid_File_Fnt_OpenSans_Regular, + gid_File_Fnt_OpenSans_Bold, + gid_File_Fnt_OpenSans_Italic, + gid_File_Fnt_OpenSans_BoldItalic, + gid_File_Fnt_SourceSans_Regular, + gid_File_Fnt_SourceSans_Bold, + gid_File_Fnt_SourceSans_Italic, + gid_File_Fnt_SourceSans_BoldItalic, + gid_File_Fnt_SourceCode_Regular, + gid_File_Fnt_SourceCode_Bold, + gid_File_FcLocal_Conf); End #endif diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 3e1b1e197128..56b8f08f77cc 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -40,6 +40,7 @@ #include <editeng/ulspitem.hxx> #include <editeng/lspcitem.hxx> #include <editeng/adjitem.hxx> +#include <editeng/numdef.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> // SVX_RESSTR #include <editeng/bulitem.hxx> @@ -1302,7 +1303,7 @@ void SdDrawDocument::SetTextDefaults() const aNumberFormat.SetStart(1); aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); - SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10, sal_False); + SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM, sal_False); aNumberFormat.SetLSpace( 0 ); aNumberFormat.SetAbsLSpace( 0 ); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index bba9cd06ba63..602fd5883171 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2989,7 +2989,7 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, const long nOffsetX = (aPartArea.Width() + nGapW) * (bRTL ? -1 : 1); const long nOffsetY = aPartArea.Height() + nGapH; - const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) - nX : nX; + const long nStartX = bRTL ? nOffsetX*(1 - nColCnt) + nX : nX; for(sal_uInt16 nRow = 0; nRow < nRowCnt; nRow++) { diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index cfe6c82a54bc..7c06d27ef75a 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -49,6 +49,7 @@ #include <editeng/bulitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/adjitem.hxx> +#include <editeng/numdef.hxx> #include <svl/itempool.hxx> #include "stlpool.hxx" @@ -994,7 +995,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, aNumberFormat.SetStart(1); aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); - SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, 10 , sal_False); + SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE, SVX_MAX_NUM , sal_False); for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ ) { @@ -1050,7 +1051,7 @@ void SdStyleSheetPool::PutNumBulletItem( SfxStyleSheetBase* pSheet, aNumberFormat.SetNumAdjust(SVX_ADJUST_LEFT); SvxNumRule aNumRule( NUM_BULLET_REL_SIZE|NUM_BULLET_COLOR|NUM_CHAR_TEXT_DISTANCE|NUM_SYMBOL_ALIGNMENT, - 10, sal_False ); + SVX_MAX_NUM, sal_False ); for( sal_uInt16 i = 0; i < aNumRule.GetLevelCount(); i++ ) { aNumberFormat.SetBulletChar( 0x25CF ); // StarBats: 0xF000 + 34 diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index c28f4d1e6eae..04018c59167e 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1423,6 +1423,11 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u case SVX_NUM_ROMAN_UPPER : case SVX_NUM_ROMAN_LOWER : case SVX_NUM_ARABIC : + case SVX_NUM_NUMBER_UPPER_ZH: + case SVX_NUM_CIRCLE_NUMBER: + case SVX_NUM_NUMBER_UPPER_ZH_TW: + case SVX_NUM_NUMBER_LOWER_ZH: + case SVX_NUM_FULL_WIDTH_ARABIC: nNumberingType = pBulletPara->nMappedNumType; break; diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 481666b1e6a9..04578a28ec23 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -878,7 +878,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 PortionObj* pPortion = front(); CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 ); - switch( (SvxExtNumType)nNumberingType ) + switch( nNumberingType ) { case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break; @@ -896,15 +896,20 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 nParaFlags |= 0x90; // wir geben den Font und den Charset vor } } - case SVX_NUM_CHARS_UPPER_LETTER : // zaehlt von a-z, aa - az, ba - bz, ... + case SVX_NUM_CHARS_UPPER_LETTER : // count from a-z, aa - az, ba - bz, ... case SVX_NUM_CHARS_LOWER_LETTER : case SVX_NUM_ROMAN_UPPER : case SVX_NUM_ROMAN_LOWER : case SVX_NUM_ARABIC : - case SVX_NUM_PAGEDESC : // Numerierung aus der Seitenvorlage + case SVX_NUM_PAGEDESC : // numbering from the page template case SVX_NUM_BITMAP : - case SVX_NUM_CHARS_UPPER_LETTER_N : // zaehlt von a-z, aa-zz, aaa-zzz + case SVX_NUM_CHARS_UPPER_LETTER_N : // count from a-z, aa-zz, aaa-zzz case SVX_NUM_CHARS_LOWER_LETTER_N : + case SVX_NUM_NUMBER_UPPER_ZH: + case SVX_NUM_CIRCLE_NUMBER: + case SVX_NUM_NUMBER_UPPER_ZH_TW: + case SVX_NUM_NUMBER_LOWER_ZH: + case SVX_NUM_FULL_WIDTH_ARABIC: { if ( nNumberingType != SVX_NUM_CHAR_SPECIAL ) { @@ -990,6 +995,45 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 } } break; + case SVX_NUM_NUMBER_UPPER_ZH : + { + if ( sSuffix.Len() ) + nMappedNumType = 0x110001; // Simplified Chinese with single-byte period. + else + nMappedNumType = 0x100001; // Simplified Chinese. + } + break; + case SVX_NUM_CIRCLE_NUMBER : + { + nMappedNumType = 0x120001; // Double byte circle numbers. + } + break; + case SVX_NUM_NUMBER_UPPER_ZH_TW : + { + if ( sSuffix.Len() ) + nMappedNumType = 0x160001; // Traditional Chinese with single-byte period. + else + nMappedNumType = 0x150001; // Traditional Chinese. + } + break; + case SVX_NUM_NUMBER_LOWER_ZH : + { + if ( sSuffix == String( sal_Unicode(0xff0e)) ) + nMappedNumType = 0x260001; // Japanese with double-byte period. + else if ( sSuffix.Len() ) + nMappedNumType = 0x1B0001; // Japanese/Korean with single-byte period. + else + nMappedNumType = 0x1A0001; // Japanese/Korean. + } + break; + case SVX_NUM_FULL_WIDTH_ARABIC : + { + if ( sSuffix.Len() ) + nMappedNumType = 0x1D0001; // Double-byte Arabic numbers with double-byte period. + else + nMappedNumType = 0x1C0001; // Double-byte Arabic numbers. + } + break; default: break; } diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx index d217cbf5b68b..6573ea0f46ca 100644 --- a/sd/source/ui/annotations/annotationwindow.cxx +++ b/sd/source/ui/annotations/annotationwindow.cxx @@ -327,15 +327,12 @@ void AnnotationWindow::InitControls() mpOutliner->SetRefDevice( pDev ); } + mpTextWindow->EnableRTL( sal_False ); mpOutlinerView = new OutlinerView ( mpOutliner, mpTextWindow ); mpOutliner->InsertView(mpOutlinerView ); mpTextWindow->SetOutlinerView(mpOutlinerView); mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) ); - // TODO: ?? - EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R; - mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir ); - //create Scrollbars mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); mpVScrollbar->EnableNativeWidget(false); diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index bab643a6be30..28e8ab660457 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -71,7 +71,7 @@ $(eval $(call gb_Library_use_libraries,sfx,\ ucbhelper \ utl \ vcl \ - $(gb_UWINAPI) \ + $(gb_UWINAPI) \ )) $(eval $(call gb_Library_use_external,sfx,libxml2)) @@ -138,7 +138,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/sorgitm \ sfx2/source/control/statcach \ sfx2/source/control/templateabstractview \ - sfx2/source/control/templateview \ sfx2/source/control/templateviewitem \ sfx2/source/control/templatelocalview \ sfx2/source/control/templatecontaineritem \ @@ -150,7 +149,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/control/unoctitm \ sfx2/source/dialog/alienwarn \ sfx2/source/dialog/basedlgs \ - sfx2/source/dialog/checkin \ + sfx2/source/dialog/checkin \ sfx2/source/dialog/dinfdlg \ sfx2/source/dialog/dinfedt \ sfx2/source/dialog/dockwin \ @@ -295,11 +294,11 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ )) $(eval $(call gb_Library_use_system_win32_libs,sfx,\ - advapi32 \ - gdi32 \ - ole32 \ - shell32 \ - uuid \ + advapi32 \ + gdi32 \ + ole32 \ + shell32 \ + uuid \ )) endif diff --git a/sfx2/Package_inc.mk b/sfx2/Package_inc.mk index aa368b7e4f00..228cc625b313 100644 --- a/sfx2/Package_inc.mk +++ b/sfx2/Package_inc.mk @@ -120,7 +120,6 @@ $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templdlg.hxx,sfx2/templdlg.h $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templatelocnames.hrc,sfx2/templatelocnames.hrc)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateabstractview.hxx,sfx2/templateabstractview.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateinfodlg.hxx,sfx2/templateinfodlg.hxx)) -$(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateview.hxx,sfx2/templateview.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templatelocalview.hxx,sfx2/templatelocalview.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templatecontaineritem.hxx,sfx2/templatecontaineritem.hxx)) $(eval $(call gb_Package_add_file,sfx2_inc,inc/sfx2/templateremoteview.hxx,sfx2/templateremoteview.hxx)) diff --git a/sfx2/inc/sfx2/doctempl.hxx b/sfx2/inc/sfx2/doctempl.hxx index b9ca56d70137..add39df0d603 100644 --- a/sfx2/inc/sfx2/doctempl.hxx +++ b/sfx2/inc/sfx2/doctempl.hxx @@ -96,6 +96,8 @@ public: sal_Bool InsertDir(const String &rText, sal_uInt16 nRegion); sal_Bool SetName(const String &rName, sal_uInt16 nRegion, sal_uInt16 nIdx); + sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath); + /** Change the name of an entry or a directory \param rName diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx index ca5118109a0d..f14efada5fbc 100644 --- a/sfx2/inc/sfx2/templateabstractview.hxx +++ b/sfx2/inc/sfx2/templateabstractview.hxx @@ -10,20 +10,25 @@ #ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__ #define __SFX2_TEMPLATEABSTRACTVIEW_HXX__ +#include <sfx2/templateproperties.hxx> #include <sfx2/thumbnailview.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> //template thumbnail item defines #define TEMPLATE_ITEM_MAX_WIDTH 160 -#define TEMPLATE_ITEM_MAX_HEIGHT 160 +#define TEMPLATE_ITEM_MAX_HEIGHT 140 #define TEMPLATE_ITEM_PADDING 5 #define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20 #define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 88 +//template thumbnail height with a subtitle +#define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160 + //template thumbnail image defines #define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING #define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING -class TemplateView; class SfxDocumentTemplates; enum FILTER_APPLICATION @@ -80,60 +85,59 @@ public: virtual ~TemplateAbstractView (); - // Fill view with template folders thumbnails - virtual void Populate () { }; - - virtual void reload () { }; + void insertItem (const TemplateItemProperties &rTemplate); - virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp); + // Fill view with new item list + void insertItems (const std::vector<TemplateItemProperties> &rTemplates); - virtual void showOverlay (bool bVisible) = 0; - - void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding); + // Fill view with template folders thumbnails + virtual void Populate () { } - sal_uInt16 getOverlayRegionId () const; + virtual void reload () { } - const OUString& getOverlayName () const; + virtual void showRootRegion () = 0; - // Check if the overlay is visible or not. - bool isOverlayVisible () const; + virtual void showRegion (ThumbnailViewItem *pItem) = 0; - void deselectOverlayItems (); + // Return if we can have regions inside the current region + virtual bool isNestedRegionAllowed () const = 0; - void deselectOverlayItem (const sal_uInt16 nItemId); + // Return if we can import templates to the current region + virtual bool isImportAllowed () const = 0; - void sortOverlayItems (const boost::function<bool (const ThumbnailViewItem*, - const ThumbnailViewItem*) > &func); + sal_uInt16 getCurRegionId () const; - virtual void filterTemplatesByKeyword (const OUString &rKeyword); + const OUString& getCurRegionName () const; - void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; } + // Check if the root region is visible or not. + bool isNonRootRegionVisible () const; - void setOverlayDblClickHdl (const Link &rLink); + void setOpenRegionHdl(const Link &rLink); - void setOverlayCloseHdl (const Link &rLink); + void setOpenTemplateHdl (const Link &rLink); static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height); - static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height); + static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath ); - virtual void Resize(); + static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height); protected: - virtual void Paint( const Rectangle& rRect ); + DECL_LINK(ShowRootRegionHdl, void*); - virtual void DrawItem (ThumbnailViewItem *pItem); - - DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*); + virtual void OnItemDblClicked(ThumbnailViewItem *pItem); protected: - TemplateView *mpItemView; - Link maOverlayItemStateHdl; + sal_uInt16 mnCurRegionId; + OUString maCurRegionName; + + PushButton maAllButton; + FixedText maFTName; - bool mbFilteredResults; // Flag keep track if overlay has been filtered so folders can get filtered too afterwards - FILTER_APPLICATION meFilterOption; + Link maOpenRegionHdl; + Link maOpenTemplateHdl; }; #endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__ diff --git a/sfx2/inc/sfx2/templatecontaineritem.hxx b/sfx2/inc/sfx2/templatecontaineritem.hxx index 476860433c47..527571c80cac 100644 --- a/sfx2/inc/sfx2/templatecontaineritem.hxx +++ b/sfx2/inc/sfx2/templatecontaineritem.hxx @@ -17,6 +17,7 @@ class TemplateContainerItem : public ThumbnailViewItem { public: + sal_uInt16 mnRegionId; BitmapEx maPreview2; BitmapEx maPreview3; BitmapEx maPreview4; diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx index 78cf5479bc91..09b69ce762ce 100644 --- a/sfx2/inc/sfx2/templatelocalview.hxx +++ b/sfx2/inc/sfx2/templatelocalview.hxx @@ -13,7 +13,6 @@ #include <set> #include <sfx2/templateabstractview.hxx> -#include <sfx2/templateproperties.hxx> class SfxDocumentTemplates; class TemplateContainerItem; @@ -26,6 +25,8 @@ namespace com { class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView { + typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); + public: TemplateLocalView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); @@ -37,26 +38,45 @@ public: virtual void reload (); - std::vector<OUString> getFolderNames (); + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); + + void showRegion (const OUString &rName); - virtual void showOverlay (bool bVisible); + sal_uInt16 getCurRegionItemId () const; + + sal_uInt16 getRegionId (size_t pos) const; + + OUString getRegionName(const sal_uInt16 nRegionId) const; + + OUString getRegionItemName(const sal_uInt16 nItemId) const; + + std::vector<OUString> getFolderNames (); std::vector<TemplateItemProperties> getFilteredItems (const boost::function<bool (const TemplateItemProperties&) > &rFunc) const; sal_uInt16 createRegion (const OUString &rName); + virtual bool isNestedRegionAllowed () const; + + virtual bool isImportAllowed () const; + bool removeRegion (const sal_uInt16 nItemId); bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId); bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem, - const sal_uInt16 nTargetItem, bool bCopy); + const sal_uInt16 nTargetItem); - bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy); + bool moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem); bool copyFrom (const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath); + // Import a template to the current region + bool copyFrom (const OUString &rPath); + bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath); bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName); @@ -65,7 +85,7 @@ public: com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName); - bool saveTemplateAs (const TemplateContainerItem *pDstItem, + bool saveTemplateAs (TemplateContainerItem *pDstItem, com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName); @@ -75,11 +95,8 @@ public: private: - virtual void OnItemDblClicked (ThumbnailViewItem *pRegionItem); - -private: - SfxDocumentTemplates *mpDocTemplates; + std::vector<TemplateContainerItem* > maRegions; }; #endif // TEMPLATEFOLDERVIEW_HXX diff --git a/sfx2/inc/sfx2/templateproperties.hxx b/sfx2/inc/sfx2/templateproperties.hxx index 0760f604242d..1f109c525105 100644 --- a/sfx2/inc/sfx2/templateproperties.hxx +++ b/sfx2/inc/sfx2/templateproperties.hxx @@ -15,6 +15,7 @@ struct TemplateItemProperties { + bool aIsFolder; sal_uInt16 nId; ///< Index for ThumbnailView sal_uInt16 nDocId; ///< Index based on SfxTemplateDocument sal_uInt16 nRegionId; diff --git a/sfx2/inc/sfx2/templateremoteview.hxx b/sfx2/inc/sfx2/templateremoteview.hxx index bd1bf5cad34a..01a582fe0698 100644 --- a/sfx2/inc/sfx2/templateremoteview.hxx +++ b/sfx2/inc/sfx2/templateremoteview.hxx @@ -25,10 +25,16 @@ public: virtual ~TemplateRemoteView (); - virtual void showOverlay (bool bVisible); + virtual void showRootRegion (); + + virtual void showRegion (ThumbnailViewItem *pItem); bool loadRepository (TemplateRepository* pRepository, bool bRefresh); + virtual bool isNestedRegionAllowed () const; + + virtual bool isImportAllowed () const; + private: com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv; diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx deleted file mode 100644 index 3e2a7c846a2d..000000000000 --- a/sfx2/inc/sfx2/templateview.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright 2012 LibreOffice contributors. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef TEMPLATEVIEW_HXX -#define TEMPLATEVIEW_HXX - -#include <sfx2/templateproperties.hxx> -#include <sfx2/thumbnailview.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> - -class Edit; -class TemplateViewItem; - -class TemplateView : public ThumbnailView -{ -public: - - TemplateView (Window *pParent); - - virtual ~TemplateView (); - - void setId (const sal_uInt16 nId) { mnId = nId; } - - sal_uInt16 getId () const { return mnId; } - - void setName (const OUString &rName); - - const OUString& getName () const { return maName; } - - void InsertItems (const std::vector<TemplateItemProperties> &rTemplates); - - void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; } - - void setCloseHdl (const Link &rLink) { maAllButton.SetClickHdl(rLink); } - void setMasterView(TemplateAbstractView* pMasterView) { mpMasterView = pMasterView; } - virtual bool renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle); - -protected: - - virtual void Resize (); - - virtual void OnItemDblClicked (ThumbnailViewItem *pItem); - -private: - TemplateAbstractView* mpMasterView; - - Control maButtons; - PushButton maAllButton; - FixedText maFTName; - sal_uInt16 mnId; - OUString maName; - Link maDblClickHdl; -}; - -#endif // TEMPLATEVIEW_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx index 8eb94267fde3..1286385d680b 100644 --- a/sfx2/inc/sfx2/thumbnailview.hxx +++ b/sfx2/inc/sfx2/thumbnailview.hxx @@ -179,16 +179,23 @@ public: virtual ~ThumbnailView (); + void AppendItem (ThumbnailViewItem *pItem); + void RemoveItem( sal_uInt16 nItemId ); void Clear(); + // Change current thumbnail item list with new one (invalidates all pointers to a thumbnail item) + void updateItems(const std::vector<ThumbnailViewItem *> &items); + size_t GetItemPos( sal_uInt16 nItemId ) const; sal_uInt16 GetItemId( size_t nPos ) const; sal_uInt16 GetItemId( const Point& rPos ) const; + sal_uInt16 getNextItemId () const; + long GetItemWidth() const { return mnItemWidth; } long GetItemHeight() const { return mnItemHeight; } @@ -202,10 +209,9 @@ public: void SelectItem( sal_uInt16 nItemId ); - sal_uInt16 GetSelectItemId() const { return mnSelItemId; } + void DeselectItem( sal_uInt16 nItemId ); - bool IsItemSelected( sal_uInt16 nItemId ) const - { return nItemId == mnSelItemId; } + bool IsItemSelected( sal_uInt16 nItemId ) const; void deselectItem (const sal_uInt16 nItemId); @@ -242,6 +248,8 @@ public: protected: + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void MouseButtonUp( const MouseEvent& rMEvt ); @@ -258,8 +266,6 @@ protected: virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual bool StartDrag( const CommandEvent& rCEvt, Region& rRegion ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); protected: @@ -277,9 +283,8 @@ protected: using Control::ImplInitSettings; using Window::ImplInit; - void calculateColumnsRows (); - void CalculateItemPositions (); + void MakeItemVisible( sal_uInt16 nId ); SFX2_DLLPRIVATE void ImplInit(); SFX2_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); @@ -299,6 +304,8 @@ protected: protected: ValueItemList mItemList; + ValueItemList mFilteredItemList; ///< Cache to store the filtered items + ValueItemList::iterator mpStartSelRange; ScrollBar* mpScrBar; Rectangle maItemListRect; long mnHeaderHeight; @@ -310,7 +317,6 @@ protected: long mnVisLines; long mnLines; sal_uInt16 mnScrBarOffset; - sal_uInt16 mnSelItemId; sal_uInt16 mnHighItemId; sal_uInt16 mnCols; sal_uInt16 mnFirstLine; diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx index 47c1989adb06..343a9ef56ad4 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/sfx2/inc/templatedlg.hxx @@ -15,6 +15,7 @@ #include <vcl/dialog.hxx> #include <vcl/button.hxx> #include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> class Edit; class PopupMenu; @@ -37,6 +38,8 @@ namespace com { class SfxTemplateManagerDlg : public ModelessDialog { + typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); + public: SfxTemplateManagerDlg (Window *parent = DIALOG_NO_PARENT); @@ -49,29 +52,27 @@ public: DECL_LINK(ActivatePageHdl, void*); - static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath ); - private: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); + void readSettings (); - virtual void Resize (); + void writeSettings (); - DECL_LINK(CloseOverlayHdl, void*); + virtual void Resize (); DECL_LINK(TBXViewHdl, void*); DECL_LINK(TBXActionHdl, void*); DECL_LINK(TBXTemplateHdl, void*); DECL_LINK(TBXDropdownHdl, ToolBox*); - DECL_LINK(TVFolderStateHdl, const ThumbnailViewItem*); - DECL_LINK(TVTemplateStateHdl, const ThumbnailViewItem*); + DECL_LINK(TVItemStateHdl, const ThumbnailViewItem*); DECL_LINK(MenuSelectHdl, Menu*); DECL_LINK(MoveMenuSelectHdl, Menu*); DECL_LINK(RepositoryMenuSelectHdl, Menu*); DECL_LINK(DefaultTemplateMenuSelectHdl, Menu*); + DECL_LINK(OpenRegionHdl, void*); DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*); DECL_LINK(SearchUpdateHdl, void*); @@ -83,7 +84,13 @@ private: void OnTemplateDelete (); void OnTemplateAsDefault (); void OnTemplateExport (); + + void OnTemplateState (const ThumbnailViewItem *pItem); + void OnFolderDelete (); + + void OnRegionState (const ThumbnailViewItem *pItem); + void OnRepositoryDelete (); void OnTemplateSaveAs (); @@ -126,7 +133,7 @@ private: private: TabControl maTabControl; - Control *mpToolbars; + TabPage maTabPage; Edit *mpSearchEdit; ToolBox *mpViewBar; @@ -140,8 +147,8 @@ private: PopupMenu *mpRepositoryMenu; PopupMenu *mpTemplateDefaultMenu; - std::set<const ThumbnailViewItem*> maSelTemplates; - std::set<const ThumbnailViewItem*> maSelFolders; + std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelTemplates; + std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders; bool mbIsSaveMode; ///< Flag that indicates if we are in save mode or not. com::sun::star::uno::Reference< com::sun::star::frame::XModel > m_xModel; diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx index de2091f22ecd..e28d2e83dbf3 100644 --- a/sfx2/source/control/templateabstractview.cxx +++ b/sfx2/source/control/templateabstractview.cxx @@ -8,10 +8,10 @@ */ #include <sfx2/templateabstractview.hxx> -#include <sfx2/templatecontaineritem.hxx> #include <comphelper/processfactory.hxx> -#include <sfx2/templateview.hxx> +#include <sfx2/sfxresid.hxx> +#include <sfx2/templatecontaineritem.hxx> #include <sfx2/templateviewitem.hxx> #include <tools/urlobj.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -23,6 +23,9 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include "../doc/doc.hrc" +#include "templateview.hrc" + bool ViewFilter_Application::isValid (const OUString &rPath) const { bool bRet = true; @@ -99,8 +102,6 @@ bool ViewFilter_Application::operator () (const ThumbnailViewItem *pItem) } } } - - return mApp != FILTER_APP_NONE ? nVisCount : true ; } return true; } @@ -114,111 +115,111 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem) TemplateAbstractView::TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : ThumbnailView(pParent,nWinStyle,bDisableTransientChildren), - mpItemView(new TemplateView(this)), - mbFilteredResults(false), - meFilterOption(FILTER_APP_WRITER) + mnCurRegionId(0), + maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)), + maFTName(this, SfxResId(FT_NAME)) { - mpItemView->setItemStateHdl(LINK(this,TemplateAbstractView,OverlayItemStateHdl)); + maAllButton.Hide(); + maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON); + maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl)); + maFTName.Hide(); } TemplateAbstractView::TemplateAbstractView(Window *pParent, const ResId &rResId, bool bDisableTransientChildren) : ThumbnailView(pParent,rResId,bDisableTransientChildren), - mpItemView(new TemplateView(this)), - mbFilteredResults(false), - meFilterOption(FILTER_APP_WRITER) + mnCurRegionId(0), + maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)), + maFTName(this, SfxResId(FT_NAME)) { - mpItemView->setItemStateHdl(LINK(this,TemplateAbstractView,OverlayItemStateHdl)); + maAllButton.Hide(); + maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON); + maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl)); + maFTName.Hide(); } TemplateAbstractView::~TemplateAbstractView () { - delete mpItemView; } -void TemplateAbstractView::setItemDimensions(long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding) +void TemplateAbstractView::insertItem(const TemplateItemProperties &rTemplate) { - ThumbnailView::setItemDimensions(ItemWidth,ThumbnailHeight,DisplayHeight,itemPadding); + const TemplateItemProperties *pCur = &rTemplate; - mpItemView->setItemDimensions(ItemWidth,ThumbnailHeight,DisplayHeight,itemPadding); -} - -sal_uInt16 TemplateAbstractView::getOverlayRegionId() const -{ - return mpItemView->getId(); -} + TemplateViewItem *pChild = new TemplateViewItem(*this); + pChild->mnId = pCur->nId; + pChild->mnDocId = pCur->nDocId; + pChild->mnRegionId = pCur->nRegionId; + pChild->maTitle = pCur->aName; + pChild->setPath(pCur->aPath); + pChild->maPreview1 = pCur->aThumbnail; -const OUString &TemplateAbstractView::getOverlayName() const -{ - return mpItemView->getName(); -} + if ( pCur->aThumbnail.IsEmpty() ) + { + // Use the default thumbnail if we have nothing else + pChild->maPreview1 = TemplateAbstractView::getDefaultThumbnail(pCur->aPath); + } -bool TemplateAbstractView::isOverlayVisible () const -{ - return mpItemView->IsVisible(); -} + pChild->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); -void TemplateAbstractView::deselectOverlayItems() -{ - mpItemView->deselectItems(); -} + AppendItem(pChild); -void TemplateAbstractView::deselectOverlayItem(const sal_uInt16 nItemId) -{ - mpItemView->deselectItem(nItemId); + CalculateItemPositions(); + Invalidate(); } -void TemplateAbstractView::sortOverlayItems(const boost::function<bool (const ThumbnailViewItem*, - const ThumbnailViewItem*) > &func) +void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties> &rTemplates) { - mpItemView->sortItems(func); -} + std::vector<ThumbnailViewItem*> aItems(rTemplates.size()); + for (size_t i = 0, n = rTemplates.size(); i < n; ++i ) + { + //TODO: CHECK IF THE ITEM IS A FOLDER OR NOT + TemplateViewItem *pChild = new TemplateViewItem(*this); + const TemplateItemProperties *pCur = &rTemplates[i]; + + pChild->mnId = pCur->nId; + pChild->mnDocId = pCur->nDocId; + pChild->mnRegionId = pCur->nRegionId; + pChild->maTitle = pCur->aName; + pChild->setPath(pCur->aPath); + pChild->maPreview1 = pCur->aThumbnail; + + if ( pCur->aThumbnail.IsEmpty() ) + { + // Use the default thumbnail if we have nothing else + pChild->maPreview1 = TemplateAbstractView::getDefaultThumbnail(pCur->aPath); + } -void TemplateAbstractView::filterTemplatesByApp (const FILTER_APPLICATION &eApp) -{ - meFilterOption = eApp; + pChild->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - if (mpItemView->IsVisible()) - { - mbFilteredResults = true; - mpItemView->filterItems(ViewFilter_Application(eApp)); - } - else - { - filterItems(ViewFilter_Application(eApp)); + aItems[i] = pChild; } + + updateItems(aItems); } -void TemplateAbstractView::showOverlay (bool bVisible) +sal_uInt16 TemplateAbstractView::getCurRegionId() const { - mpItemView->Show(bVisible); - - // Clear items is the overlay is closed. - if (!bVisible) - { - // Check if the folder view needs to be filtered - if (mbFilteredResults) - { - filterItems(ViewFilter_Application(meFilterOption)); - } + return mnCurRegionId; +} - mpItemView->Clear(); - } +const OUString &TemplateAbstractView::getCurRegionName() const +{ + return maCurRegionName; } -void TemplateAbstractView::filterTemplatesByKeyword(const OUString &rKeyword) +bool TemplateAbstractView::isNonRootRegionVisible () const { - if (mpItemView->IsVisible()) - mpItemView->filterItems(ViewFilter_Keyword(rKeyword)); + return mnCurRegionId; } -void TemplateAbstractView::setOverlayDblClickHdl(const Link &rLink) +void TemplateAbstractView::setOpenRegionHdl(const Link &rLink) { - mpItemView->setDblClickHdl(rLink); + maOpenRegionHdl = rLink; } -void TemplateAbstractView::setOverlayCloseHdl(const Link &rLink) +void TemplateAbstractView::setOpenTemplateHdl(const Link &rLink) { - mpItemView->setCloseHdl(rLink); + maOpenTemplateHdl = rLink; } BitmapEx TemplateAbstractView::scaleImg (const BitmapEx &rImg, long width, long height) @@ -256,6 +257,31 @@ BitmapEx TemplateAbstractView::scaleImg (const BitmapEx &rImg, long width, long return aImg; } +BitmapEx TemplateAbstractView::getDefaultThumbnail( const OUString& rPath ) +{ + INetURLObject aUrl(rPath); + OUString aExt = aUrl.getExtension(); + + BitmapEx aImg; + if ( aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx" ) + { + aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_TEXT ) ); + } + else if ( aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx" ) + { + aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_SHEET ) ); + } + else if ( aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx" ) + { + aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_PRESENTATION ) ); + } + else if ( aExt == "otg" || aExt == "std" ) + { + aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_DRAWING ) ); + } + return aImg; +} + BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width, long height) { using namespace ::com::sun::star; @@ -365,28 +391,30 @@ BitmapEx TemplateAbstractView::fetchThumbnail (const OUString &msURL, long width return TemplateAbstractView::scaleImg(aThumbnail,width,height); } -void TemplateAbstractView::Resize() +IMPL_LINK_NOARG(TemplateAbstractView, ShowRootRegionHdl) { - mpItemView->SetSizePixel(GetSizePixel()); - ThumbnailView::Resize(); + showRootRegion(); + return 0; } -void TemplateAbstractView::Paint(const Rectangle &rRect) +void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem) { - if (!mpItemView->IsVisible()) - ThumbnailView::Paint(rRect); -} + //Check if the item is a TemplateContainerItem (Folder) or a TemplateViewItem (File) -void TemplateAbstractView::DrawItem(ThumbnailViewItem *pItem) -{ - if (!mpItemView->IsVisible()) - ThumbnailView::DrawItem(pItem); -} + TemplateContainerItem* pContainerItem = dynamic_cast<TemplateContainerItem*>(pItem); + if ( pContainerItem ) + { + // Fill templates -IMPL_LINK(TemplateAbstractView, OverlayItemStateHdl, const ThumbnailViewItem*, pItem) -{ - maOverlayItemStateHdl.Call((void*)pItem); - return 0; + mnCurRegionId = pContainerItem->mnRegionId+1; + maCurRegionName = pContainerItem->maTitle; + maFTName.SetText(maCurRegionName); + showRegion(pItem); + } + else + { + maOpenTemplateHdl.Call(pItem); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx index ca8856ece221..f1a34217f0fb 100644 --- a/sfx2/source/control/templatelocalview.cxx +++ b/sfx2/source/control/templatelocalview.cxx @@ -12,7 +12,6 @@ #include <comphelper/processfactory.hxx> #include <sfx2/doctempl.hxx> #include <sfx2/templatecontaineritem.hxx> -#include <sfx2/templateview.hxx> #include <sfx2/templateviewitem.hxx> #include <svl/inettype.hxx> #include <tools/urlobj.hxx> @@ -36,17 +35,25 @@ TemplateLocalView::TemplateLocalView ( Window* pParent, const ResId& rResId, boo : TemplateAbstractView(pParent,rResId,bDisableTransientChildren), mpDocTemplates(new SfxDocumentTemplates) { - mpItemView->SetColor(GetSettings().GetStyleSettings().GetFieldColor()); - mpItemView->setMasterView(this); } TemplateLocalView::~TemplateLocalView() { + for (size_t i = 0; i < maRegions.size(); ++i) + delete maRegions[i]; + + maRegions.clear(); + delete mpDocTemplates; } void TemplateLocalView::Populate () { + for (size_t i = 0; i < maRegions.size(); ++i) + delete maRegions[i]; + + maRegions.clear(); + sal_uInt16 nCount = mpDocTemplates->GetRegionCount(); for (sal_uInt16 i = 0; i < nCount; ++i) { @@ -54,6 +61,7 @@ void TemplateLocalView::Populate () TemplateContainerItem* pItem = new TemplateContainerItem( *this ); pItem->mnId = i+1; + pItem->mnRegionId = i; pItem->maTitle = aRegionName; pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); @@ -65,6 +73,7 @@ void TemplateLocalView::Populate () OUString aURL = mpDocTemplates->GetPath(i,j); TemplateItemProperties aProperties; + aProperties.aIsFolder = false; // Flat hierarchy for the local filesystem (no nested folders) aProperties.nId = j+1; aProperties.nDocId = j; aProperties.nRegionId = i; @@ -79,68 +88,132 @@ void TemplateLocalView::Populate () lcl_updateThumbnails(pItem); - mItemList.push_back(pItem); + maRegions.push_back(pItem); } - - CalculateItemPositions(); - - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate(); } void TemplateLocalView::reload () { mpDocTemplates->Update(); - Clear(); - Populate(); - if (mpItemView->IsVisible()) + // Check if we are currently browsing a region or root folder + if (mnCurRegionId) { - sal_uInt16 nItemId = mpItemView->getId() + 1; + sal_uInt16 nRegionId = mnCurRegionId - 1; //Is offset by 1 - for (size_t i = 0; i < mItemList.size(); ++i) + for (size_t i = 0; i < maRegions.size(); ++i) { - if (mItemList[i]->mnId == nItemId) + if (maRegions[i]->mnRegionId == nRegionId) { - mpItemView->Clear(); - mpItemView->InsertItems(static_cast<TemplateContainerItem*>(mItemList[i])->maTemplates); + showRegion(maRegions[i]); break; } } } + else + showRootRegion(); } -std::vector<OUString> TemplateLocalView::getFolderNames() +void TemplateLocalView::showRootRegion() { - size_t n = mItemList.size(); - std::vector<OUString> ret(n); + mnHeaderHeight = 0; + mnCurRegionId = 0; + maCurRegionName = OUString(); - for (size_t i = 0; i < n; ++i) - ret[i] = mItemList[i]->maTitle; + // Clone root region items so they dont get invalidated when we open another region + std::vector<ThumbnailViewItem*> items(maRegions.size()); + for (int i = 0, n = maRegions.size(); i < n; ++i) + { + TemplateContainerItem *pCur = maRegions[i]; + TemplateContainerItem *pItem = new TemplateContainerItem(*this); + pItem->mnId = pCur->mnId; + pItem->mnRegionId = pCur->mnRegionId; + pItem->maTitle = pCur->maTitle; + pItem->maTemplates = pCur->maTemplates; + pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - return ret; + items[i] = pItem; + } + + maAllButton.Show(false); + maFTName.Show(false); + + updateItems(items); + + maOpenRegionHdl.Call(NULL); } -void TemplateLocalView::showOverlay (bool bVisible) +void TemplateLocalView::showRegion(ThumbnailViewItem *pItem) { - mpItemView->Show(bVisible); + mnHeaderHeight = maAllButton.GetSizePixel().getHeight() + maAllButton.GetPosPixel().Y() * 2; + + mnCurRegionId = static_cast<TemplateContainerItem*>(pItem)->mnRegionId+1; + maCurRegionName = pItem->maTitle; + maAllButton.Show(true); + maFTName.Show(true); + + insertItems(reinterpret_cast<TemplateContainerItem*>(pItem)->maTemplates); - // Clear items is the overlay is closed. - if (!bVisible) + maOpenRegionHdl.Call(NULL); +} + +void TemplateLocalView::showRegion(const OUString &rName) +{ + for (int i = 0, n = maRegions.size(); i < n; ++i) { - // Check if the folder view needs to be filtered - if (mbFilteredResults) + if (maRegions[i]->maTitle == rName) { - filterItems(ViewFilter_Application(meFilterOption)); - - mbFilteredResults = false; - meFilterOption = FILTER_APP_NONE; + showRegion(maRegions[i]); + break; } + } +} + +sal_uInt16 TemplateLocalView::getCurRegionItemId() const +{ + for (size_t i = 0; i < maRegions.size(); ++i) + { + if (maRegions[i]->mnRegionId == mnCurRegionId-1) + return maRegions[i]->mnId; + } - mpItemView->Clear(); + return 0; +} + +sal_uInt16 TemplateLocalView::getRegionId(size_t pos) const +{ + assert(pos < maRegions.size()); + + return maRegions[pos]->mnId; +} + +OUString TemplateLocalView::getRegionName(const sal_uInt16 nRegionId) const +{ + return mpDocTemplates->GetRegionName(nRegionId); +} + +OUString TemplateLocalView::getRegionItemName(const sal_uInt16 nItemId) const +{ + for (size_t i = 0; i < maRegions.size(); ++i) + { + if (maRegions[i]->mnId == nItemId) + return maRegions[i]->maTitle; } + + return OUString(); +} + +std::vector<OUString> TemplateLocalView::getFolderNames() +{ + size_t n = maRegions.size(); + std::vector<OUString> ret(n); + + for (size_t i = 0; i < n; ++i) + ret[i] = maRegions[i]->maTitle; + + return ret; } std::vector<TemplateItemProperties> @@ -148,9 +221,9 @@ TemplateLocalView::getFilteredItems(const boost::function<bool (const TemplateIt { std::vector<TemplateItemProperties> aItems; - for (size_t i = 0; i < mItemList.size(); ++i) + if (mnCurRegionId) { - TemplateContainerItem *pFolderItem = static_cast<TemplateContainerItem*>(mItemList[i]); + TemplateContainerItem *pFolderItem = maRegions[mnCurRegionId-1]; for (size_t j = 0; j < pFolderItem->maTemplates.size(); ++j) { @@ -158,6 +231,19 @@ TemplateLocalView::getFilteredItems(const boost::function<bool (const TemplateIt aItems.push_back(pFolderItem->maTemplates[j]); } } + else + { + for (size_t i = 0; i < maRegions.size(); ++i) + { + TemplateContainerItem *pFolderItem = maRegions[i]; + + for (size_t j = 0; j < pFolderItem->maTemplates.size(); ++j) + { + if (rFunc(pFolderItem->maTemplates[j])) + aItems.push_back(pFolderItem->maTemplates[j]); + } + } + } return aItems; } @@ -165,34 +251,85 @@ TemplateLocalView::getFilteredItems(const boost::function<bool (const TemplateIt sal_uInt16 TemplateLocalView::createRegion(const OUString &rName) { sal_uInt16 nRegionId = mpDocTemplates->GetRegionCount(); // Next regionId + sal_uInt16 nItemId = getNextItemId(); if (!mpDocTemplates->InsertDir(rName,nRegionId)) return false; OUString aRegionName = rName; + // Insert to the region cache list and to the thumbnail item list TemplateContainerItem* pItem = new TemplateContainerItem( *this ); - pItem->mnId = nRegionId+1; + pItem->mnId = nItemId; + pItem->mnRegionId = nRegionId; pItem->maTitle = aRegionName; pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - mItemList.push_back(pItem); + maRegions.push_back(pItem); - CalculateItemPositions(); + pItem = new TemplateContainerItem(*this); + pItem->mnId = nItemId; + pItem->mnRegionId = nRegionId; + pItem->maTitle = aRegionName; + pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate(); + AppendItem(pItem); + + CalculateItemPositions(); + Invalidate(); return pItem->mnId; } +bool TemplateLocalView::isNestedRegionAllowed() const +{ + return !mnCurRegionId; +} + +bool TemplateLocalView::isImportAllowed() const +{ + return mnCurRegionId; +} + bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId) { - sal_uInt16 nRegionId = nItemId - 1; + sal_uInt16 nRegionId = USHRT_MAX; + + // Remove from the region cache list + std::vector<TemplateContainerItem*>::iterator pRegionIt; + for ( pRegionIt = maRegions.begin(); pRegionIt != maRegions.end();) + { + if ( (*pRegionIt)->mnId == nItemId ) + { + if (!mpDocTemplates->Delete((*pRegionIt)->mnRegionId,USHRT_MAX)) + return false; - if (!mpDocTemplates->Delete(nRegionId,USHRT_MAX)) + nRegionId = (*pRegionIt)->mnRegionId; + + delete *pRegionIt; + pRegionIt = maRegions.erase(pRegionIt); + } + else + { + // Syncronize regions cache ids with SfxDocumentTemplates + if (nRegionId != USHRT_MAX && (*pRegionIt)->mnRegionId > nRegionId) + --(*pRegionIt)->mnRegionId; + + ++pRegionIt; + } + } + + if (nRegionId == USHRT_MAX) return false; + // Syncronize view regions ids with SfxDocumentTemplates + std::vector<ThumbnailViewItem*>::iterator pViewIt = mItemList.begin(); + for ( pViewIt = mItemList.begin(); pViewIt != mItemList.end(); ++pViewIt) + { + if (static_cast<TemplateContainerItem*>(*pViewIt)->mnRegionId > nRegionId) + --static_cast<TemplateContainerItem*>(*pViewIt)->mnRegionId; + } + RemoveItem(nItemId); return true; @@ -200,24 +337,26 @@ bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId) bool TemplateLocalView::removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId) { - sal_uInt16 nRegionId = nSrcItemId - 1; - - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nSrcItemId) + if (maRegions[i]->mnId == nSrcItemId) { - TemplateContainerItem *pItem = static_cast<TemplateContainerItem*>(mItemList[i]); + TemplateContainerItem *pItem = static_cast<TemplateContainerItem*>(maRegions[i]); std::vector<TemplateItemProperties>::iterator pIter; for (pIter = pItem->maTemplates.begin(); pIter != pItem->maTemplates.end(); ++pIter) { if (pIter->nId == nItemId) { - if (!mpDocTemplates->Delete(nRegionId,pIter->nDocId)) + if (!mpDocTemplates->Delete(pItem->mnRegionId,pIter->nDocId)) return false; pIter = pItem->maTemplates.erase(pIter); - mpItemView->RemoveItem(nItemId); + if (maRegions[i]->mnRegionId == mnCurRegionId-1) + { + RemoveItem(nItemId); + Invalidate(); + } // Update Doc Idx for all templates that follow for (; pIter != pItem->maTemplates.end(); ++pIter) @@ -239,40 +378,34 @@ bool TemplateLocalView::removeTemplate (const sal_uInt16 nItemId, const sal_uInt } bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_uInt16 nSrcItem, - const sal_uInt16 nTargetItem, bool bCopy) + const sal_uInt16 nTargetItem) { - bool bRet = true; - bool bRefresh = false; - TemplateContainerItem *pTarget = NULL; TemplateContainerItem *pSrc = NULL; - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nTargetItem) - pTarget = static_cast<TemplateContainerItem*>(mItemList[i]); - else if (mItemList[i]->mnId == nSrcItem) - pSrc = static_cast<TemplateContainerItem*>(mItemList[i]); + if (maRegions[i]->mnId == nTargetItem) + pTarget = static_cast<TemplateContainerItem*>(maRegions[i]); + else if (maRegions[i]->mnId == nSrcItem) + pSrc = static_cast<TemplateContainerItem*>(maRegions[i]); } if (pTarget && pSrc) { - sal_uInt16 nSrcRegionId = nSrcItem-1; - sal_uInt16 nTargetRegion = pTarget->mnId-1; + sal_uInt16 nSrcRegionId = pSrc->mnRegionId; + sal_uInt16 nTargetRegion = pTarget->mnRegionId; sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion); // Next Idx const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(pItem); - bool bOK; + bool bCopy = !mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId); if (bCopy) - bOK = mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1); - else - bOK = mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1); - - if (!bOK) - return false; - + { + if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId)) + return false; + } // move template to destination TemplateItemProperties aTemplateItem; @@ -280,91 +413,94 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_ aTemplateItem.nDocId = nTargetIdx; aTemplateItem.nRegionId = nTargetRegion; aTemplateItem.aName = pViewItem->maTitle; - aTemplateItem.aPath = pViewItem->getPath(); + aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx); aTemplateItem.aThumbnail = pViewItem->maPreview1; pTarget->maTemplates.push_back(aTemplateItem); if (!bCopy) { - // remove template from overlay and from cached data + // remove template from region cached data std::vector<TemplateItemProperties>::iterator aIter; - for (aIter = pSrc->maTemplates.begin(); aIter != pSrc->maTemplates.end(); ++aIter) + for (aIter = pSrc->maTemplates.begin(); aIter != pSrc->maTemplates.end();) { - if (aIter->nId == pViewItem->mnId) + if (aIter->nDocId == pViewItem->mnDocId) + { + aIter = pSrc->maTemplates.erase(aIter); + } + else { - pSrc->maTemplates.erase(aIter); + // Keep region document id syncronized with SfxDocumentTemplates + if (aIter->nDocId > pViewItem->mnDocId) + --aIter->nDocId; - mpItemView->RemoveItem(pViewItem->mnId); - break; + ++aIter; } } - } - bRefresh = true; - } - else - bRet = false; + // Keep view document id syncronized with SfxDocumentTemplates + std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin(); + for (; pItemIter != mItemList.end(); ++pItemIter) + { + if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId) + --static_cast<TemplateViewItem*>(*pItemIter)->mnDocId; + } + } - if (bRefresh) - { lcl_updateThumbnails(pSrc); lcl_updateThumbnails(pTarget); CalculateItemPositions(); + Invalidate(); - if (IsReallyVisible() && IsUpdateMode()) - { - Invalidate(); - mpItemView->Invalidate(); - } + return true; } - return bRet; + return false; } -bool TemplateLocalView::moveTemplates(std::set<const ThumbnailViewItem *> &rItems, - const sal_uInt16 nTargetItem, bool bCopy) +bool TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, selection_cmp_fn> &rItems, + const sal_uInt16 nTargetItem) { + assert(mnCurRegionId); // Only allowed in non root regions + bool ret = true; bool refresh = false; - sal_uInt16 nSrcRegionId = mpItemView->getId(); - sal_uInt16 nSrcRegionItemId = nSrcRegionId + 1; + sal_uInt16 nSrcRegionId = mnCurRegionId-1; TemplateContainerItem *pTarget = NULL; TemplateContainerItem *pSrc = NULL; - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nTargetItem) - pTarget = static_cast<TemplateContainerItem*>(mItemList[i]); - else if (mItemList[i]->mnId == nSrcRegionItemId) - pSrc = static_cast<TemplateContainerItem*>(mItemList[i]); + if (maRegions[i]->mnId == nTargetItem) + pTarget = static_cast<TemplateContainerItem*>(maRegions[i]); + else if (maRegions[i]->mnRegionId == nSrcRegionId) + pSrc = static_cast<TemplateContainerItem*>(maRegions[i]); } if (pTarget && pSrc) { - sal_uInt16 nTargetRegion = pTarget->mnId-1; + sal_uInt16 nTargetRegion = pTarget->mnRegionId; sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion); // Next Idx + std::vector<sal_uInt16> aItemIds; // List of moved items ids (also prevents the invalidation of rItems iterators when we remove them as we go) - std::set<const ThumbnailViewItem*>::iterator aSelIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn>::iterator aSelIter; for ( aSelIter = rItems.begin(); aSelIter != rItems.end(); ++aSelIter, ++nTargetIdx ) { const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(*aSelIter); - bool bOK; + bool bCopy = !mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId); if (bCopy) - bOK = mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1); - else - bOK = mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1); - - if (!bOK) { - ret = false; - continue; + if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId)) + { + ret = false; + continue; + } } // move template to destination @@ -374,44 +510,60 @@ bool TemplateLocalView::moveTemplates(std::set<const ThumbnailViewItem *> &rItem aTemplateItem.nDocId = nTargetIdx; aTemplateItem.nRegionId = nTargetRegion; aTemplateItem.aName = pViewItem->maTitle; - aTemplateItem.aPath = pViewItem->getPath(); + aTemplateItem.aPath = mpDocTemplates->GetPath(nTargetRegion,nTargetIdx); aTemplateItem.aThumbnail = pViewItem->maPreview1; pTarget->maTemplates.push_back(aTemplateItem); if (!bCopy) { - // remove template from overlay and from cached data + // remove template from region cached data - std::vector<TemplateItemProperties>::iterator pIter; - for (pIter = pSrc->maTemplates.begin(); pIter != pSrc->maTemplates.end(); ++pIter) + std::vector<TemplateItemProperties>::iterator pPropIter; + for (pPropIter = pSrc->maTemplates.begin(); pPropIter != pSrc->maTemplates.end();) { - if (pIter->nId == pViewItem->mnId) + if (pPropIter->nDocId == pViewItem->mnDocId) + { + pPropIter = pSrc->maTemplates.erase(pPropIter); + aItemIds.push_back(pViewItem->mnId); + } + else { - pSrc->maTemplates.erase(pIter); + // Keep region document id syncronized with SfxDocumentTemplates + if (pPropIter->nDocId > pViewItem->mnDocId) + --pPropIter->nDocId; - mpItemView->RemoveItem(pViewItem->mnId); - break; + ++pPropIter; } } + + // Keep view document id syncronized with SfxDocumentTemplates + std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin(); + for (; pItemIter != mItemList.end(); ++pItemIter) + { + if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId) + --static_cast<TemplateViewItem*>(*pItemIter)->mnDocId; + } } refresh = true; } - } - else - ret = false; - if (refresh) - { - lcl_updateThumbnails(pSrc); - lcl_updateThumbnails(pTarget); + // Remove items from the current view + for (std::vector<sal_uInt16>::iterator it = aItemIds.begin(); it != aItemIds.end(); ++it) + RemoveItem(*it); - CalculateItemPositions(); + if (refresh) + { + lcl_updateThumbnails(pSrc); + lcl_updateThumbnails(pTarget); - Invalidate(); - mpItemView->Invalidate(); + CalculateItemPositions(); + Invalidate(); + } } + else + ret = false; return ret; } @@ -419,17 +571,15 @@ bool TemplateLocalView::moveTemplates(std::set<const ThumbnailViewItem *> &rItem bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath) { - sal_uInt16 nRegionId = nRegionItemId - 1; - - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nRegionItemId) + if (maRegions[i]->mnId == nRegionItemId) { sal_uInt16 nId = 0; sal_uInt16 nDocId = 0; TemplateContainerItem *pRegionItem = - static_cast<TemplateContainerItem*>(mItemList[i]); + static_cast<TemplateContainerItem*>(maRegions[i]); if (!pRegionItem->maTemplates.empty()) { @@ -438,6 +588,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx } String aPath(rPath); + sal_uInt16 nRegionId = maRegions[i]->mnRegionId; if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath)) { @@ -450,7 +601,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx aTemplate.aPath = mpDocTemplates->GetPath(nRegionId,nDocId); TemplateContainerItem *pItem = - static_cast<TemplateContainerItem*>(mItemList[i]); + static_cast<TemplateContainerItem*>(maRegions[i]); pItem->maTemplates.push_back(aTemplate); @@ -466,11 +617,47 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx return false; } +bool TemplateLocalView::copyFrom(const OUString &rPath) +{ + assert(mnCurRegionId); + + TemplateContainerItem *pRegItem = maRegions[mnCurRegionId-1]; + + sal_uInt16 nId = getNextItemId(); + sal_uInt16 nDocId = 0; + sal_uInt16 nRegionId = pRegItem->mnRegionId; + + String aPath(rPath); + + if (!pRegItem->maTemplates.empty()) + nDocId = (pRegItem->maTemplates.back()).nDocId+1; + + if (!mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath)) + return false; + + TemplateItemProperties aTemplate; + aTemplate.aIsFolder = false; + aTemplate.nId = nId; + aTemplate.nDocId = nDocId; + aTemplate.nRegionId = nRegionId; + aTemplate.aName = aPath; + aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(rPath, + TEMPLATE_THUMBNAIL_MAX_WIDTH, + TEMPLATE_THUMBNAIL_MAX_HEIGHT); + aTemplate.aPath = rPath; + + pRegItem->maTemplates.push_back(aTemplate); + + insertItem(aTemplate); + + return true; +} + bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString &rPath) { - sal_uInt16 nId = 0; + sal_uInt16 nId = 1; sal_uInt16 nDocId = 0; - sal_uInt16 nRegionId = pItem->mnId - 1; + sal_uInt16 nRegionId = pItem->mnRegionId; String aPath(rPath); if (!pItem->maTemplates.empty()) @@ -482,6 +669,7 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString & if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath)) { TemplateItemProperties aTemplate; + aTemplate.aIsFolder = false; aTemplate.nId = nId; aTemplate.nDocId = nDocId; aTemplate.nRegionId = nRegionId; @@ -505,21 +693,18 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString & bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName) { - sal_uInt16 nRegionId = nRegionItemId - 1; - - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nRegionItemId) + if (maRegions[i]->mnId == nRegionItemId) { - TemplateContainerItem *pRegItem = - static_cast<TemplateContainerItem*>(mItemList[i]); + TemplateContainerItem *pRegItem = maRegions[i]; std::vector<TemplateItemProperties>::iterator aIter; for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter) { if (aIter->nId == nItemId) { - if (!mpDocTemplates->CopyTo(nRegionId,aIter->nDocId,rName)) + if (!mpDocTemplates->CopyTo(pRegItem->mnRegionId,aIter->nDocId,rName)) return false; return true; @@ -537,21 +722,50 @@ bool TemplateLocalView::saveTemplateAs (sal_uInt16 nItemId, com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName) { - bool bRet = false; - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nItemId) + if (maRegions[i]->mnId == nItemId) { - bRet = saveTemplateAs((const TemplateContainerItem*)mItemList[i],rModel,rName); - break; + uno::Reference< frame::XStorable > xStorable(rModel, uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XDocumentTemplates > xTemplates( + frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) ); + + if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(maRegions[i]->mnRegionId),rName, xStorable )) + return false; + + sal_uInt16 nDocId = maRegions[i]->maTemplates.size(); + + OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(maRegions[i]->mnRegionId),rName); + + if(!mpDocTemplates->InsertTemplate(maRegions[i]->mnRegionId,nDocId,rName,aURL)) + return false; + + + TemplateItemProperties aTemplate; + aTemplate.aIsFolder = false; + aTemplate.nId = getNextItemId(); + aTemplate.nDocId = nDocId; + aTemplate.nRegionId = maRegions[i]->mnRegionId; + aTemplate.aName = rName; + aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL, + TEMPLATE_THUMBNAIL_MAX_WIDTH, + TEMPLATE_THUMBNAIL_MAX_HEIGHT); + aTemplate.aPath = aURL; + + maRegions[i]->maTemplates.push_back(aTemplate); + + insertItem(aTemplate); + + return true; } } - return bRet; + return false; } -bool TemplateLocalView::saveTemplateAs(const TemplateContainerItem *pDstItem, +bool TemplateLocalView::saveTemplateAs(TemplateContainerItem *pDstItem, com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, const OUString &rName) { @@ -560,22 +774,38 @@ bool TemplateLocalView::saveTemplateAs(const TemplateContainerItem *pDstItem, uno::Reference< frame::XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) ); - sal_uInt16 nRegionId = pDstItem->mnId-1; + if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(pDstItem->mnRegionId),rName, xStorable )) + return false; + + sal_uInt16 nDocId = pDstItem->maTemplates.size(); + OUString aURL = mpDocTemplates->GetTemplateTargetURLFromComponent(mpDocTemplates->GetRegionName(pDstItem->mnRegionId),rName); - if (!xTemplates->storeTemplate(mpDocTemplates->GetRegionName(nRegionId),rName, xStorable )) + if(!mpDocTemplates->InsertTemplate(pDstItem->mnRegionId,nDocId,rName,aURL)) return false; + TemplateItemProperties aTemplate; + aTemplate.aIsFolder = false; + aTemplate.nId = pDstItem->maTemplates.empty() ? 1 : pDstItem->maTemplates.back().nId+1; + aTemplate.nDocId = nDocId; + aTemplate.nRegionId = pDstItem->mnRegionId; + aTemplate.aName = rName; + aTemplate.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL, + TEMPLATE_THUMBNAIL_MAX_WIDTH, + TEMPLATE_THUMBNAIL_MAX_HEIGHT); + aTemplate.aPath = aURL; + + pDstItem->maTemplates.push_back(aTemplate); + return true; } bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, const OUString &rName) const { - for (size_t i = 0, n = mItemList.size(); i < n; ++i) + for (size_t i = 0, n = maRegions.size(); i < n; ++i) { - if (mItemList[i]->mnId == nRegionItemId) + if (maRegions[i]->mnId == nRegionItemId) { - TemplateContainerItem *pRegItem = - static_cast<TemplateContainerItem*>(mItemList[i]); + TemplateContainerItem *pRegItem = maRegions[i]; std::vector<TemplateItemProperties>::iterator aIter; for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter) @@ -591,19 +821,6 @@ bool TemplateLocalView::isTemplateNameUnique(const sal_uInt16 nRegionItemId, con return true; } -void TemplateLocalView::OnItemDblClicked (ThumbnailViewItem *pRegionItem) -{ - // Fill templates - sal_uInt16 nRegionId = pRegionItem->mnId-1; - - mpItemView->setId(nRegionId); - mpItemView->setName(mpDocTemplates->GetRegionName(nRegionId)); - mpItemView->InsertItems(static_cast<TemplateContainerItem*>(pRegionItem)->maTemplates); - - mpItemView->filterItems(ViewFilter_Application(meFilterOption)); - - showOverlay(true); -} bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle) { @@ -618,7 +835,7 @@ bool TemplateLocalView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewT } else if ( pContainerItem ) { - nRegionId = pContainerItem->mnId - 1; + nRegionId = pContainerItem->mnRegionId; } return mpDocTemplates->SetName( sNewTitle, nRegionId, nDocId ); } diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx index 9f840533d855..3fc85a75885a 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -11,7 +11,6 @@ #include <comphelper/processfactory.hxx> #include <sfx2/templaterepository.hxx> -#include <sfx2/templateview.hxx> #include <sfx2/templateviewitem.hxx> #include <svtools/imagemgr.hxx> #include <tools/urlobj.hxx> @@ -47,8 +46,6 @@ enum TemplateRemoteView::TemplateRemoteView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren) : TemplateAbstractView(pParent,nWinStyle,bDisableTransientChildren) { - mpItemView->SetColor(Color(COL_WHITE)); - Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler( InteractionHandler::createWithParent(xContext, 0), UNO_QUERY_THROW ); @@ -60,15 +57,14 @@ TemplateRemoteView::~TemplateRemoteView () { } -void TemplateRemoteView::showOverlay (bool bVisible) +void TemplateRemoteView::showRootRegion() { - mpItemView->Show(bVisible); + //TODO: +} - // Clear items is the overlay is closed. - if (!bVisible) - { - mpItemView->Clear(); - } +void TemplateRemoteView::showRegion(ThumbnailViewItem */*pItem*/) +{ + //TODO: } bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefresh) @@ -78,13 +74,13 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres if (!pItem->getTemplates().empty() && !bRefresh) { - mpItemView->InsertItems(pItem->getTemplates()); + insertItems(pItem->getTemplates()); return true; } - mpItemView->Clear(); - mpItemView->setId(pItem->mnId); - mpItemView->setName(pItem->maTitle); + mnCurRegionId = pItem->mnId; + maCurRegionName = pItem->maTitle; + maFTName.SetText(maCurRegionName); OUString aURL = pItem->getURL(); @@ -178,7 +174,7 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres } } - mpItemView->InsertItems(aItems); + insertItems(aItems); } } catch( ucb::CommandAbortedException& ) @@ -194,4 +190,14 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres return true; } +bool TemplateRemoteView::isNestedRegionAllowed() const +{ + return true; +} + +bool TemplateRemoteView::isImportAllowed() const +{ + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx index 775abbc09d4b..c24c567b6946 100644 --- a/sfx2/source/control/templatesearchview.cxx +++ b/sfx2/source/control/templatesearchview.cxx @@ -20,14 +20,15 @@ TemplateSearchView::~TemplateSearchView () { } -void TemplateSearchView::AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx, +void TemplateSearchView::AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx, const OUString &rTitle, const OUString &rSubtitle, const OUString &rPath, const BitmapEx &rImage) { TemplateSearchViewItem *pItem = new TemplateSearchViewItem(*this); - pItem->mnId = nItemId; - pItem->mnIdx = nIdx; + pItem->mnId = getNextItemId(); + pItem->mnAssocId = nAssocItemId; + pItem->mnDocId = nIdx; pItem->mnRegionId = nRegionId; pItem->maPreview1 = rImage; pItem->maTitle = rTitle; @@ -35,7 +36,7 @@ void TemplateSearchView::AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sa pItem->setPath(rPath); pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - mItemList.push_back(pItem); + ThumbnailView::AppendItem(pItem); CalculateItemPositions(); } diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx deleted file mode 100644 index 615465df3862..000000000000 --- a/sfx2/source/control/templateview.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * Copyright 2012 LibreOffice contributors. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "templatedlg.hxx" -#include <sfx2/templateview.hxx> -#include <sfx2/templateabstractview.hxx> - -#include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/range/b2drange.hxx> -#include <basegfx/vector/b2dvector.hxx> -#include <drawinglayer/attribute/fillbitmapattribute.hxx> -#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> -#include <drawinglayer/primitive2d/textlayoutdevice.hxx> -#include <drawinglayer/primitive2d/textprimitive2d.hxx> -#include <drawinglayer/processor2d/baseprocessor2d.hxx> -#include <sfx2/sfxresid.hxx> -#include <sfx2/templateviewitem.hxx> -#include <vcl/edit.hxx> - -#include "templateview.hrc" - -#define EDIT_HEIGHT 30 - -using namespace basegfx; -using namespace basegfx::tools; -using namespace drawinglayer::attribute; -using namespace drawinglayer::primitive2d; - -TemplateView::TemplateView (Window *pParent) - : ThumbnailView(pParent,WB_VSCROLL), - mpMasterView(NULL), - maButtons(this, SfxResId(CONTROL_BUTTONS)), - maAllButton(&maButtons, SfxResId(BTN_ALL_TEMPLATES)), - maFTName(&maButtons, SfxResId(FT_NAME)), - mnId(0) -{ - mnHeaderHeight = maButtons.GetSizePixel().getHeight(); - maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON); -} - -TemplateView::~TemplateView () -{ -} - -void TemplateView::setName (const OUString &rName) -{ - maName = rName; - maFTName.SetText(maName); -} - -void TemplateView::InsertItems (const std::vector<TemplateItemProperties> &rTemplates) -{ - for (size_t i = 0, n = rTemplates.size(); i < n; ++i ) - { - TemplateViewItem *pItem = new TemplateViewItem(*this); - const TemplateItemProperties *pCur = &rTemplates[i]; - - pItem->mnId = pCur->nId; - pItem->mnDocId = pCur->nDocId; - pItem->mnRegionId = pCur->nRegionId; - pItem->maTitle = pCur->aName; - pItem->setPath(pCur->aPath); - pItem->maPreview1 = pCur->aThumbnail; - if ( pCur->aThumbnail.IsEmpty() ) - { - // Use the default thumbnail if we have nothing else - pItem->maPreview1 = SfxTemplateManagerDlg::getDefaultThumbnail( pItem->getPath() ); - } - pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected)); - - mItemList.push_back(pItem); - } - - CalculateItemPositions(); - - Invalidate(); -} - -void TemplateView::Resize() -{ - Size aWinSize = GetOutputSize(); - - // Set the buttons panel and buttons size - Size aPanelSize = maButtons.GetSizePixel(); - int nDeltaW = aWinSize.getWidth() - aPanelSize.getWidth(); - aPanelSize.setWidth(aWinSize.getWidth()); - maButtons.SetSizePixel(aPanelSize); - - Size aNameSize = maFTName.GetSizePixel(); - aNameSize.setWidth(aNameSize.getWidth() + nDeltaW); - maFTName.SetSizePixel(aNameSize); - - ThumbnailView::Resize(); -} - -void TemplateView::OnItemDblClicked(ThumbnailViewItem *pItem) -{ - maDblClickHdl.Call(pItem); -} - -bool TemplateView::renameItem(ThumbnailViewItem* pItem, rtl::OUString sNewTitle) -{ - if (mpMasterView) - return mpMasterView->renameItem(pItem, sNewTitle); - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - - diff --git a/sfx2/source/control/templateview.src b/sfx2/source/control/templateview.src index d2711a7c984b..8549c96485e4 100644 --- a/sfx2/source/control/templateview.src +++ b/sfx2/source/control/templateview.src @@ -8,18 +8,12 @@ #include "templateview.hrc" -Control CONTROL_BUTTONS -{ - Size = MAP_APPFONT( 290, 17 ); - Border = True; - TabStop = False; -}; - PushButton BTN_ALL_TEMPLATES { Pos = MAP_APPFONT( 1, 1 ); Size = MAP_APPFONT( 50, 14 ); Text [ en-US ] = "All Templates"; + TabStop = True; }; FixedText FT_NAME diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx index 94ce4d30ee2b..d68268b0f276 100644 --- a/sfx2/source/control/templateviewitem.cxx +++ b/sfx2/source/control/templateviewitem.cxx @@ -55,9 +55,6 @@ void TemplateViewItem::calculateItemsPosition(const long nThumbnailHeight, const long nSpace = (nDisplayHeight + nPadding - 2*aTextDev.getTextHeight()) / 3; - // Set title position - maTextPos.setY(maDrawArea.getY() + nThumbnailHeight + nPadding + nSpace + aTextDev.getTextHeight()); - // Set subtitle position maSubTitlePos.setY(maTextPos.getY() + nSpace + aTextDev.getTextHeight()); maSubTitlePos.setX(maDrawArea.Left() + diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx index c996f0fad30a..d08173cba7de 100644 --- a/sfx2/source/control/thumbnailview.cxx +++ b/sfx2/source/control/thumbnailview.cxx @@ -10,6 +10,8 @@ #include <sfx2/thumbnailview.hxx> #include <sfx2/thumbnailviewitem.hxx> +#include <utility> + #include "thumbnailviewacc.hxx" #include <basegfx/color/bcolortools.hxx> @@ -81,6 +83,27 @@ ThumbnailView::~ThumbnailView() ImplDeleteItems(); } +void ThumbnailView::AppendItem(ThumbnailViewItem *pItem) +{ + if (maFilterFunc(pItem)) + { + // Save current start,end range, iterator might get invalidated + size_t nSelStartPos = 0; + ThumbnailViewItem *pSelStartItem = NULL; + + if (mpStartSelRange != mFilteredItemList.end()) + { + pSelStartItem = *mpStartSelRange; + nSelStartPos = mpStartSelRange - mFilteredItemList.begin(); + } + + mFilteredItemList.push_back(pItem); + mpStartSelRange = pSelStartItem != NULL ? mFilteredItemList.begin() + nSelStartPos : mFilteredItemList.end(); + } + + mItemList.push_back(pItem); +} + void ThumbnailView::ImplInit() { mpScrBar = NULL; @@ -92,7 +115,6 @@ void ThumbnailView::ImplInit() mnLines = 0; mnFirstLine = 0; mnScrBarOffset = 1; - mnSelItemId = 0; mnHighItemId = 0; mnCols = 0; mnSpacing = 0; @@ -100,6 +122,7 @@ void ThumbnailView::ImplInit() mbHasVisibleItems = false; maFilterFunc = ViewFilterAll(); maColor = GetSettings().GetStyleSettings().GetFieldColor(); + mpStartSelRange = mFilteredItemList.end(); // Create the processor and process the primitives const drawinglayer::geometry::ViewInformation2D aNewViewInfos; @@ -115,6 +138,16 @@ void ThumbnailView::ImplDeleteItems() for ( size_t i = 0; i < n; ++i ) { ThumbnailViewItem *const pItem = mItemList[i]; + + // deselect all current selected items and fire events + if (pItem->isSelected()) + { + pItem->setSelection(false); + maItemStateHdl.Call(pItem); + + // fire accessible event??? + } + if ( pItem->isVisible() && ImplHasAccessibleListeners() ) { ::com::sun::star::uno::Any aOldAny, aNewAny; @@ -127,6 +160,9 @@ void ThumbnailView::ImplDeleteItems() } mItemList.clear(); + mFilteredItemList.clear(); + + mpStartSelRange = mFilteredItemList.end(); } void ThumbnailView::ImplInitSettings( bool bFont, bool bForeground, bool bBackground ) @@ -211,7 +247,7 @@ void ThumbnailView::CalculateItemPositions () return; Size aWinSize = GetOutputSizePixel(); - size_t nItemCount = mItemList.size(); + size_t nItemCount = mFilteredItemList.size(); WinBits nStyle = GetStyle(); ScrollBar* pDelScrBar = NULL; @@ -255,9 +291,6 @@ void ThumbnailView::CalculateItemPositions () if ( !mnLines ) mnLines = 1; - // check if scroll is needed - mbScroll = mnLines > mnVisLines; - if ( mnLines <= mnVisLines ) mnFirstLine = 0; else @@ -295,58 +328,35 @@ void ThumbnailView::CalculateItemPositions () size_t nCurCount = 0; for ( size_t i = 0; i < nItemCount; i++ ) { - ThumbnailViewItem *const pItem = mItemList[i]; + ThumbnailViewItem *const pItem = mFilteredItemList[i]; - if (maFilterFunc(pItem)) + if ((nCurCount >= nFirstItem) && (nCurCount < nLastItem)) { - if ((nCurCount >= nFirstItem) && (nCurCount < nLastItem)) + if( !pItem->isVisible()) { - if( !pItem->isVisible()) + if ( ImplHasAccessibleListeners() ) { - if ( ImplHasAccessibleListeners() ) - { - ::com::sun::star::uno::Any aOldAny, aNewAny; - - aNewAny <<= pItem->GetAccessible( mbIsTransientChildrenDisabled ); - ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); - } - - pItem->show(true); + ::com::sun::star::uno::Any aOldAny, aNewAny; - maItemStateHdl.Call(pItem); + aNewAny <<= pItem->GetAccessible( mbIsTransientChildrenDisabled ); + ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); } - pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) )); - pItem->calculateItemsPosition(mnThumbnailHeight,mnDisplayHeight,mnItemPadding,mpItemAttrs->nMaxTextLenght,mpItemAttrs); + pItem->show(true); - if ( !((nCurCount+1) % mnCols) ) - { - x = nStartX; - y += mnItemHeight+nVItemSpace; - } - else - x += mnItemWidth+nHItemSpace; + maItemStateHdl.Call(pItem); } - else - { - if( pItem->isVisible()) - { - if ( ImplHasAccessibleListeners() ) - { - ::com::sun::star::uno::Any aOldAny, aNewAny; - - aOldAny <<= pItem->GetAccessible( mbIsTransientChildrenDisabled ); - ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); - } - pItem->show(false); - - maItemStateHdl.Call(pItem); - } + pItem->setDrawArea(Rectangle( Point(x,y), Size(mnItemWidth, mnItemHeight) )); + pItem->calculateItemsPosition(mnThumbnailHeight,mnDisplayHeight,mnItemPadding,mpItemAttrs->nMaxTextLenght,mpItemAttrs); + if ( !((nCurCount+1) % mnCols) ) + { + x = nStartX; + y += mnItemHeight+nVItemSpace; } - - ++nCurCount; + else + x += mnItemWidth+nHItemSpace; } else { @@ -364,13 +374,20 @@ void ThumbnailView::CalculateItemPositions () maItemStateHdl.Call(pItem); } + } + + ++nCurCount; } // arrange ScrollBar, set values and show it if ( mpScrBar ) { - long nLines = (nCurCount+mnCols-1)/mnCols; + mnLines = (nCurCount+mnCols-1)/mnCols; + + // check if scroll is needed + mbScroll = mnLines > mnVisLines; + Point aPos( aWinSize.Width() - nScrBarWidth - mnScrBarOffset, mnHeaderHeight ); Size aSize( nScrBarWidth - mnScrBarOffset, aWinSize.Height() - mnHeaderHeight ); @@ -383,7 +400,7 @@ void ThumbnailView::CalculateItemPositions () if ( nPageSize < 1 ) nPageSize = 1; mpScrBar->SetPageSize( nPageSize ); - mpScrBar->Show( nLines > mnVisLines ); + mpScrBar->Show( mbScroll ); } // delete ScrollBar @@ -399,9 +416,9 @@ size_t ThumbnailView::ImplGetItem( const Point& rPos, bool bMove ) const if ( maItemListRect.IsInside( rPos ) ) { - for (size_t i = 0; i < mItemList.size(); ++i) + for (size_t i = 0; i < mFilteredItemList.size(); ++i) { - if (mItemList[i]->isVisible() && mItemList[i]->getDrawArea().IsInside(rPos)) + if (mFilteredItemList[i]->isVisible() && mFilteredItemList[i]->getDrawArea().IsInside(rPos)) return i; } @@ -418,7 +435,7 @@ size_t ThumbnailView::ImplGetItem( const Point& rPos, bool bMove ) const ThumbnailViewItem* ThumbnailView::ImplGetItem( size_t nPos ) { - return ( nPos < mItemList.size() ) ? mItemList[nPos] : NULL; + return ( nPos < mFilteredItemList.size() ) ? mFilteredItemList[nPos] : NULL; } sal_uInt16 ThumbnailView::ImplGetVisibleItemCount() const @@ -491,34 +508,287 @@ IMPL_LINK (ThumbnailView, OnItemSelected, ThumbnailViewItem*, pItem) return 0; } +void ThumbnailView::KeyInput( const KeyEvent& rKEvt ) +{ + // Get the last selected item in the list + size_t nLastPos = 0; + bool bFoundLast = false; + for ( long i = mFilteredItemList.size() - 1; !bFoundLast && i >= 0; --i ) + { + ThumbnailViewItem* pItem = mFilteredItemList[i]; + if ( pItem->isSelected() ) + { + nLastPos = i; + bFoundLast = true; + } + } + + bool bValidRange = false; + bool bHasSelRange = mpStartSelRange != mFilteredItemList.end(); + size_t nNextPos = nLastPos; + KeyCode aKeyCode = rKEvt.GetKeyCode(); + ThumbnailViewItem* pNext = NULL; + + if (aKeyCode.IsShift() && bHasSelRange) + { + //If the last elemented selected is the start range position + //search for the first selected item + size_t nSelPos = mpStartSelRange - mFilteredItemList.begin(); + + if (nLastPos == nSelPos) + { + while (nLastPos && mFilteredItemList[nLastPos-1]->isSelected()) + --nLastPos; + } + } + + switch ( aKeyCode.GetCode() ) + { + case KEY_RIGHT: + { + if ( bFoundLast && nLastPos < mFilteredItemList.size( ) - 1 ) + { + bValidRange = true; + nNextPos = nLastPos + 1; + } + + pNext = mFilteredItemList[nNextPos]; + } + break; + case KEY_LEFT: + { + if ( nLastPos > 0 ) + { + bValidRange = true; + nNextPos = nLastPos - 1; + } + + pNext = mFilteredItemList[nNextPos]; + } + break; + case KEY_DOWN: + { + if ( bFoundLast && nLastPos < mFilteredItemList.size( ) - mnCols ) + { + bValidRange = true; + nNextPos = nLastPos + mnCols; + } + + pNext = mFilteredItemList[nNextPos]; + } + break; + case KEY_UP: + { + if ( nLastPos >= mnCols ) + { + bValidRange = true; + nNextPos = nLastPos - mnCols; + } + + pNext = mFilteredItemList[nNextPos]; + } + break; + case KEY_RETURN: + { + if ( bFoundLast ) + OnItemDblClicked( mFilteredItemList[nLastPos] ); + } + default: + Control::KeyInput( rKEvt ); + } + + if ( pNext ) + { + if (aKeyCode.IsShift() && bValidRange) + { + std::pair<size_t,size_t> aRange; + size_t nSelPos = mpStartSelRange - mFilteredItemList.begin(); + + if (nLastPos < nSelPos) + { + if (nNextPos > nLastPos) + { + if ( nNextPos > nSelPos) + aRange = std::make_pair(nLastPos,nNextPos); + else + aRange = std::make_pair(nLastPos,nNextPos-1); + } + else + aRange = std::make_pair(nNextPos,nLastPos-1); + } + else if (nLastPos == nSelPos) + { + if (nNextPos > nLastPos) + aRange = std::make_pair(nLastPos+1,nNextPos); + else + aRange = std::make_pair(nNextPos,nLastPos-1); + } + else + { + if (nNextPos > nLastPos) + aRange = std::make_pair(nLastPos+1,nNextPos); + else + { + if ( nNextPos < nSelPos) + aRange = std::make_pair(nNextPos,nLastPos); + else + aRange = std::make_pair(nNextPos+1,nLastPos); + } + } + + for (size_t i = aRange.first; i <= aRange.second; ++i) + { + if (i != nSelPos) + { + ThumbnailViewItem *pCurItem = mFilteredItemList[i]; + + pCurItem->setSelection(!pCurItem->isSelected()); + + if (pCurItem->isVisible()) + DrawItem(pCurItem); + + maItemStateHdl.Call(pCurItem); + } + } + } + else if (!aKeyCode.IsShift()) + { + deselectItems(); + SelectItem(pNext->mnId); + + //Mark it as the selection range start position + mpStartSelRange = mFilteredItemList.begin() + nNextPos; + } + + MakeItemVisible(pNext->mnId); + } +} + +void ThumbnailView::MakeItemVisible( sal_uInt16 nItemId ) +{ + // Get the item row + size_t nPos = 0; + bool bFound = false; + for ( size_t i = 0; !bFound && i < mFilteredItemList.size(); ++i ) + { + ThumbnailViewItem* pItem = mFilteredItemList[i]; + if ( pItem->mnId == nItemId ) + { + nPos = i; + bFound = true; + } + } + sal_uInt16 nRow = nPos / mnCols; + + // Move the visible rows as little as possible to include that one + if ( nRow < mnFirstLine ) + mnFirstLine = nRow; + else if ( nRow > mnFirstLine + mnVisLines ) + mnFirstLine = nRow - mnVisLines; + + CalculateItemPositions(); + Invalidate(); +} + void ThumbnailView::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) { - ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) ); + size_t nPos = ImplGetItem(rMEvt.GetPosPixel()); + ThumbnailViewItem* pItem = ImplGetItem(nPos); if (pItem && pItem->isVisible()) { if ( rMEvt.GetClicks() == 1 ) { - if (!pItem->isSelected() && !rMEvt.IsMod1()) - deselectItems( ); - pItem->setSelection(true); + if (rMEvt.IsMod1()) + { + //Keep selected item group state and just invert current desired one state + pItem->setSelection(!pItem->isSelected()); + + //This one becomes the selection range start position if it changes its state to selected otherwise resets it + mpStartSelRange = pItem->isSelected() ? mFilteredItemList.begin() + nPos : mFilteredItemList.end(); + } + else if (rMEvt.IsShift() && mpStartSelRange != mFilteredItemList.end()) + { + std::pair<size_t,size_t> aNewRange; + aNewRange.first = mpStartSelRange - mFilteredItemList.begin(); + aNewRange.second = nPos; + + if (aNewRange.first > aNewRange.second) + std::swap(aNewRange.first,aNewRange.second); + + //Deselect the ones outside of it + for (size_t i = 0, n = mFilteredItemList.size(); i < n; ++i) + { + ThumbnailViewItem *pCurItem = mFilteredItemList[i]; - bool bClickOnTitle = pItem->getTextArea().IsInside(rMEvt.GetPosPixel()); - pItem->setEditTitle(bClickOnTitle); + if (pCurItem->isSelected() && (i < aNewRange.first || i > aNewRange.second)) + { + pCurItem->setSelection(false); + + if (pCurItem->isVisible()) + DrawItem(pCurItem); + + maItemStateHdl.Call(pCurItem); + } + } + + size_t nSelPos = mpStartSelRange - mFilteredItemList.begin(); + + //Select the items between start range and the selected item + if (nSelPos != nPos) + { + int dir = nSelPos < nPos ? 1 : -1; + size_t nCurPos = nSelPos + dir; + + while (nCurPos != nPos) + { + ThumbnailViewItem *pCurItem = mFilteredItemList[nCurPos]; + + if (!pCurItem->isSelected()) + { + pCurItem->setSelection(true); + + if (pCurItem->isVisible()) + DrawItem(pCurItem); + + maItemStateHdl.Call(pCurItem); + } + + nCurPos += dir; + } + } + + pItem->setSelection(true); + } + else + { + //If we got a group of selected items deselect the rest and only keep the desired one + //mark items as not selected to not fire unnecessary change state events. + pItem->setSelection(false); + deselectItems(); + pItem->setSelection(true); + + //Mark as initial selection range position and reset end one + mpStartSelRange = mFilteredItemList.begin() + nPos; + } + + if (pItem->isSelected()) + { + bool bClickOnTitle = pItem->getTextArea().IsInside(rMEvt.GetPosPixel()); + pItem->setEditTitle(bClickOnTitle); + } if (!pItem->isHighlighted()) DrawItem(pItem); maItemStateHdl.Call(pItem); + + //fire accessible event?? } else if ( rMEvt.GetClicks() == 2 ) { - // The mouse button down event 1 click right before is pointless - pItem->setSelection(false); - maItemStateHdl.Call(pItem); - Rectangle aRect(pItem->getDrawArea()); if (aRect.IsInside(rMEvt.GetPosPixel())) @@ -579,12 +849,28 @@ void ThumbnailView::Paint( const Rectangle &aRect) void ThumbnailView::GetFocus() { - Control::GetFocus(); + if(GETFOCUS_TAB & GetGetFocusFlags()) + { + // Select the first item if nothing selected + int nSelected = -1; + for (size_t i = 0, n = mItemList.size(); i < n && nSelected == -1; ++i) + { + if (mItemList[i]->isSelected()) + nSelected = i; + } + + if ( nSelected == -1 && mItemList.size( ) > 0 ) + { + SelectItem( 1 ); + } + } // Tell the accessible object that we got the focus. ThumbnailViewAcc* pAcc = ThumbnailViewAcc::getImplementation( GetAccessible( sal_False ) ); if( pAcc ) pAcc->GetFocus(); + + Control::GetFocus(); } void ThumbnailView::LoseFocus() @@ -616,11 +902,11 @@ void ThumbnailView::LoseFocus() void ThumbnailView::Resize() { + Control::Resize(); CalculateItemPositions(); if ( IsReallyVisible() && IsUpdateMode() ) Invalidate(); - Control::Resize(); } void ThumbnailView::StateChanged( StateChangedType nType ) @@ -685,18 +971,37 @@ void ThumbnailView::RemoveItem( sal_uInt16 nItemId ) if ( nPos == THUMBNAILVIEW_ITEM_NOTFOUND ) return; - if ( nPos < mItemList.size() ) { - ValueItemList::iterator it = mItemList.begin(); + if ( nPos < mFilteredItemList.size() ) { + + // delete item from the thumbnail list + for (size_t i = 0, n = mItemList.size(); i < n; ++i) + { + if (mItemList[i]->mnId == nItemId) + { + mItemList.erase(mItemList.begin()+i); + break; + } + } + + // delete item from the filter item list + ValueItemList::iterator it = mFilteredItemList.begin(); ::std::advance( it, nPos ); + + if ((*it)->isSelected()) + { + (*it)->setSelection(false); + maItemStateHdl.Call(*it); + } + delete *it; - mItemList.erase( it ); + mFilteredItemList.erase( it ); + mpStartSelRange = mFilteredItemList.end(); } // reset variables - if ( (mnHighItemId == nItemId) || (mnSelItemId == nItemId) ) + if ( (mnHighItemId == nItemId) ) { mnHighItemId = 0; - mnSelItemId = 0; } CalculateItemPositions(); @@ -712,7 +1017,6 @@ void ThumbnailView::Clear() // reset variables mnFirstLine = 0; mnHighItemId = 0; - mnSelItemId = 0; CalculateItemPositions(); @@ -720,10 +1024,23 @@ void ThumbnailView::Clear() Invalidate(); } +void ThumbnailView::updateItems (const std::vector<ThumbnailViewItem*> &items) +{ + ImplDeleteItems(); + + // reset variables + mnFirstLine = 0; + mnHighItemId = 0; + + mItemList = items; + + filterItems(maFilterFunc); +} + size_t ThumbnailView::GetItemPos( sal_uInt16 nItemId ) const { - for ( size_t i = 0, n = mItemList.size(); i < n; ++i ) { - if ( mItemList[i]->mnId == nItemId ) { + for ( size_t i = 0, n = mFilteredItemList.size(); i < n; ++i ) { + if ( mFilteredItemList[i]->mnId == nItemId ) { return i; } } @@ -732,7 +1049,7 @@ size_t ThumbnailView::GetItemPos( sal_uInt16 nItemId ) const sal_uInt16 ThumbnailView::GetItemId( size_t nPos ) const { - return ( nPos < mItemList.size() ) ? mItemList[nPos]->mnId : 0 ; + return ( nPos < mFilteredItemList.size() ) ? mFilteredItemList[nPos]->mnId : 0 ; } sal_uInt16 ThumbnailView::GetItemId( const Point& rPos ) const @@ -744,6 +1061,11 @@ sal_uInt16 ThumbnailView::GetItemId( const Point& rPos ) const return 0; } +sal_uInt16 ThumbnailView::getNextItemId() const +{ + return mItemList.empty() ? 1 : mItemList.back()->mnId + 1; +} + void ThumbnailView::setItemMaxTextLength(sal_uInt32 nLength) { mpItemAttrs->nMaxTextLenght = nLength; @@ -760,19 +1082,18 @@ void ThumbnailView::setItemDimensions(long itemWidth, long thumbnailHeight, long void ThumbnailView::SelectItem( sal_uInt16 nItemId ) { - size_t nItemPos = 0; + size_t nItemPos = GetItemPos( nItemId ); + if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND ) + return; - if ( nItemId ) + ThumbnailViewItem* pItem = mFilteredItemList[nItemPos]; + if (!pItem->isSelected()) { - nItemPos = GetItemPos( nItemId ); - if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND ) - return; - } + pItem->setSelection(true); + maItemStateHdl.Call(pItem); - if ( mnSelItemId != nItemId) - { - sal_uInt16 nOldItem = mnSelItemId ? mnSelItemId : 1; - mnSelItemId = nItemId; + if (IsReallyVisible() && IsUpdateMode()) + Invalidate(); bool bNewOut = IsReallyVisible() && IsUpdateMode(); @@ -798,44 +1119,8 @@ void ThumbnailView::SelectItem( sal_uInt16 nItemId ) if( ImplHasAccessibleListeners() ) { - // focus event (deselect) - if( nOldItem ) - { - const size_t nPos = GetItemPos( nItemId ); - - if( nPos != THUMBNAILVIEW_ITEM_NOTFOUND ) - { - ThumbnailViewAcc* pItemAcc = ThumbnailViewAcc::getImplementation( - mItemList[nPos]->GetAccessible( mbIsTransientChildrenDisabled ) ); - - if( pItemAcc ) - { - ::com::sun::star::uno::Any aOldAny, aNewAny; - if( !mbIsTransientChildrenDisabled ) - { - aOldAny <<= ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >( - static_cast< ::cppu::OWeakObject* >( pItemAcc )); - ImplFireAccessibleEvent (::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny ); - } - else - { - aOldAny <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED; - pItemAcc->FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); - } - } - } - } - // focus event (select) - const size_t nPos = GetItemPos( mnSelItemId ); - - ThumbnailViewItem* pItem = NULL; - if( nPos != THUMBNAILVIEW_ITEM_NOTFOUND ) - pItem = mItemList[nPos]; - - ThumbnailViewAcc* pItemAcc = NULL; - if (pItem != NULL) - pItemAcc = ThumbnailViewAcc::getImplementation( pItem->GetAccessible( mbIsTransientChildrenDisabled ) ); + ThumbnailViewAcc* pItemAcc = ThumbnailViewAcc::getImplementation( pItem->GetAccessible( mbIsTransientChildrenDisabled ) ); if( pItemAcc ) { @@ -878,6 +1163,35 @@ void ThumbnailView::deselectItem(const sal_uInt16 nItemId) } } +void ThumbnailView::DeselectItem( sal_uInt16 nItemId ) +{ + size_t nItemPos = GetItemPos( nItemId ); + if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND ) + return; + + ThumbnailViewItem* pItem = mFilteredItemList[nItemPos]; + if (pItem->isSelected()) + { + pItem->setSelection(false); + maItemStateHdl.Call(pItem); + + if (IsReallyVisible() && IsUpdateMode()) + Invalidate(); + + // TODO Trigger event in accessible object? + } +} + +bool ThumbnailView::IsItemSelected( sal_uInt16 nItemId ) const +{ + size_t nItemPos = GetItemPos( nItemId ); + if ( nItemPos == THUMBNAILVIEW_ITEM_NOTFOUND ) + return false; + + ThumbnailViewItem* pItem = mFilteredItemList[nItemPos]; + return pItem->isSelected(); +} + void ThumbnailView::deselectItems() { for (size_t i = 0, n = mItemList.size(); i < n; ++i) @@ -900,7 +1214,7 @@ OUString ThumbnailView::GetItemText( sal_uInt16 nItemId ) const size_t nPos = GetItemPos( nItemId ); if ( nPos != THUMBNAILVIEW_ITEM_NOTFOUND ) - return mItemList[nPos]->maTitle; + return mFilteredItemList[nPos]->maTitle; return OUString(); } @@ -914,58 +1228,52 @@ void ThumbnailView::SetColor( const Color& rColor ) Invalidate(); } -bool ThumbnailView::StartDrag( const CommandEvent& rCEvt, Region& rRegion ) +void ThumbnailView::filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func) { - if ( rCEvt.GetCommand() != COMMAND_STARTDRAG ) - return false; - - // if necessary abort an existing action + mnFirstLine = 0; // start at the top of the list instead of the current position + maFilterFunc = func; - // Check out if the the clicked on page is selected. If this is not the - // case set it as the current item. We only check mouse actions since - // drag-and-drop can also be triggered by the keyboard - sal_uInt16 nSelId; - if ( rCEvt.IsMouseEvent() ) - nSelId = GetItemId( rCEvt.GetMousePosPixel() ); - else - nSelId = mnSelItemId; + size_t nSelPos = 0; + bool bHasSelRange = false; + ThumbnailViewItem *curSel = mpStartSelRange != mFilteredItemList.end() ? *mpStartSelRange : NULL; - // don't activate dragging if no item was clicked on - if ( !nSelId ) - return false; + mFilteredItemList.clear(); - // Check out if the page was selected. If not set as current page and - // call select. - if ( nSelId != mnSelItemId ) + for (size_t i = 0, n = mItemList.size(); i < n; ++i) { - SelectItem( nSelId ); - Update(); - } + ThumbnailViewItem *const pItem = mItemList[i]; - Region aRegion; + if (maFilterFunc(pItem)) + { + if (curSel == pItem) + { + nSelPos = i; + bHasSelRange = true; + } - // assign region - rRegion = aRegion; + mFilteredItemList.push_back(pItem); + } + else + { + if( pItem->isVisible()) + { + if ( ImplHasAccessibleListeners() ) + { + ::com::sun::star::uno::Any aOldAny, aNewAny; - return true; -} + aOldAny <<= pItem->GetAccessible( mbIsTransientChildrenDisabled ); + ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::CHILD, aOldAny, aNewAny ); + } -long ThumbnailView::GetScrollWidth() const -{ - if ( GetStyle() & WB_VSCROLL ) - { - ((ThumbnailView*)this)->ImplInitScrollBar(); - return mpScrBar->GetSizePixel().Width()+mnScrBarOffset; - } - else - return 0; -} + pItem->show(false); + pItem->setSelection(false); -void ThumbnailView::filterItems (const boost::function<bool (const ThumbnailViewItem*) > &func) -{ - mnFirstLine = 0; // start at the top of the list instead of the current position - maFilterFunc = func; + maItemStateHdl.Call(pItem); + } + } + } + mpStartSelRange = bHasSelRange ? mFilteredItemList.begin() + nSelPos : mFilteredItemList.end(); CalculateItemPositions(); Invalidate(); diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 8a7da2b37f71..c89f1b0788fc 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -350,7 +350,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces if( THUMBNAILVIEW_ITEM_NONEITEM != nItemPos ) { - ThumbnailViewItem *const pItem = mpParent->mItemList[nItemPos]; + ThumbnailViewItem *const pItem = mpParent->mFilteredItemList[nItemPos]; xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled ); } } @@ -788,7 +788,7 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ThumbnailViewItemA // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE ); // SELECTED - if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId ) + if( mpParent->isSelected() ) { pStateSet->AddState( accessibility::AccessibleStateType::SELECTED ); // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED ); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index a81c27dd5350..c551bac9d027 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -753,6 +753,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Sfx bUpdateByExampleDisabled( sal_False ), bTreeDrag ( sal_True ), bHierarchical ( sal_False ), + m_bWantHierarchical ( sal_False ), bBindingUpdate ( sal_True ) { aFmtLb.SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString()); @@ -1278,8 +1279,10 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) } // if the tree view again, select family hierarchy - if(pTreeBox) + if (pTreeBox || m_bWantHierarchical) + { aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString()); + } // show maximum 14 entries aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES ); @@ -1287,12 +1290,21 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) } else { - if( nActFilter < aFilterLb.GetEntryCount() - 1) - aFilterLb.SelectEntryPos(nActFilter + 1); - else + if (m_bWantHierarchical) { nActFilter = 0; - aFilterLb.SelectEntryPos(1); + aFilterLb.SelectEntry(SfxResId( + STR_STYLE_FILTER_HIERARCHICAL).toString()); + } + else + { + if (nActFilter < aFilterLb.GetEntryCount() - 1) + aFilterLb.SelectEntryPos(nActFilter + 1); + else + { + nActFilter = 0; + aFilterLb.SelectEntryPos(1); + } } } @@ -1635,7 +1647,6 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint //------------------------------------------------------------------------- - // Other filters; can be switched by the users or as a result of new or // editing, if the current document has been assigned a different filter. void SfxCommonTemplateDialog_Impl::FilterSelect( @@ -1646,14 +1657,7 @@ void SfxCommonTemplateDialog_Impl::FilterSelect( if( nEntry != nActFilter || bForce ) { nActFilter = nEntry; - SfxViewFrame *pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); - SfxObjectShell *pDocShell = pViewFrame->GetObjectShell(); - if (pDocShell) - { - pDocShell->SetAutoStyleFilterIndex(nActFilter); - SaveFactoryStyleFilter( pDocShell, nActFilter ); - } - + SfxObjectShell *const pDocShell = SaveSelection(); SfxStyleSheetBasePool *pOldStyleSheetPool = pStyleSheetPool; pStyleSheetPool = pDocShell? pDocShell->GetStyleSheetPool(): 0; if ( pOldStyleSheetPool != pStyleSheetPool ) @@ -1744,6 +1748,8 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) { // Turn on treeView bHierarchical=sal_True; + m_bWantHierarchical = sal_True; + SaveSelection(); // fdo#61429 store "hierarchical" const String aSelectEntry( GetSelectedEntry()); aFmtLb.Hide(); @@ -1776,6 +1782,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FilterSelectHdl, ListBox *, pBox ) aFmtLb.Show(); // If bHierarchical, then the family can have changed // minus one since hierarchical is inserted at the start + m_bWantHierarchical = sal_False; // before FilterSelect FilterSelect(pBox->GetSelectEntryPos() - 1, bHierarchical ); bHierarchical=sal_False; } @@ -1918,6 +1925,10 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell* sal_Int32 nDefault = -1; nFilter = aFactoryProps.getUnpackedValueOrDefault( DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"), nDefault ); + m_bWantHierarchical = + (nFilter & SFXSTYLEBIT_HIERARCHY) ? sal_True : sal_False; + nFilter &= ~SFXSTYLEBIT_HIERARCHY; // clear it + return nFilter; } @@ -1928,10 +1939,23 @@ void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell* i_pOb OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); Sequence< PropertyValue > lProps(1); lProps[0].Name = DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"); - lProps[0].Value = makeAny( i_nFilter );; + lProps[0].Value = makeAny( + i_nFilter | (m_bWantHierarchical ? SFXSTYLEBIT_HIERARCHY : 0)); xModuleManager->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) ); } +SfxObjectShell* SfxCommonTemplateDialog_Impl::SaveSelection() +{ + SfxViewFrame *const pViewFrame(pBindings->GetDispatcher_Impl()->GetFrame()); + SfxObjectShell *const pDocShell(pViewFrame->GetObjectShell()); + if (pDocShell) + { + pDocShell->SetAutoStyleFilterIndex(nActFilter); + SaveFactoryStyleFilter( pDocShell, nActFilter ); + } + return pDocShell; +} + //------------------------------------------------------------------------- IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox ) @@ -2650,7 +2674,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl() if ( pOldStyleSheetPool ) EndListening(*pOldStyleSheetPool); if ( pStyleSheetPool ) - StartListening(*pOldStyleSheetPool); + StartListening(*pStyleSheetPool); } bWaterDisabled = sal_False; diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index f3edfa7390d2..b56a47358228 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -39,6 +39,7 @@ #define DLG_DOC_TEMPLATE (RID_SFX_DOC_START+2) #define DLG_ORGANIZE (RID_SFX_DOC_START+3) #define DLG_TEMPLATE_MANAGER (RID_SFX_DOC_START+4) +#define TAB_TEMPLATE_MANAGER (RID_SFX_DOC_START+5) #define BMP_STYLES_CLOSED (RID_SFX_DOC_START+ 0) #define BMP_STYLES_OPENED (RID_SFX_DOC_START+ 1) diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 6678600c5cb4..dd09be0d640e 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -1098,6 +1098,24 @@ sal_Bool SfxDocumentTemplates::InsertDir return sal_False; } +sal_Bool SfxDocumentTemplates::InsertTemplate(sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath) +{ + DocTemplLocker_Impl aLocker( *pImp ); + + if ( ! pImp->Construct() ) + return sal_False; + + RegionData_Impl *pRegion = pImp->GetRegion( nSourceRegion ); + + if ( !pRegion ) + return sal_False; + + size_t pos = nIdx; + pRegion->AddEntry( rName, rPath, &pos ); + + return sal_True; +} + sal_Bool SfxDocumentTemplates::SetName( const OUString& rName, sal_uInt16 nRegion, sal_uInt16 nIdx ) { diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 7041966afb96..82289ba2618a 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -35,6 +35,7 @@ #include <tools/urlobj.hxx> #include <unotools/moduleoptions.hxx> #include <unotools/pathoptions.hxx> +#include <unotools/viewoptions.hxx> #include <vcl/edit.hxx> #include <vcl/msgbox.hxx> #include <vcl/toolbox.hxx> @@ -57,6 +58,10 @@ #define PADDING_DLG_BORDER 10 +#define TM_SETTING_MANAGER "TemplateManager" +#define TM_SETTING_LASTFOLDER "LastFolder" +#define TM_SETTING_FILTER "SelectedFilter" + using namespace ::com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::embed; @@ -85,36 +90,88 @@ class SearchView_Keyword { public: - SearchView_Keyword (const OUString &rKeyword) - : maKeyword(rKeyword) + SearchView_Keyword (const OUString &rKeyword, FILTER_APPLICATION App) + : maKeyword(rKeyword), meApp(App) {} bool operator() (const TemplateItemProperties &rItem) { - return rItem.aName.matchIgnoreAsciiCase(maKeyword); + bool bRet = true; + + INetURLObject aUrl(rItem.aPath); + OUString aExt = aUrl.getExtension(); + + if (meApp == FILTER_APP_WRITER) + { + bRet = aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx"; + } + else if (meApp == FILTER_APP_CALC) + { + bRet = aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx"; + } + else if (meApp == FILTER_APP_IMPRESS) + { + bRet = aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx"; + } + else if (meApp == FILTER_APP_DRAW) + { + bRet = aExt == "otg" || aExt == "std"; + } + + return bRet && rItem.aName.matchIgnoreAsciiCase(maKeyword); } private: OUString maKeyword; + FILTER_APPLICATION meApp; +}; + +/*** + * + * Order items in ascending order (useful for the selection sets and move/copy operations since the associated ids + * change when processed by the SfxDocumentTemplates class so we want to process to ones with higher id first) + * + ***/ + +static bool cmpSelectionItems (const ThumbnailViewItem *pItem1, const ThumbnailViewItem *pItem2) +{ + return pItem1->mnId > pItem2->mnId; +} + +class TemplateManagerPage : public TabPage +{ + private: + FixedText maFixedText; + + public: + TemplateManagerPage( Window* pParent ); + ~TemplateManagerPage( ) { }; }; SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) : ModelessDialog(parent, SfxResId(DLG_TEMPLATE_MANAGER)), maTabControl(this,SfxResId(TAB_CONTROL)), - mpToolbars( new Control(&maTabControl,SfxResId(TOOLBARS))), - mpSearchEdit(new Edit(this,WB_HIDE | WB_BORDER)), - mpViewBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_VIEW))), - mpActionBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_ACTION))), - mpTemplateBar( new ToolBox(mpToolbars, SfxResId(TBX_ACTION_TEMPLATES))), - mpSearchView(new TemplateSearchView(this)), - maView(new TemplateLocalView(this,SfxResId(TEMPLATE_VIEW))), - mpOnlineView(new TemplateRemoteView(this, WB_VSCROLL,false)), + maTabPage(&maTabControl, SfxResId(TAB_TEMPLATE_MANAGER)), + mpSearchEdit(new Edit(&maTabPage,WB_HIDE | WB_BORDER)), + mpViewBar( new ToolBox(&maTabPage, SfxResId(TBX_ACTION_VIEW))), + mpActionBar( new ToolBox(&maTabPage, SfxResId(TBX_ACTION_ACTION))), + mpTemplateBar( new ToolBox(&maTabPage, SfxResId(TBX_ACTION_TEMPLATES))), + mpSearchView(new TemplateSearchView(&maTabPage)), + maView(new TemplateLocalView(&maTabPage,SfxResId(TEMPLATE_VIEW))), + mpOnlineView(new TemplateRemoteView(&maTabPage, WB_VSCROLL,false)), + maSelTemplates(cmpSelectionItems), + maSelFolders(cmpSelectionItems), mbIsSaveMode(false), mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY ), mbIsSynced(false), maRepositories() { + maTabControl.SetTabPage( FILTER_DOCS, &maTabPage ); + maTabControl.SetTabPage( FILTER_SHEETS, &maTabPage ); + maTabControl.SetTabPage( FILTER_PRESENTATIONS, &maTabPage ); + maTabControl.SetTabPage( FILTER_DRAWS, &maTabPage ); + // Create popup menus mpActionMenu = new PopupMenu; mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT)); @@ -148,17 +205,16 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpSearchEdit->SetUpdateDataHdl(LINK(this,SfxTemplateManagerDlg,SearchUpdateHdl)); mpSearchEdit->EnableUpdateData(); - maView->SetStyle(WB_VSCROLL); + maView->SetStyle(maView->GetStyle() | WB_VSCROLL); maView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH); maView->setItemDimensions(TEMPLATE_ITEM_MAX_WIDTH,TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, TEMPLATE_ITEM_MAX_HEIGHT-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, TEMPLATE_ITEM_PADDING); - maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVFolderStateHdl)); - maView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); - maView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); + maView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVItemStateHdl)); + maView->setOpenRegionHdl(LINK(this,SfxTemplateManagerDlg,OpenRegionHdl)); + maView->setOpenTemplateHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); // Set online view position and dimensions mpOnlineView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH); @@ -167,17 +223,17 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) TEMPLATE_ITEM_MAX_HEIGHT-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, TEMPLATE_ITEM_PADDING); - mpOnlineView->setOverlayItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); - mpOnlineView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); - mpOnlineView->setOverlayCloseHdl(LINK(this,SfxTemplateManagerDlg,CloseOverlayHdl)); + mpOnlineView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVItemStateHdl)); + mpOnlineView->setOpenRegionHdl(LINK(this,SfxTemplateManagerDlg,OpenRegionHdl)); + mpOnlineView->setOpenTemplateHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl)); mpSearchView->setItemMaxTextLength(TEMPLATE_ITEM_MAX_TEXT_LENGTH); mpSearchView->setItemDimensions(TEMPLATE_ITEM_MAX_WIDTH,TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, - TEMPLATE_ITEM_MAX_HEIGHT-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, + TEMPLATE_ITEM_MAX_HEIGHT_SUB-TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT, TEMPLATE_ITEM_PADDING); - mpSearchView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl)); + mpSearchView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVItemStateHdl)); maTabControl.SetActivatePageHdl(LINK(this,SfxTemplateManagerDlg,ActivatePageHdl)); @@ -188,6 +244,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) mpViewBar->RemoveItem(nPos); } + SetMinOutputSizePixel(GetOutputSizePixel()); + mpViewBar->Show(); mpActionBar->Show(); @@ -199,20 +257,35 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent) createDefaultTemplateMenu(); maView->Populate(); - maView->Show(); + mpCurView->filterItems(ViewFilter_Application(FILTER_APP_WRITER)); + + readSettings(); - mpCurView->filterTemplatesByApp(FILTER_APP_WRITER); + maView->Show(); FreeResource(); } SfxTemplateManagerDlg::~SfxTemplateManagerDlg () { + writeSettings(); + // Synchronize the config before deleting it syncRepositories(); for (size_t i = 0, n = maRepositories.size(); i < n; ++i) delete maRepositories[i]; + // Ignore view events since we are cleaning the object + maView->setItemStateHdl(Link()); + maView->setOpenRegionHdl(Link()); + maView->setOpenTemplateHdl(Link()); + + mpOnlineView->setItemStateHdl(Link()); + mpOnlineView->setOpenRegionHdl(Link()); + mpOnlineView->setOpenTemplateHdl(Link()); + + mpSearchView->setItemStateHdl(Link()); + delete mpSearchEdit; delete mpViewBar; delete mpActionBar; @@ -223,20 +296,27 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg () delete mpTemplateDefaultMenu; delete mpActionMenu; delete mpRepositoryMenu; - delete mpToolbars; } void SfxTemplateManagerDlg::setSaveMode(bool bMode) { mbIsSaveMode = bMode; maTabControl.Clear(); - mpCurView->filterTemplatesByApp(FILTER_APP_NONE); + mpCurView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); if (bMode) { mpViewBar->ShowItem(TBI_TEMPLATE_SAVE); mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); mpViewBar->HideItem(TBI_TEMPLATE_REPOSITORY); + + mpTemplateBar->ShowItem(TBI_TEMPLATE_SAVE); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->HideItem(TBI_TEMPLATE_MOVE); + mpTemplateBar->HideItem(TBI_TEMPLATE_EXPORT); + mpTemplateBar->HideItem(TBI_TEMPLATE_DELETE); } else { @@ -269,46 +349,103 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl) eFilter = FILTER_APP_DRAW; break; } - mpCurView->filterTemplatesByApp(eFilter); + mpCurView->filterItems(ViewFilter_Application(eFilter)); + + if (mpSearchView->IsVisible()) + SearchUpdateHdl(NULL); + return 0; } -void SfxTemplateManagerDlg::MouseButtonDown( const MouseEvent& rMEvt ) +void SfxTemplateManagerDlg::readSettings () { - if (!maView->GetActiveClipRegion().IsInside(rMEvt.GetPosPixel()) && maView->isOverlayVisible()) + OUString aLastFolder; + sal_uInt16 nPageId = FILTER_DOCS; + SvtViewOptions aViewSettings( E_DIALOG, TM_SETTING_MANAGER ); + + if ( aViewSettings.Exists() ) { - maSelTemplates.clear(); - mpTemplateBar->Hide(); - mpViewBar->Show(); + sal_uInt16 nFilter = 0; + aViewSettings.GetUserItem(TM_SETTING_LASTFOLDER) >>= aLastFolder; + aViewSettings.GetUserItem(TM_SETTING_FILTER) >>= nFilter; - maView->showOverlay(false); + switch (nFilter) + { + case FILTER_APP_WRITER: + nPageId = FILTER_DOCS; + break; + case FILTER_APP_IMPRESS: + nPageId = FILTER_PRESENTATIONS; + break; + case FILTER_APP_CALC: + nPageId = FILTER_SHEETS; + break; + case FILTER_APP_DRAW: + nPageId = FILTER_DRAWS; + break; + } } + + if (!aLastFolder.getLength()) + maView->showRootRegion(); + else + maView->showRegion(aLastFolder); + + maTabControl.SelectTabPage(nPageId); } -void SfxTemplateManagerDlg::Resize() +void SfxTemplateManagerDlg::writeSettings () { - Size aWinSize = GetSizePixel(); + Sequence< NamedValue > aSettings(2); + + OUString aLastFolder; + + if (mpCurView == maView && maView->getCurRegionId()) + aLastFolder = maView->getRegionName(maView->getCurRegionId()-1); + + // last folder + aSettings[0].Name = TM_SETTING_LASTFOLDER; + aSettings[0].Value <<= aLastFolder; + + sal_uInt16 nFilter = FILTER_APP_WRITER; + switch (maTabControl.GetCurPageId()) + { + case FILTER_DOCS: + nFilter = FILTER_APP_WRITER; + break; + case FILTER_PRESENTATIONS: + nFilter = FILTER_APP_IMPRESS; + break; + case FILTER_SHEETS: + nFilter = FILTER_APP_CALC; + break; + case FILTER_DRAWS: + nFilter = FILTER_APP_DRAW; + break; + } + + aSettings[1].Name = TM_SETTING_FILTER; + aSettings[1].Value <<= nFilter; + + // write + SvtViewOptions aViewSettings( E_DIALOG, TM_SETTING_MANAGER ); + aViewSettings.SetUserData( aSettings ); +} +void SfxTemplateManagerDlg::Resize() +{ // Fit the tab page control and the toolbars - Size aTabSize = maTabControl.GetSizePixel(); - aTabSize.setWidth(aWinSize.getWidth()); - maTabControl.SetSizePixel(aTabSize); - Size aTabPageSize = maTabControl.GetTabPageSizePixel(); - Point aToolbarsPos(0, aTabSize.getHeight() - aTabPageSize.getHeight()); - mpToolbars->SetPosPixel(aToolbarsPos); - aTabPageSize.setHeight(mpToolbars->GetSizePixel().getHeight() + 3); - maTabControl.SetTabPageSizePixel(aTabPageSize); - - Size aToolbarsSize = mpToolbars->GetSizePixel(); - aToolbarsSize.setWidth(aWinSize.getWidth()); - mpToolbars->SetSizePixel(aToolbarsSize); + maTabControl.SetSizePixel(GetSizePixel()); + const Size aWinSize = maTabControl.GetTabPageSizePixel(); // Calculate toolboxes size and positions Size aViewSize = mpViewBar->CalcMinimumWindowSizePixel(); Size aActionSize = mpActionBar->CalcMinimumWindowSizePixel(); Size aTemplateSize = mpTemplateBar->CalcMinimumWindowSizePixel(); - aActionSize.setWidth(3*aActionSize.getWidth()); + long nToolbarsHeight = std::max(std::max(aViewSize.getHeight(), aActionSize.getHeight()), aTemplateSize.getHeight()); + + aActionSize.setWidth(2.5*aActionSize.getWidth()); aViewSize.setWidth(aWinSize.getWidth()-aActionSize.getWidth()-mpViewBar->GetPosPixel().X()); aTemplateSize.setWidth(aWinSize.getWidth()); @@ -319,15 +456,9 @@ void SfxTemplateManagerDlg::Resize() mpActionBar->SetPosSizePixel(aActionPos,aActionSize); mpTemplateBar->SetSizePixel(aTemplateSize); - // Set view position below toolbox Point aViewPos = maView->GetPosPixel(); - aViewPos.setY(maTabControl.GetPosPixel().Y() + maTabControl.GetSizePixel().getHeight()); + aViewPos.setY(nToolbarsHeight); aViewPos.setX(0); - Size aThumbSize(aWinSize.getWidth(), aWinSize.getHeight() - aViewPos.getY()); - maView->SetPosSizePixel(aViewPos, aThumbSize); - - if (aWinSize.getHeight() < aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER) - aWinSize.setHeight(aViewPos.getY() + aThumbSize.getHeight() + PADDING_DLG_BORDER); // Set search box position and size Size aSearchSize = mpSearchEdit->CalcMinimumSize(); @@ -336,28 +467,17 @@ void SfxTemplateManagerDlg::Resize() mpSearchEdit->SetSizePixel(aSearchSize); mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aViewPos.Y())); - maView->SetSizePixel(aThumbSize); - mpOnlineView->SetPosSizePixel(aViewPos,aThumbSize); - mpSearchView->SetSizePixel(aThumbSize); - - mpCurView->Resize(); - - ModelessDialog::Resize(); -} + if (mpSearchEdit->IsVisible()) + aViewPos.setY(aViewPos.getY() + mpSearchEdit->GetSizePixel().getHeight() ); -IMPL_LINK_NOARG(SfxTemplateManagerDlg, CloseOverlayHdl) -{ - maSelTemplates.clear(); - mpTemplateBar->Hide(); - mpViewBar->Show(); - mpActionBar->Show(); + // Set view position below toolbox and search box + Size aThumbSize(aWinSize.getWidth(), aWinSize.getHeight() - aViewPos.getY()); - if (mpCurView == maView) - mpCurView->showOverlay(false); - else - switchMainView(true); + maView->SetPosSizePixel(aViewPos,aThumbSize); + mpOnlineView->SetPosSizePixel(aViewPos,aThumbSize); + mpSearchView->SetPosSizePixel(aViewPos,aThumbSize); - return 0; + ModelessDialog::Resize(); } IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXViewHdl) @@ -485,79 +605,14 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox) return 0; } -IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pItem) +IMPL_LINK(SfxTemplateManagerDlg, TVItemStateHdl, const ThumbnailViewItem*, pItem) { - if (pItem->isSelected()) - { - if (maSelFolders.empty() && !mbIsSaveMode) - { - mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); - mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL); - } + const TemplateContainerItem *pCntItem = dynamic_cast<const TemplateContainerItem*>(pItem); - maSelFolders.insert(pItem); - } + if (pCntItem) + OnRegionState(pItem); else - { - maSelFolders.erase(pItem); - - if (maSelFolders.empty() && !mbIsSaveMode) - { - mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); - mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL); - } - } - - return 0; -} - -IMPL_LINK(SfxTemplateManagerDlg, TVTemplateStateHdl, const ThumbnailViewItem*, pItem) -{ - bool bInSelection = maSelTemplates.find(pItem) != maSelTemplates.end(); - if (pItem->isSelected()) - { - if (!mbIsSaveMode) - { - if (maSelTemplates.empty()) - { - mpViewBar->Show(false); - mpActionBar->Show(false); - mpTemplateBar->Show(); - } - else if (maSelTemplates.size() != 1 || !bInSelection) - { - mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); - } - } - - if (!bInSelection) - maSelTemplates.insert(pItem); - } - else - { - if (bInSelection) - { - maSelTemplates.erase(pItem); - - if (!mbIsSaveMode) - { - if (maSelTemplates.empty()) - { - mpTemplateBar->Show(false); - mpViewBar->Show(); - mpActionBar->Show(); - } - else if (maSelTemplates.size() == 1) - { - mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); - mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); - mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); - } - } - } - } + OnTemplateState(pItem); return 0; } @@ -569,10 +624,7 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu) switch(nMenuId) { case MNI_ACTION_SORT_NAME: - if (maView->isOverlayVisible()) - maView->sortOverlayItems(SortView_Name()); - else - maView->sortItems(SortView_Name()); + maView->sortItems(SortView_Name()); break; case MNI_ACTION_REFRESH: mpCurView->reload(); @@ -651,10 +703,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu) } if (mpOnlineView->loadRepository(pRepository,false)) - { switchMainView(false); - mpOnlineView->showOverlay(true); - } } return 0; @@ -672,6 +721,21 @@ IMPL_LINK(SfxTemplateManagerDlg, DefaultTemplateMenuSelectHdl, Menu*, pMenu) return 0; } +IMPL_LINK_NOARG(SfxTemplateManagerDlg, OpenRegionHdl) +{ + maSelFolders.clear(); + maSelTemplates.clear(); + + if (!mbIsSaveMode) + mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT,mpCurView->isImportAllowed()); + + mpTemplateBar->Hide(); + mpViewBar->Show(); + mpActionBar->Show(); + + return 0; +} + IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem) { if (!mbIsSaveMode) @@ -702,59 +766,152 @@ IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem) IMPL_LINK_NOARG(SfxTemplateManagerDlg, SearchUpdateHdl) { - // if the search view is hidden, hide the folder view and display search one - if (!mpCurView->isOverlayVisible() && !mpSearchView->IsVisible()) - { - mpSearchView->Clear(); - mpSearchView->Show(); - mpCurView->Hide(); - } - OUString aKeyword = mpSearchEdit->GetText(); if (!aKeyword.isEmpty()) { - if (mpCurView->isOverlayVisible()) + mpSearchView->Clear(); + + // if the search view is hidden, hide the folder view and display search one + if (!mpSearchView->IsVisible()) { - mpCurView->filterTemplatesByKeyword(aKeyword); + mpCurView->deselectItems(); + mpSearchView->Show(); + mpCurView->Hide(); } - else + + bool bDisplayFolder = !mpCurView->isNonRootRegionVisible(); + + FILTER_APPLICATION eFilter = FILTER_APP_NONE; + switch (maTabControl.GetCurPageId()) { - mpSearchView->Clear(); + case FILTER_DOCS: + eFilter = FILTER_APP_WRITER; + break; + case FILTER_PRESENTATIONS: + eFilter = FILTER_APP_IMPRESS; + break; + case FILTER_SHEETS: + eFilter = FILTER_APP_CALC; + break; + case FILTER_DRAWS: + eFilter = FILTER_APP_DRAW; + break; + } - std::vector<TemplateItemProperties> aItems = - maView->getFilteredItems(SearchView_Keyword(aKeyword)); + std::vector<TemplateItemProperties> aItems = + maView->getFilteredItems(SearchView_Keyword(aKeyword,eFilter)); - size_t nCounter = 0; - for (size_t i = 0; i < aItems.size(); ++i) - { - TemplateItemProperties *pItem = &aItems[i]; - - mpSearchView->AppendItem(++nCounter,pItem->nRegionId, - pItem->nId-1, - pItem->aName, - maView->GetItemText(pItem->nRegionId+1), - pItem->aPath, - pItem->aThumbnail); - } + for (size_t i = 0; i < aItems.size(); ++i) + { + TemplateItemProperties *pItem = &aItems[i]; - mpSearchView->Invalidate(); + OUString aFolderName; + + if (bDisplayFolder) + aFolderName = maView->getRegionName(pItem->nRegionId); + + mpSearchView->AppendItem(pItem->nId,maView->getRegionId(pItem->nRegionId), + pItem->nDocId, + pItem->aName, + aFolderName, + pItem->aPath, + pItem->aThumbnail); } + + mpSearchView->Invalidate(); } else { - if (mpCurView->isOverlayVisible()) + mpSearchView->Hide(); + mpCurView->Show(); + } + + return 0; +} + +void SfxTemplateManagerDlg::OnRegionState (const ThumbnailViewItem *pItem) +{ + if (pItem->isSelected()) + { + if (maSelFolders.empty() && !mbIsSaveMode) { - mpCurView->filterTemplatesByApp(FILTER_APP_NONE); + mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT); + mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL); } - else + + maSelFolders.insert(pItem); + } + else + { + maSelFolders.erase(pItem); + + if (maSelFolders.empty() && !mbIsSaveMode) { - mpSearchView->Hide(); - mpCurView->Show(); + mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); + mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL); } } +} - return 0; +void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem) +{ + bool bInSelection = maSelTemplates.find(pItem) != maSelTemplates.end(); + + if (pItem->isSelected()) + { + if (maSelTemplates.empty()) + { + mpViewBar->Show(false); + mpTemplateBar->Show(); + } + else if (maSelTemplates.size() != 1 || !bInSelection) + { + if (!mbIsSaveMode) + { + mpTemplateBar->HideItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + } + else + { + mpTemplateBar->HideItem(TBI_TEMPLATE_SAVE); + mpTemplateBar->HideItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->HideItem(TBI_TEMPLATE_DEFAULT); + } + } + + if (!bInSelection) + maSelTemplates.insert(pItem); + } + else + { + if (bInSelection) + { + maSelTemplates.erase(pItem); + + if (maSelTemplates.empty()) + { + mpTemplateBar->Show(false); + mpViewBar->Show(); + } + else if (maSelTemplates.size() == 1) + { + if (!mbIsSaveMode) + { + mpTemplateBar->ShowItem(TBI_TEMPLATE_EDIT); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + } + else + { + mpTemplateBar->ShowItem(TBI_TEMPLATE_SAVE); + mpTemplateBar->ShowItem(TBI_TEMPLATE_PROPERTIES); + mpTemplateBar->ShowItem(TBI_TEMPLATE_DEFAULT); + } + } + } + } } void SfxTemplateManagerDlg::OnTemplateImport () @@ -821,15 +978,41 @@ void SfxTemplateManagerDlg::OnTemplateImport () if (aFiles.hasElements()) { - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) + if (!maSelFolders.empty()) { - OUString aTemplateList; - TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter); + //Import to the selected regions + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) + { + OUString aTemplateList; + TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter); + for (size_t i = 0, n = aFiles.getLength(); i < n; ++i) + { + if(!maView->copyFrom(pFolder,aFiles[i])) + { + if (aTemplateList.isEmpty()) + aTemplateList = aFiles[i]; + else + aTemplateList = aTemplateList + "\n" + aFiles[i]; + } + } + + if (!aTemplateList.isEmpty()) + { + OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString()); + aMsg = aMsg.replaceFirst("$1",pFolder->maTitle); + ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList)); + } + } + } + else + { + //Import to current region + OUString aTemplateList; for (size_t i = 0, n = aFiles.getLength(); i < n; ++i) { - if(!maView->copyFrom(pFolder,aFiles[i])) + if(!maView->copyFrom(aFiles[i])) { if (aTemplateList.isEmpty()) aTemplateList = aFiles[i]; @@ -841,7 +1024,7 @@ void SfxTemplateManagerDlg::OnTemplateImport () if (!aTemplateList.isEmpty()) { OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT).toString()); - aMsg = aMsg.replaceFirst("$1",pFolder->maTitle); + aMsg = aMsg.replaceFirst("$1",maView->getCurRegionName()); ErrorBox(this,WB_OK,aMsg.replaceFirst("$2",aTemplateList)); } } @@ -870,7 +1053,7 @@ void SfxTemplateManagerDlg::OnTemplateExport() { sal_uInt16 i = 1; - std::set<const ThumbnailViewItem*>::const_iterator pIter = maSelTemplates.begin(); + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin(); for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i) { const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*pIter); @@ -884,7 +1067,7 @@ void SfxTemplateManagerDlg::OnTemplateExport() OUString aPath = aPathObj.GetMainURL( INetURLObject::NO_DECODE ); - if (!maView->exportTo(pItem->mnIdx+1,pItem->mnRegionId+1,aPath)) + if (!maView->exportTo(pItem->mnAssocId,pItem->mnRegionId,aPath)) { if (aTemplateList.isEmpty()) aTemplateList = pItem->maTitle; @@ -897,12 +1080,12 @@ void SfxTemplateManagerDlg::OnTemplateExport() } else { - // export templates from the current open overlay + // export templates from the current view sal_uInt16 i = 1; - sal_uInt16 nRegionItemId = maView->getOverlayRegionId() + 1; + sal_uInt16 nRegionItemId = maView->getCurRegionItemId(); - std::set<const ThumbnailViewItem*>::const_iterator pIter = maSelTemplates.begin(); + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin(); for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i) { const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*pIter); @@ -925,7 +1108,7 @@ void SfxTemplateManagerDlg::OnTemplateExport() } } - maView->deselectOverlayItems(); + maView->deselectItems(); } if (!aTemplateList.isEmpty()) @@ -964,6 +1147,7 @@ void SfxTemplateManagerDlg::OnTemplateSearch () // Hide search view if (bVisible) { + mpSearchView->deselectItems(); mpSearchView->Hide(); mpCurView->Show(); } @@ -974,8 +1158,8 @@ void SfxTemplateManagerDlg::OnTemplateSearch () mpSearchEdit->GrabFocus(); // display all templates if we hide the search bar - if (bVisible && mpCurView->isOverlayVisible()) - mpCurView->filterTemplatesByApp(FILTER_APP_NONE); + if (bVisible && mpCurView->isNonRootRegionVisible()) + mpCurView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); } void SfxTemplateManagerDlg::OnTemplateEdit () @@ -989,7 +1173,7 @@ void SfxTemplateManagerDlg::OnTemplateEdit () aArgs[2].Value <<= UpdateDocMode::ACCORDING_TO_CONFIG; uno::Reference< XStorable > xStorable; - std::set<const ThumbnailViewItem*>::const_iterator pIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter) { const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*pIter); @@ -1023,63 +1207,41 @@ void SfxTemplateManagerDlg::OnTemplateDelete () if (mpSearchView->IsVisible()) { - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) + std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoids invalid iterators + + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter) { const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*pIter); - sal_uInt16 nItemId = pItem->mnIdx + 1; - sal_uInt16 nItemRegionId = pItem->mnRegionId + 1; - - if (maView->removeTemplate(nItemId,nItemRegionId)) - maSelTemplates.erase(pIter++); - else + if (!maView->removeTemplate(pItem->mnAssocId,pItem->mnRegionId)) { if (aTemplateList.isEmpty()) aTemplateList = pItem->maTitle; else aTemplateList = aTemplateList + "\n" + pItem->maTitle; - - ++pIter; } + else + mpSearchView->RemoveItem(pItem->mnId); } - - // Update search results - if (maSelTemplates.empty()) - { - mpTemplateBar->Show(false); - mpViewBar->Show(); - mpActionBar->Show(); - } - - SearchUpdateHdl(mpSearchEdit); } else { - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end();) + sal_uInt16 nRegionItemId = maView->getCurRegionItemId(); + std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoid invalid iterators + + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter) { - if (maView->removeTemplate((*pIter)->mnId,maView->getOverlayRegionId()+1)) - maSelTemplates.erase(pIter++); - else + if (!maView->removeTemplate((*pIter)->mnId,nRegionItemId)) { if (aTemplateList.isEmpty()) aTemplateList = (*pIter)->maTitle; else aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle; - - ++pIter; } } - - if (maSelTemplates.empty()) - { - mpTemplateBar->SetItemDown(TBI_TEMPLATE_DELETE,false); - mpTemplateBar->Show(false); - mpViewBar->Show(); - mpActionBar->Show(); - } } if (!aTemplateList.isEmpty()) @@ -1114,12 +1276,12 @@ void SfxTemplateManagerDlg::OnFolderDelete() OUString aFolderList; - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelFolders.begin(); pIter != maSelFolders.end();) + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating an iterator + + for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter) { - if (maView->removeRegion((*pIter)->mnId)) - maSelFolders.erase(pIter++); - else + if (!maView->removeRegion((*pIter)->mnId)) { if (aFolderList.isEmpty()) aFolderList = (*pIter)->maTitle; @@ -1130,12 +1292,6 @@ void SfxTemplateManagerDlg::OnFolderDelete() } } - if (maSelFolders.empty()) - { - mpViewBar->HideItem(TBI_TEMPLATE_IMPORT); - mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL); - } - if (!aFolderList.isEmpty()) { OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER).toString() ); @@ -1145,9 +1301,9 @@ void SfxTemplateManagerDlg::OnFolderDelete() void SfxTemplateManagerDlg::OnRepositoryDelete() { - if(deleteRepository(mpOnlineView->getOverlayRegionId())) + if(deleteRepository(mpOnlineView->getCurRegionId())) { - // close overlay and switch to local view + // switch to local view switchMainView(true); createRepositoryMenu(); @@ -1158,7 +1314,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() { assert(m_xModel.is()); - if (!maView->isOverlayVisible() && maSelFolders.empty()) + if (!maView->isNonRootRegionVisible() && maSelFolders.empty()) { ErrorBox(this, WB_OK,SfxResId(STR_MSG_ERROR_SELECT_FOLDER).toString()).Execute(); return; @@ -1176,25 +1332,25 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() OUString aQMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE).toString()); QueryBox aQueryDlg(this,WB_YES_NO | WB_DEF_YES, OUString()); - if (maView->isOverlayVisible()) + if (maView->isNonRootRegionVisible()) { - sal_uInt16 nRegionItemId = maView->getOverlayRegionId()+1; + sal_uInt16 nRegionItemId = maView->getRegionId(maView->getCurRegionId()-1); if (!maView->isTemplateNameUnique(nRegionItemId,aName)) { aQMsg = aQMsg.replaceFirst("$1",aName); - aQueryDlg.SetMessText(aQMsg.replaceFirst("$2",maView->getOverlayName())); + aQueryDlg.SetMessText(aQMsg.replaceFirst("$2",maView->getCurRegionName())); if (aQueryDlg.Execute() == RET_NO) return; } if (!maView->saveTemplateAs(nRegionItemId,m_xModel,aName)) - aFolderList = maView->getOverlayName(); + aFolderList = maView->getCurRegionName(); } else { - std::set<const ThumbnailViewItem*>::const_iterator pIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) { TemplateContainerItem *pItem = (TemplateContainerItem*)(*pIter); @@ -1218,8 +1374,6 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() } } - maView->reload(); - if (!aFolderList.isEmpty()) { } @@ -1315,20 +1469,19 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) } else { - nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); + nItemId = maView->getRegionId(nMenuId-MNI_MOVE_FOLDER_BASE); } if (nItemId) { // Move templates to desired folder if for some reason move fails // try copying them. - if (!maView->moveTemplates(maSelTemplates,nItemId,false) && - !maView->moveTemplates(maSelTemplates,nItemId,true)) + if (!maView->moveTemplates(maSelTemplates,nItemId)) { OUString aTemplateList; - std::set<const ThumbnailViewItem*>::const_iterator pIter; - for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; + for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter) { if (aTemplateList.isEmpty()) aTemplateList = (*pIter)->maTitle; @@ -1336,7 +1489,7 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) aTemplateList = aTemplateList + "\n" + (*pIter)->maTitle; } - OUString aDst = maView->GetItemText(nItemId); + OUString aDst = maView->getRegionItemName(nItemId); OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString()); aMsg = aMsg.replaceFirst("$1",aDst); ErrorBox(this, WB_OK,aMsg.replaceFirst( "$2",aTemplateList)).Execute(); @@ -1364,14 +1517,14 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId) } else { - nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); + nItemId = maView->getRegionId(nMenuId-MNI_MOVE_FOLDER_BASE); } if (nItemId) { OUString aTemplateList; - std::set<const ThumbnailViewItem*>::const_iterator aIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator aIter; for (aIter = maSelTemplates.begin(); aIter != maSelTemplates.end(); ++aIter) { const TemplateSearchViewItem *pItem = @@ -1391,8 +1544,8 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId) if (!aTemplateList.isEmpty()) { OUString aMsg(SfxResId(STR_MSG_ERROR_REMOTE_MOVE).toString()); - aMsg = aMsg.replaceFirst("$1",mpOnlineView->getOverlayName()); - aMsg = aMsg.replaceFirst("$2",maView->GetItemText(nItemId)); + aMsg = aMsg.replaceFirst("$1",mpOnlineView->getCurRegionName()); + aMsg = aMsg.replaceFirst("$2",maView->getRegionItemName(nItemId)); ErrorBox(this,WB_OK,aMsg.replaceFirst("$1",aTemplateList)).Execute(); } } @@ -1418,7 +1571,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) } else { - nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE); + nItemId = maView->getRegionId(nMenuId-MNI_MOVE_FOLDER_BASE); } if (nItemId) @@ -1427,14 +1580,15 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) // Move templates to desired folder if for some reason move fails // try copying them. - std::set<const ThumbnailViewItem*>::const_iterator aIter; - for (aIter = maSelTemplates.begin(); aIter != maSelTemplates.end(); ++aIter) + std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator aIter; + std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Copy to avoid invalidating an iterator + + for (aIter = aSelTemplates.begin(); aIter != aSelTemplates.end(); ++aIter) { const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*aIter); - if(!maView->moveTemplate(pItem,pItem->mnRegionId+1,nItemId,false) - && !maView->moveTemplate(pItem,pItem->mnRegionId+1,nItemId,true)) + if(!maView->moveTemplate(pItem,pItem->mnRegionId,nItemId)) { if (aTemplateList.isEmpty()) aTemplateList = (*aIter)->maTitle; @@ -1445,7 +1599,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) if (!aTemplateList.isEmpty()) { - OUString aDst = maView->GetItemText(nItemId); + OUString aDst = maView->getRegionItemName(nItemId); OUString aMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE).toString()); aMsg = aMsg.replaceFirst("$1",aDst); ErrorBox(this, WB_OK,aMsg.replaceFirst( "$2",aTemplateList)).Execute(); @@ -1544,31 +1698,6 @@ void SfxTemplateManagerDlg::syncRepositories() const } } -BitmapEx SfxTemplateManagerDlg::getDefaultThumbnail( const OUString& rPath ) -{ - INetURLObject aUrl(rPath); - OUString aExt = aUrl.getExtension(); - - BitmapEx aImg; - if ( aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx" ) - { - aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_TEXT ) ); - } - else if ( aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx" ) - { - aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_SHEET ) ); - } - else if ( aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx" ) - { - aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_PRESENTATION ) ); - } - else if ( aExt == "otg" || aExt == "std" ) - { - aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_DRAWING ) ); - } - return aImg; -} - static bool lcl_getServiceName ( const OUString &rFileURL, OUString &rName ) { bool bRet = false; diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src index a3514316e76f..9beb3dac9e86 100644 --- a/sfx2/source/doc/templatedlg.src +++ b/sfx2/source/doc/templatedlg.src @@ -101,75 +101,18 @@ String STR_QMSG_TEMPLATE_OVERWRITE Text [ en-US ] = "A template named $1 already exist in $2. Do you want to overwrite it?"; }; -ModelessDialog DLG_TEMPLATE_MANAGER +TabPage TAB_TEMPLATE_MANAGER { - OutputSize = TRUE; - SVLook = TRUE; - Moveable = TRUE; - Closeable = TRUE; - Sizeable = TRUE; + Size = MAP_APPFONT( 290, 220 ); Hide = TRUE; - Size = MAP_APPFONT ( 290 , 250 ); - Text [en-US] = "Template Manager"; - - TabControl TAB_CONTROL - { - OutputSize = TRUE; - Size = MAP_APPFONT( 290, 22 ); - Pos = MAP_APPFONT( 0, 0 ); - PageList = - { - PageItem - { - Identifier = FILTER_DOCS; - Text [ en-US ] = "Documents"; - }; - PageItem - { - Identifier = FILTER_SHEETS; - Text [ en-US ] = "Spreadsheets"; - }; - PageItem - { - Identifier = FILTER_PRESENTATIONS; - Text [ en-US ] = "Presentations"; - }; - PageItem - { - Identifier = FILTER_DRAWS; - Text [ en-US ] = "Drawings"; - }; - }; - }; Control TEMPLATE_VIEW { - Size = MAP_APPFONT(280,220); + Pos = MAP_APPFONT( 0, 20 ); + Size = MAP_APPFONT( 290, 200 ); TabStop = TRUE; }; - Image IMG_ACTION_SORT - { - ImageBitmap = Bitmap - { - File = "sortascending.png"; - }; - }; - - Image IMG_ACTION_REFRESH - { - ImageBitmap = Bitmap - { - File = "reload.png"; - }; - }; - - Control TOOLBARS - { - Size = MAP_APPFONT( 290 , 16 ); - TabStop = False; - }; - ToolBox TBX_ACTION_VIEW { SVLook = TRUE ; @@ -269,6 +212,18 @@ ModelessDialog DLG_TEMPLATE_MANAGER { ToolBoxItem { + Identifier = TBI_TEMPLATE_SAVE; + Hide = TRUE; + Text [ en-US ] = "Save"; + + ItemImage = Image + { + ImageBitmap = Bitmap { File = "actionview028.png" ; }; + }; + }; + + ToolBoxItem + { Identifier = TBI_TEMPLATE_EDIT; Text [ en-US ] = "Edit"; @@ -334,4 +289,63 @@ ModelessDialog DLG_TEMPLATE_MANAGER }; }; }; + + Image IMG_ACTION_SORT + { + ImageBitmap = Bitmap + { + File = "sortascending.png"; + }; + }; + + Image IMG_ACTION_REFRESH + { + ImageBitmap = Bitmap + { + File = "reload.png"; + }; + }; +}; + +ModelessDialog DLG_TEMPLATE_MANAGER +{ + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + Hide = TRUE; + Size = MAP_APPFONT ( 290 , 250 ); + Text [en-US] = "Template Manager"; + + TabControl TAB_CONTROL + { + OutputSize = TRUE; + Size = MAP_APPFONT( 290, 250 ); + Pos = MAP_APPFONT( 0, 0 ); + PageList = + { + PageItem + { + Identifier = FILTER_DOCS; + Text [ en-US ] = "Documents"; + }; + PageItem + { + Identifier = FILTER_SHEETS; + Text [ en-US ] = "Spreadsheets"; + }; + PageItem + { + Identifier = FILTER_PRESENTATIONS; + Text [ en-US ] = "Presentations"; + }; + PageItem + { + Identifier = FILTER_DRAWS; + Text [ en-US ] = "Drawings"; + }; + }; + }; + }; diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx index de5514d620cb..b9ca781114ea 100644 --- a/sfx2/source/inc/templatesearchview.hxx +++ b/sfx2/source/inc/templatesearchview.hxx @@ -20,7 +20,7 @@ public: virtual ~TemplateSearchView(); - void AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx, + void AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx, const OUString &rTitle, const OUString &rSubtitle, const OUString &rPath, const BitmapEx &rImage ); }; diff --git a/sfx2/source/inc/templatesearchviewitem.hxx b/sfx2/source/inc/templatesearchviewitem.hxx index 27e393d24571..9d26ac7aeb72 100644 --- a/sfx2/source/inc/templatesearchviewitem.hxx +++ b/sfx2/source/inc/templatesearchviewitem.hxx @@ -21,8 +21,7 @@ struct TemplateSearchViewItem : public TemplateViewItem virtual ~TemplateSearchViewItem () {} - sal_uInt16 mnIdx; // Template associated Index - sal_uInt16 mnRegionId; // Template associated Region id + sal_uInt16 mnAssocId; //Associated item id to the TemplateViews }; #endif // __SFX2_TEMPLATESEARCHVIEWITEM_HXX__ diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 2d92b719ae67..c78ad47be16e 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -165,6 +165,7 @@ protected: bUpdateByExampleDisabled:1, bTreeDrag :1, bHierarchical :1, + m_bWantHierarchical :1, bBindingUpdate :1; DECL_LINK( FilterSelectHdl, ListBox * ); @@ -225,6 +226,7 @@ protected: sal_Int32 LoadFactoryStyleFilter( SfxObjectShell* i_pObjSh ); void SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter ); + SfxObjectShell * SaveSelection(); public: TYPEINFO(); diff --git a/solenv/gbuild/Deliver.mk b/solenv/gbuild/Deliver.mk index 0f257e5b9814..1e0fef51b8f9 100644 --- a/solenv/gbuild/Deliver.mk +++ b/solenv/gbuild/Deliver.mk @@ -60,7 +60,7 @@ endif endef define gb_Deliver__deliver -$(if $(gb_Deliver_CLEARONDELIVER),rm -f $(2) &&) $(if $(gb_Deliver_HARDLINK),ln,cp -P -f) $(1) $(2) && touch -r $(1) $(2) +$(if $(gb_Deliver_CLEARONDELIVER),rm -f $(2) &&) $(if $(gb_Deliver_HARDLINK),ln,cp -P -f) $(1) $(2) && touch $(if $(filter-out MACOSX,$(OS_FOR_BUILD)),--no-dereference) -r $(1) $(2) endef ifneq ($(strip $(gb_Deliver_GNUCOPY)),) diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 1178445bab70..6d6438f0f979 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -339,7 +339,7 @@ endef # JunitTest class ifneq ($(OOO_TEST_SOFFICE),) -gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) +gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE) else ifneq ($(gb_JunitTest_DEBUGRUN),) gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER) diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index a918cb295265..22f813c757cc 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -75,6 +75,13 @@ void SmOoxmlExport::HandleText( const SmNode* pNode, int /*nLevel*/) { m_pSerializer->startElementNS( XML_m, XML_r, FSEND ); + if( pNode->GetToken().eType == TTEXT ) // literal text (in quotes) + { + m_pSerializer->startElementNS( XML_m, XML_rPr, FSEND ); + m_pSerializer->singleElementNS( XML_m, XML_lit, FSEND ); + m_pSerializer->singleElementNS( XML_m, XML_nor, FSEND ); + m_pSerializer->endElementNS( XML_m, XML_rPr ); + } if( version == ECMA_DIALECT ) { // HACK: MSOffice2007 does not import characters properly unless this font is explicitly given m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND ); diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 0b1bedad3315..648f80895ebc 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -530,10 +530,10 @@ OUString SmOoxmlImport::handleNary() ret = "int"; break; case MS_IINT: - ret = "liint"; + ret = "iint"; break; case MS_IIINT: - ret = "liiint"; + ret = "iiint"; break; case MS_LINT: ret = "lint"; @@ -570,11 +570,21 @@ OUString SmOoxmlImport::handleNary() OUString SmOoxmlImport::handleR() { stream.ensureOpeningTag( M_TOKEN( r )); - if( XmlStream::Tag rPr = stream.checkOpeningTag( OOX_TOKEN( doc, rPr ))) - { // TODO -// stream.checkOpeningTag( OOX_TOKEN( doc, rFonts )); -// stream.ensureClosingTag( OOX_TOKEN( doc, rFonts )); - stream.ensureClosingTag( OOX_TOKEN( doc, rPr )); + bool normal = false; + bool literal = false; + if( XmlStream::Tag rPr = stream.checkOpeningTag( M_TOKEN( rPr ))) + { + if( XmlStream::Tag litTag = stream.checkOpeningTag( M_TOKEN( lit ))) + { + literal = litTag.attribute( M_TOKEN( val ), true ); + stream.ensureClosingTag( M_TOKEN( lit )); + } + if( XmlStream::Tag norTag = stream.checkOpeningTag( M_TOKEN( nor ))) + { + normal = norTag.attribute( M_TOKEN( val ), true ); + stream.ensureClosingTag( M_TOKEN( nor )); + } + stream.ensureClosingTag( M_TOKEN( rPr )); } OUString text; while( !stream.atEnd() && stream.currentToken() != CLOSING( stream.currentToken())) @@ -597,6 +607,8 @@ OUString SmOoxmlImport::handleR() } } stream.ensureClosingTag( M_TOKEN( r )); + if( normal || literal ) + text = "\"" + text + "\""; return text.replaceAll("{", "\\{").replaceAll("}", "\\}"); } diff --git a/svl/inc/svl/style.hrc b/svl/inc/svl/style.hrc index d4988400083a..e12feed67208 100644 --- a/svl/inc/svl/style.hrc +++ b/svl/inc/svl/style.hrc @@ -21,6 +21,7 @@ #define SFXSTYLEBIT_AUTO 0x0000 // automatisch; Flags kommen von der Applikation #define SFXSTYLEBIT_HIDDEN 0x0200 // benutzte Vorlage (als Suchmaske) +#define SFXSTYLEBIT_HIERARCHY 0x1000 // hierarchical view - just for dialog #define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_USED 0x4000 // benutzte Vorlage (als Suchmaske) #define SFXSTYLEBIT_USERDEF 0x8000 // benutzerdefinierte Vorlage diff --git a/svl/source/numbers/zforfind.hxx b/svl/source/numbers/zforfind.hxx index 412e189f5028..dadde5cc1a46 100644 --- a/svl/source/numbers/zforfind.hxx +++ b/svl/source/numbers/zforfind.hxx @@ -218,6 +218,10 @@ private: const OUString& rString, sal_Int32 nPos ) { + if (rWhat.isEmpty() || rString.getLength() <= nPos) + { + return false; + } // mostly used with one character if ( rWhat[ 0 ] != rString[ nPos ] ) { diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 0440835e9214..3e55e22e5cc2 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -972,7 +972,7 @@ sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, bool bNoAdditio if (LocaleDataWrapper::areChecksEnabled()) { const LanguageTag& rLoadedLocale = xLocaleData->getLoadedLanguageTag(); - if ( rLoadedLocale != maLanguageTag ) + if ( !rLoadedLocale.equals( maLanguageTag, true) ) { OUString aMsg("SvNumerFormatter::ImpGenerateCL: locales don't match:"); LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg )); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b9dfc1786b8c..545d6cc5683a 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1292,6 +1292,22 @@ sal_Unicode toUniChar(sal_uInt8 n) return sal_Unicode(c); } +bool IsSingleSymbol(OUStringBuffer& rStringBuffer, sal_Int32 nPos) +{ + bool ret = false; + while (nPos >= 0) + { + if(rStringBuffer[nPos] == '*' || rStringBuffer[nPos] == '\\' || rStringBuffer[nPos] == '_') + { + ret = !ret; + nPos--; + } + else + return ret; + } + return ret; +} + } // namespace OUString SvNumberformat::LocaleType::generateCode() const @@ -1396,6 +1412,21 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rStr return (cToken == ']' || nPos == nLen) ? LocaleType(nNum) : LocaleType(); } +static bool lcl_matchKeywordAndGetNumber( const OUString & rString, const sal_Int32 nPos, + const OUString & rKeyword, sal_Int32 & nNumber ) +{ + if (0 <= nPos && nPos + rKeyword.getLength() < rString.getLength() && rString.matchIgnoreAsciiCase( rKeyword, nPos)) + { + nNumber = rString.copy( nPos + rKeyword.getLength()).toInt32(); + return true; + } + else + { + nNumber = 0; + return false; + } +} + short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, sal_Int32& nPos, OUString& sSymbol) @@ -1498,49 +1529,53 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString, { const OUString aNatNum("NATNUM"); const OUString aDBNum("DBNUM"); - OUString aUpperNatNum( rChrCls().uppercase( rString.toString(), nPos-1, aNatNum.getLength() ) ); - OUString aUpperDBNum( rChrCls().uppercase( rString.toString(), nPos-1, aDBNum.getLength() ) ); - sal_Unicode cUpper = aUpperNatNum[0]; - sal_Int32 nNatNumNum = rString.toString().copy( nPos - 1 + aNatNum.getLength() ).toInt32(); - sal_Unicode cDBNum = rString[ nPos - 1 + aDBNum.getLength()]; - if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 ) + const OUString aBufStr( rString.toString()); + sal_Int32 nNatNumNum; + sal_Int32 nDBNum; + if ( lcl_matchKeywordAndGetNumber( aBufStr, nPos-1, aNatNum, nNatNumNum) && + 0 <= nNatNumNum && nNatNumNum <= 19 ) { sBuffSymbol.stripStart((sal_Unicode)'['); - sBuffSymbol.append( rString.toString().copy( --nPos, aNatNum.getLength()+1 )); + sBuffSymbol.append( aBufStr.copy( --nPos, aNatNum.getLength()+1 )); nPos += aNatNum.getLength()+1; //! SymbolType is negative eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum); eState = SsGetPrefix; } - else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' ) + else if ( lcl_matchKeywordAndGetNumber( aBufStr, nPos-1, aDBNum, nDBNum) && + '1' <= nDBNum && nDBNum <= '9' ) { sBuffSymbol.stripStart((sal_Unicode)'['); sBuffSymbol.append(rString.toString().copy( --nPos, aDBNum.getLength()+1 )); nPos += aDBNum.getLength()+1; //! SymbolType is negative - eSymbolType = sal::static_int_cast< short >( BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1')); + eSymbolType = sal::static_int_cast< short >( BRACKET_SYMBOLTYPE_DBNUM1 - (nDBNum - '1')); eState = SsGetPrefix; } - else if (cUpper == rKeywords[NF_KEY_H][0] || // H - cUpper == rKeywords[NF_KEY_MI][0] || // M - cUpper == rKeywords[NF_KEY_S][0] ) // S - { - sBuffSymbol.append(cToken); - eState = SsGetTime; - cLetter = cToken; - } else { - sBuffSymbol.stripStart((sal_Unicode)'['); - sBuffSymbol.append(cToken); - eSymbolType = BRACKET_SYMBOLTYPE_COLOR; - eState = SsGetPrefix; + sal_Unicode cUpper = rChrCls().uppercase( aBufStr, nPos-1, 1)[0]; + if ( cUpper == rKeywords[NF_KEY_H][0] || // H + cUpper == rKeywords[NF_KEY_MI][0] || // M + cUpper == rKeywords[NF_KEY_S][0] ) // S + { + sBuffSymbol.append(cToken); + eState = SsGetTime; + cLetter = cToken; + } + else + { + sBuffSymbol.stripStart((sal_Unicode)'['); + sBuffSymbol.append(cToken); + eSymbolType = BRACKET_SYMBOLTYPE_COLOR; + eState = SsGetPrefix; + } } } } break; case SsGetString: - if (cToken == ';') + if (cToken == ';' && (nPos < 2 || !IsSingleSymbol(rString, nPos-2))) { eState = SsStop; } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 3513b11280ba..26492e6a9372 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1300,6 +1300,9 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt ) return; } + if ( mbFormat ) + Format(); + --nLastItem; const size_t nCurPos = mnSelItemId ? GetItemPos( mnSelItemId ) : mpNoneItem ? VALUESET_ITEM_NONEITEM : 0; diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk index 3eac0948f077..fa3313d38ba1 100644 --- a/svx/Package_inc.mk +++ b/svx/Package_inc.mk @@ -31,6 +31,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftdiit.hxx,svx/xftdiit.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/fntctl.hxx,svx/fntctl.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdattr.hxx,svx/svdattr.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/imapdlg.hxx,svx/imapdlg.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/itextprovider.hxx,svx/itextprovider.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/linkwarn.hxx,svx/linkwarn.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/formatpaintbrushctrl.hxx,svx/formatpaintbrushctrl.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xcolit.hxx,svx/xcolit.hxx)) diff --git a/svx/inc/svx/itextprovider.hxx b/svx/inc/svx/itextprovider.hxx new file mode 100644 index 000000000000..3202e4d65495 --- /dev/null +++ b/svx/inc/svx/itextprovider.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#if !defined SVX_ITEXTPROVIDER_HXX_INCLUDED +#define SVX_ITEXTPROVIDER_HXX_INCLUDED + +#include <sal/types.h> + +#include <svx/svxdllapi.h> + +class SdrText; + +namespace svx +{ + + /** This interface provides access to text object(s) in an SdrObject. + + */ + class SVX_DLLPUBLIC ITextProvider + { + public: + /** Return the number of texts available for this object. */ + virtual sal_Int32 getTextCount() const = 0; + + /** Return the nth available text. */ + virtual SdrText* getText(sal_Int32 nIndex) const = 0; + + protected: + ~ITextProvider() {} + }; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx index ac6a613e2c2a..456b104e60ec 100644 --- a/svx/inc/svx/sdr/properties/textproperties.hxx +++ b/svx/inc/svx/sdr/properties/textproperties.hxx @@ -20,6 +20,7 @@ #ifndef _SDR_PROPERTIES_TEXTPROPERTIES_HXX #define _SDR_PROPERTIES_TEXTPROPERTIES_HXX +#include <svx/itextprovider.hxx> #include <svx/sdr/properties/attributeproperties.hxx> #include "svx/svxdllapi.h" @@ -45,6 +46,9 @@ namespace sdr // react on ItemSet changes virtual void ItemSetChanged(const SfxItemSet& rSet); + /// Get the TextProvider related to our SdrObject + virtual const svx::ITextProvider& getTextProvider() const; + public: // basic constructor explicit TextProperties(SdrObject& rObj); diff --git a/svx/inc/svx/svdotext.hxx b/svx/inc/svx/svdotext.hxx index 5f1eeac67bab..551cf58382f1 100644 --- a/svx/inc/svx/svdotext.hxx +++ b/svx/inc/svx/svdotext.hxx @@ -21,6 +21,7 @@ #define _SVDOTEXT_HXX #include <vcl/field.hxx> +#include <svx/itextprovider.hxx> #include <svx/svdoattr.hxx> #include <svx/svdtrans.hxx> // GeoStat #include <tools/datetime.hxx> @@ -123,7 +124,7 @@ namespace sdr // SdrTextObj //************************************************************ -class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj +class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider { private: // Cell needs access to ImpGetDrawOutliner(); diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index 6a8c442bc79a..4f069a2b85ce 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -227,7 +227,7 @@ static const SvxMSDffTextRectangles mso_sptRightTriangleTextRect[] = }; static const SvxMSDffVertPair mso_sptRightTriangleGluePoints[] = { - { 10800, 0 }, { 5400, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 16200, 10800 } + { 0, 0 }, { 0, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 10800, 10800 } }; static const mso_CustomShape msoRightTriangle = { @@ -460,7 +460,7 @@ static const SvxMSDffTextRectangles mso_sptIsocelesTriangleTextRect[] = }; static const SvxMSDffVertPair mso_sptIsocelesTriangleGluePoints[] = { - { 10800, 0 }, { 1 MSO_I, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 7 MSO_I, 10800 } + { 0 MSO_I, 0 }, { 1 MSO_I, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 7 MSO_I, 10800 } }; static const SvxMSDffHandle mso_sptIsocelesTriangleHandle[] = { diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 9a4081656770..2663b8f93087 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -3397,7 +3397,7 @@ void DbGridControl::KeyInput( const KeyEvent& rEvt ) { size_t Location = GetModelColumnPos( nColId ); DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; - OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this ); + OStringTransfer::CopyString( GetCurrentRowCellText( pColumn, m_xCurrentRow ), this ); return; } } diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index e4eb5cd272ed..db1a34a849d8 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -82,14 +82,15 @@ namespace sdr void TextProperties::ItemSetChanged(const SfxItemSet& rSet) { SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); - sal_Int32 nText = rObj.getTextCount(); + const svx::ITextProvider& rTextProvider(getTextProvider()); + sal_Int32 nText = rTextProvider.getTextCount(); // #i101556# ItemSet has changed -> new version maVersion++; while( --nText >= 0 ) { - SdrText* pText = rObj.getText( nText ); + SdrText* pText = rTextProvider.getText( nText ); OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0; @@ -170,10 +171,11 @@ namespace sdr { SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner(); - sal_Int32 nCount = rObj.getTextCount(); + const svx::ITextProvider& rTextProvider(getTextProvider()); + sal_Int32 nCount = rTextProvider.getTextCount(); while( nCount-- ) { - SdrText* pText = rObj.getText( nCount ); + SdrText* pText = rTextProvider.getText( nCount ); OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject(); if( pParaObj ) { @@ -223,6 +225,11 @@ namespace sdr } } + const svx::ITextProvider& TextProperties::getTextProvider() const + { + return static_cast<const SdrTextObj&>(GetSdrObject()); + } + void TextProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) { SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); @@ -237,11 +244,12 @@ namespace sdr { SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner(); - sal_Int32 nText = rObj.getTextCount(); + const svx::ITextProvider& rTextProvider(getTextProvider()); + sal_Int32 nText = rTextProvider.getTextCount(); while( --nText >= 0 ) { - SdrText* pText = rObj.getText( nText ); + SdrText* pText = rTextProvider.getText( nText ); OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0; if( !pParaObj ) @@ -396,11 +404,12 @@ namespace sdr && !rObj.IsLinkedText()) { Outliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_OUTLINEOBJECT, rObj.GetModel()); - sal_Int32 nText = rObj.getTextCount(); + const svx::ITextProvider& rTextProvider(getTextProvider()); + sal_Int32 nText = rTextProvider.getTextCount(); while( --nText >= 0 ) { - SdrText* pText = rObj.getText( nText ); + SdrText* pText = rTextProvider.getText( nText ); OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : 0; if( !pParaObj ) @@ -542,6 +551,7 @@ namespace sdr SdrTextObj& rObj = (SdrTextObj&)GetSdrObject(); if(rObj.HasText()) { + const svx::ITextProvider& rTextProvider(getTextProvider()); if(HAS_BASE(SfxStyleSheet, &rBC)) { SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint); @@ -551,10 +561,10 @@ namespace sdr { rObj.SetPortionInfoChecked(sal_False); - sal_Int32 nText = rObj.getTextCount(); + sal_Int32 nText = rTextProvider.getTextCount(); while( --nText > 0 ) { - OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject(); + OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); if( pParaObj ) pParaObj->ClearPortionInfo(); } @@ -574,10 +584,10 @@ namespace sdr if(SFX_HINT_DYING == nId) { rObj.SetPortionInfoChecked(sal_False); - sal_Int32 nText = rObj.getTextCount(); + sal_Int32 nText = rTextProvider.getTextCount(); while( --nText > 0 ) { - OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject(); + OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); if( pParaObj ) pParaObj->ClearPortionInfo(); } @@ -596,10 +606,10 @@ namespace sdr if(!aOldName.Equals(aNewName)) { - sal_Int32 nText = rObj.getTextCount(); + sal_Int32 nText = rTextProvider.getTextCount(); while( --nText > 0 ) { - OutlinerParaObject* pParaObj = rObj.getText(nText )->GetOutlinerParaObject(); + OutlinerParaObject* pParaObj = rTextProvider.getText( nText )->GetOutlinerParaObject(); if( pParaObj ) pParaObj->ChangeStyleSheetName(eFamily, aOldName, aNewName); } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index e931007c20f4..9a52903d6de7 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -99,6 +99,46 @@ static const SvxItemPropertySet* ImplGetSvxCellPropertySet() return &aSvxCellPropertySet; } +namespace +{ + +class CellTextProvider : public svx::ITextProvider +{ +public: + explicit CellTextProvider(const sdr::table::CellRef xCell); + virtual ~CellTextProvider(); + +private: + virtual sal_Int32 getTextCount() const; + virtual SdrText* getText(sal_Int32 nIndex) const; + +private: + const sdr::table::CellRef m_xCell; +}; + +CellTextProvider::CellTextProvider(const sdr::table::CellRef xCell) + : m_xCell(xCell) +{ +} + +CellTextProvider::~CellTextProvider() +{ +} + +sal_Int32 CellTextProvider::getTextCount() const +{ + return 1; +} + +SdrText* CellTextProvider::getText(sal_Int32 nIndex) const +{ + (void) nIndex; + assert(nIndex == 0); + return m_xCell.get(); +} + +} + namespace sdr { namespace properties @@ -109,6 +149,8 @@ namespace sdr // create a new itemset SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool); + const svx::ITextProvider& getTextProvider() const; + public: // basic constructor CellProperties(SdrObject& rObj, sdr::table::Cell* pCell ); @@ -131,6 +173,9 @@ namespace sdr void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); sdr::table::CellRef mxCell; + + private: + const CellTextProvider maTextProvider; }; // create a new itemset @@ -153,15 +198,22 @@ namespace sdr 0, 0)); } + const svx::ITextProvider& CellProperties::getTextProvider() const + { + return maTextProvider; + } + CellProperties::CellProperties(SdrObject& rObj, sdr::table::Cell* pCell) : TextProperties(rObj) , mxCell(pCell) + , maTextProvider(mxCell) { } CellProperties::CellProperties(const CellProperties& rProps, SdrObject& rObj, sdr::table::Cell* pCell) : TextProperties(rProps, rObj) , mxCell( pCell ) + , maTextProvider(mxCell) { } diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 15d85e9a251f..b581d8ff52c4 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -1024,7 +1024,7 @@ void TableLayouter::UpdateBorderLayout() for( aPos.mnCol = 0; aPos.mnCol < nColCount; aPos.mnCol++ ) { CellRef xCell( getCell( aPos ) ); - if( !xCell.is() || xCell->isMerged() ) + if( !xCell.is() ) continue; const SvxBoxItem* pThisAttr = (const SvxBoxItem*)xCell->GetItemSet().GetItem( SDRATTR_TABLE_BORDER ); diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index a74dc60a836b..1f9f7d22571d 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -357,7 +357,7 @@ namespace drawinglayer } } - if(!getRightLine().isEmpty() && getRightIsOutside()) + if(!getRightLine().isEmpty()) { // create right line from top to bottom const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(1.0, 0.0)); @@ -622,9 +622,11 @@ namespace sdr // get basic lines impGetLine(aLeftLine, rTableLayouter, nX, nY, false, nColCount, nRowCount, bIsRTL); - impGetLine(aBottomLine, rTableLayouter, nX, nYBottom, true, nColCount, nRowCount, bIsRTL); + //To resolve the bug fdo#59117 + //In RTL table as BottomLine & TopLine are drawn from Left Side to Right, nX should be nX-1 + impGetLine(aBottomLine, rTableLayouter, bIsRTL?nX-1:nX, nYBottom, true, nColCount, nRowCount, bIsRTL); impGetLine(aRightLine, rTableLayouter, nXRight, nY, false, nColCount, nRowCount, bIsRTL); - impGetLine(aTopLine, rTableLayouter, nX, nY, true, nColCount, nRowCount, bIsRTL); + impGetLine(aTopLine, rTableLayouter, bIsRTL?nX-1:nX, nY, true, nColCount, nRowCount, bIsRTL); // get the neighbor cells' borders impGetLine(aLeftFromTLine, rTableLayouter, nX, nY - 1, false, nColCount, nRowCount, bIsRTL); diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index e236102164ab..998bf6f6d349 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -165,7 +165,7 @@ sal_False. */ virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, - const sal_uInt16 nFlags) = 0; + const sal_uInt16 nFlags,bool bExpandCharToPara=false) = 0; virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&, const sal_uInt16 nFlags) = 0; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d71ce5295656..ed168699ce83 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -874,8 +874,9 @@ public: virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*); virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*); + //Add a para for the char attribute exp... virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem&, - const SetAttrMode nFlags); + const SetAttrMode nFlags,bool bExpandCharToPara=false); virtual bool InsertItemSet (const SwPaM &rRg, const SfxItemSet&, const SetAttrMode nFlags); virtual void ReRead(SwPaM&, const String& rGrfName, const String& rFltName, const Graphic* pGraphic, const GraphicObject* pGrfObj); diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 7212c067315b..3cf5d086c4e9 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -65,8 +65,11 @@ public: virtual ~SwGrfFmtColls() {} }; +/// stupid base class to work around MSVC dllexport mess +class SAL_DLLPUBLIC_TEMPLATE SwFrmFmts_Base : public std::vector<SwFrmFmt*> {}; + /// Specific frame formats (frames, DrawObjects). -class SW_DLLPUBLIC SwFrmFmts : public std::vector<SwFrmFmt*>, public SwFmtsBase +class SW_DLLPUBLIC SwFrmFmts : public SwFrmFmts_Base, public SwFmtsBase { public: virtual size_t GetFmtCount() const { return size(); } diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 0779b256dd69..35ea4c156154 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -34,6 +34,7 @@ class SwTxtFld; class SwFrm; class OutlinerParaObject; class SwTextAPIObject; +class SwFmtFld; enum SwAuthorFormat { @@ -530,6 +531,9 @@ public: const String& rAuthor, const String& rTxt, const String& rInitials, const String& rName, const DateTime& rDate); ~SwPostItField(); + /// Looks up a field identified by its unique name (used to get the postit field of a comment fieldmark) + static const SwFmtFld* GetByName(SwDoc* pDoc, const OUString& rName); + virtual String Expand() const; virtual SwField* Copy() const; diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 985e6e81e480..e3cc9d04edd1 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -206,6 +206,7 @@ public: /// SMARTTAGS void SetSmartTags( SwWrongList* pNew, bool bDelete = true ); SwWrongList* GetSmartTags(); + bool TryCharSetExpandToNum(const SfxItemSet& pCharSet); /// End: Data collected during idle time diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index 1fe43ba6eece..6485c0c07867 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -48,7 +48,8 @@ const sal_Unicode cBulletChar = 0x2022; ///< Character for lists. class SW_DLLPUBLIC SwNumFmt : public SvxNumberFormat, public SwClient { SwFmtVertOrient* pVertOrient; - + //For i120928,record the cp info of graphic within bullet + sal_Unicode cGrfBulletCP; SW_DLLPRIVATE void UpdateNumNodes( SwDoc* pDoc ); SW_DLLPRIVATE virtual void NotifyGraphicArrived(); @@ -77,6 +78,10 @@ public: virtual void SetCharFmtName(const String& rSet); virtual const String& GetCharFmtName()const; + //For i120928,access the cp info of graphic within bullet + void SetGrfBulletCP(sal_Unicode cP){cGrfBulletCP = cP;} + sal_Unicode GetGrfBulletCP()const {return cGrfBulletCP;} + virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0); virtual void SetVertOrient(sal_Int16 eSet); diff --git a/sw/qa/extras/ooxmlimport/data/fdo59273.docx b/sw/qa/extras/ooxmlimport/data/fdo59273.docx Binary files differnew file mode 100644 index 000000000000..fcdfd7734411 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo59273.docx diff --git a/sw/qa/extras/ooxmlimport/data/fdo60922.docx b/sw/qa/extras/ooxmlimport/data/fdo60922.docx Binary files differnew file mode 100644 index 000000000000..0d1ff2613ecd --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/fdo60922.docx diff --git a/sw/qa/extras/ooxmlimport/data/n780645.docx b/sw/qa/extras/ooxmlimport/data/n780645.docx Binary files differindex 12ffa3870130..35ad11f35183 100755 --- a/sw/qa/extras/ooxmlimport/data/n780645.docx +++ b/sw/qa/extras/ooxmlimport/data/n780645.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 54a14786efd5..29f38899fa32 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -114,6 +114,8 @@ public: void testFdo53985(); void testFdo59638(); void testFdo61343(); + void testFdo60922(); + void testFdo59273(); void testN592908_Frame(); void testN592908_Picture(); @@ -182,6 +184,8 @@ void Test::run() {"fdo53985.docx", &Test::testFdo53985}, {"fdo59638.docx", &Test::testFdo59638}, {"fdo61343.docx", &Test::testFdo61343}, + {"fdo60922.docx", &Test::testFdo60922}, + {"fdo59273.docx", &Test::testFdo59273}, {"n592908-frame.docx", &Test::testN592908_Frame}, {"n592908-picture.docx", &Test::testN592908_Picture}, }; @@ -1136,6 +1140,22 @@ void Test::testFdo61343() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } +void Test::testFdo60922() +{ + // This was 0, not 100, due to wrong import of w:position w:val="0" + CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharEscapementHeight")); +} + +void Test::testFdo59273() +{ + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); + // Was 9997, so the 4th column had ~zero width + CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position); +} + void Test::testN592908_Frame() { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/data/fdo30983.rtf b/sw/qa/extras/rtfexport/data/fdo30983.rtf new file mode 100644 index 000000000000..bd4dd96e1083 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/fdo30983.rtf @@ -0,0 +1,43 @@ +{\rtf1\ansi\deff4\adeflang1025 +\paperh15840\paperw12240\margl902\margr958\margt1440\margb735\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn902\margrsxn958\margtsxn1440\margbsxn735\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc +\absw2380\absh-1244\pvpg\posy465\phpg\posx8437 +{\*\flymaincnt96\flyvert29040\flyhorz30464\flyanchor4\pgndec} +\s111\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\loch\f1\rtlch \ltrch\loch\loch\f5 +5983 Red Pine Blvd} +\par \s111\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +White Bear Township, MN 55110} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Home 651-426-9645} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Cell 651-245-1843} +\par \s110\sl200\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs16\lang1033 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +E-mail dadsouch@gmail.com} +\par \pard +\pard\plain \s123\sl240\slmult0\ql\widctlpar +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\li2160\ri0\lin2160\rin0\fi0\sb0\sa440\ltrpar\cf0\expnd-4\expndtw-20\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs48\lang1033\li-11\ri0\lin-11\rin0\fi0\sb0\sa144 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +M} +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +ichael P. Soucheray} +\par \pard\plain \s114\sl220\slmult0\ql\widctlpar\tx2160\tqr\tx6480 +{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0} +\aspalpha\li0\ri-360\lin0\rin-360\fi0\sb220\sa40\ltrpar\cf0\dbch\af6\langfe255\dbch\af6\afs20\alang1025\loch\f6\fs20\lang1033\li-11\ri0\lin-11\rin0\fi0\sb0\sa144 +{\dbch\af5\rtlch \ltrch\loch\loch\f5 +Experienced general} +\par } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 18ddf1bdf326..0610516b6349 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/text/RelOrientation.hpp> #include <unotools/tempfile.hxx> #include <vcl/svapp.hxx> @@ -71,6 +72,7 @@ public: void testFdo53604(); void testFdo52286(); void testFdo61507(); + void testFdo30983(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -116,6 +118,7 @@ void Test::run() {"fdo53604.odt", &Test::testFdo53604}, {"fdo52286.odt", &Test::testFdo52286}, {"fdo61507.rtf", &Test::testFdo61507}, + {"fdo30983.rtf", &Test::testFdo30983}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -488,6 +491,16 @@ void Test::testFdo61507() CPPUNIT_ASSERT_EQUAL(6, getLength()); } +void Test::testFdo30983() +{ + // These were 'page text area', not 'entire page', i.e. both the horizontal + // and vertical positions were incorrect. + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrientRelation")); + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrientRelation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/rtfimport/data/fdo37716.rtf b/sw/qa/extras/rtfimport/data/fdo37716.rtf new file mode 100644 index 000000000000..489bdb7fcd72 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo37716.rtf @@ -0,0 +1,5 @@ +{\rtf1 +\pard\plain \pvpg\phpg\posx1143\posy4743\absw9615\absh-2922\dfrmtxtx72\dfrmtxty72\nowrap +Hello\par +\pard\plain\par +} diff --git a/sw/qa/extras/rtfimport/data/fdo51916.rtf b/sw/qa/extras/rtfimport/data/fdo51916.rtf new file mode 100644 index 000000000000..b2359c3fbd8a --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo51916.rtf @@ -0,0 +1,319 @@ +{\rtf1 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\f34\fbidi \froman\fcharset238\fprq2 +{\*\panose 02040503050406030204} +Cambria Math;} +{\f37\fbidi \fswiss\fcharset238\fprq2 +{\*\panose 020f0502020204030204} +Calibri +{\*\falt Century Gothic} +;} +{\f38\fbidi \fswiss\fcharset238\fprq2 +{\*\panose 020b0604030504040204} +Tahoma;} +{\flomajor\f31500\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\fhimajor\f31502\fbidi \froman\fcharset238\fprq2 +{\*\panose 02040503050406030204} +Cambria;} +{\fbimajor\f31503\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\flominor\f31504\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\fhiminor\f31506\fbidi \fswiss\fcharset238\fprq2 +{\*\panose 020f0502020204030204} +Calibri +{\*\falt Century Gothic} +;} +{\fbiminor\f31507\fbidi \froman\fcharset238\fprq2 +{\*\panose 02020603050405020304} +Times New Roman;} +{\f297\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\f296\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\f298\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\f299\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\f300\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f301\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f302\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\f303\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f637\fbidi \froman\fcharset0\fprq2 Cambria Math;} +{\f636\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;} +{\f638\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;} +{\f639\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;} +{\f642\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;} +{\f643\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);} +{\f667\fbidi \fswiss\fcharset0\fprq2 Calibri +{\*\falt Century Gothic} +;} +{\f666\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr +{\*\falt Century Gothic} +;} +{\f668\fbidi \fswiss\fcharset161\fprq2 Calibri Greek +{\*\falt Century Gothic} +;} +{\f669\fbidi \fswiss\fcharset162\fprq2 Calibri Tur +{\*\falt Century Gothic} +;} +{\f672\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic +{\*\falt Century Gothic} +;} +{\f673\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese) +{\*\falt Century Gothic} +;} +{\f677\fbidi \fswiss\fcharset0\fprq2 Tahoma;} +{\f676\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;} +{\f679\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;} +{\flomajor\f31510\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fdbmajor\f31520\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fhimajor\f31530\fbidi \froman\fcharset0\fprq2 Cambria;} +{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;} +{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;} +{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;} +{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);} +{\fbimajor\f31540\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\flominor\f31550\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fdbminor\f31560\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fhiminor\f31570\fbidi \fswiss\fcharset0\fprq2 Calibri +{\*\falt Century Gothic} +;} +{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr +{\*\falt Century Gothic} +;} +{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek +{\*\falt Century Gothic} +;} +{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur +{\*\falt Century Gothic} +;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic +{\*\falt Century Gothic} +;} +{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese) +{\*\falt Century Gothic} +;} +{\fbiminor\f31580\fbidi \froman\fcharset0\fprq2 Times New Roman;} +{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;} +{\upr +{\stylesheet +{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs22\alang1025 +\ltrch\fcs0 \f37\fs22\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 \snext0 \sqformat \spriority0 Normal;} +{\*\cs10 \additive \ssemihidden Default Paragraph Font;} +{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f37\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused \sqformat Normal Table;} +{ +\s15\ql \li0\ri0\sa160\sl-240\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs28\alang1025 \ltrch\fcs0 \f37\fs28\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +\sbasedon0 \snext15 \sautoupd \styrsid4140469 ????;} +{\s16\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0 \f38\fs16\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 +\sbasedon0 \snext16 \slink18 \ssemihidden \styrsid4282853 Balloon Text;} +{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid11798718 Hyperlink;} +{\*\cs18 \additive \rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16 +\sbasedon10 \slink16 \slocked \ssemihidden \styrsid4282853 Balloon Text Char;} +{\*\cs19 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \styrsid11798718 search_color;} +{ +\s20\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs24\alang1025 \ltrch\fcs0 \f37\fs24\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 +\sbasedon0 \snext20 \styrsid11798718 Normal (Web);} +} +{\*\ud\uc0 +{\stylesheet +{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs22\alang1025 \ltrch\fcs0 +\f37\fs22\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 \snext0 \sqformat \spriority0 Normal;} +{\*\cs10 \additive \ssemihidden Default Paragraph Font;} +{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f37\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused \sqformat Normal Table;} +{ +\s15\ql \li0\ri0\sa160\sl-240\slmult0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs28\alang1025 \ltrch\fcs0 \f37\fs28\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 +\sbasedon0 \snext15 \sautoupd \styrsid4140469 +{\uc1\u1047 ?\u1085 ?\u1072 ?\u1082 ?} +;} +{\s16\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0 +\f38\fs16\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 \sbasedon0 \snext16 \slink18 \ssemihidden \styrsid4282853 Balloon Text;} +{\*\cs17 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid11798718 Hyperlink;} +{\*\cs18 \additive +\rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16 \sbasedon10 \slink16 \slocked \ssemihidden \styrsid4282853 Balloon Text Char;} +{\*\cs19 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \sbasedon10 \styrsid11798718 search_color;} +{ +\s20\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af37\afs24\alang1025 \ltrch\fcs0 \f37\fs24\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 +\sbasedon0 \snext20 \styrsid11798718 Normal (Web);} +} +} +} +\ltrrow\trowd \irow0\irowband0\ltrrow\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 +\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone +\cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 \rtlch\fcs1 \af37\afs22\alang1025 \ltrch\fcs0 \f37\fs22\lang1049\langfe1049\cgrid\langnp1049\langfenp1049 +{\rtlch\fcs1 +\af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li17\ri0\sb240\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17 +{\rtlch\fcs1 \ab\af296\afs20 \ltrch\fcs0 \b\f296\fs20\ul\insrsid14318737\charrsid14318737 K} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \trowd \irow10\irowband10\ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142\clvertalt\clbrdrt\brdrnone +\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row \ltrrow} +\pard \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li17\ri0\sb240\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17 +{\rtlch\fcs1 \ab\ai\af296\afs20 \ltrch\fcs0 \b\i\f296\fs20\insrsid14318737\charrsid14318737 L} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar +\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \trowd \irow11\irowband11\ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142\clvertalt\clbrdrt\brdrnone +\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row \ltrrow} +\pard \ltrpar\qc \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li17\ri0\sb14\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17 +{\rtlch\fcs1 \ai\af296\afs20 +\ltrch\fcs0 \i\f296\fs20\insrsid14318737\charrsid14318737 M} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 +\trowd \irow12\irowband12\ltrrow\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142 +\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row \ltrrow} +\pard \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 +\ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li17\ri0\sb240\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17\itap2\pararsid8008194 +{\rtlch\fcs1 \ab\ai\af296\afs20 \ltrch\fcs0 +\b\i\f296\fs20\insrsid4282853\charrsid4282853 N} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4282853\charrsid4282853 +\nestcell +{\nonesttables +\par } +} +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap2 +{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid4282853 +{\*\nesttableprops\trowd \irow0\irowband0\ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth9662\clshdrawnil \cellx9662\nestrow} +{\nonesttables +\par } +} +\pard \ltrpar\ql \li17\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17\itap2\pararsid1914047 +{\rtlch\fcs1 \af296\afs20 \ltrch\fcs0 \f296\fs20\insrsid4282853\charrsid4282853 O} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid1914047 +\par } +\pard \ltrpar\qj \li0\ri0\sl129\slmult0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap2\pararsid8077423 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid1914047\charrsid4282853 \nestcell +{\nonesttables +\par } +} +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap2 +{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid4282853 +{\*\nesttableprops\trowd \irow1\irowband1\ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth9662\clshdrawnil \cellx9662\nestrow} +{\nonesttables +\par } +} +\pard \ltrpar\ql \li17\ri0\sb14\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17\itap2\pararsid8008194 +{\rtlch\fcs1 \ai\af296\afs20 \ltrch\fcs0 \i\f296\fs20\insrsid4282853\charrsid4282853 P} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4282853\charrsid4282853 \nestcell +{\nonesttables +\par } +} +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap2 +{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid4282853 +{\*\nesttableprops\trowd \irow2\irowband2\lastrow \ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl \cltxlrtb\clftsWidth3\clwWidth9662\clshdrawnil \cellx9662\nestrow} +{\nonesttables +\par } +\ltrrow} +\trowd \irow13\irowband13\ltrrow\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil +\cellx142\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\pard \ltrpar\ql \li17\ri0\sb240\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17 +{\rtlch\fcs1 +\af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4282853\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \trowd \irow13\irowband13\ltrrow\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone +\cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row \ltrrow} +\pard \ltrpar +\qc \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid1914047 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar +\ql \li17\ri0\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17\pararsid1914047 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 \trowd \irow14\irowband14\ltrrow +\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil \cellx142\clvertalt\clbrdrt\brdrnone +\clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row \ltrrow} +\pard \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin0\pararsid1914047 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li17\ri0\sa120\nowidctlpar\intbl\wrapdefault\faauto\rin0\lin17\pararsid1914047 +{\rtlch\fcs1 \ab\ai\af296\afs20 \ltrch\fcs0 \b\i\f296\fs20\insrsid14318737\charrsid14318737 Q} +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 +\f0\fs20\insrsid14318737\charrsid14318737 \cell } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid14318737\charrsid14318737 +\trowd \irow15\irowband15\lastrow \ltrrow\ts11\trleft0\trftsWidth3\trwWidth9662\trftsWidthB3\trftsWidthA3\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth142\clshdrawnil +\cellx142\clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrnone \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth9520\clshdrawnil \cellx9662\row } +\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 +{\rtlch\fcs1 \af37\afs20 \ltrch\fcs0 \fs20\insrsid14318737\charrsid14318737 +\par } +} diff --git a/sw/qa/extras/rtfimport/data/fdo61193.rtf b/sw/qa/extras/rtfimport/data/fdo61193.rtf new file mode 100644 index 000000000000..6618bda8b4ac --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo61193.rtf @@ -0,0 +1 @@ +{\rtf1\ansi text.{\footnote footnote}} diff --git a/sw/qa/extras/rtfimport/data/fdo61909.rtf b/sw/qa/extras/rtfimport/data/fdo61909.rtf new file mode 100644 index 000000000000..e31414a9b655 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo61909.rtf @@ -0,0 +1,28 @@ +{\rtf1\deff0 +{\fonttbl +{\f000 Courier New;} +} +{\colortbl +\red000\green000\blue000; +\red255\green255\blue255; +\red255\green128\blue000; +\red255\green255\blue255; +\red000\green000\blue255; +\red255\green255\blue255; +\red128\green128\blue128; +\red255\green255\blue255; +\red128\green128\blue128; +\red255\green255\blue255; +\red128\green064\blue000; +\red255\green255\blue255; +\red000\green000\blue128; +\red255\green255\blue255; +\red000\green000\blue000; +\red255\green255\blue255; +\red128\green000\blue255; +\red255\green255\blue255; +\red000\green000\blue000; +\red255\green255\blue255; +} +\highlight11 #include<iostream.h>\par +} diff --git a/sw/qa/extras/rtfimport/data/fdo62288.rtf b/sw/qa/extras/rtfimport/data/fdo62288.rtf new file mode 100644 index 000000000000..f5ec592fc1fc --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo62288.rtf @@ -0,0 +1,23 @@ +{\rtf1 +\paperw11907\paperh16840\margl567\margr567\margt567\margb567 +\sb113\sa113 +{\b\fs22\cf1\kerning1\cgrid0 Objectives} +{\fs24\kerning1\cgrid0 +\par } +\trowd \trgaph10\trleft-10 \clvertalt\cltxlrtb \cellx4808\clvertalt\cltxlrtb \cellx5375\clvertalt\cltxlrtb \cellx10194\clvertalt\cltxlrtb \cellx10762\pard \li567\nowidctlpar\intbl\adjustright +{\cf1\kerning1\cgrid0 One} +{\fs24\kerning1\cgrid0 \cell } +\pard \qc\nowidctlpar\intbl\adjustright +{\cf1\kerning1\cgrid0 [ ]} +{\fs24\kerning1\cgrid0 \cell } +\pard \li567\nowidctlpar\intbl\adjustright +{\cf1\kerning1\cgrid0 Two} +{ +\fs24\kerning1\cgrid0 \cell } +\pard \qc\nowidctlpar\intbl\adjustright +{\cf1\kerning1\cgrid0 [ ]} +{\fs24\kerning1\cgrid0 \cell } +\pard \widctlpar\intbl\adjustright +{\fs24\kerning1\cgrid0 \row } +\pard\par +} diff --git a/sw/qa/extras/rtfimport/data/hello.rtf b/sw/qa/extras/rtfimport/data/hello.rtf new file mode 100644 index 000000000000..472817d311b9 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/hello.rtf @@ -0,0 +1 @@ +{\rtf1 Hello world!\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 3d3cbe6827ce..246358eb4c89 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -141,6 +141,11 @@ public: void testFdo59953(); void testFdo59638(); void testFdo60722(); + void testFdo61909(); + void testFdo62288(); + void testFdo37716(); + void testFdo51916(); + void testFdo61193(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -152,6 +157,26 @@ private: void run(); /// Get page count. int getPages(); + /// Copy&paste helper. + void paste(OUString aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>()) + { + uno::Reference<document::XFilter> xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); + uno::Reference<document::XImporter> xImporter(xFilter, uno::UNO_QUERY_THROW); + xImporter->setTargetDocument(mxComponent); + uno::Sequence<beans::PropertyValue> aDescriptor(xTextRange.is() ? 3 : 2); + aDescriptor[0].Name = "InputStream"; + SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, STREAM_WRITE); + uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(*pStream)); + aDescriptor[0].Value <<= xStream; + aDescriptor[1].Name = "IsNewDoc"; + aDescriptor[1].Value <<= sal_False; + if (xTextRange.is()) + { + aDescriptor[2].Name = "TextInsertModeRange"; + aDescriptor[2].Value <<= xTextRange; + } + xFilter->filter(aDescriptor); + } }; void Test::run() @@ -232,6 +257,11 @@ void Test::run() {"fdo59953.rtf", &Test::testFdo59953}, {"fdo59638.rtf", &Test::testFdo59638}, {"fdo60722.rtf", &Test::testFdo60722}, + {"fdo61909.rtf", &Test::testFdo61909}, + {"fdo62288.rtf", &Test::testFdo62288}, + {"fdo37716.rtf", &Test::testFdo37716}, + {"fdo51916.rtf", &Test::testFdo51916}, + {"hello.rtf", &Test::testFdo61193}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -898,6 +928,15 @@ void Test::testCopyPasteFootnote() CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString()); } +void Test::testFdo61193() +{ + // Pasting content that contained a footnote caused a crash. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xEnd = xText->getEnd(); + paste("fdo61193.rtf", xEnd); +} + void Test::testShptxtPard() { // The problem was that \pard inside \shptxt caused loss of shape text @@ -1131,6 +1170,41 @@ void Test::testFdo60722() CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor")); } +void Test::testFdo61909() +{ + uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1); + // Was the Writer default font. + CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName")); + // Was 0x008000. + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor")); +} + +void Test::testFdo62288() +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); + // Margins were inherited from the previous cell, even there was a \pard there. + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin")); +} + +void Test::testFdo37716() +{ + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + // \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL + CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround")); +} + +void Test::testFdo51916() +{ + // Complex nested table caused a crash. +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 379af07d0035..ac00ff73114b 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1859,13 +1859,17 @@ void SwCrsrShell::RefreshBlockCursor() /// create a copy of the cursor and save it in the stack void SwCrsrShell::Push() { - pCrsrStk = new SwShellCrsr( *this, *pCurCrsr->GetPoint(), - pCurCrsr->GetPtPos(), pCrsrStk ); + // fdo#60513: if we have a table cursor, copy that; else copy current. + // This seems to work because UpdateCrsr() will fix this up on Pop(), + // then MakeBoxSels() will re-create the current pCurCrsr cell ring. + SwShellCrsr *const pCurrent((pTblCrsr) ? pTblCrsr : pCurCrsr); + pCrsrStk = new SwShellCrsr( *this, *pCurrent->GetPoint(), + pCurrent->GetPtPos(), pCrsrStk ); - if( pCurCrsr->HasMark() ) + if (pCurrent->HasMark()) { pCrsrStk->SetMark(); - *pCrsrStk->GetMark() = *pCurCrsr->GetMark(); + *pCrsrStk->GetMark() = *pCurrent->GetMark(); } } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index c1231f9f0630..427c4fab9efe 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -258,7 +258,7 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes { if( pNode->IsTxtNode() ) { - nTxtLen = ((SwTxtNode*)pNode)->GetTxt().Len(); + nTxtLen = static_cast<SwTxtNode*>(pNode)->GetTxt().Len(); if( rNdIdx == pPam->GetMark()->nNode ) nEnd = pPam->GetMark()->nContent.GetIndex(); else @@ -446,8 +446,9 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, } xub_StrLen nStringEnd = nEnd; - while ( (bSrchForward && nStart < nStringEnd) || - (! bSrchForward && nStart > nStringEnd) ) + bool bZeroMatch = false; // zero-length match, i.e. only $ anchor as regex + while ( ((bSrchForward && nStart < nStringEnd) || + (! bSrchForward && nStart > nStringEnd)) && !bZeroMatch ) { // SearchAlgorithms_APPROXIMATE works on a per word base so we have to // provide the text searcher with the correct locale, because it uses @@ -475,7 +476,8 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, } if( nSearchScript == nCurrScript && - (rSTxt.*fnMove->fnSearch)( sCleanStr, &nStart, &nEnd, 0 )) + (rSTxt.*fnMove->fnSearch)( sCleanStr, &nStart, &nEnd, 0 ) && + !(bZeroMatch = (nStart == nEnd))) { // set section correctly *GetPoint() = *pPam->GetPoint(); @@ -518,11 +520,14 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt, if ( bFound ) return true; - else if( ( bChkEmptyPara && !nStart && !nTxtLen ) || bChkParaEnd ) + else if( ( bChkEmptyPara && !nStart && !nTxtLen ) || bChkParaEnd) { *GetPoint() = *pPam->GetPoint(); GetPoint()->nContent = bChkParaEnd ? nTxtLen : 0; SetMark(); + /* FIXME: this condition does not work for !bSrchForward backward + * search, it probably never did. (pSttNd != &rNdIdx.GetNode()) + * is never true in this case. */ if( (bSrchForward || pSttNd != &rNdIdx.GetNode()) && Move( fnMoveForward, fnGoCntnt ) && (!bSrchForward || pSttNd != &GetPoint()->nNode.GetNode()) && @@ -655,30 +660,14 @@ String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam ) if( pTxtNode && pTxtNode->IsTxtNode() && pTxtNode == pPam->GetCntntNode( sal_False ) ) { utl::TextSearch aSTxt( rSearchOpt ); - String aStr( pPam->GetTxt() ); - String aReplaceStr( rSearchOpt.replaceString ); - aStr = comphelper::string::remove(aStr, CH_TXTATR_BREAKWORD); - aStr = comphelper::string::remove(aStr, CH_TXTATR_INWORD); - xub_StrLen nStart = 0; - rtl::OUString sX( 'x' ); - if( pPam->Start()->nContent > 0 ) - { - aStr.Insert( sX, 0 ); - ++nStart; - } - xub_StrLen nEnd = aStr.Len(); - bool bDeleteLastX = false; - if( pPam->End()->nContent < (static_cast<const SwTxtNode*>(pTxtNode))->GetTxt().Len() ) - { - aStr.Insert( sX ); - bDeleteLastX = true; - } + const String& rStr = static_cast<const SwTxtNode*>(pTxtNode)->GetTxt(); + xub_StrLen nStart = pPam->Start()->nContent.GetIndex(); + xub_StrLen nEnd = pPam->End()->nContent.GetIndex(); SearchResult aResult; - if( aSTxt.SearchFrwrd( aStr, &nStart, &nEnd, &aResult ) ) + if( aSTxt.SearchFrwrd( rStr, &nStart, &nEnd, &aResult ) ) { - if( bDeleteLastX ) - aStr.Erase( aStr.Len() - 1 ); - aSTxt.ReplaceBackReferences( aReplaceStr, aStr, aResult ); + String aReplaceStr( rSearchOpt.replaceString ); + aSTxt.ReplaceBackReferences( aReplaceStr, rStr, aResult ); pRet = new String( aReplaceStr ); } } diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index c2d1dbc063e5..e99954b1dba8 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1304,10 +1304,16 @@ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds ) // This section will be hidden, but it wasn't before if (nShownSections == 1) { - // This would be the last section, so set its condition to false, and avoid hiding it. - OUString aCond("0"); - pSect->SetCondition(aCond); - bHide = false; + // Is the last node part of a section? + SwPaM aPam(GetNodes()); + aPam.Move(fnMoveForward, fnGoDoc); + if (aPam.Start()->nNode.GetNode().StartOfSectionNode()->IsSectionNode()) + { + // This would be the last section, so set its condition to false, and avoid hiding it. + OUString aCond("0"); + pSect->SetCondition(aCond); + bHide = false; + } } nShownSections--; } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 484c93c1aa46..4341aa971824 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -495,7 +495,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, static bool lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, - const SetAttrMode nFlags, SwUndoAttr *const pUndo) + const SetAttrMode nFlags, SwUndoAttr *const pUndo,bool bExpandCharToPara=false) { // Divide the Sets (for selections in Nodes) const SfxItemSet* pCharSet = 0; @@ -899,6 +899,24 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, // Only selection in a Node. if( pStt->nNode == pEnd->nNode ) { + //The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc, + //Which is set in SW MS word Binary filter WW8ImplRreader. With this flag on, means that + //current setting attribute set is a character range properties set and comes from a MS word + //binary file, And the setting range include a paragraph end position (0X0D); + //More specifications, as such property inside the character range properties set recorded in + //MS word binary file are dealed and inserted into data model (SwDoc) one by one, so we + //only dealing the scenario that the char properties set with 1 item inside; + + if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1 ) + { + SwTxtNode* pCurrentNd = pStt->nNode.GetNode().GetTxtNode(); + + if (pCurrentNd) + { + pCurrentNd->TryCharSetExpandToNum(*pCharSet); + + } + } DELETECHARSETS return bRet; } @@ -1002,13 +1020,41 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, ++nNodes; } + //The data parameter flag: bExpandCharToPara, comes from the data member of SwDoc, + //Which is set in SW MS word Binary filter WW8ImplRreader. With this flag on, means that + //current setting attribute set is a character range properties set and comes from a MS word + //binary file, And the setting range include a paragraph end position (0X0D); + //More specifications, as such property inside the character range properties set recorded in + //MS word binary file are dealed and inserted into data model (SwDoc) one by one, so we + //only dealing the scenario that the char properties set with 1 item inside; + if (bExpandCharToPara && pCharSet && pCharSet->Count() ==1) + { + SwPosition aStartPos (*rRg.Start()); + SwPosition aEndPos (*rRg.End()); + + if (aEndPos.nNode.GetNode().GetTxtNode() && aEndPos.nContent != aEndPos.nNode.GetNode().GetTxtNode()->Len()) + aEndPos.nNode--; + + sal_uLong nStart = aStartPos.nNode.GetIndex(); + sal_uLong nEnd = aEndPos.nNode.GetIndex(); + for(; nStart <= nEnd; ++nStart) + { + SwNode* pNd = pDoc->GetNodes()[ nStart ]; + if (!pNd || !pNd->IsTxtNode()) + continue; + SwTxtNode *pCurrentNd = (SwTxtNode*)pNd; + pCurrentNd->TryCharSetExpandToNum(*pCharSet); + + } + } + DELETECHARSETS return (nNodes != 0) || bRet; } - +//Add a para for the char attribute exp... bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, - const SetAttrMode nFlags ) + const SetAttrMode nFlags, bool bExpandCharToPara) { SwDataChanged aTmp( rRg ); SwUndoAttr* pUndoAttr = 0; @@ -1020,7 +1066,7 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() ); aSet.Put( rHt ); - bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr ); + bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr,bExpandCharToPara ); if (GetIDocumentUndoRedo().DoesUndo()) { diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 91b822b3de15..839b9bbf49a6 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -178,6 +178,7 @@ SwNumFmt::SwNumFmt() : SvxNumberFormat(SVX_NUM_ARABIC), SwClient( 0 ), pVertOrient(new SwFmtVertOrient( 0, text::VertOrientation::NONE)) + ,cGrfBulletCP(USHRT_MAX)//For i120928,record the cp info of graphic within bullet { } @@ -185,6 +186,7 @@ SwNumFmt::SwNumFmt( const SwNumFmt& rFmt) : SvxNumberFormat(rFmt), SwClient( rFmt.GetRegisteredInNonConst() ), pVertOrient(new SwFmtVertOrient( 0, rFmt.GetVertOrient())) + ,cGrfBulletCP(rFmt.cGrfBulletCP)//For i120928,record the cp info of graphic within bullet { sal_Int16 eMyVertOrient = rFmt.GetVertOrient(); SetGraphicBrush( rFmt.GetBrush(), &rFmt.GetGraphicSize(), @@ -265,6 +267,8 @@ SwNumFmt& SwNumFmt::operator=( const SwNumFmt& rNumFmt) rNumFmt.GetRegisteredInNonConst()->Add( this ); else if( GetRegisteredIn() ) GetRegisteredInNonConst()->Remove( this ); + //For i120928,record the cp info of graphic within bullet + cGrfBulletCP = rNumFmt.cGrfBulletCP; return *this; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 252ac7f87197..df85ebce8a96 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4022,41 +4022,42 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate ) SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rBox.GetFrmFmt(); SfxItemSet aBoxSet( GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE ); - sal_Bool bSetNumFmt = IsInsTblFormatNum(), bLockModify = sal_True; - if( bSetNumFmt ) + sal_Bool bLockModify = sal_True; + sal_Bool bSetNumFmt = sal_False; + const bool bForceNumberFormat = IsInsTblFormatNum() && IsInsTblChangeNumFormat(); + + // if the user forced a number format in this cell previously, + // keep it, unless the user set that she wants the full number + // format recognition + if( pNumFmtItem && !bForceNumberFormat ) { - if( !IsInsTblChangeNumFormat() ) + sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)->GetValue(); + SvNumberFormatter* pNumFmtr = GetNumberFormatter(); + + short nFmtType = pNumFmtr->GetType( nFmtIdx ); + if( nFmtType == pNumFmtr->GetType( nOldNumFmt ) || NUMBERFORMAT_NUMBER == nFmtType ) { - if( !pNumFmtItem ) - bSetNumFmt = sal_False; - else - { - sal_uLong nOldNumFmt = ((SwTblBoxNumFormat*)pNumFmtItem)-> - GetValue(); - SvNumberFormatter* pNumFmtr = GetNumberFormatter(); - - short nFmtType = pNumFmtr->GetType( nFmtIdx ); - if( nFmtType == pNumFmtr->GetType( nOldNumFmt ) || - NUMBERFORMAT_NUMBER == nFmtType ) - // Current and specified NumFormat match - // -> keep old Format - nFmtIdx = nOldNumFmt; - else - // Current and specified NumFormat do not match - // -> insert as Text - bLockModify = bSetNumFmt = sal_False; - } + // Current and specified NumFormat match + // -> keep old Format + nFmtIdx = nOldNumFmt; + bSetNumFmt = sal_True; } - - if( bSetNumFmt ) + else { - pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); - - aBoxSet.Put( SwTblBoxValue( fNumber )); - aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx )); + // Current and specified NumFormat do not match + // -> insert as Text + bLockModify = bSetNumFmt = sal_False; } } + if( bSetNumFmt || bForceNumberFormat ) + { + pBoxFmt = (SwTableBoxFmt*)rBox.ClaimFrmFmt(); + + aBoxSet.Put( SwTblBoxValue( fNumber )); + aBoxSet.Put( SwTblBoxNumFormat( nFmtIdx )); + } + // It's not enough to only reset the Formula. // Make sure that the Text is formatted accordingly if( !bSetNumFmt && !bIsEmptyTxtNd && pNumFmtItem ) diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index de0d3a841611..ebee25966357 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -92,6 +92,7 @@ #include <editeng/outliner.hxx> #include <editeng/outlobj.hxx> #include <switerator.hxx> +#include <docary.hxx> #define URL_DECODE INetURLObject::DECODE_UNAMBIGUOUS @@ -1753,6 +1754,27 @@ SwPostItField::~SwPostItField() } } +const SwFmtFld* SwPostItField::GetByName(SwDoc* pDoc, const OUString& rName) +{ + const SwFldTypes* pFldTypes = pDoc->GetFldTypes(); + sal_uInt16 nCount = pFldTypes->size(); + for (sal_uInt16 nType = 0; nType < nCount; ++nType) + { + const SwFieldType *pCurType = (*pFldTypes)[nType]; + SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType); + for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next()) + { + // Ignore the field if it's not an annotation or it doesn't have an anchor. + if (pCurFldFmt->GetFld()->GetTyp()->Which() != RES_POSTITFLD || !pCurFldFmt->GetTxtFld()) + continue; + + const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetFld()); + if (pField->GetName() == rName) + return pCurFldFmt; + } + } + return 0; +} String SwPostItField::Expand() const { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 806f055e0c95..8285416845b8 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -994,14 +994,9 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField ) GetFieldIdsFromDoc( rDestDoc, aIds ); GetFieldIdsFromDoc( rDoc, aDstIds ); - // Define the mappings now - sal_uInt16 nMaxDstId = -1; - if ( !aIds.empty() ) - nMaxDstId = *aIds.rbegin(); - - // Map all the src fields to their value + nMaxDstId + // Map all the new src fields to the next available unused id for ( std::set<sal_uInt16>::iterator pIt = aDstIds.begin(); pIt != aDstIds.end(); ++pIt ) - AddId( ++nMaxDstId, *pIt ); + AddId( GetFirstUnusedId(aIds), *pIt ); // Change the Sequence number of all the SetExp fields in the destination document SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false ); @@ -1024,9 +1019,9 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField ) bInit = true; } -/// Get the lowest unused ID in the passed set. +/// Get the lowest number unused in the passed set. /// @param[in] rIds The set of used ID numbers. -/// @returns The lowest unused ID. +/// @returns The lowest number unused by the passed set sal_uInt16 _RefIdsMap::GetFirstUnusedId( std::set<sal_uInt16> &rIds ) { sal_uInt16 num(0); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 2785e92fc61c..42cdbe29aaac 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -66,6 +66,7 @@ #include <cstdio> // #i12836# enhanced pdf export #include <EnhancedPDFExportHelper.hxx> +#include <docufld.hxx> #include <unomid.h> @@ -1106,17 +1107,14 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const // If this is a comment range, need to look up the color of the comment author. if (pFieldmark->GetFieldname() == ODF_COMMENTRANGE) { - // Search for the position of the postit field - const sal_Unicode fld[] = { CH_TXTATR_INWORD, 0 }; - xub_StrLen nEndIdx = GetTxt().SearchChar(fld, GetIdx()); - if (nEndIdx != STRING_NOTFOUND) + // Search for the postit field + const SwFmtFld* pField = SwPostItField::GetByName(pNd->GetDoc(), pFieldmark->GetName()); + if (pField) { - SwTxtAttr* pTxtAttr = pNd->GetTxtAttrForCharAt(nEndIdx, RES_TXTATR_FIELD); - const SwFmtFld& rPostItField = pTxtAttr->GetFld(); // Look up the author name - const OUString& rAuthor = rPostItField.GetFld()->GetPar1(); + const OUString& rAuthor = pField->GetFld()->GetPar1(); sal_uInt16 nIndex = pNd->GetDoc()->InsertRedlineAuthor(rAuthor); - pOutDev->SetFillColor( SwPostItMgr::GetColorLight(nIndex) ); + pOutDev->SetFillColor(SwPostItMgr::GetColorLight(nIndex)); bFilled = true; } } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index cf549e3a8758..a2be20b37751 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1607,6 +1607,76 @@ void SwTxtNode::DelSoftHyph( const xub_StrLen nStt, const xub_StrLen nEnd ) } } +//In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it +bool lcl_IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich) +{ + return (nWhich == RES_CHRATR_UNDERLINE); +} + +//In MS Word, following properties of the paragraph end position wont affect the formatting of bullets, so we ignore them: +//Font underline; +//Font Italic of Western, CJK and CTL; +//Font Bold of Wertern, CJK and CTL; +bool lcl_IsIgnoredCharFmtForBullets(const sal_uInt16 nWhich) +{ + return (nWhich == RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_POSTURE || nWhich == RES_CHRATR_WEIGHT + || nWhich == RES_CHRATR_CJK_POSTURE || nWhich == RES_CHRATR_CJK_WEIGHT + || nWhich == RES_CHRATR_CTL_POSTURE || nWhich == RES_CHRATR_CTL_WEIGHT); +} + +//Condition for expanding char set to character style of specified number rule level: +//The item inside the set should not conflict to any exist and non-default item inside paragraph properties set (SwCntntNode::SwPAttrSet); +//The node should have applied a number rule; +//The node should be counted in a list, if not, make it to be; +//The item should not conflict to any exist and non-default item inside the character of specified number rule level; +//The item should not be ignored depend on the exact number rule type; +bool SwTxtNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet) +{ + bool bRet = false; + SfxItemIter aIter( aCharSet ); + const SfxPoolItem* pItem = aIter.FirstItem(); + const sal_uInt16 nWhich = pItem->Which(); + + const SfxPoolItem& rInnerItem = GetAttr(nWhich,false); + + if (!IsDefaultItem(&rInnerItem) && !IsInvalidItem(&rInnerItem)) + return bRet; + + if ( !IsInList() && GetNumRule() && GetListId().Len() > 0 ) + { + return bRet; + } + + SwNumRule* pCurrNum = GetNumRule(false); + + int nLevel = GetActualListLevel(); + + if (nLevel != -1 && pCurrNum) + { + const SwNumFmt* pCurrNumFmt = pCurrNum->GetNumFmt(static_cast<sal_uInt16>(nLevel)); + if (pCurrNumFmt) + { + if (pCurrNumFmt->IsItemize() && lcl_IsIgnoredCharFmtForBullets(nWhich)) + return bRet; + if (pCurrNumFmt->IsEnumeration() && lcl_IsIgnoredCharFmtForNumbering(nWhich)) + return bRet; + SwCharFmt* pCurrCharFmt =pCurrNumFmt->GetCharFmt(); + + if (pCurrCharFmt && pCurrCharFmt->GetItemState(nWhich,false) != SFX_ITEM_SET) + { + pCurrCharFmt->SetFmtAttr(*pItem); + SwNumFmt aNewNumFmt(*pCurrNumFmt); + aNewNumFmt.SetCharFmt(pCurrCharFmt); + pCurrNum->Set(nLevel,aNewNumFmt); + bRet = true; + } + } + } + + + return bRet; +} + // setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt, // dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr) sal_Bool SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 2829d3f6b058..788965a42146 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -320,28 +320,6 @@ lcl_FillFieldMarkArray(FieldMarks_t & rFieldMarks, SwUnoCrsr const & rUnoCrsr, } } -static const SwFmtFld* lcl_getFieldByName(SwDoc* pDoc, const OUString& rName) -{ - const SwFldTypes* pFldTypes = pDoc->GetFldTypes(); - sal_uInt16 nCount = pFldTypes->size(); - for (sal_uInt16 nType = 0; nType < nCount; ++nType) - { - const SwFieldType *pCurType = (*pFldTypes)[nType]; - SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType); - for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next()) - { - // Ignore the field if it's not an annotation or it doesn't have an anchor. - if (pCurFldFmt->GetFld()->GetTyp()->Which() != RES_POSTITFLD || !pCurFldFmt->GetTxtFld()) - continue; - - const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetFld()); - if (pField->GetName() == rName) - return pCurFldFmt; - } - } - return 0; -} - static uno::Reference<text::XTextRange> lcl_ExportFieldMark( uno::Reference< text::XText > const & i_xParentText, @@ -378,7 +356,7 @@ lcl_ExportFieldMark( { pPortion->SetBookmark( SwXFieldmark::CreateXFieldmark( *pDoc, *pFieldmark ) ); Reference<XTextField> xField; - const SwFmtFld* pField = lcl_getFieldByName(pDoc, pFieldmark->GetName()); + const SwFmtFld* pField = SwPostItField::GetByName(pDoc, pFieldmark->GetName()); if (pField) xField = SwXTextField::CreateSwXTextField(*pDoc, *pField); pPortion->SetTextField(xField); diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 55ea8e4d6c80..e0a64b3ed103 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -111,6 +111,10 @@ public: sal_Bool bOpen; //Entry open, awaiting being closed sal_Bool bConsumedByField; + sal_Int32 mnStartCP; + sal_Int32 mnEndCP; + bool bIsParaEnd; + SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt ); SW_DLLPUBLIC ~SwFltStackEntry(); @@ -118,8 +122,16 @@ public: SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos); SW_DLLPUBLIC bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const; SW_DLLPUBLIC static bool MakeRegion(SwDoc* pDoc, SwPaM& rRegion, - bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, + bool bCheck, const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd=false, sal_uInt16 nWhich=0); + + void SetStartCP(sal_Int32 nCP) {mnStartCP = nCP;} + void SetEndCP(sal_Int32 nCP) {mnEndCP = nCP;} + sal_Int32 GetStartCP() const {return mnStartCP;} + sal_Int32 GetEndCP() const {return mnEndCP;} + bool IsAbleMakeRegion(); + bool IsParaEnd(){ return bIsParaEnd;} + void SetIsParaEnd(bool bArg){ bIsParaEnd = bArg;} }; class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable @@ -132,12 +144,23 @@ class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable sal_uLong nFieldFlags; KeyCode aEmptyKeyCode; // fuer Bookmarks +private: + bool bHasSdOD; + bool bSdODChecked; + protected: SwDoc* pDoc; sal_Bool bIsEndStack; void MoveAttrs( const SwPosition& rPos ); virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry); + virtual sal_Int32 GetCurrAttrCP() const {return -1;} + virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const; + + //Clear the para end position recorded in reader intermittently for the least impact on loading performance + virtual void ClearParaEndPosition(){}; + virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd); + bool HasSdOD(); public: enum Flags diff --git a/sw/source/filter/inc/rtf.hxx b/sw/source/filter/inc/rtf.hxx index f2fc54f7c226..f82780af9e92 100644 --- a/sw/source/filter/inc/rtf.hxx +++ b/sw/source/filter/inc/rtf.hxx @@ -27,7 +27,7 @@ class RTFVertOrient union { struct { sal_uInt16 nOrient : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; @@ -52,7 +52,7 @@ class RTFHoriOrient struct { sal_uInt16 nOrient : 4; sal_uInt16 nRelAnchor : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 2608e62c21f9..9eb936401e23 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -81,6 +81,9 @@ static SwCntntNode* GetCntntNode(SwDoc* pDoc, SwNodeIndex& rIdx, sal_Bool bNext) SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt) : m_aMkPos(rStartPos) , m_aPtPos(rStartPos) + , mnStartCP(-1) + , mnEndCP(-1) + , bIsParaEnd(false) { pAttr = pHt; // speicher eine Kopie vom Attribut bOld = sal_False; // used for marking Attributes *before* skipping field results @@ -105,22 +108,26 @@ void SwFltStackEntry::SetEndPos(const SwPosition& rEndPos) m_aPtPos.SetPos(rEndPos); } + bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, - const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, + const SwFltPosition &rMkPos, const SwFltPosition &rPtPos, bool bIsParaEnd, sal_uInt16 nWhich) { // does this range actually contain something? // empty range is allowed if at start of empty paragraph // fields are special: never have range, so leave them + // + // The only position of 0x0D will not be able to make region in the old logic + // because it is beyond the length of para...need special consideration here. SwCntntNode *const pCntntNode( SwNodeIndex(rMkPos.m_nNode, +1).GetNode().GetCntntNode()); if (rMkPos == rPtPos && ((0 != rPtPos.m_nCntnt) || (pCntntNode && (0 != pCntntNode->Len()))) - && (RES_TXTATR_FIELD != nWhich)) + && (RES_TXTATR_FIELD != nWhich) + && !(bIsParaEnd && pCntntNode && pCntntNode->IsTxtNode() && 0 != pCntntNode->Len() )) { return false; } - // !!! Die Content-Indizies beziehen sich immer auf den Node !!! rRegion.GetPoint()->nNode = rMkPos.m_nNode.GetIndex() + 1; SwCntntNode* pCNd = GetCntntNode(pDoc, rRegion.GetPoint()->nNode, sal_True); @@ -144,12 +151,12 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck) const { - return MakeRegion(pDoc, rRegion, bCheck, m_aMkPos, m_aPtPos, + return MakeRegion(pDoc, rRegion, bCheck, m_aMkPos, m_aPtPos, bIsParaEnd, pAttr->Which()); } SwFltControlStack::SwFltControlStack(SwDoc* pDo, sal_uLong nFieldFl) - : nFieldFlags(nFieldFl), pDoc(pDo), bIsEndStack(false) + : nFieldFlags(nFieldFl),bHasSdOD(true), bSdODChecked(false), pDoc(pDo), bIsEndStack(false) { } @@ -238,7 +245,11 @@ void SwFltControlStack::NewAttr(const SwPosition& rPos, const SfxPoolItem& rAttr pExtendCandidate->bOpen=true; } else - maEntries.push_back(new SwFltStackEntry(rPos, rAttr.Clone())); + { + SwFltStackEntry *pTmp = new SwFltStackEntry(rPos, rAttr.Clone() ); + pTmp->SetStartCP(GetCurrAttrCP()); + maEntries.push_back(pTmp); + } } void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt) @@ -249,6 +260,14 @@ void SwFltControlStack::DeleteAndDestroy(Entries::size_type nCnt) myEIter aElement = maEntries.begin() + nCnt; maEntries.erase(aElement); } + //Clear the para end position recorded in reader intermittently for the least impact on loading performance + //Because the attributes handled based on the unit of para + if ( empty() ) + { + ClearParaEndPosition(); + bHasSdOD = true; + bSdODChecked = false; + } } // SwFltControlStack::StealAttr() loescht Attribute des angegebenen Typs vom Stack. @@ -343,6 +362,7 @@ SwFltStackEntry* SwFltControlStack::SetAttr(const SwPosition& rPos, { rEntry.bConsumedByField = consumedByField; rEntry.SetEndPos(rPos); + rEntry.SetEndCP(GetCurrAttrCP()); if (bLastEntry && nAttrId == rEntry.pAttr->Which()) { //potential candidate for merging with an identical @@ -446,6 +466,28 @@ static sal_Bool IterateNumrulePiece( const SwNodeIndex& rEnd, return rTmpStart <= rTmpEnd; // gueltig ? } +//***This function will check whether there is existing individual attribute positon for 0x0D***/ +//The check will happen only once for a paragraph during loading +bool SwFltControlStack::HasSdOD() +{ + bool bRet = false; + + for (Entries::iterator it = maEntries.begin(); it != maEntries.end(); ++it) + { + SwFltStackEntry& rEntry = *it; + if ( rEntry.mnStartCP == rEntry.mnEndCP ) + { + if ( CheckSdOD(rEntry.mnStartCP,rEntry.mnEndCP) ) + { + bRet = true; + break; + } + } + } + + return bRet; +} + void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry) { @@ -628,14 +670,47 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, } break; default: - if (rEntry.MakeRegion(pDoc, aRegion, sal_False)) { - pDoc->InsertPoolItem(aRegion, *rEntry.pAttr, 0); + //Revised for more complex situations should be considered + if ( !bSdODChecked ) + { + bHasSdOD = HasSdOD(); + bSdODChecked = true; + } + sal_Int32 nStart = rEntry.GetStartCP(); + sal_Int32 nEnd = rEntry.GetEndCP(); + if (nStart != -1 && nEnd != -1 && nEnd >= nStart ) + { + rEntry.SetIsParaEnd( IsParaEndInCPs(nStart,nEnd,bHasSdOD) ); + } + if (rEntry.MakeRegion(pDoc, aRegion, sal_False)) + { + nStart = rEntry.GetStartCP(); + nEnd = rEntry.GetEndCP(); + if (rEntry.IsParaEnd()) + { + pDoc->InsertPoolItem(aRegion, *rEntry.pAttr, 0, true); + } + else + { + pDoc->InsertPoolItem(aRegion, *rEntry.pAttr, 0); + } + } } break; } } +bool SwFltControlStack::IsParaEndInCPs(sal_Int32 /*nStart*/, sal_Int32 /*nEnd*/,bool /*bSdOD*/) const +{ + return false; +} + +bool SwFltControlStack::CheckSdOD(sal_Int32 /*nStart*/, sal_Int32 /*nEnd*/) +{ + return false; +} + SfxPoolItem* SwFltControlStack::GetFmtStackAttr(sal_uInt16 nWhich, sal_uInt16 * pPos) { size_t nSize = maEntries.size(); diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 898acbbe640e..982cbef03c64 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -327,7 +327,8 @@ public: sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString ) = 0; + const String &rNumberingString, + const SvxBrushItem* pBrush = 0) = 0; // #i120928 export graphic of bullet protected: diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index fb0b39634164..a233f1281e40 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3037,7 +3037,8 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString ) + const String &rNumberingString, + const SvxBrushItem* ) { m_pSerializer->startElementNS( XML_w, XML_lvl, FSNS( XML_w, XML_ilvl ), OString::valueOf( sal_Int32( nLevel ) ).getStr(), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index f42ffdf71ee1..ecdc243b9fdb 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -265,7 +265,8 @@ public: sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString ); + const String &rNumberingString, + const SvxBrushItem* pBrush = 0 ); void WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, sal_uInt8 nMode ); void WriteFormData_Impl( const ::sw::mark::IFieldmark& rFieldmark ); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 59e9bd1f2f59..0cbb453f0fa7 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -152,6 +152,11 @@ void DocxExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ ) m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); } +void DocxExport::ExportGrfBullet(const SwTxtNode&) +{ + SAL_INFO("sw.docx", "TODO: " << OSL_THIS_FUNC); +} + ::rtl::OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget ) { OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 56399e68a232..203dbea7e317 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -108,6 +108,8 @@ public: virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); + virtual void ExportGrfBullet(const SwTxtNode&); + /// Returns the relationd id rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget ); diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx index c7761a02af39..4adf3d8a221b 100644 --- a/sw/source/filter/ww8/escher.hxx +++ b/sw/source/filter/ww8/escher.hxx @@ -116,6 +116,8 @@ protected: public: SwBasicEscherEx(SvStream* pStrm, WW8Export& rWrt); sal_Int32 WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); + //For i120928,to export graphic of bullet + sal_Int32 WriteGrfBullet(const Graphic&); sal_Int32 WriteOLEFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); void WriteEmptyFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId); virtual void WriteFrmExtraData(const SwFrmFmt&); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 14afa3619218..33032b1905c2 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1325,7 +1325,8 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel, sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 /*nListTabPos*/, - const String &rNumberingString ) + const String &rNumberingString, + const SvxBrushItem* /*pBrush*/) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); @@ -2769,7 +2770,15 @@ void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) { - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPARA); + switch (rFlyVert.GetRelationOrient()) + { + case text::RelOrientation::PAGE_FRAME: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPG); + break; + default: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PVPARA); + break; + } switch (rFlyVert.GetVertOrient()) { @@ -2807,7 +2816,15 @@ void RtfAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) { - m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHCOL); + switch (rFlyHori.GetRelationOrient()) + { + case text::RelOrientation::PAGE_FRAME: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHPG); + break; + default: + m_aRunText->append(OOO_STRING_SVTOOLS_RTF_PHCOL); + break; + } const char* pS = 0; switch(rFlyHori.GetHoriOrient()) diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index 65e493c41d10..c74ab4a1315d 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -202,7 +202,8 @@ public: sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString ); + const String &rNumberingString, + const SvxBrushItem* pBrush = 0);//For i120928,to export graphic of bullet void WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, sal_uInt8 nMode ); void WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds ); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index fc1afec58911..97f9b7304fee 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -167,6 +167,12 @@ void RtfExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ ) m_pAttrOutput->WriteBookmarks_Impl(aStarts, aEnds); } +//For i120928,to export graphic of bullet for RTF filter +void RtfExport::ExportGrfBullet(const SwTxtNode&) +{ + SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC); +} + void RtfExport::WriteChar( sal_Unicode ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx index 30d4c799a03b..cfd45be09cdd 100644 --- a/sw/source/filter/ww8/rtfexport.hxx +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -73,6 +73,9 @@ public: virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); + //For i120928,add an interface to export graphic of bullet + virtual void ExportGrfBullet(const SwTxtNode& rNd); + virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* no-op for rtf, most probably should not even be in MSWordExportBase */ } virtual void WriteChar( sal_Unicode ); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 481b9a866cd7..b540868a3f96 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -49,6 +49,7 @@ #include <fchrfmt.hxx> //SwFmtCharFmt #include <unotools/streamwrap.hxx> #include <numrule.hxx> +#include <vcl/svapp.hxx>//For i120928 using namespace com::sun::star; using namespace nsSwGetPoolIdFromName; @@ -149,15 +150,44 @@ namespace namespace sw { + //For i120928,size conversion before exporting graphic of bullet + Frame::Frame(const Graphic &rGrf, const SwPosition &rPos) + : mpFlyFrm(NULL) + , maPos(rPos) + , maSize() + , maLayoutSize() + , meWriterType(eBulletGrf) + , mpStartFrameContent(0) + , mbIsInline(true) + , mbForBullet(true) + , maGrf(rGrf) + { + const MapMode aMap100mm( MAP_100TH_MM ); + Size aSize( rGrf.GetPrefSize() ); + if ( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() ) + { + aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap100mm ); + } + else + { + aSize = OutputDevice::LogicToLogic( aSize,rGrf.GetPrefMapMode(), aMap100mm ); + } + maSize = aSize; + maLayoutSize = maSize; + } + Frame::Frame(const SwFrmFmt &rFmt, const SwPosition &rPos) - : mpFlyFrm(&rFmt), - maPos(rPos), - maSize(), - maLayoutSize(), // #i43447# - meWriterType(eTxtBox), - mpStartFrameContent(0), - // #i43447# - move to initialization list - mbIsInline( (rFmt.GetAnchor().GetAnchorId() == FLY_AS_CHAR) ) + : mpFlyFrm(&rFmt) + , maPos(rPos) + , maSize() + , maLayoutSize() // #i43447# + , meWriterType(eTxtBox) + , mpStartFrameContent(0) + // #i43447# - move to initialization list + , mbIsInline( (rFmt.GetAnchor().GetAnchorId() == FLY_AS_CHAR) ) + // #i120928# - handle graphic of bullet within existing implementation + , mbForBullet(false) + , maGrf() { switch (rFmt.Which()) { diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index ad8f3a88bab1..f1361a819368 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -95,7 +95,7 @@ namespace sw class Frame { public: - enum WriterSource {eTxtBox, eGraphic, eOle, eDrawing, eFormControl}; + enum WriterSource {eTxtBox, eGraphic, eOle, eDrawing, eFormControl,eBulletGrf};//For i120928,add Grf Bul Type private: const SwFrmFmt* mpFlyFrm; SwPosition maPos; @@ -108,9 +108,11 @@ namespace sw WriterSource meWriterType; const SwNode *mpStartFrameContent; bool mbIsInline; + bool mbForBullet:1; + Graphic maGrf; public: Frame(const SwFrmFmt &rFlyFrm, const SwPosition &rPos); - + Frame(const Graphic&, const SwPosition &); /** Get the writer SwFrmFmt that this object describes @return @@ -164,6 +166,8 @@ namespace sw the first node of content in the frame, might not be any at all. */ const SwNode *GetContent() const { return mpStartFrameContent; } + const Graphic &GetGraphic() const { return maGrf; } + bool HasGraphic() const { return mbForBullet; } /** Does this sw::Frame refer to the same writer content as another @@ -173,7 +177,12 @@ namespace sw */ bool RefersToSameFrameAs(const Frame &rOther) const { - return (mpFlyFrm == rOther.mpFlyFrm); + if (mbForBullet && rOther.mbForBullet) + return (maGrf == rOther.maGrf); + else if ((!mbForBullet) && (!rOther.mbForBullet)) + return (mpFlyFrm == rOther.mpFlyFrm); + else + return false; } /** The Size of the contained element diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 6e0ae30c8ac0..3263817c0759 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1329,6 +1329,57 @@ sal_uInt32 AddMirrorFlags(sal_uInt32 nFlags, const SwMirrorGrf &rMirror) } return nFlags; } +//For i120928,this function is added to export graphic of bullet +sal_Int32 SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf) +{ + OpenContainer( ESCHER_SpContainer ); + AddShape(ESCHER_ShpInst_PictureFrame, 0xa00,0x401); + EscherPropertyContainer aPropOpt; + GraphicObject aGraphicObject( rGrf ); + OString aUniqueId = aGraphicObject.GetUniqueID(); + if ( !aUniqueId.isEmpty() ) + { + const MapMode aMap100mm( MAP_100TH_MM ); + Size aSize( rGrf.GetPrefSize() ); + if ( MAP_PIXEL == rGrf.GetPrefMapMode().GetMapUnit() ) + { + aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMap100mm ); + } + else + { + aSize = OutputDevice::LogicToLogic( aSize,rGrf.GetPrefMapMode(), aMap100mm ); + } + Point aEmptyPoint = Point(); + Rectangle aRect( aEmptyPoint, aSize ); + sal_uInt32 nBlibId = mxGlobal->GetBlibID( *(mxGlobal->QueryPictureStream()), aUniqueId,aRect, NULL, 0 ); + if (nBlibId) + aPropOpt.AddOpt(ESCHER_Prop_pib, nBlibId, sal_True); + } + aPropOpt.AddOpt( ESCHER_Prop_pibFlags, ESCHER_BlipFlagDefault ); + aPropOpt.AddOpt( ESCHER_Prop_dyTextTop, DrawModelToEmu(0)); + aPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, DrawModelToEmu(0)); + aPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, DrawModelToEmu(0)); + aPropOpt.AddOpt( ESCHER_Prop_dxTextRight, DrawModelToEmu(0)); + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); + aPropOpt.AddOpt( ESCHER_Prop_dyTextTop, 0 ); + aPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, 0 ); + aPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 ); + aPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 ); + const Color aTmpColor( COL_WHITE ); + SvxBrushItem aBrush( aTmpColor, RES_BACKGROUND ); + const SvxBrushItem *pRet = rWrt.GetCurrentPageBgBrush(); + if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT))) + aBrush = *pRet; + WriteBrushAttr(aBrush, aPropOpt); + + aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0 ); + aPropOpt.Commit( GetStream() ); + AddAtom(4, ESCHER_ClientAnchor); + GetStream() << (sal_uInt32)0x80000000; + CloseContainer(); + + return 0; +} sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nShapeId) { @@ -1983,6 +2034,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) WriteOCXControl(rFmt, nShapeId = GenerateShapeId()); break; case sw::Frame::eDrawing: + { aWinwordAnchoring.SetAnchoring(rFmt); const SdrObject* pSdrObj = rFmt.FindRealSdrObject(); if (pSdrObj) @@ -2010,6 +2062,10 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) OSL_ENSURE( !this, "Where is the SDR-Object?" ); #endif } + break; + default: + break; + } if( !nShapeId ) { diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 9320e7004ca1..e5b312de5410 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1738,6 +1738,16 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo( mpTableInfo->getTableNodeInfo( &rNode ) ); + //For i120928,identify the last node + bool bLastCR = false; + bool bExported = false; + { + SwNodeIndex aNextIdx(rNode,1); + SwNodeIndex aLastIdx(rNode.GetNodes().GetEndOfContent()); + if (aNextIdx == aLastIdx) + bLastCR = true; + } + AttrOutput().StartParagraph( pTextNodeInfo ); bool bFlyInTable = mpParentFrame && IsInTable(); @@ -1971,6 +1981,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) m_aCurrentCharPropStarts.pop(); AttrOutput().EndTOX( *pTOXSect ); } + //For i120928,the position of the bullet's graphic is at end of doc + if (bLastCR && (!bExported)) + { + ExportGrfBullet(rNode); + bExported = true; + } + WriteCR( pTextNodeInfoInner ); } } @@ -2007,6 +2024,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) aAttrIter.OutFlys( nEnd ); // insert final bookmarks if any before CR and after flys AppendBookmarks( rNode, nEnd, 1 ); + WriteCR( pTextNodeInfoInner ); + // #i120928 - position of the bullet's graphic is at end of doc + if (bLastCR && (!bExported)) + { + ExportGrfBullet(rNode); + bExported = true; + } if ( pTOXSect ) { diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 68826bab030d..d64c9bc2e325 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -196,7 +196,8 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString + const String &rNumberingString, + const SvxBrushItem* pBrush //For i120928,to transfer graphic of bullet ) { // Start value @@ -254,6 +255,18 @@ void WW8AttributeOutput::NumberingLevel( sal_uInt8 /*nLevel*/, } m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rWW8Export.mbExportModeRTF ); + //For i120928,achieve graphic's index of bullet from the bullet bookmark + if (SVX_NUM_BITMAP == nNumberingType && pBrush) + { + int nIndex = m_rWW8Export.GetGrfIndex(*pBrush); + if ( nIndex != -1 ) + { + m_rWW8Export.InsUInt16(0x6887); + m_rWW8Export.InsUInt32(nIndex); + m_rWW8Export.InsUInt16(0x4888); + m_rWW8Export.InsUInt16(1); + } + } m_rWW8Export.pO = pOldpO; } @@ -479,7 +492,8 @@ void MSWordExportBase::AbstractNumberingDefinitions() nFollow, pPseudoFont, pOutSet, nIndentAt, nFirstLineIndex, nListTabPos, - sNumStr ); + sNumStr, + rFmt.GetNumberingType()==SVX_NUM_BITMAP ? rFmt.GetBrush():0); delete pPseudoFont; } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 7651b40ad06c..269b913bf93e 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -108,7 +108,9 @@ #include <rtl/random.h> #include "WW8Sttbf.hxx" #include "WW8FibData.hxx" - +#ifndef _NUMRULE_HXX +#include "numrule.hxx"//For i120928 +#endif using namespace sw::util; using namespace sw::types; @@ -1410,6 +1412,125 @@ void WW8Export::AppendBookmark( const rtl::OUString& rName, bool bSkip ) pBkmks->Append( nSttCP, rName ); } +// #i120928 collect all the graphics of bullets applied to paragraphs +int WW8Export::CollectGrfsOfBullets() const +{ + m_vecBulletPic.clear(); + + if ( pDoc ) + { + int nCountRule = pDoc->GetNumRuleTbl().size(); + for (int n = 0; n < nCountRule; ++n) + { + const SwNumRule &rRule = *( pDoc->GetNumRuleTbl().at(n) ); + sal_uInt16 nLevels = rRule.IsContinusNum() ? 1 : 9; + for (sal_uInt16 nLvl = 0; nLvl < nLevels; ++nLvl) + { + const SwNumFmt &rFmt = rRule.Get(nLvl); + if (SVX_NUM_BITMAP != rFmt.GetNumberingType()) + { + continue; + } + const Graphic *pGraf = rFmt.GetBrush()? rFmt.GetBrush()->GetGraphic():0; + if ( pGraf ) + { + bool bHas = false; + for (unsigned i = 0; i < m_vecBulletPic.size(); ++i) + { + if (m_vecBulletPic[i]->GetChecksum() == pGraf->GetChecksum()) + { + bHas = true; + break; + } + } + if (!bHas) + { + m_vecBulletPic.push_back(pGraf); + } + } + } + } + } + + return m_vecBulletPic.size(); +} +//Export Graphic of Bullets +void WW8Export::ExportGrfBullet(const SwTxtNode& rNd) +{ + int nCount = CollectGrfsOfBullets(); + if (nCount > 0) + { + SwPosition aPos(rNd); + OUString aPicBullets("_PictureBullets"); + AppendBookmark(aPicBullets); + for (int i = 0; i < nCount; i++) + { + sw::Frame aFrame(*(m_vecBulletPic[i]), aPos); + OutGrfBullets(aFrame); + } + AppendBookmark(aPicBullets); + } +} + +static sal_uInt8 nAttrMagicIdx = 0; +void WW8Export::OutGrfBullets(const sw::Frame & rFrame) +{ + if ( !pGrf || !pChpPlc || !pO ) + return; + + pGrf->Insert(rFrame); + pChpPlc->AppendFkpEntry( Strm().Tell(), pO->size(), pO->data() ); + pO->clear(); + //if links... + WriteChar( (char)1 ); + + sal_uInt8 aArr[ 22 ]; + sal_uInt8* pArr = aArr; + + // sprmCFSpec + if( bWrtWW8 ) + Set_UInt16( pArr, 0x855 ); + else + Set_UInt8( pArr, 117 ); + Set_UInt8( pArr, 1 ); + + Set_UInt16( pArr, 0x083c ); + Set_UInt8( pArr, 0x81 ); + + // sprmCPicLocation + if( bWrtWW8 ) + Set_UInt16( pArr, 0x6a03 ); + else + { + Set_UInt8( pArr, 68 ); + Set_UInt8( pArr, 4 ); + } + Set_UInt32( pArr, GRF_MAGIC_321 ); + + //extern nAttrMagicIdx; + --pArr; + Set_UInt8( pArr, nAttrMagicIdx++ ); + pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr ); +} +//Achieve the index position +int WW8Export::GetGrfIndex(const SvxBrushItem& rBrush) +{ + int nIndex = -1; + if ( rBrush.GetGraphic() ) + { + for (unsigned i = 0; i < m_vecBulletPic.size(); ++i) + { + if (m_vecBulletPic[i]->GetChecksum() == rBrush.GetGraphic()->GetChecksum()) + { + nIndex = i; + break; + } + } + } + + return nIndex; +} + void MSWordExportBase::AppendWordBookmark( const String& rName ) { AppendBookmark( BookmarkToWord( rName ) ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index b405f59ae604..165274023890 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -38,6 +38,9 @@ #include "../inc/msfilter.hxx" #include <expfld.hxx> +#include <vcl/graph.hxx> +class SvxBrushItem; + // einige Forward Deklarationen class SwWW8AttrIter; namespace msfilter @@ -644,6 +647,8 @@ public: virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen ) = 0; virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ) = 0; + //For i120928,add this interface to export graphic of bullet + virtual void ExportGrfBullet(const SwTxtNode& rNd) = 0; // FIXME probably a hack... virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() ) = 0; @@ -908,6 +913,8 @@ public: sal_uInt8 bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format + mutable std::vector<const Graphic*> m_vecBulletPic; ///< Vector to record all the graphics of bullets + protected: SwWW8Writer *m_pWriter; ///< Pointer to the writer WW8AttributeOutput *m_pAttrOutput; ///< Converting attributes to stream data @@ -1001,6 +1008,12 @@ public: virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen ); virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); + + virtual void ExportGrfBullet(const SwTxtNode& rNd); + int CollectGrfsOfBullets() const; + void OutGrfBullets(const sw::Frame &rFrame); + int GetGrfIndex(const SvxBrushItem& rBrush); + void MoveFieldMarks(sal_uLong nFrom, sal_uLong nTo); void WriteAsStringTable(const ::std::vector<rtl::OUString>&, sal_Int32& rfcSttbf, @@ -1336,6 +1349,9 @@ private: void WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rNd, const sw::Frame &rFly, sal_uInt16 nWidth, sal_uInt16 nHeight); + void WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 mm, sal_uInt16 nWidth, sal_uInt16 nHeight); + void WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 nWidth, sal_uInt16 nHeight); + //No copying SwWW8WrGrf(const SwWW8WrGrf&); SwWW8WrGrf& operator=(const SwWW8WrGrf&); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 53489364f677..e3facdfea11f 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -717,6 +717,134 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, } } } +//For i120928,export graphic info of bullet +void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, + sal_uInt16 mm, sal_uInt16 nWidth, sal_uInt16 nHeight) +{ + sal_Int16 nXSizeAdd = 0, nYSizeAdd = 0; + sal_Int16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; + + Size aGrTwipSz(rGrf.GetPrefSize()); + bool bWrtWW8 = rWrt.bWrtWW8; + sal_uInt16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; + + sal_uInt8 aArr[ 0x44 ] = { 0 }; + + sal_uInt8* pArr = aArr + 0x2E; //Do borders first + + sal_uInt8 aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, + BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; + for( sal_uInt8 i = 0; i < 4; ++i ) + { + WW8_BRC aBrc; + + short nSpacing; + short nThick = aBrc.DetermineBorderProperties(!bWrtWW8, + &nSpacing); + switch (aLnArr[ i ]) + { + case BOX_LINE_TOP: + case BOX_LINE_BOTTOM: + nHeight -= nThick; + nHeight = nHeight - nSpacing; + break; + case BOX_LINE_LEFT: + case BOX_LINE_RIGHT: + default: + nWidth -= nThick; + nWidth = nWidth - nSpacing; + break; + } + memcpy( pArr, &aBrc.aBits1, 2); + pArr+=2; + + if( bWrtWW8 ) + { + memcpy( pArr, &aBrc.aBits2, 2); + pArr+=2; + } + } + + pArr = aArr + 4; //skip lcb + Set_UInt16( pArr, nHdrLen ); // set cbHeader + + Set_UInt16( pArr, mm ); // set mm + + if ( (aGrTwipSz.Width() * 254L / 144 > USHRT_MAX) || (aGrTwipSz.Height() * 254L / 144 > USHRT_MAX) + || (aGrTwipSz.Width() < 0 ) || (aGrTwipSz.Height() < 0) ) + { + aGrTwipSz.Width() = nWidth; + aGrTwipSz.Height() = nHeight; + } + using namespace sw::types; + // set xExt & yExt + Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Width() * 254L / 144)); + Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Height() * 254L / 144)); + pArr += 16; + // skip hMF & rcWinMF + // set dxaGoal & dyaGoal + Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Width())); + Set_UInt16(pArr, msword_cast<sal_uInt16>(aGrTwipSz.Height())); + + if( aGrTwipSz.Width() + nXSizeAdd ) // set mx + { + double fVal = nWidth * 1000.0 / (aGrTwipSz.Width() + nXSizeAdd); + Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) ); + } + else + pArr += 2; + + if( aGrTwipSz.Height() + nYSizeAdd ) // set my + { + double fVal = nHeight * 1000.0 / (aGrTwipSz.Height() + nYSizeAdd); + Set_UInt16( pArr, (sal_uInt16)::rtl::math::round(fVal) ); + } + else + pArr += 2; + + Set_UInt16( pArr, nCropL ); // set dxaCropLeft + Set_UInt16( pArr, nCropT ); // set dyaCropTop + Set_UInt16( pArr, nCropR ); // set dxaCropRight + Set_UInt16( pArr, nCropB ); // set dyaCropBottom + + rStrm.Write( aArr, nHdrLen ); +} + +void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 nWidth, sal_uInt16 nHeight) +{ + if (rWrt.bWrtWW8) + { + WritePICBulletFHeader(rStrm,rGrf, 0x64,nWidth,nHeight); + SwBasicEscherEx aInlineEscher(&rStrm, rWrt); + aInlineEscher.WriteGrfBullet(rGrf); + aInlineEscher.WritePictures(); + } + else + { + GDIMetaFile aMeta; + switch (rGrf.GetType()) + { + case GRAPHIC_BITMAP: // Bitmap -> in Metafile abspielen + { + VirtualDevice aVirt; + aMeta.Record(&aVirt); + aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() ); + aMeta.Stop(); + aMeta.WindStart(); + aMeta.SetPrefMapMode( rGrf.GetPrefMapMode()); + aMeta.SetPrefSize( rGrf.GetPrefSize()); + } + break; + case GRAPHIC_GDIMETAFILE : // GDI ( =SV ) Metafile + aMeta = rGrf.GetGDIMetaFile(); + break; + default: + return; + } + WritePICBulletFHeader(rStrm, rGrf, 8, nWidth, nHeight); + WriteWindowMetafileBits(rStrm, aMeta); + } +} void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) { @@ -736,6 +864,17 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) WriteGrfFromGrfNode(rStrm, *pNd, rItem.maFly, nWidth, nHeight); } break; + //For i120928,add branch to export graphic of bullet + case sw::Frame::eBulletGrf: + { + if (rItem.maFly.HasGraphic()) + { + const Graphic& rGrf = rItem.maFly.GetGraphic(); + WriteGrfForBullet(rStrm, rGrf, nWidth, nHeight); + } + } + break; + case sw::Frame::eOle: { #ifdef OLE_PREVIEW_AS_EMF diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index d1e17bb86a63..edaa905152ae 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -190,7 +190,8 @@ public: sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, - const String &rNumberingString ); + const String &rNumberingString, + const SvxBrushItem* pBrush = 0); //For i120928,transfer graphic of bullet protected: /// Output frames - the implementation. diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d18106e20db8..26cfd3e8bfc1 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -34,6 +34,7 @@ #include <comphelper/docpasswordrequest.hxx> #include <comphelper/string.hxx> +#include <editeng/brshitem.hxx> #include <editeng/tstpitem.hxx> #include <editeng/ulspitem.hxx> #include <editeng/langitem.hxx> @@ -85,6 +86,11 @@ #include "writerwordglue.hxx" +#include "ndgrf.hxx" +#include <editeng/editids.hrc> +#include <txtflcnt.hxx> +#include <fmtflcnt.hxx> +#include <txatbase.hxx> #include "ww8par2.hxx" // class WW8RStyle, class WW8AnchorPara @@ -1015,6 +1021,30 @@ const SwNumFmt* SwWW8FltControlStack::GetNumFmtFromStack(const SwPosition &rPos, return pRet; } +sal_Int32 SwWW8FltControlStack::GetCurrAttrCP() const +{ + return rReader.GetCurrAttrCP(); +} + +bool SwWW8FltControlStack::IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD) const +{ + return rReader.IsParaEndInCPs(nStart,nEnd,bSdOD); +} + +//Clear the para end position recorded in reader intermittently for the least impact on loading performance +void SwWW8FltControlStack::ClearParaEndPosition() +{ + if ( !empty() ) + return; + + rReader.ClearParaEndPosition(); +} + +bool SwWW8FltControlStack::CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd) +{ + return rReader.IsParaEndInCPs(nStart,nEnd); +} + void SwWW8FltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry) { @@ -3344,6 +3374,34 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTxtPos, bool& rbStartLine) return nNext; } +//Revised 2012.8.16 for the complex attribute presentation of 0x0D in MS +bool SwWW8ImplReader::IsParaEndInCPs(sal_Int32 nStart, sal_Int32 nEnd,bool bSdOD) const +{ + //Revised for performance consideration + if (nStart == -1 || nEnd == -1 || nEnd < nStart ) + return false; + + for (cp_vector::const_reverse_iterator aItr = maEndParaPos.rbegin(); aItr!= maEndParaPos.rend(); aItr++) + { + //Revised 2012.8.16,to the 0x0D,the attribute will have two situations + //*********within***********exact******// + //*********but also sample with only left and the position of 0x0d is the edge of the right side***********// + if ( bSdOD && ( (nStart < *aItr && nEnd > *aItr) || ( nStart == nEnd && *aItr == nStart)) ) + return true; + else if ( !bSdOD && (nStart < *aItr && nEnd >= *aItr) ) + return true; + } + + return false; +} + +//Clear the para end position recorded in reader intermittently for the least impact on loading performance +void SwWW8ImplReader::ClearParaEndPosition() +{ + if ( maEndParaPos.size() > 0 ) + maEndParaPos.clear(); +} + void SwWW8ImplReader::ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLine) { if( rTxtPos >= rNext ) @@ -3351,6 +3409,7 @@ void SwWW8ImplReader::ReadAttrs(WW8_CP& rNext, WW8_CP& rTxtPos, bool& rbStartLin do { + maCurrAttrCP = rTxtPos; rNext = ReadTextAttr( rTxtPos, rbStartLine ); } while( rTxtPos >= rNext ); @@ -3434,7 +3493,12 @@ bool SwWW8ImplReader::ReadText(long nStartCp, long nTextLen, ManTypes nType) // create a new txtnode and join the two paragraphs together if (bStartLine && !pPreviousNode) // Zeilenende + { + //We will record the CP of a paragraph end ('0x0D'), if current loading contents is from main stream; + if (mbOnLoadingMain) + maEndParaPos.push_back(l-1); AppendTxtNode(*pPaM->GetPoint()); + } if (pPreviousNode && bStartLine) { @@ -3593,7 +3657,9 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage, nDropCap(0), nIdctHint(0), bBidi(false), - bReadTable(false) + bReadTable(false), + maCurrAttrCP(-1), + mbOnLoadingMain(false) { pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); nWantedVersion = nVersionPara; @@ -4599,7 +4665,9 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) StoreMacroCmds(); } + mbOnLoadingMain = true; ReadText(0, pWwFib->ccpText, MAN_MAINTEXT); + mbOnLoadingMain = false; } @@ -4688,7 +4756,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) GrafikDtor(); DELETEZ( pMSDffManager ); DELETEZ( pHdFt ); - DELETEZ( pLstManager ); DELETEZ( pSBase ); delete pWDop; DELETEZ( pFonts ); @@ -4704,6 +4771,84 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) delete mpRedlineStack; DeleteAnchorStk(); DeleteRefStks(); + //For i120928,achieve the graphics from the special bookmark with is for graphic bullet + { + std::vector<const SwGrfNode*> vecBulletGrf; + std::vector<SwFrmFmt*> vecFrmFmt; + + IDocumentMarkAccess* const pMarkAccess = + rDoc.getIDocumentMarkAccess(); + if ( pMarkAccess ) + { + IDocumentMarkAccess::const_iterator_t ppBkmk = + pMarkAccess->findBookmark( "_PictureBullets" ); + if ( ppBkmk != pMarkAccess->getBookmarksEnd() && + IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) + == IDocumentMarkAccess::BOOKMARK ) + { + SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode(); + if ( pTxtNode ) + { + const SwpHints *pHints = pTxtNode->GetpSwpHints(); + for(int nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos) + { + const SwTxtAttr *pHt = (*pHints)[nHintPos]; + xub_StrLen st = *(pHt->GetStart()); + if(pHt && pHt->Which() == RES_TXTATR_FLYCNT && (st >= ppBkmk->get()->GetMarkStart().nContent.GetIndex())) + { + SwFrmFmt *pFrmFmt = pHt->GetFlyCnt().GetFrmFmt(); + const SwNodeIndex *pNdIdx = pFrmFmt->GetCntnt().GetCntntIdx(); + const SwNodes &nos = pNdIdx->GetNodes(); + const SwGrfNode *pGrf = dynamic_cast<const SwGrfNode*>(nos[pNdIdx->GetIndex() + 1]); + if (pGrf) + { + vecBulletGrf.push_back(pGrf); + vecFrmFmt.push_back(pFrmFmt); + } + } + } + // update graphic bullet information + size_t nCount = pLstManager->GetWW8LSTInfoNum(); + for (size_t i = 0; i < nCount; ++i) + { + SwNumRule* pRule = pLstManager->GetNumRule(i); + for (int j = 0; j < MAXLEVEL; ++j) + { + SwNumFmt aNumFmt(pRule->Get(j)); + sal_Int16 nType = aNumFmt.GetNumberingType(); + sal_uInt16 nGrfBulletCP = aNumFmt.GetGrfBulletCP(); + if (nType == SVX_NUM_BITMAP && vecBulletGrf.size() > nGrfBulletCP) + { + Graphic aGraphic = vecBulletGrf[nGrfBulletCP]->GetGrf(); + SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH); + Font aFont = numfunc::GetDefBulletFont(); + int nHeight = aFont.GetHeight() * 12;//20; + Size aPrefSize( aGraphic.GetPrefSize()); + if (aPrefSize.Height() * aPrefSize.Width() != 0 ) + { + int nWidth = (nHeight * aPrefSize.Width()) / aPrefSize.Height(); + Size aSize(nWidth, nHeight); + aNumFmt.SetGraphicBrush(&aBrush, &aSize); + } + else + { + aNumFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aNumFmt.SetBulletChar(0x2190); + } + pRule->Set( j, aNumFmt ); + } + } + } + // Remove additional pictures + for (sal_uInt16 i = 0; i < vecFrmFmt.size(); ++i) + { + rDoc.DelLayoutFmt(vecFrmFmt[i]); + } + } + } + } + DELETEZ( pLstManager ); + } //remove extra paragraphs after attribute ctrl //stacks etc. are destroyed, and before fields diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 31321f763668..485177f55723 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -159,6 +159,8 @@ public: std::vector<sal_uInt8> &rParaSprms, SwTxtNode *pNode=0); SwNumRule* CreateNextRule(bool bSimple); ~WW8ListManager(); + SwNumRule* GetNumRule(size_t i); + size_t GetWW8LSTInfoNum() const{return maLSTInfos.size();} private: wwSprmParser maSprmParser; SwWW8ImplReader& rReader; @@ -330,6 +332,12 @@ protected: virtual void SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry& rEntry); + virtual sal_Int32 GetCurrAttrCP() const; + virtual bool IsParaEndInCPs(sal_Int32 nStart,sal_Int32 nEnd,bool bSdOD=true) const; + //Clear the para end position recorded in reader intermittently for the least impact on loading performance + virtual void ClearParaEndPosition(); + virtual bool CheckSdOD(sal_Int32 nStart,sal_Int32 nEnd); + public: SwWW8FltControlStack(SwDoc* pDo, sal_uLong nFieldFl, SwWW8ImplReader& rReader_ ) : SwFltControlStack( pDo, nFieldFl ), rReader( rReader_ ), @@ -910,6 +918,8 @@ struct WW8PostProcessAttrsInfo //----------------------------------------- // Storage-Reader //----------------------------------------- +typedef std::vector<WW8_CP> cp_vector; + class SwWW8ImplReader { private: @@ -1208,6 +1218,9 @@ private: bool bReadTable; boost::shared_ptr<SwPaM> mpTableEndPaM; + cp_vector maEndParaPos; + WW8_CP maCurrAttrCP; + bool mbOnLoadingMain:1; //--------------------------------------------- const SprmReadInfo& GetSprmReadInfo(sal_uInt16 nId) const; @@ -1534,7 +1547,10 @@ public: // eigentlich private, geht aber leider nur public sal_uInt16 GetToggleBiDiAttrFlags() const; void SetToggleAttrFlags(sal_uInt16 nFlags); void SetToggleBiDiAttrFlags(sal_uInt16 nFlags); - + WW8_CP GetCurrAttrCP() const {return maCurrAttrCP;} + bool IsParaEndInCPs(sal_Int32 , sal_Int32,bool bSdOD=true) const; + //Clear the para end position recorded in reader intermittently for the least impact on loading performance + void ClearParaEndPosition(); long Read_Ftn(WW8PLCFManResult* pRes); sal_uInt16 End_Ftn(); diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 90170614cc1f..d8bb2f615e9e 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -503,6 +503,9 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, SvxExtNumType eType; // Writer-Num-Typ SvxAdjust eAdj; // Ausrichtung (Links/rechts/zent.) sal_Unicode cBullet(0x2190); // default safe bullet + + sal_Unicode cGrfBulletCP(USHRT_MAX); + String sPrefix; String sPostfix; WW8LVL aLVL; @@ -642,12 +645,28 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, // // 3. ggfs. CHPx einlesen und // + sal_uInt16 nWitchPicIsBullet = USHRT_MAX; + bool bIsPicBullet = false; + if( aLVL.nLenGrpprlChpx ) { sal_uInt8 aGrpprlChpx[ 255 ]; memset(&aGrpprlChpx, 0, sizeof( aGrpprlChpx )); if(aLVL.nLenGrpprlChpx != rSt.Read(&aGrpprlChpx, aLVL.nLenGrpprlChpx)) return false; + + //For i120928,parse the graphic info of bullets + sal_uInt8 *pSprmWhichPis = GrpprlHasSprm(0x6887,aGrpprlChpx[0],aLVL.nLenGrpprlChpx); + sal_uInt8 *pSprmIsPicBullet = GrpprlHasSprm(0x4888,aGrpprlChpx[0],aLVL.nLenGrpprlChpx); + if (pSprmWhichPis) + { + nWitchPicIsBullet = *pSprmWhichPis; + } + if (pSprmIsPicBullet) + { + bIsPicBullet = (*pSprmIsPicBullet) & 0x0001; + } + // neues ItemSet fuer die Zeichenattribute anlegen rpItemSet = new SfxItemSet( rDoc.GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END - 1 ); @@ -717,6 +736,12 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, case 23: case 25: eType = SVX_NUM_CHAR_SPECIAL; + //For i120928,type info + if (bIsPicBullet) + { + eType = SVX_NUM_BITMAP; + } + break; case 255: eType = SVX_NUM_NUMBER_NONE; @@ -790,6 +815,10 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, if (!cBullet) // unsave control code? cBullet = 0x2190; } + else if (SVX_NUM_BITMAP == eType) //For i120928,position index info of graphic + { + cGrfBulletCP = nWitchPicIsBullet; // This is a bullet picture ID + } else { /* @@ -860,6 +889,11 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet, // Don't forget: unten, nach dem Bauen eventueller Styles auch noch // SetBulletFont() rufen !!! } + //For i120928,position index info + else if (SVX_NUM_BITMAP == eType) + { + rNumFmt.SetGrfBulletCP(cGrfBulletCP); + } else { // reminder: Garnix ist default Prefix @@ -995,6 +1029,21 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule, // aNumFmt.SetCharFmt( pFmt ); } + //Ensure the default char fmt is initialized for any level of num ruler if no customized attr + else + { + SwCharFmt* pFmt = aNumFmt.GetCharFmt(); + if ( !pFmt) + { + OUString aName = ( sPrefix.Len() ? sPrefix : rNumRule.GetName() ); + aName += "z" + OUString::valueOf( nLevel ); + + pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt()); + bNewCharFmtCreated = true; + rCharFmt[ nLevel ] = pFmt; + aNumFmt.SetCharFmt( pFmt ); + } + } // // ggfs. Bullet Font an das NumFormat haengen // @@ -1038,6 +1087,14 @@ SwNumRule* WW8ListManager::CreateNextRule(bool bSimple) return pMyNumRule; } +SwNumRule* WW8ListManager::GetNumRule(size_t i) +{ + if (i < maLSTInfos.size()) + return maLSTInfos[i]->pNumRule; + else + return 0; +} + // oeffentliche Methoden ///////////////////////////////////////////////////// // WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 3a2456594e99..7f67fb0b441d 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -90,7 +90,32 @@ using namespace sw::sidebarwindows; bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b) { // sort by anchor position - return a->GetAnchorPosition() < b->GetAnchorPosition(); + SwPosition aPosAnchorA = a->GetAnchorPosition(); + SwPosition aPosAnchorB = b->GetAnchorPosition(); + + bool aAnchorAInFooter = false; + bool aAnchorBInFooter = false; + + // is the anchor placed in Footnote or the Footer? + if( aPosAnchorA.nNode.GetNode().FindFootnoteStartNode() || aPosAnchorA.nNode.GetNode().FindFooterStartNode() ) + aAnchorAInFooter = true; + if( aPosAnchorB.nNode.GetNode().FindFootnoteStartNode() || aPosAnchorB.nNode.GetNode().FindFooterStartNode() ) + aAnchorBInFooter = true; + + // fdo#34800 + // if AnchorA is in footnote, and AnchorB isn't + // we do not want to change over the position + if( aAnchorAInFooter && !aAnchorBInFooter ) + return false; + // if aAnchorA is not placed in a footnote, and aAnchorB is + // force a change over + else if( !aAnchorAInFooter && aAnchorBInFooter ) + return true; + // If neither or both are in the footer, compare the positions. + // Since footnotes are in Inserts section of nodes array and footers + // in Autotext section, all footnotes precede any footers so no need + // to check that. + return aPosAnchorA < aPosAnchorB; } SwPostItMgr::SwPostItMgr(SwView* pView) diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx index 8ad2c153b502..c0417adb9eff 100644 --- a/sw/source/ui/docvw/SidebarWin.cxx +++ b/sw/source/ui/docvw/SidebarWin.cxx @@ -320,6 +320,7 @@ void SwSidebarWin::InitControls() mpOutliner->SetUpdateMode( sal_True ); Rescale(); + mpSidebarTxtControl->EnableRTL( sal_False ); mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTxtControl ); mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT); mpOutliner->InsertView(mpOutlinerView ); @@ -327,10 +328,6 @@ void SwSidebarWin::InitControls() mpOutlinerView->SetAttribs(DefaultItem()); - // TODO: ?? - EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R; - mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir ); - //create Scrollbars mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG); mpVScrollbar->EnableNativeWidget(false); diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index c089cfc53482..a923cc26623b 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -270,8 +270,9 @@ void SwWrtShell::Insert( const String &rPath, const String &rFilter, DelRight(); // eingefuegte Grafik in eigenen Absatz, falls am Ende // eines nichtleeren Absatzes - if ( IsEndPara() && !IsSttPara() ) - SwFEShell::SplitNode(); + //For i120928,avoid to split node + //if ( IsEndPara() && !IsSttPara() ) + // SwFEShell::SplitNode(); EnterSelFrmMode(); diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index a05e39bf0b42..8f12d2c0cd9f 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -117,6 +117,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/app/session \ vcl/source/app/settings \ vcl/source/app/solarmutex \ + vcl/source/app/sound \ vcl/source/app/stdtext \ vcl/source/app/svapp \ vcl/source/app/svdata \ diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk index 53a7326279b1..48d996d443e2 100644 --- a/vcl/Package_inc.mk +++ b/vcl/Package_inc.mk @@ -126,6 +126,7 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/seleng.hxx,vcl/seleng.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/settings.hxx,vcl/settings.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/slider.hxx,vcl/slider.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/solarmutex.hxx,vcl/solarmutex.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/sound.hxx,vcl/sound.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spinfld.hxx,vcl/spinfld.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.h,vcl/spin.h)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/spin.hxx,vcl/spin.hxx)) diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx index 9696b9a83651..b129f06370d1 100644 --- a/vcl/aqua/source/gdi/salvd.cxx +++ b/vcl/aqua/source/gdi/salvd.cxx @@ -184,8 +184,22 @@ sal_Bool AquaSalVirtualDevice::SetSize( long nDX, long nDY ) { // default to a NSView target context AquaSalFrame* pSalFrame = mpGraphics->getGraphicsFrame(); - if( !pSalFrame && !GetSalData()->maFrames.empty() ) - pSalFrame = *GetSalData()->maFrames.begin(); + if( !pSalFrame || !AquaSalFrame::isAlive( pSalFrame )) + { + if( !GetSalData()->maFrames.empty() ) + { + // get the first matching frame + pSalFrame = *GetSalData()->maFrames.begin(); + } + else + { + // ensure we don't reuse a dead AquaSalFrame on the very + // unlikely case of no other frame to use + pSalFrame = NULL; + } + // update the frame reference + mpGraphics->setGraphicsFrame( pSalFrame ); + } if( pSalFrame ) { // #i91990# diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index d2e616c920da..12cbb916fefc 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -1339,6 +1339,13 @@ const SystemEnvData* AquaSalFrame::GetSystemData() const // ----------------------------------------------------------------------- +void AquaSalFrame::Beep() +{ + NSBeep(); +} + +// ----------------------------------------------------------------------- + void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags) { if ( !mpWindow ) diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 0d4e4660f197..5827d51c88a1 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -419,6 +419,10 @@ void SvpSalFrame::UpdateSettings( AllSettings& ) { } +void SvpSalFrame::Beep() +{ +} + const SystemEnvData* SvpSalFrame::GetSystemData() const { return &m_aSystemChildData; diff --git a/vcl/inc/aqua/salframe.h b/vcl/inc/aqua/salframe.h index e6dcde37cf75..39d9496a9fe0 100644 --- a/vcl/inc/aqua/salframe.h +++ b/vcl/inc/aqua/salframe.h @@ -138,6 +138,7 @@ public: virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep(); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index c48d602176b5..887e182deda4 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -102,11 +102,12 @@ public: virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); virtual void EndExtTextInput( sal_uInt16 nFlags ); - virtual rtl::OUString GetKeyName( sal_uInt16 nKeyCode ); - virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); + virtual rtl::OUString GetKeyName( sal_uInt16 nKeyCode ); + virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual void UpdateSettings( AllSettings& rSettings ); - virtual const SystemEnvData* GetSystemData() const; + virtual void Beep(); + virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); virtual void SimulateKeyPress( sal_uInt16 nKeyCode ); diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 63096e0e2a40..afc84203f82b 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -205,6 +205,8 @@ public: virtual void UpdateSettings( AllSettings& rSettings ) = 0; + virtual void Beep() = 0; + // returns system data (most prominent: window handle) virtual const SystemEnvData* GetSystemData() const = 0; diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index a33a5584eb7a..45bee2d07b87 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -402,6 +402,8 @@ public: virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep(); + // returns system data (most prominent: window handle) virtual const SystemEnvData* GetSystemData() const; diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index d5e62409b664..711c735f9c8f 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -316,6 +316,8 @@ public: void DbgPrintDisplayEvent(const char *pComment, XEvent *pEvent) const; #endif + void Beep() const; + void ModifierMapping(); void SimulateKeyPress( sal_uInt16 nKeyCode ); sal_uInt16 GetIndicatorState() const; diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index c6a8cc30d100..75a37c12ed82 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -241,6 +241,7 @@ public: virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep(); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); diff --git a/vcl/inc/vcl/sound.hxx b/vcl/inc/vcl/sound.hxx new file mode 100644 index 000000000000..7be53a0944ee --- /dev/null +++ b/vcl/inc/vcl/sound.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _SV_SOUND_HXX +#define _SV_SOUND_HXX + +#include <vcl/dllapi.h> + +class Window; + +// --------- +// - Sound - +// --------- + +class VCL_DLLPUBLIC Sound +{ +public: + static void Beep( Window* pWindow = NULL ); +}; + +#endif // _SV_SOUND_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index 54e10bd59d5b..2a622195f37d 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -121,6 +121,7 @@ public: virtual sal_Bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, KeyCode& rKeyCode ); virtual LanguageType GetInputLanguage(); virtual void UpdateSettings( AllSettings& rSettings ); + virtual void Beep(); virtual const SystemEnvData* GetSystemData() const; virtual SalPointerState GetPointerState(); virtual SalIndicatorState GetIndicatorState(); diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx new file mode 100644 index 000000000000..308f37f8c57f --- /dev/null +++ b/vcl/source/app/sound.cxx @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#include <vcl/svapp.hxx> +#include <vcl/window.hxx> +#include <vcl/sound.hxx> + +#include <salframe.hxx> +#include <svdata.hxx> + +void Sound::Beep( Window* pWindow ) +{ + // #i91990# + if ( Application::IsHeadlessModeEnabled() ) + return; + + if ( !pWindow ) + pWindow = ImplGetDefaultWindow(); + + pWindow->ImplGetFrame()->Beep(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 4e1afc25e29c..19163f170f2a 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -29,6 +29,7 @@ #include "vcl/tabpage.hxx" #include "vcl/tabctrl.hxx" #include "vcl/controllayout.hxx" +#include "vcl/layout.hxx" #include "vcl/lstbox.hxx" #include "controldata.hxx" @@ -2179,7 +2180,7 @@ Size TabControl::calculateRequisition() const if (!pPage) continue; - Size aPageSize(pPage->GetOptimalSize(WINDOWSIZE_PREFERRED)); + Size aPageSize(VclContainer::getLayoutRequisition(*pPage)); if (aPageSize.Width() > aOptimalPageSize.Width()) aOptimalPageSize.Width() = aPageSize.Width(); diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 46eb689356ff..85f6ce5f70da 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -614,6 +614,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, if( mpMetaFile ) mpMetaFile->AddAction( new MetaFloatTransparentAction( rMtf, rPos, rSize, rTransparenceGradient ) ); + if ( !IsDeviceOutputNecessary() ) + return; + if( ( rTransparenceGradient.GetStartColor() == aBlack && rTransparenceGradient.GetEndColor() == aBlack ) || ( mnDrawMode & ( DRAWMODE_NOTRANSPARENCY ) ) ) { diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 6c481da574a6..e6c1ddd8d0ab 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -533,39 +533,14 @@ namespace return (pWindow && isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled()); } - bool backInGroup(std::vector<RadioButton*>::reverse_iterator aRevStart, std::vector<RadioButton*> &rGroup) + bool focusNextInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup) { - std::vector<RadioButton*>::reverse_iterator aI(aRevStart); - while (aI != rGroup.rend()) - { - Window *pWindow = *aI; - - if (isSuitableDestination(pWindow)) - { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return true; - } - } - - aI = rGroup.rbegin(); - while (aI != aRevStart) - { - Window *pWindow = *aI; - - if (isSuitableDestination(pWindow)) - { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); - return true; - } - } + std::vector<RadioButton*>::iterator aI(aStart); - return false; - } + if (aStart != rGroup.end()) + ++aI; - bool forwardInGroup(std::vector<RadioButton*>::iterator aStart, std::vector<RadioButton*> &rGroup) - { - std::vector<RadioButton*>::iterator aI(aStart); - while (++aI != rGroup.end()) + for (; aI != rGroup.end(); ++aI) { Window *pWindow = *aI; @@ -576,8 +551,7 @@ namespace } } - aI = rGroup.begin(); - while (aI != aStart) + for (aI = rGroup.begin(); aI != aStart; ++aI) { Window *pWindow = *aI; @@ -598,14 +572,14 @@ namespace if (aGroup.size() == 1) //only one button in group return false; + if (bBackward) + std::reverse(aGroup.begin(), aGroup.end()); + std::vector<RadioButton*>::iterator aStart(std::find(aGroup.begin(), aGroup.end(), pSourceWindow)); assert(aStart != aGroup.end()); - if (bBackward) - return backInGroup(std::vector<RadioButton*>::reverse_iterator(aStart), aGroup); - else - return forwardInGroup(aStart, aGroup); + return focusNextInGroup(aStart, aGroup); } } diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 3546c4f15508..d3b1f34d5813 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -222,7 +222,7 @@ Size TabPage::GetOptimalSize(WindowSizeType eType) const return Window::GetOptimalSize(eType); Size aSize; if (isLayoutEnabled()) - aSize = GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize(eType); + aSize = VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD)); else aSize = getLegacyBestSizeForChildren(*this); return Window::CalcWindowSize(aSize); diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 725bd19f1d9f..c6719da4fb24 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -664,6 +664,12 @@ void SalX11Display::SetupInput( SalI18N_InputMethod *pInputMethod ) SetKbdExtension( pKbdExtension ); } +// Sound +void SalDisplay::Beep() const +{ + XBell( pDisp_, 100 ); +} + // Keyboard // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 67ce56e08992..455c57a797b2 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2586,6 +2586,12 @@ bool X11SalFrame::SetPluginParent( SystemParentData* pNewParent ) return true; } +// Sound +void X11SalFrame::Beep() +{ + GetDisplay()->Beep(); +} + // Event Handling // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= static sal_uInt16 sal_GetCode( int state ) diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 48bc239fd8b7..6ff6e4afc1b7 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -69,6 +69,13 @@ struct GdkRectangleEqual } +/** + * GtkSalSystem::countScreenMonitors() + * + * This method builds the vector which allows us to map from VCL's + * idea of linear integer ScreenNumber to to gtk+'s rather more + * complicated screen + monitor concept. + */ void GtkSalSystem::countScreenMonitors() { @@ -133,6 +140,11 @@ GtkSalSystem::getScreenMonitorFromIdx (int nIdx, gint &nMonitor) break; } nMonitor = nIdx; + + // handle invalid monitor indexes as non-existent screens + if (nMonitor < 0 || (pScreen && nMonitor >= gdk_screen_get_n_monitors (pScreen))) + pScreen = NULL; + return pScreen; } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 398ece4c300a..61d3f7852d07 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -2059,7 +2059,15 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz return; gint nMonitor; + bool bSameMonitor = false; GdkScreen *pScreen = getDisplay()->getSystem()->getScreenMonitorFromIdx( nNewScreen, nMonitor ); + if (!pScreen) + { + g_warning ("Attempt to move GtkSalFrame to invalid screen %d => " + "fallback to current\n", nNewScreen); + pScreen = gtk_widget_get_screen( m_pWindow ); + bSameMonitor = true; + } // Heavy lifting, need to move screen ... if( pScreen != gtk_widget_get_screen( m_pWindow )) @@ -2067,6 +2075,9 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz gint nOldMonitor = gdk_screen_get_monitor_at_window( pScreen, widget_get_window( m_pWindow ) ); + if (bSameMonitor) + nMonitor = nOldMonitor; + #if OSL_DEBUG_LEVEL > 1 if( nMonitor == nOldMonitor ) g_warning( "An apparently pointless SetScreen - should we elide it ?" ); @@ -2673,6 +2684,11 @@ void GtkSalFrame::UpdateSettings( AllSettings& rSettings ) ReleaseGraphics( pGraphics ); } +void GtkSalFrame::Beep() +{ + gdk_display_beep( getGdkDisplay() ); +} + const SystemEnvData* GtkSalFrame::GetSystemData() const { return &m_aSystemData; diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 411d87a10943..1138ebde6734 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2955,6 +2955,14 @@ const SystemEnvData* WinSalFrame::GetSystemData() const // ----------------------------------------------------------------------- +void WinSalFrame::Beep() +{ + // a simple beep + MessageBeep( 0 ); +} + +// ----------------------------------------------------------------------- + SalFrame::SalPointerState WinSalFrame::GetPointerState() { SalPointerState aState; diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 88c93728a5ba..86357af2fc78 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -426,8 +426,12 @@ sal_Int16 ConvertNumberingType(sal_Int32 nNFC) case NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting: case NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting: case NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital: + case NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand: nRet = style::NumberingType::NUMBER_LOWER_ZH; break; + case NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified: + nRet = style::NumberingType::NUMBER_UPPER_ZH; + break; default: nRet = style::NumberingType::ARABIC; } /* TODO: Lots of additional values are available - some are supported in the I18 framework diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 8e74201c19ed..d552e144f1a3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2152,7 +2152,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_sprm::LN_CHpsInc: break; // sprmCHpsInc case NS_sprm::LN_CHpsPos: - m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); + // The spec says 0 is the same as the lack of the value, so don't parse that. + if (nIntValue) + m_pImpl->deferCharacterProperty( nSprmId, uno::makeAny( nIntValue )); break; // sprmCHpsPos case NS_sprm::LN_CHpsPosAdj: break; // sprmCHpsPosAdj diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index d81aea774036..02986902d381 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -51,6 +51,7 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) : m_nTableWidth(0), m_bOOXML( bOOXML ), m_bPushCurrentWidth(false), + m_nLayoutType(0), m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) ) { m_pTablePropsHandler->SetTableManager( this ); @@ -395,6 +396,7 @@ void DomainMapperTableManager::startLevel( ) m_aTablePositions.push_back( pNewPositionHandler ); m_nCell.push_back( 0 ); m_nTableWidth = 0; + m_nLayoutType = 0; // And push it back to the right level. if (oCurrentWidth) @@ -408,6 +410,7 @@ void DomainMapperTableManager::endLevel( ) m_aCellWidths.pop_back( ); m_nCell.pop_back( ); m_nTableWidth = 0; + m_nLayoutType = 0; DomainMapperTableManager_Base_t::endLevel( ); @@ -548,12 +551,13 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } - else if (pCellWidths->size() > 0) + else if (pCellWidths->size() > 0 && m_nLayoutType == NS_ooxml::LN_Value_wordprocessingml_ST_TblLayout_fixed) { // If we're here, then the number of cells does not equal to the amount // defined by the grid, even after taking care of // gridSpan/gridBefore/gridAfter. Handle this by ignoring the grid and - // providing the separators based on the provided cell widths. + // providing the separators based on the provided cell widths, as long + // as we have a fixed layout. uno::Sequence< text::TableColumnSeparator > aSeparators(pCellWidths->size() - 1); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nSum = 0; @@ -593,7 +597,7 @@ void DomainMapperTableManager::endOfRowAction() void DomainMapperTableManager::clearData() { - m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0; + m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = m_nLayoutType = 0; m_sTableStyleName = OUString(); m_pTableStyleTextProperies.reset(); } diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index d3164eaf3ee3..0488de444cbc 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -54,6 +54,8 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t bool m_bPushCurrentWidth; /// Individual table cell width values, used only in case the number of cells doesn't match the table grid. ::std::vector< IntVectorPtr > m_aCellWidths; + /// Table layout algorithm, IOW if we should consider fixed column width or not. + sal_uInt32 m_nLayoutType; TablePropertiesHandler *m_pTablePropsHandler; PropertyMapPtr m_pStyleProps; @@ -119,6 +121,11 @@ public: DomainMapperTableManager_Base_t::insertTableProps( pProps ); }; + void SetLayoutType(sal_uInt32 nLayoutType) + { + m_nLayoutType = nLayoutType; + } + }; }} diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6074add28f9b..deda4f16ebb4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -726,6 +726,8 @@ void lcl_AddRangeAndStyle( void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); + if (m_aTextAppendStack.empty()) + return; TextAppendContext& rAppendContext = m_aTextAppendStack.top(); // n#779642: ignore fly frame inside table as it could lead to messy situations if( rAppendContext.pLastParagraphProperties.get() && rAppendContext.pLastParagraphProperties->IsFrameMode() @@ -969,6 +971,8 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) #endif ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pPropertyMap.get() ); + if (!m_aTextAppendStack.size()) + return; TextAppendContext& rAppendContext = m_aTextAppendStack.top(); uno::Reference< text::XTextAppend > xTextAppend; if (!m_aTextAppendStack.empty()) @@ -1453,14 +1457,14 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote ) } appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties ); m_aTextAppendStack.push(TextAppendContext(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ), - m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : m_xBodyText->createTextCursorByRange(xFootnoteText->getStart()))); + m_bIsNewDoc ? uno::Reference<text::XTextCursor>() : xFootnoteText->createTextCursorByRange(xFootnoteText->getStart()))); // Redlines for the footnote anchor CheckRedline( xFootnote->getAnchor( ) ); } - catch( const uno::Exception& ) + catch( const uno::Exception& e ) { - OSL_FAIL( "exception in PushFootOrEndnote" ); + SAL_WARN("writerfilter", "exception in PushFootOrEndnote: " << e.Message); } } diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index b1d560cd592a..92c5bbb0c6e3 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -24,6 +24,7 @@ #include "MeasureHandler.hxx" #include "TablePropertiesHandler.hxx" #include "TDefTableHandler.hxx" +#include "DomainMapperTableManager.hxx" #include <ooxml/resourceids.hxx> #include <doctok/sprmids.hxx> @@ -155,6 +156,13 @@ namespace dmapper { } } break; + case NS_ooxml::LN_CT_TblPrBase_tblLayout: + { + DomainMapperTableManager* pManager = dynamic_cast<DomainMapperTableManager*>(m_pTableManager); + if (pManager) + pManager->SetLayoutType(static_cast<sal_uInt32>(nIntValue)); + } + break; case NS_ooxml::LN_CT_TcPrBase_tcBorders ://cell borders //contains CT_TcBorders_left, right, top, bottom { diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 27c46a46582c..18861880e801 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -17882,7 +17882,7 @@ <xs:documentation>Revision Identifier for Table Row Properties</xs:documentation> </attribute> </define> - <define name="ST_TblLayoutType"> + <define name="ST_TblLayout"> <list> <xs:documentation>Table Layout Type</xs:documentation> <choice> @@ -17893,9 +17893,9 @@ </choice> </list> </define> - <define name="CT_TblLayoutType"> + <define name="CT_TblLayout"> <attribute name="type"> - <text/> + <ref name="ST_TblLayout"/> <xs:documentation>Table Layout Setting</xs:documentation> </attribute> </define> @@ -18095,7 +18095,7 @@ </optional> <optional> <element name="tblLayout"> - <ref name="CT_TblLayoutType"/> + <ref name="CT_TblLayout"/> </element> </optional> <optional> @@ -18150,7 +18150,7 @@ </optional> <optional> <element name="tblLayout"> - <ref name="CT_TblLayoutType"/> + <ref name="CT_TblLayout"/> </element> </optional> <optional> @@ -22943,9 +22943,12 @@ <action name="end" action="sendTableProperties"/> <action name="end" action="endRow"/> </resource> - <resource name="ST_TblLayoutType" resource="List" generated="yes"> - <value name="fixed" tokenid="ooxml:Value_wordprocessingml_ST_TblLayoutType_fixed">fixed</value> - <value name="autofit" tokenid="ooxml:Value_wordprocessingml_ST_TblLayoutType_autofit">autofit</value> + <resource name="ST_TblLayout" resource="List"> + <value tokenid="ooxml:Value_wordprocessingml_ST_TblLayout_fixed">fixed</value> + <value tokenid="ooxml:Value_wordprocessingml_ST_TblLayout_autofit">autofit</value> + </resource> + <resource name="CT_TblLayout" resource="Value" tag="table"> + <attribute name="type" tokenid="ooxml:CT_TblLayout_type" action="setValue"/> </resource> <resource name="ST_TblOverlap" resource="List"> <value tokenid="ooxml:Value_ST_TblOverlap_never">never</value> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 401ebb783f9e..954c08f7e67f 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -254,7 +254,6 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x m_aTableBuffer(), m_aSuperBuffer(), m_aShapetextBuffer(), - m_pCurrentBuffer(0), m_bHasFootnote(false), m_pSuperstream(0), m_nHeaderFooterPositions(), @@ -393,6 +392,11 @@ void RTFDocumentImpl::checkFirstRun() if (!m_pSuperstream) Mapper().startSectionGroup(); Mapper().startParagraphGroup(); + + // set the requested default font + RTFValue::Pointer_t pFont = m_aDefaultState.aCharacterSprms.find(NS_sprm::LN_CRgFtc0); + if (pFont.get()) + dispatchValue(RTF_F, pFont->getInt()); m_bFirstRun = false; } } @@ -432,7 +436,7 @@ void RTFDocumentImpl::checkNeedPap() if (m_bNeedPap) { m_bNeedPap = false; // reset early, so we can avoid recursion when calling ourselves - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties( getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms) @@ -460,14 +464,14 @@ void RTFDocumentImpl::checkNeedPap() else { RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); } } } void RTFDocumentImpl::runProps() { - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { writerfilter::Reference<Properties>::Pointer_t const pProperties = getProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms); Mapper().props(pProperties); @@ -475,7 +479,7 @@ void RTFDocumentImpl::runProps() else { RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); } } @@ -834,7 +838,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) } writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms)); checkFirstRun(); - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { Mapper().props(pProperties); // Make sure we don't loose these properties with a too early reset. @@ -843,7 +847,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) else { RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); } return 0; } @@ -943,7 +947,7 @@ bool RTFFrame::inFrame() void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) { sal_uInt8 sValue[] = { nValue }; - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { Mapper().startCharacterGroup(); // Should we send run properties? @@ -954,10 +958,10 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) } else { - m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); RTFValue::Pointer_t pValue(new RTFValue(*sValue)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); } } @@ -1104,31 +1108,31 @@ void RTFDocumentImpl::text(OUString& rString) return; } - if (!m_pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) + if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) Mapper().startCharacterGroup(); - else if (m_pCurrentBuffer) + else if (m_aStates.top().pCurrentBuffer) { RTFValue::Pointer_t pValue; - m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue)); } if (m_aStates.top().nDestinationState == DESTINATION_NORMAL || m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT || m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT) runProps(); - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength()); else { RTFValue::Pointer_t pValue(new RTFValue(rString)); - m_pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue)); } m_bNeedCr = true; - if (!m_pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) + if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) Mapper().endCharacterGroup(); - else if(m_pCurrentBuffer) + else if(m_aStates.top().pCurrentBuffer) { RTFValue::Pointer_t pValue; - m_pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue)); } } @@ -1284,13 +1288,17 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) break; case RTF_SHPINST: // Don't try to support shapes inside tables for now. - if (m_pCurrentBuffer != &m_aTableBuffer) + if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer) m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION; else m_aStates.top().nDestinationState = DESTINATION_SKIP; break; case RTF_NESTTABLEPROPS: - m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES; + // Don't try to support nested tables having table styles for now. + if (!m_aStates.top().bHasTableStyle) + m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES; + else + m_aStates.top().nDestinationState = DESTINATION_SKIP; break; case RTF_HEADER: case RTF_FOOTER: @@ -1338,8 +1346,8 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) nId = NS_rtf::LN_endnote; m_bHasFootnote = true; - if (m_pCurrentBuffer == &m_aSuperBuffer) - m_pCurrentBuffer = 0; + if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) + m_aStates.top().pCurrentBuffer = 0; bool bCustomMark = false; OUString aCustomMark; while (m_aSuperBuffer.size()) @@ -1410,7 +1418,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) dispatchFlag(RTF_PARD); m_bNeedPap = true; OSL_ENSURE(!m_aShapetextBuffer.size(), "shapetext buffer is not empty"); - m_pCurrentBuffer = &m_aShapetextBuffer; + m_aStates.top().pCurrentBuffer = &m_aShapetextBuffer; break; case RTF_FORMFIELD: if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION) @@ -1458,7 +1466,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) m_aStates.top().nDestinationState = DESTINATION_OBJECT; // check if the object is in a special container (e.g. a table) - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { // the object is in a table or another container. // Don't try to treate it as an OLE object (fdo#53594). @@ -1470,7 +1478,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) break; case RTF_OBJDATA: // check if the object is in a special container (e.g. a table) - if (m_pCurrentBuffer) + if (m_aStates.top().pCurrentBuffer) { // the object is in a table or another container. // Use the \result (RTF_RESULT) element of the object instead, @@ -1690,7 +1698,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) checkNeedPap(); if (bNeedPap) runProps(); - if (!m_pCurrentBuffer) + if (!m_aStates.top().pCurrentBuffer) { parBreak(); // Not in table? Reset max width. @@ -1699,7 +1707,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT) { RTFValue::Pointer_t pValue; - m_pCurrentBuffer->push_back(make_pair(BUFFER_PAR, pValue)); + m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PAR, pValue)); } // but don't emit properties yet, since they may change till the first text token arrives m_bNeedPap = true; @@ -2123,9 +2131,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Trivial paragraph flags switch (nKeyword) { - case RTF_KEEP: if (m_pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeep; break; - case RTF_KEEPN: if (m_pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeepFollow; break; - case RTF_INTBL: m_pCurrentBuffer = &m_aTableBuffer; nParam = NS_sprm::LN_PFInTable; break; + case RTF_KEEP: if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeep; break; + case RTF_KEEPN: if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer) nParam = NS_sprm::LN_PFKeepFollow; break; + case RTF_INTBL: m_aStates.top().pCurrentBuffer = &m_aTableBuffer; nParam = NS_sprm::LN_PFInTable; break; case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; break; default: break; } @@ -2167,10 +2175,19 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. if (m_aStates.top().nCells == 0) { + // Reset everything. m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT) - m_pCurrentBuffer = 0; + m_aStates.top().pCurrentBuffer = 0; + } + else + { + // Reset only margins. + lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before); + lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after); + m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaLeft); + m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaRight); } m_aStates.top().resetFrame(); break; @@ -2364,8 +2381,8 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) break; case RTF_SUPER: { - if (!m_pCurrentBuffer) - m_pCurrentBuffer = &m_aSuperBuffer; + if (!m_aStates.top().pCurrentBuffer) + m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; RTFValue::Pointer_t pValue(new RTFValue("superscript")); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); } @@ -2377,10 +2394,10 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) } break; case RTF_NOSUPERSUB: - if (m_pCurrentBuffer == &m_aSuperBuffer) + if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer) { replayBuffer(m_aSuperBuffer); - m_pCurrentBuffer = 0; + m_aStates.top().pCurrentBuffer = 0; } m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign); break; @@ -2595,6 +2612,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // Seems this old syntax has no way to specify a custom radius, and this is the default m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", uno::makeAny(sal_Int32(83))); break; + case RTF_NOWRAP: + m_aStates.top().aFrame.setSprm(NS_sprm::LN_PWr, NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside); + break; default: SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); aSkip.setParsed(false); @@ -2706,7 +2726,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { m_bNeedPap = true; // Don't try to support text frames inside tables for now. - if (m_pCurrentBuffer != &m_aTableBuffer) + if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer) m_aStates.top().aFrame.setSprm(nId, nParam); return 0; } @@ -2835,7 +2855,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) break; case RTF_HIGHLIGHT: { - RTFValue::Pointer_t pValue(new RTFValue(nParam)); + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); m_aStates.top().aCharacterSprms.set(NS_sprm::LN_CHighlight, pValue); } break; @@ -3428,6 +3448,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aStates.top().aCharacterAttributes.set(NS_rtf::LN_WR, RTFValue::Pointer_t(new RTFValue(3))); } break; + case RTF_TS: + m_aStates.top().bHasTableStyle = true; + break; default: SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'"); aSkip.setParsed(false); @@ -3747,9 +3770,6 @@ int RTFDocumentImpl::popState() case DESTINATION_PICT: resolvePict(true); break; - case DESTINATION_SHAPETEXT: - m_pCurrentBuffer = 0; // Just disable buffering, don't empty it yet. - break; case DESTINATION_FORMFIELDNAME: { RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear())); @@ -3800,11 +3820,14 @@ int RTFDocumentImpl::popState() // extract default text nLength = aStr.toChar(); aStr = aStr.copy(1); - OString aDefaultText = aStr.copy(0, nLength); RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, m_aStates.top().nCurrentEncoding))); m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue); - RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, m_aStates.top().nCurrentEncoding))); - m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); + if (nLength > 0) + { + OString aDefaultText = aStr.copy(0, nLength); + RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, m_aStates.top().nCurrentEncoding))); + m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue); + } m_bFormField = false; } @@ -4274,11 +4297,13 @@ int RTFDocumentImpl::popState() else if (m_xDocumentProperties.is()) m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear()); } - if (m_pCurrentBuffer == &m_aSuperBuffer) + if (aState.pCurrentBuffer == &m_aSuperBuffer) { + OSL_ASSERT(m_aStates.top().pCurrentBuffer == 0); + if (!m_bHasFootnote) replayBuffer(m_aSuperBuffer); - m_pCurrentBuffer = 0; + m_bHasFootnote = false; } if (m_aStates.size()) @@ -4391,7 +4416,9 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl) nDay(0), nHour(0), nMinute(0), - nCurrentStyleIndex(-1) + nCurrentStyleIndex(-1), + pCurrentBuffer(0), + bHasTableStyle(false) { } @@ -4505,6 +4532,9 @@ void RTFFrame::setSprm(Id nId, Id nValue) case NS_ooxml::LN_CT_FramePr_vAnchor: nVertAnchor = nValue; break; + case NS_sprm::LN_PWr: + oWrap.reset(nValue); + break; default: break; } @@ -4591,8 +4621,12 @@ RTFSprms RTFFrame::getSprms() else if ( nH > 0 ) nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast; pValue.reset(new RTFValue(nHRule)); - break; } + break; + case NS_sprm::LN_PWr: + if (oWrap) + pValue.reset(new RTFValue(*oWrap)); + break; default: break; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index 5ced0196b916..0e0c4672c0d8 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -308,6 +308,7 @@ namespace writerfilter { sal_Int32 nHoriPadding, nVertPadding; sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor; Id nHRule; + boost::optional<Id> oWrap; public: RTFFrame(RTFParserState* pParserState); sal_Int16 nAnchorType; @@ -407,6 +408,12 @@ namespace writerfilter { /// Same as the int value of NS_rtf::LN_ISTD in aParagraphAttributes, for performance reasons. int nCurrentStyleIndex; + + /// Points to the active buffer, if there is one. + RTFBuffer_t* pCurrentBuffer; + + /// If a table style was requested to be used. + bool bHasTableStyle; }; class RTFTokenizer; @@ -540,8 +547,6 @@ namespace writerfilter { RTFBuffer_t m_aSuperBuffer; /// Buffered shape text. RTFBuffer_t m_aShapetextBuffer; - /// Points to the active buffer, if there is one. - RTFBuffer_t* m_pCurrentBuffer; bool m_bHasFootnote; /// Superstream of this substream. diff --git a/writerfilter/source/rtftok/rtffly.hxx b/writerfilter/source/rtftok/rtffly.hxx index 9e2141c146aa..918f800f9047 100644 --- a/writerfilter/source/rtftok/rtffly.hxx +++ b/writerfilter/source/rtftok/rtffly.hxx @@ -99,7 +99,7 @@ namespace writerfilter { struct { sal_uInt16 nOrient : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; @@ -180,7 +180,7 @@ namespace writerfilter { { sal_uInt16 nOrient : 4; sal_uInt16 nRelAnchor : 4; - sal_uInt16 nRelOrient : 1; + sal_uInt16 nRelOrient : 4; } Flags; sal_uInt16 nVal; } Value; diff --git a/xmloff/inc/EnhancedCustomShapeToken.hxx b/xmloff/inc/EnhancedCustomShapeToken.hxx index 39a5faf355fe..42d95abca597 100644 --- a/xmloff/inc/EnhancedCustomShapeToken.hxx +++ b/xmloff/inc/EnhancedCustomShapeToken.hxx @@ -84,6 +84,7 @@ namespace xmloff { namespace EnhancedCustomShapeToken { EAS_handle_polar, EAS_handle_radius_range_minimum, EAS_handle_radius_range_maximum, + EAS_sub_view_size, EAS_CustomShapeEngine, EAS_CustomShapeData, @@ -145,6 +146,7 @@ namespace xmloff { namespace EnhancedCustomShapeToken { EAS_SameLetterHeights, EAS_Position, EAS_AdjustmentValues, + EAS_SubViewSize, EAS_Last, EAS_NotFound diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index f5b89a6acfdc..74b78f3ea224 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -1732,6 +1732,7 @@ namespace xmloff { namespace token { XML_SUBTOTAL_FIELD, XML_SUBTOTAL_RULE, XML_SUBTOTAL_RULES, + XML_SUB_VIEW_SIZE, XML_SUFFIX, XML_SUM, XML_SWISS, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 9ada1b73e46c..801ce5f0a80d 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1737,6 +1737,7 @@ namespace xmloff { namespace token { TOKEN( "subtotal-field", XML_SUBTOTAL_FIELD ), TOKEN( "subtotal-rule", XML_SUBTOTAL_RULE ), TOKEN( "subtotal-rules", XML_SUBTOTAL_RULES ), + TOKEN( "sub-view-size", XML_SUB_VIEW_SIZE ), TOKEN( "suffix", XML_SUFFIX ), TOKEN( "sum", XML_SUM ), TOKEN( "swiss", XML_SWISS ), diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx index 1e12ee2fe697..ba70abd924c5 100644 --- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx +++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx @@ -112,6 +112,7 @@ static const TokenTable pTokenTableArray[] = { "handle-polar", EAS_handle_polar }, { "handle-radius-range-minimum", EAS_handle_radius_range_minimum }, { "handle-radius-range-maximum", EAS_handle_radius_range_maximum }, + { "sub-view-size", EAS_sub_view_size }, { "CustomShapeEngine", EAS_CustomShapeEngine }, { "CustomShapeData", EAS_CustomShapeData }, @@ -173,6 +174,7 @@ static const TokenTable pTokenTableArray[] = { "SameLetterHeights", EAS_SameLetterHeights }, { "Position", EAS_Position }, { "AdjustmentValues", EAS_AdjustmentValues }, + { "SubViewSize", EAS_SubViewSize }, { "Last", EAS_Last }, { "NotFound", EAS_NotFound } diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index d47b6bbd1a86..ce504fe2b793 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -413,6 +413,30 @@ void ImpExportEnhancedPath( SvXMLExport& rExport, i += 2; } break; + case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKEN : + if ( bExtended ) + aStrBuffer.append( (sal_Unicode)'H' ); + else + bNeedExtended = true; + break; + case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS : + if ( bExtended ) + aStrBuffer.append( (sal_Unicode)'I' ); + else + bNeedExtended = true; + break; + case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN : + if ( bExtended ) + aStrBuffer.append( (sal_Unicode)'J' ); + else + bNeedExtended = true; + break; + case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS : + if ( bExtended ) + aStrBuffer.append( (sal_Unicode)'K' ); + else + bNeedExtended = true; + break; default : // ups, seems to be something wrong { aSegment.Count = 1; @@ -908,8 +932,26 @@ void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< bean for ( i = 0; i < nCount; i++ ) { const beans::PropertyValue& rProp = aPathPropSeq[ i ]; + switch( EASGet( rProp.Name ) ) { + case EAS_SubViewSize: + { + uno::Sequence< awt::Size > aSubViewSizes; + rProp.Value >>= aSubViewSizes; + + for ( int nIdx = 0; nIdx < aSubViewSizes.getLength(); nIdx++ ) + { + if ( nIdx ) + aStrBuffer.append(' '); + ::sax::Converter::convertNumber( aStrBuffer, aSubViewSizes[nIdx].Width ); + aStrBuffer.append(' '); + ::sax::Converter::convertNumber( aStrBuffer, aSubViewSizes[nIdx].Height ); + } + aStr = aStrBuffer.makeStringAndClear(); + rExport.AddAttribute( XML_NAMESPACE_DRAW_EXT, XML_SUB_VIEW_SIZE, aStr ); + } + break; case EAS_ExtrusionAllowed : { sal_Bool bExtrusionAllowed = sal_Bool(); diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 3b145ca526fc..1a280ef14347 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -472,6 +472,43 @@ void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDe } } +void GetSizeSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, + const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) +{ + std::vector< sal_Int32 > vNum; + sal_Int32 nIndex = 0; + do + { + sal_Int32 n; + rtl::OUString aToken( rValue.getToken( 0, ' ', nIndex ) ); + if (!::sax::Converter::convertNumber( n, aToken )) + break; + else + vNum.push_back( n ); + } + while ( nIndex >= 0 ); + + if ( !vNum.empty() ) + { + uno::Sequence< awt::Size > aSizeSeq( vNum.size() / 2 ); + std::vector< sal_Int32 >::const_iterator aIter = vNum.begin(); + std::vector< sal_Int32 >::const_iterator aEnd = vNum.end(); + awt::Size* pValues = aSizeSeq.getArray(); + + while ( aIter != aEnd ) { + pValues->Width = *aIter++; + if ( aIter != aEnd ) + pValues->Height = *aIter++; + pValues ++; + } + + beans::PropertyValue aProp; + aProp.Name = EASGet( eDestProp ); + aProp.Value <<= aSizeSeq; + rDest.push_back( aProp ); + } +} + void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) { @@ -665,6 +702,34 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest nIndex++; } break; + case 'H' : + { + nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKEN; + nParametersNeeded = 0; + nIndex++; + } + break; + case 'I' : + { + nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::DARKENLESS; + nParametersNeeded = 0; + nIndex++; + } + break; + case 'J' : + { + nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTEN; + nParametersNeeded = 0; + nIndex++; + } + break; + case 'K' : + { + nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LIGHTENLESS; + nParametersNeeded = 0; + nIndex++; + } + break; case 'W' : { nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO; @@ -860,6 +925,9 @@ void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax mrCustomShapeGeometry.push_back( aProp ); } break; + case EAS_sub_view_size: + GetSizeSequence( maPath, rValue, EAS_SubViewSize ); + break; case EAS_text_rotate_angle : GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle ); break; diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 08d8decfb59a..e52736ce0199 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -367,7 +367,7 @@ void SdXMLShapeContext::EndElement() rtl::OUString sLink( "Hyperlink" ); if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) ) xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) ); - Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW ); + Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY ); const OUString sBookmark( "Bookmark" ); if( xEventsSupplier.is() ) |