[Pardus] tdf#112481 Ability to add worksheets on Calc
This patch is sponsored by ULAKBIM/PARDUS project. Signed-off-by: Mert Tümer <merttumer7@gmail.com> Change-Id: Id67e3c400971b47738fe2f628955534f34839493 Reviewed-on: https://gerrit.libreoffice.org/49294 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
committed by
Thorsten Behrens
parent
a6e46a2402
commit
ddd49295d1
@@ -40,6 +40,11 @@
|
||||
android:title="@string/action_add_slide"
|
||||
android:orderInCategory="100"
|
||||
android:enabled="false" />
|
||||
|
||||
<item android:id="@+id/action_add_worksheet"
|
||||
android:title="@string/action_add_worksheet"
|
||||
android:orderInCategory="100"
|
||||
android:enabled="false" />
|
||||
</group>
|
||||
|
||||
|
||||
|
@@ -155,6 +155,7 @@
|
||||
<string name="calc_optimal_length_confirm">OK</string>
|
||||
<string name="calc_optimal_length_default_text">Enter Extra Length in 100th/mm</string>
|
||||
<string name="calc_alert_double_click_optimal_length">Hint: Double tap on a header sets optimal width/height.</string>
|
||||
<string name="action_add_worksheet">Add Worksheet</string>
|
||||
|
||||
<!-- Password dialog strings -->
|
||||
<string name="action_pwd_dialog_OK">OK</string>
|
||||
|
@@ -13,6 +13,8 @@ import android.graphics.PointF;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.libreoffice.kit.DirectBufferAllocator;
|
||||
import org.libreoffice.kit.Document;
|
||||
import org.libreoffice.kit.LibreOfficeKit;
|
||||
@@ -116,6 +118,9 @@ class LOKitTileProvider implements TileProvider {
|
||||
mContext.getToolbarController().disableMenuItem(R.id.action_presentation, false);
|
||||
mContext.getToolbarController().disableMenuItem(R.id.action_add_slide, false);
|
||||
}
|
||||
if (mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET) {
|
||||
mContext.getToolbarController().disableMenuItem(R.id.action_add_worksheet, false);
|
||||
}
|
||||
|
||||
// Writer documents always have one part, so hide the navigation drawer.
|
||||
if (mDocument.getDocumentType() != Document.DOCTYPE_TEXT) {
|
||||
@@ -163,7 +168,25 @@ class LOKitTileProvider implements TileProvider {
|
||||
|
||||
public void addPart(){
|
||||
int parts = mDocument.getParts();
|
||||
if(mDocument.getDocumentType() == Document.DOCTYPE_SPREADSHEET){
|
||||
try{
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject values = new JSONObject();
|
||||
JSONObject values2 = new JSONObject();
|
||||
values.put("type", "long");
|
||||
values.put("value", 0); //add to the last
|
||||
values2.put("type", "string");
|
||||
values2.put("value", "");
|
||||
jsonObject.put("Name", values2);
|
||||
jsonObject.put("Index", values);
|
||||
LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:Insert", jsonObject.toString()));
|
||||
}catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (mDocument.getDocumentType() == Document.DOCTYPE_PRESENTATION){
|
||||
LOKitShell.sendEvent(new LOEvent(LOEvent.UNO_COMMAND, ".uno:InsertPage"));
|
||||
}
|
||||
|
||||
String partName = mDocument.getPartName(parts);
|
||||
if (partName.isEmpty()) {
|
||||
partName = getGenericPartName(parts);
|
||||
|
@@ -691,7 +691,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity implements Settin
|
||||
aboutDialogFragment.show(getSupportFragmentManager(), "AboutDialogFragment");
|
||||
}
|
||||
|
||||
public void addSlide(){
|
||||
public void addPart(){
|
||||
mTileProvider.addPart();
|
||||
mDocumentPartViewListAdapter.notifyDataSetChanged();
|
||||
setDocumentChanged(true);
|
||||
|
@@ -136,7 +136,10 @@ public class ToolbarController implements Toolbar.OnMenuItemClickListener {
|
||||
mContext.preparePresentation();
|
||||
return true;
|
||||
case R.id.action_add_slide:
|
||||
mContext.addSlide();
|
||||
mContext.addPart();
|
||||
return true;
|
||||
case R.id.action_add_worksheet:
|
||||
mContext.addPart();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user